summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-06-24 08:57:53 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-06-24 08:57:53 +0000
commit5dc5c43bdaf3f318000c4f1ead024c09ab4a337e (patch)
treef453fb1d30aa70cecdaf13c6cb0b5ac403a60d1a /libavformat/mov.c
parenta2f3851166fab01d472273ce3ef9025d1764bf77 (diff)
mov_read_packet: extract code that searches for the stream/sample to demux next
into a separate function. Originally committed as revision 19263 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3b9cc267d8..1ced2447db 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2055,15 +2055,11 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
return 0;
}
-static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
+static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
{
- MOVContext *mov = s->priv_data;
- MOVStreamContext *sc = 0;
- AVIndexEntry *sample = 0;
- AVStream *st = NULL;
+ AVIndexEntry *sample = NULL;
int64_t best_dts = INT64_MAX;
- int i, ret;
- retry:
+ int i;
for (i = 0; i < s->nb_streams; i++) {
AVStream *avst = s->streams[i];
MOVStreamContext *msc = avst->priv_data;
@@ -2078,10 +2074,22 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
(FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) {
sample = current_sample;
best_dts = dts;
- st = avst;
+ *st = avst;
}
}
}
+ return sample;
+}
+
+static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ MOVContext *mov = s->priv_data;
+ MOVStreamContext *sc;
+ AVIndexEntry *sample;
+ AVStream *st = NULL;
+ int ret;
+ retry:
+ sample = mov_find_next_sample(s, &st);
if (!sample) {
mov->found_mdat = 0;
if (!url_is_streamed(s->pb) ||