diff options
author | Aman Gupta <aman@tmm1.net> | 2019-08-23 12:56:33 -0700 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2019-09-10 19:01:13 -0700 |
commit | c0c7946196710d0579a9c85bf65289d5a123ab89 (patch) | |
tree | 35373c710bfb5d4930efe033bbcf9c61b29c7af1 /libavcodec/v4l2_context.c | |
parent | d61cf1b1ebc2477749d7d7825a072400ed24af9f (diff) |
avcodec/v4l2_m2m: decouple v4l2_m2m helpers from AVCodecContext
This will allow re-use of the m2m backend with AVFilterContext
Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavcodec/v4l2_context.c')
-rw-r--r-- | libavcodec/v4l2_context.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c index 3f8a510331..1f1b8347dc 100644 --- a/libavcodec/v4l2_context.c +++ b/libavcodec/v4l2_context.c @@ -48,9 +48,9 @@ static inline V4L2m2mContext *ctx_to_m2mctx(V4L2Context *ctx) container_of(ctx, V4L2m2mContext, capture); } -static inline AVCodecContext *logger(V4L2Context *ctx) +static inline AVClass *logger(V4L2Context *ctx) { - return ctx_to_m2mctx(ctx)->avctx; + return ctx_to_m2mctx(ctx)->priv; } static inline unsigned int v4l2_get_width(struct v4l2_format *fmt) @@ -96,7 +96,7 @@ static inline int v4l2_get_framesize_compressed(V4L2Context* ctx, int width, int const int SZ_4K = 0x1000; int size; - if (av_codec_is_decoder(s->avctx->codec)) + if (s->avctx && av_codec_is_decoder(s->avctx->codec)) return ((width * height * 3 / 2) / 2) + 128; /* encoder */ @@ -193,7 +193,8 @@ static int v4l2_handle_event(V4L2Context *ctx) } if (reinit) { - ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height); + if (s->avctx) + ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height); if (ret < 0) av_log(logger(ctx), AV_LOG_WARNING, "update avcodec height and width\n"); |