am7xxx-play: add a comment to explain why a run-time warning can be ignored Using the AV_PIX_FMT_YUVJ420P pixel format results n a run-time warning from swscaler: [swscaler @ 0x5600046b3cc0] deprecated pixel format used, make sure you did set range correctly However this cannot be changed because the mjpeg codec relies on it, otherwise it fails with the following error message: [mjpeg @ 0x560eea5f5360] Specified pixel format yuv420p is invalid or not supported So just add a comment, to avoid loosing time figuring things out again in the future.
am7xxx-play: stop using avcodec_decode_video2() and avcodec_encode_video2() Since FFMpeg 3.1, avcodec_decode_video2() and avcodec_encode_video2() have been deprecated in favor of the more generic send/receive API. Provide some wrappers to ease the transition between the two APIs. The change fixes the following warnings: .../libam7xxx/examples/am7xxx-play.c: In function ‘am7xxx_play’: .../libam7xxx/examples/am7xxx-play.c:372:3: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations] ret = avcodec_decode_video2(input_ctx.codec_ctx, frame_raw, &got_frame, &in_packet); ^~~ In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:319:0, from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51, from .../libam7xxx/examples/am7xxx-play.c:32: /usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4993:5: note: declared here int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, ^~~~~~~~~~~~~~~~~~~~~ .../libam7xxx/examples/am7xxx-play.c:403:5: warning: ‘avcodec_encode_video2’ is deprecated [-Wdeprecated-declarations] ret = avcodec_encode_video2(output_ctx.codec_ctx, ^~~ In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:319:0, from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51, from .../libam7xxx/examples/am7xxx-play.c:32: /usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:5508:5: note: declared here int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, ^~~~~~~~~~~~~~~~~~~~~
am7xxx-play: use AVStream.codecpar instead of the deprecated AVStream.codec AVStream.codec has been deprecated and AVStream.codecpar should be used instead, as shown in: http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commitdiff;h=9200514ad8717c63f82101dc394f4378854325bf The changes fix the following compilation warnings: .../libam7xxx/examples/am7xxx-play.c: In function ‘video_input_init’: .../libam7xxx/examples/am7xxx-play.c:104:3: warning: ‘codec’ is deprecated [-Wdeprecated-declarations] if (input_format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { ^~ In file included from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51:0, from .../libam7xxx/examples/am7xxx-play.c:32: /usr/include/x86_64-linux-gnu/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^~~~~ .../libam7xxx/examples/am7xxx-play.c:115:2: warning: ‘codec’ is deprecated [-Wdeprecated-declarations] input_codec_ctx = input_format_ctx->streams[video_index]->codec; ^~~~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/libavdevice/avdevice.h:51:0, from .../libam7xxx/examples/am7xxx-play.c:32: /usr/include/x86_64-linux-gnu/libavformat/avformat.h:893:21: note: declared here AVCodecContext *codec; ^~~~~