ffmpeg compil versions warnnings

This commit is contained in:
Jacek Jendrzej
2021-10-27 12:31:48 +02:00
parent fb13b064fb
commit 2453d8a030
6 changed files with 22 additions and 5 deletions

View File

@@ -265,7 +265,9 @@ void write_frame(AVFrame *in_frame, int fd)
if (avcodec_open2(codec_context, codec, 0) != -1) if (avcodec_open2(codec_context, codec, 0) != -1)
{ {
AVPacket pkt; AVPacket pkt;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&pkt); av_init_packet(&pkt);
#endif
/* encode the image */ /* encode the image */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100)
int got_output = 0; int got_output = 0;
@@ -430,7 +432,9 @@ int image_to_mpeg2(const char *image_name, int fd)
if (codecContext) if (codecContext)
{ {
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#endif
if ((ret = av_read_frame(formatContext, &packet)) != -1) if ((ret = av_read_frame(formatContext, &packet)) != -1)
{ {
if ((ret = decode_frame(codecContext, packet, fd)) != 1) if ((ret = decode_frame(codecContext, packet, fd)) != 1)

View File

@@ -261,8 +261,9 @@ bool Input::Play()
} }
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#endif
int err = av_read_frame(avfc, &packet); int err = av_read_frame(avfc, &packet);
if (err == AVERROR(EAGAIN)) if (err == AVERROR(EAGAIN))
{ {
@@ -449,8 +450,9 @@ bool Input::ReadSubtitle(const char *filename, const char *format, int pid)
} }
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#endif
while (av_read_frame(subavfc, &packet) > -1) while (av_read_frame(subavfc, &packet) > -1)
{ {
AVSubtitle sub; AVSubtitle sub;

View File

@@ -2288,9 +2288,11 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
if (track.avCodecCtx) if (track.avCodecCtx)
{ {
ffmpeg_printf(10, " Handle inject_as_pcm = %d\n", track.inject_as_pcm); ffmpeg_printf(10, " Handle inject_as_pcm = %d\n", track.inject_as_pcm);
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
AVCodec *codec = avcodec_find_decoder(get_codecpar(stream)->codec_id); AVCodec *codec = avcodec_find_decoder(get_codecpar(stream)->codec_id);
#else
const AVCodec *codec = avcodec_find_decoder(get_codecpar(stream)->codec_id);
#endif
int errorCode = avcodec_open2(track.avCodecCtx, codec, NULL); int errorCode = avcodec_open2(track.avCodecCtx, codec, NULL);
if (codec != NULL && !errorCode) if (codec != NULL && !errorCode)
{ {

View File

@@ -379,7 +379,9 @@ void cAudio::run()
char tmp[64] = "unknown"; char tmp[64] = "unknown";
curr_pts = 0; curr_pts = 0;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&avpkt); av_init_packet(&avpkt);
#endif
inp = av_find_input_format("mpegts"); inp = av_find_input_format("mpegts");
AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size
0, // bWriteable (1=true,0=false) 0, // bWriteable (1=true,0=false)

View File

@@ -300,7 +300,9 @@ bool cVideo::ShowPicture(const char *fname)
hal_info("%s: Could not allocate video frame\n", __func__); hal_info("%s: Could not allocate video frame\n", __func__);
goto out_free; goto out_free;
} }
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&avpkt); av_init_packet(&avpkt);
#endif
if (av_read_frame(avfc, &avpkt) < 0) if (av_read_frame(avfc, &avpkt) < 0)
{ {
hal_info("%s: av_read_frame < 0\n", __func__); hal_info("%s: av_read_frame < 0\n", __func__);
@@ -520,8 +522,9 @@ void cVideo::run(void)
buf_in = 0; buf_in = 0;
buf_out = 0; buf_out = 0;
dec_r = 0; dec_r = 0;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&avpkt); av_init_packet(&avpkt);
#endif
inp = av_find_input_format("mpegts"); inp = av_find_input_format("mpegts");
AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size
0, // bWriteable (1=true,0=false) 0, // bWriteable (1=true,0=false)

View File

@@ -230,7 +230,9 @@ void write_frame(AVFrame *in_frame, FILE *fp)
if (avcodec_open2(codec_context, codec, 0) != -1) if (avcodec_open2(codec_context, codec, 0) != -1)
{ {
AVPacket pkt; AVPacket pkt;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&pkt); av_init_packet(&pkt);
#endif
/* encode the image */ /* encode the image */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100)
int got_output = 0; int got_output = 0;
@@ -395,7 +397,9 @@ int image_to_mpeg2(const char *image_name, const char *encode_name)
if (codecContext) if (codecContext)
{ {
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#endif
if ((ret = av_read_frame(formatContext, &packet)) != -1) if ((ret = av_read_frame(formatContext, &packet)) != -1)
{ {
FILE *fp = fopen(encode_name, "wb"); FILE *fp = fopen(encode_name, "wb");