summaryrefslogtreecommitdiffstats
path: root/demux/packet.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-05 21:52:07 +0100
committerwm4 <wm4@nowhere>2015-02-05 21:52:07 +0100
commit1f2a370a03fff9f1156f3cafa2255c27b61cc35d (patch)
tree8fa504a5201f66cf2567217d15f431e191195c14 /demux/packet.c
parentf8d7756a14a8073f24c31b3854b7e64784cbb002 (diff)
downloadmpv-1f2a370a03fff9f1156f3cafa2255c27b61cc35d.tar.bz2
mpv-1f2a370a03fff9f1156f3cafa2255c27b61cc35d.tar.xz
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.
Diffstat (limited to 'demux/packet.c')
-rw-r--r--demux/packet.c14
1 files changed, 11 insertions, 3 deletions
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;
}