diff options
author | wm4 <wm4@nowhere> | 2013-03-28 20:16:11 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-03-28 21:46:17 +0100 |
commit | 3374a43998f183b585640de0a588db2431ed87ae (patch) | |
tree | caa863740ad976d735c4b874e87f260c126f01f8 /video/decode/vd_lavc.c | |
parent | ac1c5e6e18afc5043fa078803ef465bb4017c07a (diff) | |
download | mpv-3374a43998f183b585640de0a588db2431ed87ae.tar.bz2 mpv-3374a43998f183b585640de0a588db2431ed87ae.tar.xz |
core: always pass data via packet fields to video decoders
Makes the code a bit simpler to follow, at least in the "modern"
decoding path (update_video_nocorrect_pts() is used with old demuxers,
which don't return proper packets and need further parsing, so this code
looks less simple now).
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r-- | video/decode/vd_lavc.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 9e334334cc..dfca042ba0 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -636,9 +636,8 @@ static struct mp_image *image_from_decoder(struct sh_video *sh) #endif /* HAVE_AVUTIL_REFCOUNTING */ -static int decode(struct sh_video *sh, struct demux_packet *packet, void *data, - int len, int flags, double *reordered_pts, - struct mp_image **out_image) +static int decode(struct sh_video *sh, struct demux_packet *packet, + int flags, double *reordered_pts, struct mp_image **out_image) { int got_picture = 0; int ret; @@ -655,8 +654,8 @@ static int decode(struct sh_video *sh, struct demux_packet *packet, void *data, avctx->skip_frame = ctx->skip_frame; av_init_packet(&pkt); - pkt.data = data; - pkt.size = len; + pkt.data = packet ? packet->buffer : NULL; + pkt.size = packet ? packet->len : 0; /* Some codecs (ZeroCodec, some cases of PNG) may want keyframe info * from demuxer. */ if (packet && packet->keyframe) @@ -692,15 +691,15 @@ static int decode(struct sh_video *sh, struct demux_packet *packet, void *data, } static struct mp_image *decode_with_fallback(struct sh_video *sh, - struct demux_packet *packet, void *data, - int len, int flags, double *reordered_pts) + struct demux_packet *packet, + int flags, double *reordered_pts) { vd_ffmpeg_ctx *ctx = sh->context; if (!ctx->avctx) return NULL; struct mp_image *mpi = NULL; - int res = decode(sh, packet, data, len, flags, reordered_pts, &mpi); + int res = decode(sh, packet, flags, reordered_pts, &mpi); if (res >= 0) return mpi; @@ -714,7 +713,7 @@ static struct mp_image *decode_with_fallback(struct sh_video *sh, ctx->software_fallback_decoder = NULL; if (init_avctx(sh, decoder, NULL)) { mpi = NULL; - decode(sh, packet, data, len, flags, reordered_pts, &mpi); + decode(sh, packet, flags, reordered_pts, &mpi); return mpi; } } |