]> git.sesse.net Git - vlc/blobdiff - modules/demux/mp4/libmp4.h
Removed es_format_t::i_aspect.
[vlc] / modules / demux / mp4 / libmp4.h
index 501d083d6028d24f764c69242048106c4d8dfd37..a4e786d4477c41181182b3ded605f43e2fad5aca 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * libmp4.h : LibMP4 library for mp4 module for vlc
  *****************************************************************************
- * Copyright (C) 2001-2004 VideoLAN
+ * Copyright (C) 2001-2004 the VideoLAN team
  * $Id$
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifndef _VLC_MP4_H
+#define _VLC_MP4_H 1
+
 
 #define FOURCC_uuid VLC_FOURCC( 'u', 'u', 'i', 'd' )
 
 #define FOURCC_iods VLC_FOURCC( 'i', 'o', 'd', 's' )
 
 #define FOURCC_nmhd VLC_FOURCC( 'n', 'm', 'h', 'd' )
+#define FOURCC_mp2v VLC_FOURCC( 'm', 'p', '2', 'v' )
 #define FOURCC_mp4v VLC_FOURCC( 'm', 'p', '4', 'v' )
 #define FOURCC_mp4a VLC_FOURCC( 'm', 'p', '4', 'a' )
 #define FOURCC_mp4s VLC_FOURCC( 'm', 'p', '4', 's' )
 #define FOURCC_vide VLC_FOURCC( 'v', 'i', 'd', 'e' )
 #define FOURCC_soun VLC_FOURCC( 's', 'o', 'u', 'n' )
 #define FOURCC_hint VLC_FOURCC( 'h', 'i', 'n', 't' )
+#define FOURCC_hdv2 VLC_FOURCC( 'h', 'd', 'v', '2' )
 
 #define FOURCC_dpnd VLC_FOURCC( 'd', 'p', 'n', 'd' )
 #define FOURCC_ipir VLC_FOURCC( 'i', 'p', 'i', 'r' )
 #define FOURCC_sawb VLC_FOURCC( 's', 'a', 'w', 'b' )
 #define FOURCC_OggS VLC_FOURCC( 'O', 'g', 'g', 'S' )
 #define FOURCC_alac VLC_FOURCC( 'a', 'l', 'a', 'c' )
+#define FOURCC_dac3 VLC_FOURCC( 'd', 'a', 'c', '3' )
+#define FOURCC_dec3 VLC_FOURCC( 'd', 'e', 'c', '3' )
 
 #define FOURCC_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
 #define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
 
 #define FOURCC_dvc  VLC_FOURCC( 'd', 'v', 'c', ' ' )
 #define FOURCC_dvp  VLC_FOURCC( 'd', 'v', 'p', ' ' )
+#define FOURCC_dv5n VLC_FOURCC( 'd', 'v', '5', 'n' )
+#define FOURCC_dv5p VLC_FOURCC( 'd', 'v', '5', 'p' )
 #define FOURCC_raw  VLC_FOURCC( 'r', 'a', 'w', ' ' )
 
 #define FOURCC_jpeg VLC_FOURCC( 'j', 'p', 'e', 'g' )
 
+#define FOURCC_yv12 VLC_FOURCC( 'y', 'v', '1', '2' )
+#define FOURCC_yuv2 VLC_FOURCC( 'y', 'u', 'v', '2' )
 
 #define FOURCC_rmra VLC_FOURCC( 'r', 'm', 'r', 'a' )
 #define FOURCC_rmda VLC_FOURCC( 'r', 'm', 'd', 'a' )
 #define FOURCC_iviv VLC_FOURCC( 'i', 'v', 'i', 'v' )
 #define FOURCC_name VLC_FOURCC( 'n', 'a', 'm', 'e' )
 #define FOURCC_priv VLC_FOURCC( 'p', 'r', 'i', 'v' )
+#define FOURCC_drmi VLC_FOURCC( 'd', 'r', 'm', 'i' )
+#define FOURCC_frma VLC_FOURCC( 'f', 'r', 'm', 'a' )
+#define FOURCC_skcr VLC_FOURCC( 's', 'k', 'c', 'r' )
 
 #define FOURCC_text VLC_FOURCC( 't', 'e', 'x', 't' )
+#define FOURCC_tx3g VLC_FOURCC( 't', 'x', '3', 'g' )
 #define FOURCC_subp VLC_FOURCC( 's', 'u', 'b', 'p' )
