Browse Source

DATV modulator: use localtime_r instead of localtime

chirpmodem-v8.0.0
f4exb 11 months ago
parent
commit
b15134e1ff
  1. 20
      plugins/channeltx/moddatv/tsgenerator.cpp
  2. 23
      plugins/channeltx/moddatv/tsgenerator.h

20
plugins/channeltx/moddatv/tsgenerator.cpp

@ -1,3 +1,20 @@ @@ -1,3 +1,20 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2026 Edouard Griffiths, F4EXB. //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
extern "C"
{
#include "libavcodec/avcodec.h"
@ -166,7 +183,8 @@ AVFrame* TSGenerator::load_image_to_yuv_with_opencv(const char* filename, int wi @@ -166,7 +183,8 @@ AVFrame* TSGenerator::load_image_to_yuv_with_opencv(const char* filename, int wi
auto now = std::chrono::system_clock::now();
auto time_t = std::chrono::system_clock::to_time_t(now);
char time_str[32];
std::strftime(time_str, sizeof(time_str), "%H:%M:%S", std::localtime(&time_t));
struct tm time_buffer; // Your own buffer
std::strftime(time_str, sizeof(time_str), "%H:%M:%S", localtime_r(&time_t, &time_buffer));
// Draw black background box first
cv::rectangle(rgb_image, cv::Point(15, 28), cv::Point(170, 65),

23
plugins/channeltx/moddatv/tsgenerator.h

@ -1,3 +1,24 @@ @@ -1,3 +1,24 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
// Copyright (C) 2021 Jon Beniston, M7RCE //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_ATVMOD_TSGENERATOR_H
#define INCLUDE_ATVMOD_TSGENERATOR_H
#include <vector>
#include <cstdint>
#include <string>
@ -52,3 +73,5 @@ private: @@ -52,3 +73,5 @@ private:
static double get_dvbs2_rate(double symbol_rate, DATVModSettings::DATVModulation modulation, DATVModSettings::DATVCodeRate code_rate);
static double calc_dvbs2_rate(double symbol_rate, double bits, double fec_num, double fec_den, double bch, double pilots);
};
#endif // INCLUDE_ATVMOD_TSGENERATOR_H

Loading…
Cancel
Save