From 8120bb5a4e7d1d2da630cf901a1555bc13dfba1b Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 6 Mar 2016 21:47:20 +0100 Subject: avformat: use new type AV_PIX_FMT_YUV420P (ref issue #114) --- modules/avformat/avformat.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/avformat/avformat.c b/modules/avformat/avformat.c index cabb103..c4566b5 100644 --- a/modules/avformat/avformat.c +++ b/modules/avformat/avformat.c @@ -56,6 +56,11 @@ #endif +#if LIBAVUTIL_VERSION_MAJOR < 52 +#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P +#endif + + struct vidsrc_st { const struct vidsrc *vs; /* inheritance */ pthread_t thread; @@ -151,14 +156,14 @@ static void handle_packet(struct vidsrc_st *st, AVPacket *pkt) st->sws = sws_getContext(st->sz.w, st->sz.h, st->ctx->pix_fmt, st->app_sz.w, st->app_sz.h, - PIX_FMT_YUV420P, + AV_PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL); if (!st->sws) return; } - ret = avpicture_alloc(&pict, PIX_FMT_YUV420P, + ret = avpicture_alloc(&pict, AV_PIX_FMT_YUV420P, st->app_sz.w, st->app_sz.h); if (ret < 0) return; @@ -170,7 +175,7 @@ static void handle_packet(struct vidsrc_st *st, AVPacket *pkt) goto end; } else { - avpicture_fill(&pict, pkt->data, PIX_FMT_YUV420P, + avpicture_fill(&pict, pkt->data, AV_PIX_FMT_YUV420P, st->sz.w, st->sz.h); } @@ -281,7 +286,7 @@ static int alloc(struct vidsrc_st **stp, const struct vidsrc *vs, prms.channels = 1; prms.width = size->w; prms.height = size->h; - prms.pix_fmt = PIX_FMT_YUV420P; + prms.pix_fmt = AV_PIX_FMT_YUV420P; prms.channel = 0; ret = av_open_input_file(&st->ic, dev, av_find_input_format(fmt), -- cgit v1.2.3