diff options
author | wm4 <wm4@nowhere> | 2017-10-31 17:11:45 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-10-31 17:11:52 +0100 |
commit | 95c6a482eb9d97f180b54e45d2c5aa360b218cba (patch) | |
tree | f54e4c7353bd0a1351f5c8eae07dd6904aca5a50 /video | |
parent | f27a9aaa17eaced765718d096d0b3284c3f15b1f (diff) | |
download | mpv-95c6a482eb9d97f180b54e45d2c5aa360b218cba.tar.bz2 mpv-95c6a482eb9d97f180b54e45d2c5aa360b218cba.tar.xz |
vd_lavc: clean out more hwdec legacy code
All this code used to be required by the old variants of the libavcodec
hw decoding APIs. Almost all of that is gone, although the mediacodec
API unfortunately still pulls in some old stuff (but not all of it).
(mediacodec build/functionality is untested, but should work.)
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/hw_mediacodec.c | 8 | ||||
-rw-r--r-- | video/decode/lavc.h | 8 | ||||
-rw-r--r-- | video/decode/vd_lavc.c | 28 |
3 files changed, 5 insertions, 39 deletions
diff --git a/video/decode/hw_mediacodec.c b/video/decode/hw_mediacodec.c index b1a06c19ed..0f52695857 100644 --- a/video/decode/hw_mediacodec.c +++ b/video/decode/hw_mediacodec.c @@ -31,12 +31,7 @@ static int probe(struct lavc_ctx *ctx, struct vd_lavc_hwdec *hwdec, return 0; } -static int init(struct lavc_ctx *ctx) -{ - return 0; -} - -static int init_decoder(struct lavc_ctx *ctx, int w, int h) +static int init_decoder(struct lavc_ctx *ctx) { av_mediacodec_default_free(ctx->avctx); @@ -59,7 +54,6 @@ const struct vd_lavc_hwdec mp_vd_lavc_mediacodec = { .image_format = IMGFMT_MEDIACODEC, .lavc_suffix = "_mediacodec", .probe = probe, - .init = init, .init_decoder = init_decoder, .uninit = uninit, }; diff --git a/video/decode/lavc.h b/video/decode/lavc.h index cf5485d3b6..70ff4cde97 100644 --- a/video/decode/lavc.h +++ b/video/decode/lavc.h @@ -31,7 +31,6 @@ typedef struct lavc_ctx { AVFrame *pic; struct vd_lavc_hwdec *hwdec; AVRational codec_timebase; - enum AVPixelFormat pix_fmt; enum AVDiscard skip_frame; bool flushing; const char *decoder; @@ -62,11 +61,6 @@ typedef struct lavc_ctx { struct mp_hwdec_ctx *hwdec_dev; bool owns_hwdec_dev; - int hwdec_fmt; - int hwdec_w; - int hwdec_h; - int hwdec_profile; - bool hwdec_request_reinit; int hwdec_fail_count; @@ -102,7 +96,7 @@ struct vd_lavc_hwdec { int (*probe)(struct lavc_ctx *ctx, struct vd_lavc_hwdec *hwdec, const char *codec); int (*init)(struct lavc_ctx *ctx); - int (*init_decoder)(struct lavc_ctx *ctx, int w, int h); + int (*init_decoder)(struct lavc_ctx *ctx); void (*uninit)(struct lavc_ctx *ctx); // Process the image returned by the libavcodec decoder. struct mp_image *(*process_image)(struct lavc_ctx *ctx, struct mp_image *img); diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 75cf8a6416..c455dbdab6 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -562,9 +562,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder, if (strstr(decoder, "_mmal")) ctx->codec_timebase = (AVRational){1, 1000000}; - ctx->pix_fmt = AV_PIX_FMT_NONE; ctx->hwdec = hwdec; - ctx->hwdec_fmt = 0; ctx->hwdec_failed = false; ctx->hwdec_request_reinit = false; ctx->avctx = avcodec_alloc_context3(lavc_codec); @@ -590,8 +588,6 @@ static void init_avctx(struct dec_video *vd, const char *decoder, avctx->hwaccel_flags |= AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH; if (ctx->hwdec->image_format) avctx->get_format = get_format_hwdec; - if (ctx->hwdec->init && ctx->hwdec->init(ctx) < 0) - goto error; if (ctx->hwdec->generic_hwaccel) { ctx->hwdec_dev = hwdec_create_dev(vd, ctx->hwdec, false); if (!ctx->hwdec_dev) @@ -818,28 +814,10 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx, if (ctx->hwdec->generic_hwaccel) { if (init_generic_hwaccel(vd, fmt[i]) < 0) break; - select = fmt[i]; - break; - } - // There could be more reasons for a change, and it's possible - // that we miss some. (Might also depend on the hwaccel type.) - bool change = - ctx->hwdec_w != avctx->coded_width || - ctx->hwdec_h != avctx->coded_height || - ctx->hwdec_fmt != ctx->hwdec->image_format || - ctx->hwdec_profile != avctx->profile || - ctx->hwdec_request_reinit; - ctx->hwdec_w = avctx->coded_width; - ctx->hwdec_h = avctx->coded_height; - ctx->hwdec_fmt = ctx->hwdec->image_format; - ctx->hwdec_profile = avctx->profile; - ctx->hwdec_request_reinit = false; - if (change && ctx->hwdec->init_decoder) { - if (ctx->hwdec->init_decoder(ctx, ctx->hwdec_w, ctx->hwdec_h) < 0) - { - ctx->hwdec_fmt = 0; + } else { + ctx->hwdec_request_reinit = false; + if (ctx->hwdec->init_decoder && ctx->hwdec->init_decoder(ctx) < 0) break; - } } select = fmt[i]; break; |