]> git.sesse.net Git - vlc/commitdiff
Properly used enda atom in mp4 demuxer (close #2692).
authorLaurent Aimar <fenrir@videolan.org>
Sat, 6 Feb 2010 14:52:34 +0000 (15:52 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 6 Feb 2010 15:07:50 +0000 (16:07 +0100)
modules/demux/mp4/mp4.c

index 5e772f93cfd9fb6614eae0778ea58e00c46d76f2..f2140d26b3291ee014c0430cc494a14b8cde4231 100644 (file)
@@ -1453,6 +1453,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
     MP4_Box_t   *p_sample;
     MP4_Box_t   *p_esds;
     MP4_Box_t   *p_frma;
+    MP4_Box_t   *p_enda;
 
     if( pp_es )
         *pp_es = NULL;
@@ -1484,6 +1485,11 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
         p_sample->i_type = p_frma->data.p_frma->i_type;
     }
 
+    p_enda = MP4_BoxGet( p_sample, "wave/enda" );
+    if( !p_enda )
+        p_enda = MP4_BoxGet( p_sample, "enda" );
+    msg_Err(p_demux, "ENDA=%p %d codec=%4.4s", p_enda, p_enda ? p_enda->data.p_enda->i_little_endian : -1, &p_sample->i_type );
+
     if( p_track->fmt.i_cat == AUDIO_ES && ( p_track->i_sample_size == 1 || p_track->i_sample_size == 2 ) )
     {
         MP4_Box_data_sample_soun_t *p_soun;
@@ -1690,14 +1696,16 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
             break;
 
         case VLC_FOURCC('i','n','2','4'):
-            /* in in24/in32 there's enda-atom to tell it's little-endian (if present) */
-            if( ( MP4_BoxGet( p_sample, "wave/enda" ) ) ||
-                ( MP4_BoxGet( p_sample, "enda" ) ) )
-            {
-                p_track->fmt.i_codec = VLC_FOURCC('4','2','n','i');
-            } else {
-                p_track->fmt.i_codec = p_sample->i_type;
-            }
+            p_track->fmt.i_codec = p_enda && p_enda->data.p_enda->i_little_endian == 1 ?
+                                    VLC_FOURCC('4','2','n','i') : VLC_FOURCC('i','n','2','4');
+            break;
+        case VLC_FOURCC('f','l','3','2'):
+            p_track->fmt.i_codec = p_enda && p_enda->data.p_enda->i_little_endian == 1 ?
+                                    VLC_CODEC_F32L : VLC_CODEC_F32B;
+            break;
+        case VLC_FOURCC('f','l','6','4'):
+            p_track->fmt.i_codec = p_enda && p_enda->data.p_enda->i_little_endian == 1 ?
+                                    VLC_CODEC_F64L : VLC_CODEC_F64B;
             break;
 
         default: