From 9e04d12e20a84b43ea365bdd570dbec2b694540b Mon Sep 17 00:00:00 2001 From: Mike Melanson Date: Sat, 21 Dec 2002 03:03:15 +0000 Subject: ...my beautiful, beautiful special information buffer facility...okay it's just a hack. Oh well, set it straight CVS patchset: 3600 CVS date: 2002/12/21 03:03:15 --- src/demuxers/demux_qt.c | 18 +++++++++--------- src/libw32dll/qt_decoder.c | 12 ++++++------ src/xine-engine/buffer.h | 28 ++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index fc4af54d8..c429d24f4 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -30,7 +30,7 @@ * build_frame_table * free_qt_info * - * $Id: demux_qt.c,v 1.129 2002/12/18 20:32:20 esnel Exp $ + * $Id: demux_qt.c,v 1.130 2002/12/21 03:03:16 tmmm Exp $ * */ @@ -2084,10 +2084,10 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { /* send stsd to the decoder */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); buf->decoder_flags = BUF_FLAG_SPECIAL; - buf->decoder_info[0] = BUF_SPECIAL_STSD_ATOM; - buf->decoder_info[1] = this->qt->video_stsd_size; - memcpy (buf->content, this->qt->video_stsd, this->qt->video_stsd_size); - buf->size = this->qt->video_stsd_size; + buf->decoder_info[1] = BUF_SPECIAL_STSD_ATOM; + buf->decoder_info[2] = this->qt->video_stsd_size; + buf->decoder_info[3] = (unsigned int)&this->qt->video_stsd; + buf->size = 0; buf->type = this->qt->video_type; this->video_fifo->put (this->video_fifo, buf); @@ -2118,10 +2118,10 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) { /* send stsd to the decoder */ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->decoder_flags = BUF_FLAG_SPECIAL; - buf->decoder_info[0] = BUF_SPECIAL_STSD_ATOM; - buf->decoder_info[1] = this->qt->audio_stsd_size; - memcpy (buf->content, this->qt->audio_stsd, this->qt->audio_stsd_size); - buf->size = this->qt->audio_stsd_size; + buf->decoder_info[1] = BUF_SPECIAL_STSD_ATOM; + buf->decoder_info[2] = this->qt->audio_stsd_size; + buf->decoder_info[3] = (unsigned int)&this->qt->audio_stsd; + buf->size = 0; buf->type = this->qt->audio_type; this->audio_fifo->put (this->audio_fifo, buf); diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index aefed740f..a3df42950 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: qt_decoder.c,v 1.1 2002/12/18 04:00:49 guenter Exp $ + * $Id: qt_decoder.c,v 1.2 2002/12/21 03:03:16 tmmm Exp $ * * quicktime video/audio decoder plugin, using win32 dlls * most of this code comes directly from MPlayer @@ -325,7 +325,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { printf ("qt_audio: output format:\n"); qta_hexdump (&this->OutputFormatInfo, sizeof (SoundComponentData)); printf ("qt_audio: stsd atom: \n"); - qta_hexdump (buf->content, buf->size); + qta_hexdump ((unsigned char *)buf->decoder_info[3], buf->decoder_info[2]); #endif error = this->SoundConverterOpen (&this->InputFormatInfo, @@ -450,7 +450,7 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { printf ("qt_audio: special buffer\n"); #endif - if (buf->decoder_info[0] == BUF_SPECIAL_STSD_ATOM) { + if (buf->decoder_info[1] == BUF_SPECIAL_STSD_ATOM) { #ifdef LOG printf ("qt_audio: got stsd atom -> init codec\n"); @@ -865,9 +865,9 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { printf ("qt_video: image size %d x %d\n", this->bih.biWidth, this->bih.biHeight); - printf ("qt_video: stsd (%d bytes):\n", buf->size) ; + printf ("qt_video: stsd (%d bytes):\n", buf->decoder_info[2]) ; - qtv_hexdump (buf->content, buf->size); + qtv_hexdump ((unsigned char *)buf->decoder_info[3], buf->decoder_info[2]); #endif { @@ -989,7 +989,7 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { printf ("qt_video: special buffer\n"); #endif - if (buf->decoder_info[0] == BUF_SPECIAL_STSD_ATOM) { + if (buf->decoder_info[1] == BUF_SPECIAL_STSD_ATOM) { #ifdef LOG printf ("qt_video: got stsd atom -> init codec\n"); diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index 568146704..f04ce9f7c 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer.h,v 1.84 2002/12/16 01:34:08 guenter Exp $ + * $Id: buffer.h,v 1.85 2002/12/21 03:03:15 tmmm Exp $ * * * contents: @@ -231,7 +231,28 @@ struct buf_element_s { /* do not decode the buffer contents, detect framing only */ #define BUF_FLAG_FRAMING 0x0800 +/* Special buffer types: + * Sometimes there is a need to relay special information from a demuxer + * to a video decoder. For example, some file types store palette data in + * the file header independant of the video data. The special buffer type + * offers a way to communicate this or any other custom, format-specific + * data to the decoder. + * + * The interface was designed in a way that did not require an API + * version bump. To send a special buffer type, set a buffer's flags field + * to BUF_SPECIAL_PALETTE. Set the buffer's decoder_info[1] field to a + * number according to one of the special buffer subtypes defined below. + * The second and third decoder_info[] fields are defined according to + * your buffer type's requirements. + * + * Finally, remember to set the buffer's size to 0. This way, if a special + * buffer is sent to a decode that does not know how to handle it, the + * buffer will fall through to the case where the buffer's data content + * is accumulated and no harm will be done. + */ + /* these are the types of special buffers */ + /* * In a BUF_SPECIAL_PALETTE buffer: * decoder_info[1] = BUF_SPECIAL_PALETTE @@ -284,13 +305,12 @@ struct buf_element_s { /* * In a BUF_SPECIAL_STSD_ATOM buffer: * decoder_info[1] = BUF_SPECIAL_STSD_ATOM - * buf content is a copy of the stsd atom + * decoder_info[2] = size of the stsd atom + * decoder_info[3] = pointer to stsd atom * binary-only quicktime decoders need this, sent by qt demuxer */ #define BUF_SPECIAL_STSD_ATOM 5 - - /* * In a BUF_SPECIAL_LPCM_CONFIG buffer: * decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG -- cgit v1.2.3