summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-28 20:16:11 +0100
committerwm4 <wm4@nowhere>2013-03-28 21:46:17 +0100
commit3374a43998f183b585640de0a588db2431ed87ae (patch)
treecaa863740ad976d735c4b874e87f260c126f01f8 /core
parentac1c5e6e18afc5043fa078803ef465bb4017c07a (diff)
downloadmpv-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 'core')
-rw-r--r--core/mplayer.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index 1a79213bdc..5707fdacc6 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -2437,9 +2437,13 @@ static double update_video_nocorrect_pts(struct MPContext *mpctx)
update_fps(mpctx);
int framedrop_type = check_framedrop(mpctx, frame_time);
- void *decoded_frame;
- decoded_frame = decode_video(sh_video, sh_video->ds->current, packet,
- in_size, framedrop_type, sh_video->pts);
+ struct demux_packet pkt = {0};
+ if (sh_video->ds->current)
+ pkt = *sh_video->ds->current;
+ pkt.buffer = packet;
+ pkt.len = in_size;
+ void *decoded_frame = decode_video(sh_video, &pkt, framedrop_type,
+ sh_video->pts);
if (decoded_frame) {
filter_video(mpctx, decoded_frame);
}
@@ -2495,8 +2499,6 @@ static double update_video(struct MPContext *mpctx)
break;
if (filter_output_queued_frame(mpctx))
break;
- int in_size = 0;
- unsigned char *buf = NULL;
pts = MP_NOPTS_VALUE;
struct demux_packet *pkt;
while (1) {
@@ -2507,11 +2509,8 @@ static double update_video(struct MPContext *mpctx)
* but to indicate the absence of a frame in formats like AVI
* that must have packets at fixed timecode intervals. */
}
- if (pkt) {
- in_size = pkt->len;
- buf = pkt->buffer;
+ if (pkt)
pts = pkt->pts;
- }
if (pts != MP_NOPTS_VALUE)
pts += mpctx->video_offset;
if (pts >= mpctx->hrseek_pts - .005)
@@ -2519,7 +2518,7 @@ static double update_video(struct MPContext *mpctx)
int framedrop_type = mpctx->hrseek_framedrop ? 1 :
check_framedrop(mpctx, sh_video->frametime);
struct mp_image *decoded_frame =
- decode_video(sh_video, pkt, buf, in_size, framedrop_type, pts);
+ decode_video(sh_video, pkt, framedrop_type, pts);
if (decoded_frame) {
determine_frame_pts(mpctx);
filter_video(mpctx, decoded_frame);