From 71baa3cdba165731b9ae92d08401f2675c46fea8 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Fri, 9 May 2003 23:23:45 +0000 Subject: [PATCH] * ffmpeg: now ffmpeg has a SVQ3 decoder, so use it :) --- modules/codec/ffmpeg/ffmpeg.c | 9 ++++++++- modules/codec/ffmpeg/ffmpeg.h | 5 +++-- modules/codec/ffmpeg/video.c | 26 +++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/modules/codec/ffmpeg/ffmpeg.c b/modules/codec/ffmpeg/ffmpeg.c index 75e36a43b4..5e83239999 100644 --- a/modules/codec/ffmpeg/ffmpeg.c +++ b/modules/codec/ffmpeg/ffmpeg.c @@ -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 * @@ -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: diff --git a/modules/codec/ffmpeg/ffmpeg.h b/modules/codec/ffmpeg/ffmpeg.h index 9ff59c7e14..c4b7799a41 100644 --- a/modules/codec/ffmpeg/ffmpeg.h +++ b/modules/codec/ffmpeg/ffmpeg.h @@ -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 * @@ -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' ) diff --git a/modules/codec/ffmpeg/video.c b/modules/codec/ffmpeg/video.c index bb6c4c9ed2..95054ee5da 100644 --- a/modules/codec/ffmpeg/video.c +++ b/modules/codec/ffmpeg/video.c @@ -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 * Gildas Bazin @@ -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; -- GitLab