Browse Source

DATV modulator: use the libavcodec version to figure out write_packet_cb prototype

chirpmodem-v8.0.0
f4exb 11 months ago
parent
commit
c334ffeeec
  1. 6
      plugins/channeltx/moddatv/tsgenerator.cpp
  2. 3
      plugins/channeltx/moddatv/tsgenerator.h

6
plugins/channeltx/moddatv/tsgenerator.cpp

@ -17,8 +17,8 @@ @@ -17,8 +17,8 @@
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/channel_layout.h>
#include <libavutil/common.h>
@ -376,7 +376,7 @@ void TSGenerator::encode_frame_to_ts(AVFormatContext* oc, AVCodecContext* codec_ @@ -376,7 +376,7 @@ void TSGenerator::encode_frame_to_ts(AVFormatContext* oc, AVCodecContext* codec_
}
// Write callback - stores TS packets in memory
#if FF_API_AVIO_WRITE_NONCONST
#if LIBAVFORMAT_VERSION_INT < ((61 << 16) | (0 << 8) | 0)
int TSGenerator::write_packet_cb(void* opaque, uint8_t* buf, int buf_size)
#else
int TSGenerator::write_packet_cb(void* opaque, const uint8_t* buf, int buf_size)

3
plugins/channeltx/moddatv/tsgenerator.h

@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
#include <vector>
#include <cstdint>
#include <string>
#include <libavformat/version.h>
#include "datvmodsettings.h"
@ -67,7 +68,7 @@ private: @@ -67,7 +68,7 @@ private:
int setup_ts_context(AVFormatContext** oc, AVCodecContext* codec_ctx);
void encode_frame_to_ts(AVFormatContext* oc, AVCodecContext* codec_ctx, AVFrame* frame, int stream_idx = 0);
std::pair<const AVCodec*, AVCodecContext*> create_codec_context(int fps, int bitrate, int width, int height, int duration_sec);
#if FF_API_AVIO_WRITE_NONCONST
#if LIBAVFORMAT_VERSION_INT < ((61 << 16) | (0 << 8) | 0)
static int write_packet_cb(void* opaque, uint8_t* buf, int buf_size);
#else
static int write_packet_cb(void* opaque, const uint8_t* buf, int buf_size);

Loading…
Cancel
Save