]> git.sesse.net Git - vlc/commitdiff
* Fix libgcrypt on MacIntel by disabling it's ASM. This fixes #620
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 13 Apr 2006 14:43:40 +0000 (14:43 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 13 Apr 2006 14:43:40 +0000 (14:43 +0000)
extras/contrib/src/Makefile
modules/demux/mp4/libmp4.c
modules/demux/nsv.c
modules/stream_out/rtp.c
src/video_output/vout_subpictures.c

index acb6b5591dfa0ac0aff3212d79a11928057b5483..72a8c2d87e0102a8d2a91365bbbf491768737691 100644 (file)
@@ -1476,7 +1476,7 @@ ifdef HAVE_WIN32
        (cd $<; ./autogen.sh && $(HOSTCC) ./configure $(HOSTCONF) --target=i586-mingw32msvc --prefix=$(PREFIX) --program-prefix="" CFLAGS="$(CFLAGS)" && make && make install)
 else
 ifeq ($(HOST),i686-apple-darwin8)
-       (cd $<; ./autogen.sh)
+       (cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) --disable-asm CFLAGS="$(CFLAGS)" && make && make install)
 endif
        (cd $<; $(HOSTCC) ./configure $(HOSTCONF) --prefix=$(PREFIX) CFLAGS="$(CFLAGS)" && make && make install)
 endif
index 6d4a2dafbf3bb9bd4f5d5ba0c3a00b97933f3928..070fac51b537e0fef4d1b7305781983f951b0557 100644 (file)
@@ -1142,6 +1142,7 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
 
         msg_Dbg( p_stream, "read box: \"soun\" mp4 or qt1/2 (rest="I64Fd")",
                  i_read );
+msg_Dbg( p_stream, "1 read box soun: p_qt_description for alac "I64Fd, i_read);
         stream_Seek( p_stream, p_box->i_pos +
                         MP4_BOX_HEADERSIZE( p_box ) + 28 );
     }
@@ -1157,20 +1158,22 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
         }
     }
 
+msg_Dbg( p_stream, "2 read box soun: p_qt_description for alac "I64Fd, i_read);
     if( p_box->i_type == FOURCC_samr || p_box->i_type == FOURCC_sawb )
     {
         /* Ignore channelcount for AMR (3gpp AMRSpecificBox) */
         p_box->data.p_sample_soun->i_channelcount = 1;
     }
 
+msg_Dbg( p_stream, "3 read box soun: p_qt_description for alac "I64Fd, i_read);
     if( p_box->i_type == FOURCC_alac )
     {
         if( p_box->data.p_sample_soun->p_qt_description )
             free( p_box->data.p_sample_soun->p_qt_description );
-
-        p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
-        p_box->data.p_sample_soun->i_qt_description = i_read;
-        memcpy( p_box->data.p_sample_soun->p_qt_description, p_peek, i_read );
+msg_Dbg( p_stream, "4 read box soun: p_qt_description for alac "I64Fd, i_read);
+        p_box->data.p_sample_soun->p_qt_description = malloc( 36 );
+        p_box->data.p_sample_soun->i_qt_description = 36;
+        memcpy( p_box->data.p_sample_soun->p_qt_description, p_peek, 36 );
     }
     else
     {
index ca27fb76c2e412e12c075885a891a99a746bb436..24fe1fbe62b557672bf749b84e04f6d91d0632f0 100644 (file)
@@ -68,6 +68,9 @@ struct demux_sys_t
     int64_t     i_pcr;
     int64_t     i_time;
     int64_t     i_pcr_inc;
+    int64_t     i_audio_desync; /* The amount the audio is ahead */
+
+    vlc_bool_t  b_reinit;
 };
 
 static int Demux  ( demux_t *p_demux );
@@ -91,21 +94,10 @@ static int Open( vlc_object_t *p_this )
     if( stream_Peek( p_demux->s, &p_peek, 8 ) < 8 )
         return VLC_EGENERIC;
 
-    if( strncmp( (char *)p_peek, "NSVf", 4 )
-            && strncmp( (char *)p_peek, "NSVs", 4 ))
-    {
-       /* In case we had force this demuxer we try to resynch */
-        if( strcmp( p_demux->psz_demux, "nsv" ) || ReSynch( p_demux ) )
-        {
-            return VLC_EGENERIC;
-        }
-    }
-
     /* Fill p_demux field */
     p_demux->pf_demux = Demux;
     p_demux->pf_control = Control;
     p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
-
     es_format_Init( &p_sys->fmt_audio, AUDIO_ES, 0 );
     p_sys->p_audio = NULL;
 
@@ -119,6 +111,18 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_time  = 0;
     p_sys->i_pcr_inc = 0;
 
+    p_sys->b_reinit = VLC_TRUE;
+
+    if( strncmp( (char *)p_peek, "NSVf", 4 )
+            && strncmp( (char *)p_peek, "NSVs", 4 ))
+    {
+        /* In case we have forced this demuxer we try to resynch */
+        if( strcmp( p_demux->psz_demux, "nsv" ) || ReSynch( p_demux ) )
+        {
+            free( p_sys );
+            return VLC_EGENERIC;
+        }
+    }
     return VLC_SUCCESS;
 }
 
