[FFmpeg-devel] [PATCH] mov.c: factorize ff_mov_read_stsd_entries()

Ronald S. Bultje rsbultje
Mon Mar 9 21:13:01 CET 2009


Hi,

as per $subj, this patch factorizes reading of a single STSD atom into
its own function. This sole atom is the stream descriptor in QT
streams sent over RTSP, and so this function alone is sufficient to
read a complete RTSP header and prepare for stream playback (which
I'll do in yet another patch).

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/mov.c
===================================================================
--- ffmpeg-svn.orig/libavformat/mov.c	2009-02-28 10:40:38.000000000 -0500
+++ ffmpeg-svn/libavformat/mov.c	2009-02-28 10:43:11.000000000 -0500
@@ -644,16 +644,11 @@
     return CODEC_ID_NONE;
 }
 
-static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
     MOVStreamContext *sc = st->priv_data;
-    int j, entries, pseudo_stream_id;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    entries = get_be32(pb);
+    int j, pseudo_stream_id;
 
     for(pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) {
         //Parsing Sample description table
@@ -966,6 +961,17 @@
     return 0;
 }
 
+static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
+{
+    int entries;
+
+    get_byte(pb); /* version */
+    get_be24(pb); /* flags */
+    entries = get_be32(pb);
+
+    return ff_mov_read_stsd_entries(c, pb, entries);
+}
+
 static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
 {
     AVStream *st = c->fc->streams[c->fc->nb_streams-1];
Index: ffmpeg-svn/libavformat/isom.h
===================================================================
--- ffmpeg-svn.orig/libavformat/isom.h	2009-02-28 10:40:34.000000000 -0500
+++ ffmpeg-svn/libavformat/isom.h	2009-02-28 10:43:11.000000000 -0500
@@ -136,4 +136,6 @@
     int itunes_metadata; ///< metadata are itunes style
 } MOVContext;
 
+int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries);
+
 #endif /* AVFORMAT_ISOM_H */



More information about the ffmpeg-devel mailing list