Archive for February, 2007

Xine – Necessary extradata missing!?

Posted: February 15, 2007 in Linux

Well, I mainly use Linux for all PC. (More specifically, is Slackware with dropline Gnome. To me their combination are the finest Linux desktop experience I ever had).

It comes with a rich set of media playing applications – mostly is based upon Xine. However, until recently, I started to have very weird problem with it. Some of the Real media files play with no sound. I was puzzled, but did not pay much attention into this, since I was quite busy at the time. Fortunately, I can still play those files using Mplayer.

Until recently, I decided to look into the problem. After a few hours of looking to the source code, as well running xine in verbose mode, I finally found the cause of this problem.

Apparently, xine is using a multimedia system, known as FFmpeg, This system had recently added support for Realaudio COOK. However, from xine source code that I dig through, there is no code added to utilise this.

From the xine verbose=9 output:

xine: found demuxer plugin: RealMedia file demux plugin
video discontinuity #1, type is 0, disc_off 0
waiting for audio discontinuity #1
audio discontinuity #1, type is 0, disc_off 0
waiting for in_discontinuity update #1
vpts adjusted with prebuffer to 47418
load_plugins: plugin real will be used for video streamtype 39.
ffmpeg_audio_dec: increasing buffer to 98304 to avoid overflow.
load_plugins: plugin ffmpegaudio will be used for audio streamtype 21.
ffmpeg_audio_dec: unknown header with buf type 0x3210000

av_offset=0 pts
spu_offset=0 pts
[cook @ 0xb66d4474]Necessary extradata missing!
ffmpeg_audio_dec: couldn’t open decoder
audio_decoder: no plugin available to handle ‘RealAudio COOK’

Notice the lines in bold, xine trys to decode the media using ffmpegaudio, however, it hit a problem as unable to recognise the content header type.

Looking into the xine source code, I finally found the location of the code where the above lines were printed. Most importantly, the section where it complain unable to recognise the content type header:

From src/libffmpeg/audio_decoder.c (From line 193 – 222):

switch(codec_type) {

case BUF_AUDIO_14_4:

this->audio_sample_rate = 8000;
this->audio_channels = 1;

this->context->block_align = 240;


case BUF_AUDIO_28_8:

this->audio_sample_rate = BE_16(&this->buf[0x30]);
this->audio_channels = this->buf[0x37];
/* this->audio_bits = buf->content[0x35] */

this->context->block_align = BE_16(&this->buf[0x2A]);

this->context->extradata_size = 5*sizeof(short);
this->context->extradata = xine_xmalloc(this->context->extradata_size);

ptr = (short *) this->context->extradata;

ptr[0] = BE_16(&this->buf[0x2C]); /* subpacket size */
ptr[1] = BE_16(&this->buf[0x28]); /* subpacket height */
ptr[2] = BE_16(&this->buf[0x16]); /* subpacket flavour */
ptr[3] = BE_32(&this->buf[0x18]); /* coded frame size */
ptr[4] = 0; /* codec's data length */


xprintf(this->stream->xine, XINE_VERBOSITY_LOG,

"ffmpeg_audio_dec: unknown header with buf type 0x%X\n", codec_type);



Notice, after the handling of case BUF_AUDIO_28_8, there should be some additional code to handle case BUF_AUDIO_COOK (which is currently missing). No wonder I can’t get it to play some of my Realmedia files.

Well, maybe some would think, since mplayer can play those files, why not just use it instead. Unfortunately, mplayer has another problem that I currently can’t figure out exactly what could have caused it. Maybe I will write about it in my next blog…

PS: I post my finding to xine-user mailing list. Hopefully, something good will come out from it.