summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-11 10:58:30 +0100
committerwm4 <wm4@nowhere>2017-01-11 11:04:59 +0100
commitf8baae585451bb072e8ef606bafd7c0d5e369bf7 (patch)
treefffee4f789cd449967564281e49c522f755ffa96 /video/decode/vd_lavc.c
parent77320ad45e3f1e6b08ecff4a3c0045a4864816a8 (diff)
downloadmpv-f8baae585451bb072e8ef606bafd7c0d5e369bf7.tar.bz2
mpv-f8baae585451bb072e8ef606bafd7c0d5e369bf7.tar.xz
vd_lavc: inline a function
There's only 1 caller now, so having it as separate function doesn't make too much sense, and makes the code less readable, if anything.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c82
1 files changed, 37 insertions, 45 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index a8c0c41f0c..48f46f3ac7 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -755,50 +755,6 @@ static int get_buffer2_hwdec(AVCodecContext *avctx, AVFrame *pic, int flags)
return 0;
}
-static bool read_output(struct dec_video *vd, bool progress,
- struct mp_image **out_image)
-{
- vd_ffmpeg_ctx *ctx = vd->priv;
-
- assert(!*out_image);
-
- if (!ctx->num_delay_queue)
- return progress;
-
- if (ctx->num_delay_queue <= ctx->max_delay_queue && progress)
- return true;
-
- struct mp_image *res = ctx->delay_queue[0];
- MP_TARRAY_REMOVE_AT(ctx->delay_queue, ctx->num_delay_queue, 0);
-
- if (ctx->hwdec && ctx->hwdec->process_image)
- res = ctx->hwdec->process_image(ctx, res);
-
- res = res ? mp_img_swap_to_native(res) : NULL;
- if (!res)
- return progress;
-
- if (!ctx->hwdec_notified && vd->opts->hwdec_api != HWDEC_NONE) {
- if (ctx->hwdec) {
- MP_INFO(vd, "Using hardware decoding (%s).\n",
- m_opt_choice_str(mp_hwdec_names, ctx->hwdec->type));
- } else {
- MP_INFO(vd, "Using software decoding.\n");
- }
- ctx->hwdec_notified = true;
- }
-
- if (ctx->hw_probing) {
- for (int n = 0; n < ctx->num_sent_packets; n++)
- talloc_free(ctx->sent_packets[n]);
- ctx->num_sent_packets = 0;
- ctx->hw_probing = false;
- }
-
- *out_image = res;
- return true;
-}
-
static bool prepare_decoding(struct dec_video *vd)
{
vd_ffmpeg_ctx *ctx = vd->priv;
@@ -946,6 +902,8 @@ static bool receive_frame(struct dec_video *vd, struct mp_image **out_image)
{
vd_ffmpeg_ctx *ctx = vd->priv;
+ assert(!*out_image);
+
bool progress = decode_frame(vd);
if (ctx->hwdec_failed) {
@@ -961,7 +919,41 @@ static bool receive_frame(struct dec_video *vd, struct mp_image **out_image)
ctx->num_requeue_packets = num_pkts;
}
- return read_output(vd, progress, out_image);
+ if (!ctx->num_delay_queue)
+ return progress;
+
+ if (ctx->num_delay_queue <= ctx->max_delay_queue && progress)
+ return true;
+
+ struct mp_image *res = ctx->delay_queue[0];
+ MP_TARRAY_REMOVE_AT(ctx->delay_queue, ctx->num_delay_queue, 0);
+
+ if (ctx->hwdec && ctx->hwdec->process_image)
+ res = ctx->hwdec->process_image(ctx, res);
+
+ res = res ? mp_img_swap_to_native(res) : NULL;
+ if (!res)
+ return progress;
+
+ if (!ctx->hwdec_notified && vd->opts->hwdec_api != HWDEC_NONE) {
+ if (ctx->hwdec) {
+ MP_INFO(vd, "Using hardware decoding (%s).\n",
+ m_opt_choice_str(mp_hwdec_names, ctx->hwdec->type));
+ } else {
+ MP_INFO(vd, "Using software decoding.\n");
+ }
+ ctx->hwdec_notified = true;
+ }
+
+ if (ctx->hw_probing) {
+ for (int n = 0; n < ctx->num_sent_packets; n++)
+ talloc_free(ctx->sent_packets[n]);
+ ctx->num_sent_packets = 0;
+ ctx->hw_probing = false;
+ }
+
+ *out_image = res;
+ return true;
}
static int control(struct dec_video *vd, int cmd, void *arg)