@@ -228,8 +232,11 @@ static int Demux( demux_t *p_demux )
                     p_sys->p_sub = es_out_Add( p_demux->out, &p_sys->fmt_sub );
                     es_out_Control( p_demux->out, ES_OUT_SET_ES, p_sys->p_sub );
                 }
-                stream_Read( p_demux->s, NULL, 2 );
-
+                if( stream_Read( p_demux->s, NULL, 2 ) < 2 )
+                {
+                    msg_Warn( p_demux, "cannot read" );
+                    return 0;
+                }
                 if( ( p_frame = stream_Block( p_demux->s, i_aux - 2 ) ) )
                 {
                     uint8_t *p = p_frame->p_buffer;
@@ -266,6 +273,11 @@ static int Demux( demux_t *p_demux )
         /* msg_Dbg( p_demux, "frame video size=%d", i_size ); */
         if( i_size > 0 && ( p_frame = stream_Block( p_demux->s, i_size ) ) )
         {
+            if( p_frame->i_buffer < i_size )
+            {
+                msg_Warn( p_demux, "cannot read" );
+                return 0;
+            }
             p_frame->i_dts = p_sys->i_pcr;
             es_out_Send( p_demux->out, p_sys->p_video, p_frame );
         }
@@ -279,7 +291,11 @@ static int Demux( demux_t *p_demux )
         if( p_sys->fmt_audio.i_codec == VLC_FOURCC( 'a', 'r', 'a', 'w' ) )
         {
             uint8_t h[4];
-            stream_Read( p_demux->s, h, 4 );
+            if( stream_Read( p_demux->s, h, 4 ) < 4 )
+            {
+                msg_Warn( p_demux, "cannot read" );
+                return 0;
+            }
 
             p_sys->fmt_audio.audio.i_channels = h[1];
             p_sys->fmt_audio.audio.i_rate = GetWLE( &h[2] );
@@ -293,8 +309,13 @@ static int Demux( demux_t *p_demux )
 
         if( ( p_frame = stream_Block( p_demux->s, i_size ) ) )
         {
+            if( p_frame->i_buffer < i_size )
+            {
+                msg_Warn( p_demux, "cannot read" );
+                return 0;
+            }
             p_frame->i_dts =
-            p_frame->i_pts = p_sys->i_pcr;
+            p_frame->i_pts = p_sys->i_pcr - ((p_sys->i_pcr > p_sys->i_audio_desync) ? p_sys->i_audio_desync : 0);
             es_out_Send( p_demux->out, p_sys->p_audio, p_frame );
         }
     }
@@ -386,8 +407,11 @@ static int ReSynch( demux_t *p_demux )
     int      i_skip;
     int      i_peek;
 
+    msg_Dbg( p_demux, "a ReSynch was requested");
     while( !p_demux->b_die )
     {
+        p_demux->p_sys->b_reinit = VLC_TRUE;
+
         if( ( i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ) ) < 8 )
         {
             return VLC_EGENERIC;
@@ -396,8 +420,8 @@ static int ReSynch( demux_t *p_demux )
 
         while( i_skip < i_peek - 4 )
         {
-            if( !strncmp( (char *)p_peek, "NSVf", 4 )
-                    || !strncmp( (char *)p_peek, "NSVs", 4 ) )
+            if( !strncmp( (char *)p_peek, "NSVf", 4 ) || 
+                !strncmp( (char *)p_peek, "NSVs", 4 ) )
             {
                 if( i_skip > 0 )
                 {
@@ -409,7 +433,7 @@ static int ReSynch( demux_t *p_demux )
             i_skip++;
         }
 
-        stream_Read( p_demux->s, NULL, i_skip );
+        stream_Read( p_demux->s, NULL, i_peek );
     }
     return VLC_EGENERIC;
 }
@@ -434,8 +458,9 @@ static int ReadNSVf( demux_t *p_demux )
 
     return stream_Read( p_demux->s, NULL, i_size ) == i_size ? VLC_SUCCESS : VLC_EGENERIC;
 }
+
 /*****************************************************************************
- * ReadNSVf:
+ * ReadNSVs:
  *****************************************************************************/
 static int ReadNSVs( demux_t *p_demux )
 {
@@ -463,7 +488,7 @@ static int ReadNSVs( demux_t *p_demux )
             msg_Warn( p_demux, "unknown codec" );
             break;
     }
-    if( fcc != VLC_FOURCC( 'N', 'O', 'N', 'E' ) && fcc != p_sys->fmt_video.i_codec  )
+    if( fcc != VLC_FOURCC( 'N', 'O', 'N', 'E' ) && ( fcc != p_sys->fmt_video.i_codec || p_sys->b_reinit ) )
     {
         es_format_Init( &p_sys->fmt_video, VIDEO_ES, fcc );
         p_sys->fmt_video.video.i_width = GetWLE( &header[12] );
@@ -489,10 +514,14 @@ static int ReadNSVs( demux_t *p_demux )
         case VLC_FOURCC( 'P', 'C', 'M', ' ' ):
             fcc = VLC_FOURCC( 'a', 'r', 'a', 'w' );
             break;
+        case VLC_FOURCC( 'V', 'L', 'B', ' ' ):
         case VLC_FOURCC( 'A', 'A', 'C', ' ' ):
         case VLC_FOURCC( 'A', 'A', 'C', 'P' ):
             fcc = VLC_FOURCC( 'm', 'p', '4', 'a' );
             break;
+        case VLC_FOURCC( 'S', 'P', 'X', ' ' ):
+            fcc = VLC_FOURCC( 's', 'p', 'x', ' ' );
+            break;
         case VLC_FOURCC( 'N', 'O', 'N', 'E' ):
             break;
         default:
@@ -500,7 +529,7 @@ static int ReadNSVs( demux_t *p_demux )
             break;
     }
 
-    if( fcc != VLC_FOURCC( 'N', 'O', 'N', 'E' ) && fcc != p_sys->fmt_audio.i_codec )
+    if( fcc != VLC_FOURCC( 'N', 'O', 'N', 'E' ) && ( fcc != p_sys->fmt_audio.i_codec || p_sys->b_reinit ) )
     {
         msg_Dbg( p_demux, "    - audio `%4.4s'", (char*)&fcc );
 
@@ -515,26 +544,15 @@ static int ReadNSVs( demux_t *p_demux )
     if( header[16]&0x80 )
     {
         /* Fractional frame rate */
-        switch( header[16]&0x03 )
-        {
-            case 0: /* 30 fps */
-                p_sys->i_pcr_inc = 33333; /* 300000/9 */
-                break;
-            case 1: /* 29.97 fps */
-                p_sys->i_pcr_inc = 33367; /* 300300/9 */
-                break;
-            case 2: /* 25 fps */
-                p_sys->i_pcr_inc = 40000; /* 360000/9 */
-                break;
-            case 3: /* 23.98 fps */
-                p_sys->i_pcr_inc = 41700; /* 375300/9 */
-                break;
-        }
-
-        if( header[16] < 0xc0 )
-            p_sys->i_pcr_inc = p_sys->i_pcr_inc * (((header[16] ^ 0x80) >> 2 ) +1 );
-        else
-            p_sys->i_pcr_inc = p_sys->i_pcr_inc / (((header[16] ^ 0xc0) >> 2 ) +1 );
+        float s = 0;
+        int t = ( header[16]&0x7f ) >> 2;
+        if( t < 16 ) s = 1.0 / t+1;
+        else s = t-15;
+
+        if( header[16]&0x01 ) s = s * 1000.0 / 1001.0;
+        if( (header[16]&0x03) == 3) p_sys->i_pcr_inc = (int)1000000 / s * 24;
+        else if( (header[16]&0x03) == 2 ) p_sys->i_pcr_inc = (int)1000000 / s * 25;
+        else p_sys->i_pcr_inc = (int)1000000 / s * 30;
     }
     else if( header[16] != 0 )
     {
@@ -548,6 +566,12 @@ static int ReadNSVs( demux_t *p_demux )
     }
     msg_Dbg( p_demux, "    - fps=%.3f", 1000000.0 / (double)p_sys->i_pcr_inc );
 
+    /* amount of miliseconds the audio is ahead of the video frame */
+    p_sys->i_audio_desync = (int64_t)1000 * GetWLE( &header[18] );
+    msg_Dbg( p_demux, "    - desync=%lld", p_sys->i_audio_desync);
+
+    p_sys->b_reinit = VLC_FALSE;
+
     return VLC_SUCCESS;
 }
 
index 112df4b551ab90e431ac4c1bf0eecc0ae75ac1ee..03ec6bb68b1f91c9fd0e34b0ad4005cc85cc8de2 100644 (file)
@@ -431,9 +431,9 @@ static int Open( vlc_object_t *p_this )
 
         if( b_rtsp )
         {
-            msg_Err( p_stream, "muxing is not supported in RTSP mode" );
-            free( p_sys );
-            return VLC_EGENERIC;
+        //    msg_Err( p_stream, "muxing is not supported in RTSP mode" );
+        //    free( p_sys );
+        //    return VLC_EGENERIC;
         }
         else if( !p_sys->psz_destination || *p_sys->psz_destination == '\0' )
         {
index 5d1c19a755f5fb95fd338e5135cc5183ae3d6cd5..b966efee0720186b469eefdbc0954adad7ad3fa0 100644 (file)
@@ -615,8 +615,8 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
         while( p_region && p_spu->p_blend && p_spu->p_blend->pf_video_blend )
         {
             int i_fade_alpha = 255;
-            int i_x_offset = p_region->i_x + i_subpic_x;
-            int i_y_offset = p_region->i_y + p_subpic->i_y;
+            int i_x_offset = p_region->i_x + i_subpic_x + p_fmt->i_x_offset;
+            int i_y_offset = p_region->i_y + p_subpic->i_y + p_fmt->i_y_offset;
 
             if( p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') )
             {