[FFmpeg-cvslog] r19263 - trunk/libavformat/mov.c

reimar subversion
Wed Jun 24 10:57:53 CEST 2009


Author: reimar
Date: Wed Jun 24 10:57:53 2009
New Revision: 19263

Log:
mov_read_packet: extract code that searches for the stream/sample to demux next
into a separate function.

Modified:
   trunk/libavformat/mov.c

Modified: trunk/libavformat/mov.c
==============================================================================
--- trunk/libavformat/mov.c	Wed Jun 24 10:50:46 2009	(r19262)
+++ trunk/libavformat/mov.c	Wed Jun 24 10:57:53 2009	(r19263)
@@ -2055,15 +2055,11 @@ static int mov_read_header(AVFormatConte
     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(AVFormatConte
                   (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) ||



More information about the ffmpeg-cvslog mailing list