]> git.sesse.net Git - vlc/blobdiff - modules/demux/mp4/libmp4.h
* modules/demux/mp4/mp4.c: couple of fixes for audio demuxing.
[vlc] / modules / demux / mp4 / libmp4.h
index e83fdca6566215ffd2bab557d3dc270214392ed1..941e701c6e6da1128e9c9ae222231857dda7ed4b 100644 (file)
 #define FOURCC_ulaw VLC_FOURCC( 'u', 'l', 'a', 'w' )
 #define FOURCC_Qclp VLC_FOURCC( 'Q', 'c', 'l', 'p' )
 #define FOURCC_samr VLC_FOURCC( 's', 'a', 'm', 'r' )
+#define FOURCC_sawb VLC_FOURCC( 's', 'a', 'w', 'b' )
 #define FOURCC_OggS VLC_FOURCC( 'O', 'g', 'g', 'S' )
 
 #define FOURCC_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
 #define FOURCC_h263 VLC_FOURCC( 'h', '2', '6', '3' )
 #define FOURCC_s263 VLC_FOURCC( 's', '2', '6', '3' )
 #define FOURCC_DIVX VLC_FOURCC( 'D', 'I', 'V', 'X' )
+#define FOURCC_XVID VLC_FOURCC( 'X', 'V', 'I', 'D' )
 #define FOURCC_cvid VLC_FOURCC( 'c', 'v', 'i', 'd' )
 #define FOURCC_mjpa VLC_FOURCC( 'm', 'j', 'p', 'a' )
 #define FOURCC_mjpb VLC_FOURCC( 'm', 'j', 'q', 't' )
 #define FOURCC_vp31 VLC_FOURCC( 'v', 'p', '3', '1' )
 #define FOURCC_h264 VLC_FOURCC( 'h', '2', '6', '4' )
 
+#define FOURCC_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
+#define FOURCC_avcC VLC_FOURCC( 'a', 'v', 'c', 'C' )
+#define FOURCC_m4ds VLC_FOURCC( 'm', '4', 'd', 's' )
+
 #define FOURCC_dvc  VLC_FOURCC( 'd', 'v', 'c', ' ' )
 #define FOURCC_dvp  VLC_FOURCC( 'd', 'v', 'p', ' ' )
 #define FOURCC_raw  VLC_FOURCC( 'r', 'a', 'w', ' ' )
 #define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
 #define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
 
+#define FOURCC_text VLC_FOURCC( 't', 'e', 'x', 't' )
+#define FOURCC_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
+
 #define FOURCC_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
 #define FOURCC_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
 #define FOURCC_0xa9swr VLC_FOURCC( 0xa9, 's', 'w', 'r' )
 #define FOURCC_0xa9prd VLC_FOURCC( 0xa9, 'p', 'r', 'd' )
 #define FOURCC_0xa9prf VLC_FOURCC( 0xa9, 'p', 'r', 'f' )
 #define FOURCC_0xa9src VLC_FOURCC( 0xa9, 's', 'r', 'c' )
+#define FOURCC_0xa9alb VLC_FOURCC( 0xa9, 'a', 'l', 'b' )
+#define FOURCC_0xa9dis VLC_FOURCC( 0xa9, 'd', 'i', 's' )
+#define FOURCC_0xa9enc VLC_FOURCC( 0xa9, 'e', 'n', 'c' )
+#define FOURCC_0xa9trk VLC_FOURCC( 0xa9, 't', 'r', 'k' )
+#define FOURCC_0xa9url VLC_FOURCC( 0xa9, 'u', 'r', 'l' )
+#define FOURCC_0xa9dsa VLC_FOURCC( 0xa9, 'd', 's', 'a' )
+#define FOURCC_0xa9hst VLC_FOURCC( 0xa9, 'h', 's', 't' )
+#define FOURCC_0xa9ope VLC_FOURCC( 0xa9, 'o', 'p', 'e' )
+#define FOURCC_0xa9wrt VLC_FOURCC( 0xa9, 'w', 'r', 't' )
+#define FOURCC_0xa9com VLC_FOURCC( 0xa9, 'c', 'o', 'm' )
+#define FOURCC_0xa9gen VLC_FOURCC( 0xa9, 'g', 'e', 'n' )
+#define FOURCC_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
 
 /* Do you want some debug information on all read boxes ? */
 #define MP4_VERBOSE  1
 
