diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 182c808..9182ddb 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -265,7 +265,9 @@ void write_frame(AVFrame *in_frame, int fd) if (avcodec_open2(codec_context, codec, 0) != -1) { AVPacket pkt; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&pkt); +#endif /* encode the image */ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100) int got_output = 0; @@ -430,7 +432,9 @@ int image_to_mpeg2(const char *image_name, int fd) if (codecContext) { AVPacket packet; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&packet); +#endif if ((ret = av_read_frame(formatContext, &packet)) != -1) { if ((ret = decode_frame(codecContext, packet, fd)) != 1) diff --git a/libeplayer3-sh4/input.cpp b/libeplayer3-sh4/input.cpp index 7de69bd..b26e25a 100644 --- a/libeplayer3-sh4/input.cpp +++ b/libeplayer3-sh4/input.cpp @@ -261,8 +261,9 @@ bool Input::Play() } AVPacket packet; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&packet); - +#endif int err = av_read_frame(avfc, &packet); if (err == AVERROR(EAGAIN)) { @@ -449,8 +450,9 @@ bool Input::ReadSubtitle(const char *filename, const char *format, int pid) } AVPacket packet; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&packet); - +#endif while (av_read_frame(subavfc, &packet) > -1) { AVSubtitle sub; diff --git a/libeplayer3/container/container_ffmpeg.c b/libeplayer3/container/container_ffmpeg.c index f80fb4a..40114b5 100644 --- a/libeplayer3/container/container_ffmpeg.c +++ b/libeplayer3/container/container_ffmpeg.c @@ -2288,9 +2288,11 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 if (track.avCodecCtx) { 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); - +#else + const AVCodec *codec = avcodec_find_decoder(get_codecpar(stream)->codec_id); +#endif int errorCode = avcodec_open2(track.avCodecCtx, codec, NULL); if (codec != NULL && !errorCode) { diff --git a/libgeneric-pc/audio.cpp b/libgeneric-pc/audio.cpp index 264b9d3..a5e8bd3 100644 --- a/libgeneric-pc/audio.cpp +++ b/libgeneric-pc/audio.cpp @@ -379,7 +379,9 @@ void cAudio::run() char tmp[64] = "unknown"; curr_pts = 0; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&avpkt); +#endif inp = av_find_input_format("mpegts"); AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size 0, // bWriteable (1=true,0=false) diff --git a/libgeneric-pc/video.cpp b/libgeneric-pc/video.cpp index 666586d..e44f22a 100644 --- a/libgeneric-pc/video.cpp +++ b/libgeneric-pc/video.cpp @@ -300,7 +300,9 @@ bool cVideo::ShowPicture(const char *fname) hal_info("%s: Could not allocate video frame\n", __func__); goto out_free; } +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&avpkt); +#endif if (av_read_frame(avfc, &avpkt) < 0) { hal_info("%s: av_read_frame < 0\n", __func__); @@ -520,8 +522,9 @@ void cVideo::run(void) buf_in = 0; buf_out = 0; dec_r = 0; - +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&avpkt); +#endif inp = av_find_input_format("mpegts"); AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size 0, // bWriteable (1=true,0=false) diff --git a/libspark/video.cpp b/libspark/video.cpp index 3ef21fa..57e0104 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -230,7 +230,9 @@ void write_frame(AVFrame *in_frame, FILE *fp) if (avcodec_open2(codec_context, codec, 0) != -1) { AVPacket pkt; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&pkt); +#endif /* encode the image */ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100) int got_output = 0; @@ -395,7 +397,9 @@ int image_to_mpeg2(const char *image_name, const char *encode_name) if (codecContext) { AVPacket packet; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) av_init_packet(&packet); +#endif if ((ret = av_read_frame(formatContext, &packet)) != -1) { FILE *fp = fopen(encode_name, "wb");