[vlc-commits] demux: libmp4: parse fiel extension atom

Francois Cartegnie git at videolan.org
Wed Jan 14 18:02:51 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan 14 17:28:41 2015 +0100| [1855ec49ff399a22c56f6f0ebe67430becb92704] | committer: Francois Cartegnie

demux: libmp4: parse fiel extension atom

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1855ec49ff399a22c56f6f0ebe67430becb92704
---

 modules/demux/mp4/libmp4.c |   25 +++++++++++++++++++++++++
 modules/demux/mp4/libmp4.h |    7 +++++++
 2 files changed, 32 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 7faaaa8..03097c1 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1871,6 +1871,30 @@ static int MP4_ReadBox_dvc1( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_READBOX_EXIT( 1 );
 }
 
+static int MP4_ReadBox_fiel( stream_t *p_stream, MP4_Box_t *p_box )
+{
+    MP4_Box_data_fiel_t *p_fiel;
+    MP4_READBOX_ENTER( MP4_Box_data_fiel_t );
+    p_fiel = p_box->data.p_fiel;
+    if(i_read < 2)
+        MP4_READBOX_EXIT( 0 );
+    if(p_peek[0] == 2) /* Interlaced */
+    {
+        /*
+         * 0 – There is only one field.
+         * 1 – T is displayed earliest, T is stored first in the file.
+         * 6 – B is displayed earliest, B is stored first in the file.
+         * 9 – B is displayed earliest, T is stored first in the file.
+         * 14 – T is displayed earliest, B is stored first in the file.
+        */
+        if(p_peek[1] == 1 || p_peek[1] == 9)
+            p_fiel->i_flags = BLOCK_FLAG_TOP_FIELD_FIRST;
+        else if(p_peek[1] == 6 || p_peek[1] == 14)
+            p_fiel->i_flags = BLOCK_FLAG_BOTTOM_FIELD_FIRST;
+    }
+    MP4_READBOX_EXIT( 1 );
+}
+
 static int MP4_ReadBox_enda( stream_t *p_stream, MP4_Box_t *p_box )
 {
     MP4_Box_data_enda_t *p_enda;
@@ -3673,6 +3697,7 @@ static const struct
     { ATOM_dac3,    MP4_ReadBox_dac3,         MP4_FreeBox_Common, 0 },
     { ATOM_dec3,    MP4_ReadBox_dec3,         MP4_FreeBox_Common, 0 },
     { ATOM_dvc1,    MP4_ReadBox_dvc1,         MP4_FreeBox_Common, 0 },
+    { ATOM_fiel,    MP4_ReadBox_fiel,         MP4_FreeBox_Common, 0 },
     { ATOM_glbl,    MP4_ReadBox_Binary,       MP4_FreeBox_Binary, ATOM_FFV1 },
     { ATOM_enda,    MP4_ReadBox_enda,         MP4_FreeBox_Common, 0 },
     { ATOM_iods,    MP4_ReadBox_iods,         MP4_FreeBox_Common, 0 },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 0486ed9..6a64659 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -199,6 +199,7 @@
 #define ATOM_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
 #define ATOM_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
 
+#define ATOM_fiel VLC_FOURCC( 'f', 'i', 'e', 'l' )
 #define ATOM_glbl VLC_FOURCC( 'g', 'l', 'b', 'l' )
 #define ATOM_hvcC VLC_FOURCC( 'h', 'v', 'c', 'C' )
 
@@ -1226,6 +1227,11 @@ typedef struct
 
 typedef struct
 {
+    uint32_t i_flags;
+} MP4_Box_data_fiel_t;
+
+typedef struct
+{
     uint16_t i_little_endian;
 
 } MP4_Box_data_enda_t;
@@ -1414,6 +1420,7 @@ typedef union MP4_Box_data_s
     MP4_Box_data_dac3_t *p_dac3;
     MP4_Box_data_dec3_t *p_dec3;
     MP4_Box_data_dvc1_t *p_dvc1;
+    MP4_Box_data_fiel_t *p_fiel;
     MP4_Box_data_chan_t *p_chan;
     MP4_Box_data_enda_t *p_enda;
     MP4_Box_data_keys_t *p_keys;



More information about the vlc-commits mailing list