-/* memory stream and file stream object */
-
-typedef struct MP4_Stream_s
-{
-    int     b_memory;   /* do we uses a memory buffer */
-
-    input_thread_t *p_input;
-
-    off_t   i_start; /* in the buffer position for memory stream */
-    off_t   i_stop;
-    uint8_t *p_buffer;
-
-} MP4_Stream_t;
 
 struct MP4_Box_s;
 
@@ -443,6 +451,25 @@ typedef struct MP4_Box_data_sample_vide_s
 
 } MP4_Box_data_sample_vide_t;
 
+typedef struct
+{
+    uint8_t  i_reserved1[6];
+    uint16_t i_data_reference_index;
+
+    uint32_t i_display_flags;
+    uint32_t i_justification;
+    uint16_t i_background_color[3];
+    uint64_t i_text_box;
+    uint64_t i_reserved2;
+    uint16_t i_font_number;
+    uint16_t i_font_face;
+    uint16_t i_reserved3;
+
+    uint16_t i_foreground_color[3];
+
+    char    *psz_text_name;
+} MP4_Box_data_sample_text_t;
+
 typedef struct MP4_Box_data_sample_hint_s
 {
     uint8_t  i_reserved1[6];
@@ -728,6 +755,31 @@ typedef struct
 
 } MP4_Box_data_0xa9xxx_t;
 
+typedef struct
+{
+    uint8_t i_version;
+    uint8_t i_profile;
+    uint8_t i_profile_compatibility;
+    uint8_t i_level;
+
+    uint8_t i_reserved1;     /* 6 bits */
+    uint8_t i_length_size;
+
+    uint8_t i_reserved2;    /* 3 bits */
+    uint8_t  i_sps;
+    uint16_t *i_sps_length;
+    uint8_t  **sps;
+
+    uint8_t  i_pps;
+    uint16_t *i_pps_length;
+    uint8_t  **pps;
+
+    /* XXX: Hack raw avcC atom payload */
+    int     i_avcC;
+    uint8_t *p_avcC;
+
+} MP4_Box_data_avcC_t;
+
 /*
 typedef struct MP4_Box_data__s
 {
@@ -756,9 +808,11 @@ typedef union MP4_Box_data_s
     MP4_Box_data_stsd_t *p_stsd;
         MP4_Box_data_sample_vide_t *p_sample_vide;
         MP4_Box_data_sample_soun_t *p_sample_soun;
+        MP4_Box_data_sample_text_t *p_sample_text;
         MP4_Box_data_sample_hint_t *p_sample_hint;
 
         MP4_Box_data_esds_t *p_esds;
+        MP4_Box_data_avcC_t *p_avcC;
 
     MP4_Box_data_stsz_t *p_stsz;
     MP4_Box_data_stz2_t *p_stz2;
@@ -821,7 +875,7 @@ typedef struct MP4_Box_s
  *  The first box is a virtual box "root" and is the father for all first
  *  level boxes
  *****************************************************************************/
-MP4_Box_t *MP4_BoxGetRoot( input_thread_t *p_input );
+MP4_Box_t *MP4_BoxGetRoot( stream_t * );
 
 /*****************************************************************************
  * MP4_FreeBox : free memory allocated after read with MP4_ReadBox
@@ -829,14 +883,14 @@ MP4_Box_t *MP4_BoxGetRoot( input_thread_t *p_input );
  * XXX : all children have to be allocated by a malloc !! and
  *         p_box is freed
  *****************************************************************************/
-void MP4_BoxFree( input_thread_t *p_input, MP4_Box_t *p_box );
+void MP4_BoxFree( stream_t *, MP4_Box_t *p_box );
 
 /*****************************************************************************
  * MP4_DumpBoxStructure: print the structure of the p_box
  *****************************************************************************
  * Usefull while debugging
  *****************************************************************************/
-void MP4_BoxDumpStructure( input_thread_t *p_input, MP4_Box_t *p_box );
+void MP4_BoxDumpStructure( stream_t *p_input, MP4_Box_t *p_box );
 
 
 /*****************************************************************************
@@ -861,3 +915,6 @@ MP4_Box_t *MP4_BoxGet( MP4_Box_t *p_box, char *psz_fmt, ... );
  *****************************************************************************/
 int MP4_BoxCount( MP4_Box_t *p_box, char *psz_fmt, ... );
 
+int MP4_ReadBoxCommon( stream_t *p_stream, MP4_Box_t *p_box );
+int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box );
+void MP4_FreeBox_sample_vide( MP4_Box_t *p_box );