[vlc-devel] commit: Use vlc_fourcc_* helpers in avi demuxer. (Laurent Aimar )

git version control git at videolan.org
Wed May 13 21:20:17 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Mar 18 21:44:51 2009 +0100| [f05f6feec18f819586ccac0abddd4adde3ec0434] | committer: Laurent Aimar 

Use vlc_fourcc_* helpers in avi demuxer.

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

 modules/demux/avi/avi.c    |   65 ++++-------------------------------------
 modules/demux/avi/libavi.h |   69 --------------------------------------------
 2 files changed, 7 insertions(+), 127 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index bfea0b7..797822c 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -549,7 +549,7 @@ static int Open( vlc_object_t * p_this )
                 else
                 {
                     es_format_Init( &fmt, VIDEO_ES, p_vids->p_bih->biCompression );
-                    if( tk->i_codec == FOURCC_mp4v &&
+                    if( tk->i_codec == VLC_CODEC_MP4V &&
                         !strncasecmp( (char*)&p_strh->i_handler, "XVID", 4 ) )
                     {
                         fmt.i_codec = VLC_FOURCC( 'X', 'V', 'I', 'D' );
@@ -1858,7 +1858,7 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
 {
     switch( i_fourcc )
     {
-        case FOURCC_DIV1:
+        case VLC_CODEC_DIV1:
             /* we have:
              *  startcode:      0x00000100   32bits
              *  framenumber     ?             5bits
@@ -1871,13 +1871,14 @@ static int AVI_GetKeyFlag( vlc_fourcc_t i_fourcc, uint8_t *p_byte )
             }
             return p_byte[4] & 0x06 ? 0 : AVIIF_KEYFRAME;
 
-        case FOURCC_DIV2:
-        case FOURCC_DIV3:   /* wmv1 also */
+        case VLC_CODEC_DIV2:
+        case VLC_CODEC_DIV3:
+        case VLC_CODEC_WMV1:
             /* we have
              *  picture type    0(I),1(P)     2bits
              */
             return p_byte[0] & 0xC0 ? 0 : AVIIF_KEYFRAME;
-        case FOURCC_mp4v:
+        case VLC_CODEC_MP4V:
             /* we should find first occurrence of 0x000001b6 (32bits)
              *  startcode:      0x000001b6   32bits
              *  piture type     0(I),1(P)     2bits
@@ -1902,60 +1903,8 @@ vlc_fourcc_t AVI_FourccGetCodec( unsigned int i_cat, vlc_fourcc_t i_codec )
         case AUDIO_ES:
             wf_tag_to_fourcc( i_codec, &i_codec, NULL );
             return i_codec;
-
         case VIDEO_ES:
-            /* XXX DIV1 <- msmpeg4v1, DIV2 <- msmpeg4v2, DIV3 <- msmpeg4v3, mp4v for mpeg4 */
-            switch( i_codec )
-            {
-                case FOURCC_1:
-                    return VLC_FOURCC('m','r','l','e');
-                case FOURCC_DIV1:
-                case FOURCC_div1:
-                case FOURCC_MPG4:
-                case FOURCC_mpg4:
-                    return FOURCC_DIV1;
-                case FOURCC_DIV2:
-                case FOURCC_div2:
-                case FOURCC_MP42:
-                case FOURCC_mp42:
-                case FOURCC_MPG3:
-                case FOURCC_mpg3:
-                    return FOURCC_DIV2;
-                case FOURCC_div3:
-                case FOURCC_MP43:
-                case FOURCC_mp43:
-                case FOURCC_DIV3:
-                case FOURCC_DIV4:
-                case FOURCC_div4:
-                case FOURCC_DIV5:
-                case FOURCC_div5:
-                case FOURCC_DIV6:
-                case FOURCC_div6:
-                case FOURCC_AP41:
-                case FOURCC_3IV1:
-                case FOURCC_3iv1:
-                case FOURCC_3IVD:
-                case FOURCC_3ivd:
-                case FOURCC_3VID:
-                case FOURCC_3vid:
-                    return FOURCC_DIV3;
-                case FOURCC_DIVX:
-                case FOURCC_divx:
-                case FOURCC_MP4S:
-                case FOURCC_mp4s:
-                case FOURCC_M4S2:
-                case FOURCC_m4s2:
-                case FOURCC_xvid:
-                case FOURCC_XVID:
-                case FOURCC_XviD:
-                case FOURCC_DX50:
-                case FOURCC_dx50:
-                case FOURCC_mp4v:
-                case FOURCC_4:
-                case FOURCC_3IV2:
-                case FOURCC_3iv2:
-                    return FOURCC_mp4v;
-            }
+            return vlc_fourcc_GetCodec( i_cat, i_codec );
         default:
             return VLC_FOURCC( 'u', 'n', 'd', 'f' );
     }
diff --git a/modules/demux/avi/libavi.h b/modules/demux/avi/libavi.h
index 453602c..ff88575 100644
--- a/modules/demux/avi/libavi.h
+++ b/modules/demux/avi/libavi.h
@@ -298,75 +298,6 @@ void    AVI_ChunkFreeRoot( stream_t *, avi_chunk_t  *p_chk );
 #define AVITWOCC_AC            VLC_TWOCC('A','C')
     /* *** codex stuff ***  */
 
-    /* Microsoft RLE video */
-#define FOURCC_1            VLC_FOURCC( 1,  0,  0,  0 )
-
-    /* MPEG4 video */
-#define FOURCC_DIVX         VLC_FOURCC('D','I','V','X')
-#define FOURCC_divx         VLC_FOURCC('d','i','v','x')
-#define FOURCC_DIV1         VLC_FOURCC('D','I','V','1')
-#define FOURCC_div1         VLC_FOURCC('d','i','v','1')
-#define FOURCC_MP4S         VLC_FOURCC('M','P','4','S')
-#define FOURCC_mp4s         VLC_FOURCC('m','p','4','s')
-#define FOURCC_M4S2         VLC_FOURCC('M','4','S','2')
-#define FOURCC_m4s2         VLC_FOURCC('m','4','s','2')
-#define FOURCC_xvid         VLC_FOURCC('x','v','i','d')
-#define FOURCC_XVID         VLC_FOURCC('X','V','I','D')
-#define FOURCC_XviD         VLC_FOURCC('X','v','i','D')
-#define FOURCC_DX50         VLC_FOURCC('D','X','5','0')
-#define FOURCC_dx50         VLC_FOURCC('d','x','5','0')
-#define FOURCC_mp4v         VLC_FOURCC('m','p','4','v')
-#define FOURCC_4            VLC_FOURCC( 4,  0,  0,  0 )
-
-    /* MSMPEG4 v2 */
-#define FOURCC_MPG4         VLC_FOURCC('M','P','G','4')
-#define FOURCC_mpg4         VLC_FOURCC('m','p','g','4')
-#define FOURCC_DIV2         VLC_FOURCC('D','I','V','2')
-#define FOURCC_div2         VLC_FOURCC('d','i','v','2')
-#define FOURCC_MP42         VLC_FOURCC('M','P','4','2')
-#define FOURCC_mp42         VLC_FOURCC('m','p','4','2')
-
-    /* MSMPEG4 v3 / M$ mpeg4 v3 */
-#define FOURCC_MPG3         VLC_FOURCC('M','P','G','3')
-#define FOURCC_mpg3         VLC_FOURCC('m','p','g','3')
-#define FOURCC_div3         VLC_FOURCC('d','i','v','3')
-#define FOURCC_MP43         VLC_FOURCC('M','P','4','3')
-#define FOURCC_mp43         VLC_FOURCC('m','p','4','3')
-
-    /* DivX 3.20 */
-#define FOURCC_DIV3         VLC_FOURCC('D','I','V','3')
-#define FOURCC_DIV4         VLC_FOURCC('D','I','V','4')
-#define FOURCC_div4         VLC_FOURCC('d','i','v','4')
-#define FOURCC_DIV5         VLC_FOURCC('D','I','V','5')
-#define FOURCC_div5         VLC_FOURCC('d','i','v','5')
-#define FOURCC_DIV6         VLC_FOURCC('D','I','V','6')
-#define FOURCC_div6         VLC_FOURCC('d','i','v','6')
-
-    /* AngelPotion stuff */
-#define FOURCC_AP41         VLC_FOURCC('A','P','4','1')
-
-    /* 3IVX */
-#define FOURCC_3IV1         VLC_FOURCC('3','I','V','1')
-#define FOURCC_3iv1         VLC_FOURCC('2','i','v','1')
-#define FOURCC_3IV2         VLC_FOURCC('3','I','V','2')
-#define FOURCC_3iv2         VLC_FOURCC('3','i','v','2')
-#define FOURCC_3IVD         VLC_FOURCC('3','I','V','D')
-#define FOURCC_3ivd         VLC_FOURCC('3','i','v','d')
-#define FOURCC_3VID         VLC_FOURCC('3','V','I','D')
-#define FOURCC_3vid         VLC_FOURCC('3','v','i','d')
-
-    /* H263 and H263i */
-#define FOURCC_H263         VLC_FOURCC('H','2','6','3')
-#define FOURCC_h263         VLC_FOURCC('h','2','6','3')
-#define FOURCC_U263         VLC_FOURCC('U','2','6','3')
-#define FOURCC_I263         VLC_FOURCC('I','2','6','3')
-#define FOURCC_i263         VLC_FOURCC('i','2','6','3')
-
-    /* H264 */
-#define FOURCC_H264         VLC_FOURCC('H','2','6','4')
-#define FOURCC_h264         VLC_FOURCC('h','2','6','4')
-#define FOURCC_VSSH         VLC_FOURCC('V','S','S','H')
-
     /* DV */
 #define FOURCC_dvsd         VLC_FOURCC('d','v','s','d')
 #define FOURCC_dvhd         VLC_FOURCC('d','v','h','d')




More information about the vlc-devel mailing list