+#define FOURCC_sbtl VLC_FOURCC( 's', 'b', 't', 'l' )
 
 #define FOURCC_0xa9nam VLC_FOURCC( 0xa9, 'n', 'a', 'm' )
 #define FOURCC_0xa9aut VLC_FOURCC( 0xa9, 'a', 'u', 't' )
 #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_chpl VLC_FOURCC( 'c', 'h', 'p', 'l' )
 #define FOURCC_WLOC VLC_FOURCC( 'W', 'L', 'O', 'C' )
 
+#define FOURCC_meta VLC_FOURCC( 'm', 'e', 't', 'a' )
+#define FOURCC_ilst VLC_FOURCC( 'i', 'l', 's', 't' )
+
+#define FOURCC_chap VLC_FOURCC( 'c', 'h', 'a', 'p' )
+
 /* Do you want some debug information on all read boxes ? */
 #define MP4_VERBOSE  1
 
@@ -285,6 +307,7 @@ typedef struct MP4_Box_data_mdhd_s
     uint64_t i_duration;
 
     /* one bit for pad */
+    uint16_t      i_language_code;
     /* unsigned int(5)[3] language difference with 0x60*/
     unsigned char i_language[3];
     uint16_t i_predefined;
@@ -343,7 +366,7 @@ typedef struct MP4_Box_data_url_s
     uint8_t  i_version;
     uint32_t i_flags;
 
-    unsigned char *psz_location;
+    char *psz_location;
 
 } MP4_Box_data_url_t;
 
@@ -352,8 +375,8 @@ typedef struct MP4_Box_data_urn_s
     uint8_t  i_version;
     uint32_t i_flags;
 
-    unsigned char *psz_name;
-    unsigned char *psz_location;
+    char *psz_name;
+    char *psz_location;
 
 } MP4_Box_data_urn_t;
 
@@ -451,25 +474,49 @@ typedef struct MP4_Box_data_sample_vide_s
     int     i_qt_image_description;
     uint8_t *p_qt_image_description;
 
+    void    *p_drms;
+
 } MP4_Box_data_sample_vide_t;
 
+#define MP4_TEXT_DISPLAY_FLAG_DONT_DISPLAY       (1<<0)
+#define MP4_TEXT_DISPLAY_FLAG_AUTO_SCALE         (1<<1)
+#define MP4_TEXT_DISPLAY_FLAG_CLIP_TO_TEXT_BOX   (1<<2)
+#define MP4_TEXT_DISPLAY_FLAG_USE_MOVIE_BG_COLOR (1<<3)
+#define MP4_TEXT_DISPLAY_FLAG_SHRINK_TEXT_BOX_TO_FIT (1<<4)
+#define MP4_TEXT_DISPLAY_FLAG_SCROLL_IN          (1<<5)
+#define MP4_TEXT_DISPLAY_FLAG_SCROLL_OUT         (1<<6)
+#define MP4_TEXT_DISPLAY_FLAG_HORIZONTAL_SCROLL  (1<<7)
+#define MP4_TEXT_DISPLAY_FLAG_REVERSE_SCROLL     (1<<8)
+#define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_SCROLL  (1<<9)
+#define MP4_TEXT_DISPLAY_FLAG_FLOW_HORIZONTAL    (1<<10)
+#define MP4_TEXT_DISPLAY_FLAG_CONTINUOUS_KARAOKE (1<<11)
+#define MP4_TEXT_DISPLAY_FLAG_DROP_SHADOW        (1<<12)
+#define MP4_TEXT_DISPLAY_FLAG_ANTI_ALIAS         (1<<13)
+#define MP4_TEXT_DISPLAY_FLAG_KEYED_TEXT         (1<<14)
+#define MP4_TEXT_DISPLAY_FLAG_INVERSE_HILITE     (1<<15)
+#define MP4_TEXT_DISPLAY_FLAG_COLOR_HILITE       (1<<16)
+#define MP4_TEXT_DISPLAY_FLAG_WRITE_VERTICALLY   (1<<17)
+
 typedef struct
 {
-    uint8_t  i_reserved1[6];
+    uint32_t i_reserved1;
+    uint16_t i_reserved2;
+
     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;
+    uint32_t i_display_flags;   // TextDescription and Tx3gDescription
 
-    uint16_t i_foreground_color[3];
+    int8_t i_justification_horizontal; // left(0), centered(1), right(-1)
+    int8_t i_justification_vertical;   // top(0), centered(1), bottom(-1)
 
-    char    *psz_text_name;
+    uint16_t i_background_color[4];
+
+    uint16_t i_text_box_top;
+    uint16_t i_text_box_left;
+    uint16_t i_text_box_bottom;
+    uint16_t i_text_box_right;
+
+    // TODO to complete
 } MP4_Box_data_sample_text_t;
 
 typedef struct MP4_Box_data_sample_hint_s
