]> git.sesse.net Git - vlc/commitdiff
* ffmpeg: now ffmpeg has a SVQ3 decoder, so use it :)
authorLaurent Aimar <fenrir@videolan.org>
Fri, 9 May 2003 23:23:45 +0000 (23:23 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 9 May 2003 23:23:45 +0000 (23:23 +0000)
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.h
modules/codec/ffmpeg/video.c

index 75e36a43b4ad5ee8eaab5b565072ac40532610e1..5e83239999eef6c35f9f72bc14ed80d760a2f437 100644 (file)
@@ -2,7 +2,7 @@
  * ffmpeg.c: video decoder using ffmpeg library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ffmpeg.c,v 1.35 2003/05/07 15:44:59 fenrir Exp $
+ * $Id: ffmpeg.c,v 1.36 2003/05/09 23:23:45 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -503,6 +503,13 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
             i_codec = CODEC_ID_SVQ1;
             psz_name = "SVQ-1 (Sorenson Video v1)";
             break;
+#if LIBAVCODEC_BUILD >= 4666
+        case FOURCC_SVQ3:
+            i_cat = VIDEO_ES;
+            i_codec = CODEC_ID_SVQ3;
+            psz_name = "SVQ-3 (Sorenson Video v3)";
+            break;
+#endif
 
         case FOURCC_DIVX:
         case FOURCC_divx:
index 9ff59c7e14c5d94eef89c7b22a8b474006c518c1..c4b7799a418ac5bd1418d4dcd7ad43b70db95955 100644 (file)
@@ -2,7 +2,7 @@
  * ffmpeg_vdec.h: video decoder using ffmpeg library
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ffmpeg.h,v 1.17 2003/04/17 10:58:30 fenrir Exp $
+ * $Id: ffmpeg.h,v 1.18 2003/05/09 23:23:45 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
@@ -137,8 +137,9 @@ int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes );
 #define FOURCC_I263         VLC_FOURCC('I','2','6','3')
 #define FOURCC_i263         VLC_FOURCC('i','2','6','3')
 
-/* Sorenson v1 */
+/* Sorenson v1/3 */
 #define FOURCC_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
+#define FOURCC_SVQ3 VLC_FOURCC( 'S', 'V', 'Q', '3' )
 
 /* mjpeg */
 #define FOURCC_MJPG VLC_FOURCC( 'M', 'J', 'P', 'G' )
index bb6c4c9ed26176bb16b4b25f357533eea258ea23..95054ee5da074eb26b5aa5b45371e4f7ad854e55 100644 (file)
@@ -2,7 +2,7 @@
  * video.c: video decoder using ffmpeg library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: video.c,v 1.26 2003/05/07 15:44:59 fenrir Exp $
+ * $Id: video.c,v 1.27 2003/05/09 23:23:45 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -194,6 +194,16 @@ static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t  *p_vdec,
  * ffmpeg codec will be open, some memory allocated. But Vout is not yet
  * open (done after the first decoded frame)
  *****************************************************************************/
+static inline void SetDWBE( void *data, uint32_t dw )
+{
+    uint8_t *p = data;
+
+    p[0] = (dw >> 24 )&0xff;
+    p[1] = (dw >> 16 )&0xff;
+    p[2] = (dw >>  8 )&0xff;
+    p[3] = (dw )&0xff;
+}
+
 int E_( InitThread_Video )( vdec_thread_t *p_vdec )
 {
     int i_tmp;
@@ -284,6 +294,20 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
                                   (void *)&p_vdec->p_format[1],
                                   i_size );
         }
+#if LIBAVCODEC_BUILD >= 4666
+        else if( p_vdec->i_codec_id == CODEC_ID_SVQ3 )
+        {
+            p_vdec->p_context->extradata_size = i_size + 28;
+            p_vdec->p_context->extradata      = malloc( p_vdec->p_context->extradata_size );
+            memcpy ( &((char*)p_vdec->p_context->extradata)[ 0],  "stsd", 4 );
+            SetDWBE( &((char*)p_vdec->p_context->extradata)[ 4], 0 );       /* version and flag */
+            SetDWBE( &((char*)p_vdec->p_context->extradata)[ 8], 0 );       /* entry count */
+            SetDWBE( &((char*)p_vdec->p_context->extradata)[12], 0 );       /* sample soun size FIXME */
+            memcpy ( &((char*)p_vdec->p_context->extradata)[16], "SVQ3", 4 );
+            memset ( &((char*)p_vdec->p_context->extradata)[20], 0, 8 );    /* reserved[6] and ref index(16b) */
+            memcpy ( &((char*)p_vdec->p_context->extradata)[28], &p_vdec->p_format[1], i_size );
+        }
+#endif
         else
         {
             p_vdec->p_context->extradata_size = i_size;