From: Miguel F. <mig...@us...> - 2002-12-02 22:00:29
|
Update of /cvsroot/xine/xine-lib/src/libffmpeg In directory sc8-pr-cvs1:/tmp/cvs-serv7516 Modified Files: xine_decoder.c Log Message: update ffmpeg, pass fourcc and other stuff that might be useful Index: xine_decoder.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/libffmpeg/xine_decoder.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- xine_decoder.c 20 Nov 2002 11:57:43 -0000 1.72 +++ xine_decoder.c 2 Dec 2002 22:00:14 -0000 1.73 @@ -38,6 +38,7 @@ #include "buffer.h" #include "metronom.h" #include "xineutils.h" +#include "math.h" #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" @@ -50,7 +51,6 @@ typedef struct { video_decoder_class_t decoder_class; - int illegal_vlc; } ff_video_class_t; typedef struct ff_decoder_s { @@ -124,6 +124,7 @@ this->context = avcodec_alloc_context(); this->context->width = this->bih.biWidth; this->context->height = this->bih.biHeight; + this->context->fourcc = this->stream->stream_info[XINE_STREAM_INFO_VIDEO_FOURCC]; if (avcodec_open (this->context, codec) < 0) { printf ("ffmpeg: couldn't open decoder\n"); @@ -134,14 +135,6 @@ this->decoder_ok = 1; this->stream->video_out->open (this->stream->video_out, this->stream); - /* needed to play streams generated by MS ISO MPEG4 codec. - Michael Niedermayer explained: - M$ "ISO MPEG4" uses illegal vlc code combinations, a ISO MPEG4 compliant - decoder which support error resilience should handle them like errors. - */ - if (this->class->illegal_vlc) - this->context->error_resilience=-1; - if (this->buf) free (this->buf); @@ -309,6 +302,7 @@ if (buf->decoder_flags & BUF_FLAG_HEADER) { AVCodec *codec = NULL; + xine_bmiheader *bih; int codec_type; #ifdef LOG @@ -317,7 +311,8 @@ /* init package containing bih */ - memcpy ( &this->bih, buf->content, sizeof (xine_bmiheader)); + bih = (xine_bmiheader *)buf->content; + memcpy ( &this->bih, bih, sizeof (xine_bmiheader)); this->video_step = buf->decoder_info[1]; this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->bih.biWidth; @@ -405,6 +400,14 @@ } init_video_codec (this, codec); + + if( bih->biSize > sizeof(xine_bmiheader) ) { + this->context->extradata_size = bih->biSize - sizeof(xine_bmiheader); + this->context->extradata = malloc(this->context->extradata_size); + memcpy( this->context->extradata, + (uint8_t *)bih + sizeof(xine_bmiheader), + this->context->extradata_size ); + } } else if (this->decoder_ok) { @@ -634,6 +637,7 @@ register_avcodec(&dvvideo_decoder); // register_avcodec(&dvaudio_decoder); register_avcodec(&mjpeg_decoder); + register_avcodec(&mjpegb_decoder); register_avcodec(&wmav1_decoder); register_avcodec(&wmav2_decoder); @@ -653,6 +657,9 @@ this->decoder_ok = 0; } + if(this->context && this->context->extradata) + free(this->context->extradata); + if( this->context ) free( this->context ); @@ -730,10 +737,6 @@ this->decoder_class.get_description = ff_video_get_description; this->decoder_class.dispose = ff_video_dispose_class; - this->illegal_vlc = xine->config->register_bool (xine->config, "codec.ffmpeg_illegal_vlc", 1, - _("allow illegal vlc codes in mpeg4 streams"), NULL, - 10, NULL, NULL); - pthread_once( &once_control, init_once_routine ); return this; @@ -784,6 +787,7 @@ this->context->block_align = audio_header->nBlockAlign; this->context->bit_rate = audio_header->nAvgBytesPerSec * 8; this->context->codec_id = codec->id; + this->context->fourcc = this->stream->stream_info[XINE_STREAM_INFO_AUDIO_FOURCC]; if( audio_header->cbSize > 0 ) { this->context->extradata = malloc(audio_header->cbSize); this->context->extradata_size = audio_header->cbSize; @@ -981,7 +985,7 @@ BUF_VIDEO_MSMPEG4_V2, BUF_VIDEO_MSMPEG4_V3, BUF_VIDEO_WMV7, - /*BUF_VIDEO_WMV8,*/ + /*BUF_VIDEO_WMV8,*/ BUF_VIDEO_MPEG4, BUF_VIDEO_XVID, BUF_VIDEO_DIVX5, |