From 1f2a370a03fff9f1156f3cafa2255c27b61cc35d Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 5 Feb 2015 21:52:07 +0100 Subject: demux_mkv: refactor packet parsing Makes it somewhat more uniform, and breaks up the awfully deep nesting. This implicitly changes multiple small details, rather than only moving code around. In particular, this computes the packet fields first and parses them afterwards, which is needed for the next commit. --- demux/packet.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'demux/packet.c') diff --git a/demux/packet.c b/demux/packet.c index 1b2d985976..22b111b0ce 100644 --- a/demux/packet.c +++ b/demux/packet.c @@ -100,6 +100,16 @@ void free_demux_packet(struct demux_packet *dp) talloc_free(dp); } +void demux_packet_copy_attribs(struct demux_packet *dst, struct demux_packet *src) +{ + dst->pts = src->pts; + dst->dts = src->dts; + dst->duration = src->duration; + dst->pos = src->pos; + dst->keyframe = src->keyframe; + dst->stream = src->stream; +} + struct demux_packet *demux_copy_packet(struct demux_packet *dp) { struct demux_packet *new = NULL; @@ -111,9 +121,7 @@ struct demux_packet *demux_copy_packet(struct demux_packet *dp) } if (!new) return NULL; - new->pts = dp->pts; - new->dts = dp->dts; - new->duration = dp->duration; + demux_packet_copy_attribs(new, dp); return new; } -- cgit v1.2.3