@@ -623,7 +670,7 @@ typedef struct MP4_Box_data_cprt_s
     /* 1 pad bit */
     unsigned char i_language[3];
 
-    unsigned char *psz_notice;
+    char *psz_notice;
 } MP4_Box_data_cprt_t;
 
 
@@ -705,6 +752,18 @@ typedef struct MP4_Box_data_cmov_s
 
 } MP4_Box_data_cmov_t;
 
+typedef struct
+{
+    uint32_t i_type;
+} MP4_Box_data_frma_t;
+
+typedef struct
+{
+    uint32_t i_init;
+    uint32_t i_encr;
+    uint32_t i_decr;
+} MP4_Box_data_skcr_t;
+
 typedef struct
 {
     uint8_t  i_version;
@@ -757,6 +816,26 @@ typedef struct
 
 } MP4_Box_data_0xa9xxx_t;
 
+typedef struct
+{
+    uint32_t i_entry_count;
+    uint32_t *i_track_ID;
+
+} MP4_Box_data_tref_generic_t;
+
+typedef struct
+{
+    uint8_t  i_version;
+    uint32_t i_flags;
+
+    uint8_t i_chapter;
+    struct
+    {
+        char    *psz_name;
+        int64_t  i_start;
+    } chapter[256];
+} MP4_Box_data_chpl_t;
+
 typedef struct
 {
     uint8_t i_version;
@@ -782,6 +861,17 @@ typedef struct
 
 } MP4_Box_data_avcC_t;
 
+typedef struct
+{
+    uint8_t i_fscod;
+    uint8_t i_bsid;
+    uint8_t i_bsmod;
+    uint8_t i_acmod;
+    uint8_t i_lfeon;
+    uint8_t i_bitrate_code;
+
+} MP4_Box_data_dac3_t;
+
 /*
 typedef struct MP4_Box_data__s
 {
@@ -815,6 +905,7 @@ typedef union MP4_Box_data_s
 
         MP4_Box_data_esds_t *p_esds;
         MP4_Box_data_avcC_t *p_avcC;
+        MP4_Box_data_dac3_t *p_dac3;
 
     MP4_Box_data_stsz_t *p_stsz;
     MP4_Box_data_stz2_t *p_stz2;
@@ -833,12 +924,17 @@ typedef union MP4_Box_data_s
 
     MP4_Box_data_moviehintinformation_rtp_t p_moviehintinformation_rtp;
 
+    MP4_Box_data_frma_t *p_frma;
+    MP4_Box_data_skcr_t *p_skcr;
+
     MP4_Box_data_rdrf_t *p_rdrf;
     MP4_Box_data_rmdr_t *p_rmdr;
     MP4_Box_data_rmqu_t *p_rmqu;
     MP4_Box_data_rmvc_t *p_rmvc;
 
     MP4_Box_data_0xa9xxx_t *p_0xa9xxx;
+    MP4_Box_data_chpl_t *p_chpl;
+    MP4_Box_data_tref_generic_t *p_tref_generic;
 
     void                *p_data; /* for unknow type */
 } MP4_Box_data_t;
@@ -904,7 +1000,7 @@ void MP4_BoxDumpStructure( stream_t *p_input, MP4_Box_t *p_box );
  * ex: /moov/trak[12]
  *     ../mdia
  *****************************************************************************/
-MP4_Box_t *MP4_BoxGet( MP4_Box_t *p_box, char *psz_fmt, ... );
+MP4_Box_t *MP4_BoxGet( MP4_Box_t *p_box, const char *psz_fmt, ... );
 
 /*****************************************************************************
  * MP4_BoxCount: find number of box given a path relative to p_box
@@ -915,8 +1011,10 @@ MP4_Box_t *MP4_BoxGet( MP4_Box_t *p_box, char *psz_fmt, ... );
  * ex: /moov/trak
  *     ../mdia
  *****************************************************************************/
-int MP4_BoxCount( MP4_Box_t *p_box, char *psz_fmt, ... );
+int MP4_BoxCount( MP4_Box_t *p_box, const 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 );
+
+#endif