From 775c694abe5e84d66e448864c0281bf569bf509c Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 14 Jul 2002 22:27:24 +0000 Subject: make demuxers a bit more "programmer friendly" CVS patchset: 2265 CVS date: 2002/07/14 22:27:24 --- src/demuxers/demux_asf.c | 13 +++---------- src/demuxers/demux_avi.c | 7 +------ src/demuxers/demux_elem.c | 4 +--- src/demuxers/demux_film.c | 10 +--------- src/demuxers/demux_fli.c | 5 +---- src/demuxers/demux_idcin.c | 5 +---- src/demuxers/demux_mpeg.c | 16 +++++----------- src/demuxers/demux_mpeg_block.c | 5 +---- src/demuxers/demux_ogg.c | 10 +--------- src/demuxers/demux_pes.c | 8 +------- src/demuxers/demux_qt.c | 19 +++++++++---------- src/demuxers/demux_roq.c | 8 +------- src/demuxers/demux_smjpeg.c | 6 +----- src/demuxers/demux_wav.c | 4 +--- src/xine-engine/buffer.c | 8 +++++++- 15 files changed, 35 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 0714fa090..5eb771e31 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.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: demux_asf.c,v 1.49 2002/07/05 20:54:37 miguelfreitas Exp $ + * $Id: demux_asf.c,v 1.50 2002/07/14 22:27:25 miguelfreitas Exp $ * * demultiplexer for asf streams * @@ -349,7 +349,6 @@ static void asf_send_audio_header (demux_asf_t *this, int stream_id) { this->streams[this->num_streams].defrag = 0; buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; memcpy (buf->content, this->wavex, this->wavex_size); #ifdef LOG @@ -401,7 +400,6 @@ static void asf_send_video_header (demux_asf_t *this, int stream_id) { buf_video_name(this->streams[this->num_streams].buf_type)); buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[1] = 3000; /* FIXME ? */ memcpy (buf->content, &this->bih, this->bih_size); @@ -717,7 +715,6 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, bufsize = stream->fifo->buffer_pool_buf_size; buf = stream->fifo->buffer_pool_alloc (stream->fifo); - buf->content = buf->mem; this->input->read (this->input, buf->content, bufsize); if (stream->fifo == this->video_fifo) { @@ -774,8 +771,7 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, stream->frag_offset = 0; - } else - buf->decoder_flags = 0; + } if( !this->keyframe_found ) buf->decoder_flags |= BUF_FLAG_PREVIEW; @@ -822,7 +818,6 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, bufsize = stream->fifo->buffer_pool_buf_size; buf = stream->fifo->buffer_pool_alloc (stream->fifo); - buf->content = buf->mem; xine_fast_memcpy (buf->content, p, bufsize); if (stream->fifo == this->video_fifo) { @@ -851,9 +846,7 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, /* test if whole packet read */ if ( !stream->frag_offset ) - buf->decoder_flags = BUF_FLAG_FRAME_END; - else - buf->decoder_flags = 0; + buf->decoder_flags |= BUF_FLAG_FRAME_END; if( !this->keyframe_found ) buf->decoder_flags |= BUF_FLAG_PREVIEW; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 9e8b977e5..f6f8a1d6c 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.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: demux_avi.c,v 1.100 2002/07/05 17:31:59 mroi Exp $ + * $Id: demux_avi.c,v 1.101 2002/07/14 22:27:25 miguelfreitas Exp $ * * demultiplexer for avi streams * @@ -1053,7 +1053,6 @@ static int demux_avi_next (demux_avi_t *this) { get_audio_pts (this, i, audio->audio_posc, aie->tot, audio->audio_posb); if (!this->no_audio && (audio_pts < video_pts)) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; /* read audio */ @@ -1085,7 +1084,6 @@ static int demux_avi_next (demux_avi_t *this) { if (do_read_video) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; /* read video */ @@ -1369,7 +1367,6 @@ static int demux_avi_start (demux_plugin_t *this_gen, if( !this->thread_running && (this->status == DEMUX_OK) ) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[1] = this->video_step; memcpy (buf->content, &this->avi->bih, sizeof (this->avi->bih)); @@ -1398,7 +1395,6 @@ static int demux_avi_start (demux_plugin_t *this_gen, /* send off the palette, if there is one */ if (this->avi->palette_count) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_PALETTE; buf->decoder_info[2] = this->avi->palette_count; @@ -1413,7 +1409,6 @@ static int demux_avi_start (demux_plugin_t *this_gen, avi_audio_t *a = this->avi->audio[i]; buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; memcpy (buf->content, a->wavex, a->wavex_len); buf->size = a->wavex_len; diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index 74dae2f28..bd1a04e59 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.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: demux_elem.c,v 1.48 2002/07/05 17:31:59 mroi Exp $ + * $Id: demux_elem.c,v 1.49 2002/07/14 22:27:25 miguelfreitas Exp $ * * demultiplexer for elementary mpeg streams * @@ -87,8 +87,6 @@ static int demux_mpeg_elem_next (demux_mpeg_elem_t *this, int preview_mode) { if (preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; buf->pts = 0; /*buf->scr = 0;*/ diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index 399ae3f74..0fd986dbf 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -21,7 +21,7 @@ * For more information on the FILM file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_film.c,v 1.17 2002/07/10 02:54:43 tmmm Exp $ + * $Id: demux_film.c,v 1.18 2002/07/14 22:27:25 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -335,13 +335,11 @@ static void *demux_film_loop (void *this_gen) { while (remaining_sample_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->type = this->video_type; buf->input_pos = this->sample_table[i].sample_offset; buf->input_length = this->data_end; buf->input_time = this->sample_table[i].pts / 90000; buf->pts = this->sample_table[i].pts; - buf->decoder_flags = 0; if (last_frame_pts) { buf->decoder_flags |= BUF_FLAG_FRAMERATE; @@ -402,13 +400,11 @@ static void *demux_film_loop (void *this_gen) { while (remaining_sample_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->type = this->video_type; buf->input_pos = this->sample_table[i].sample_offset; buf->input_length = this->data_end; buf->input_time = this->sample_table[i].pts / 90000; buf->pts = this->sample_table[i].pts; - buf->decoder_flags = 0; if (remaining_sample_bytes > buf->max_size) buf->size = buf->max_size; @@ -436,13 +432,11 @@ static void *demux_film_loop (void *this_gen) { while (remaining_sample_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = this->audio_type; buf->input_pos = this->sample_table[i].sample_offset; buf->input_length = this->data_end; buf->input_time = this->sample_table[i].pts / 90000; buf->pts = this->sample_table[i].pts; - buf->decoder_flags = 0; if (remaining_sample_bytes > buf->max_size) buf->size = buf->max_size; @@ -625,7 +619,6 @@ static int demux_film_start (demux_plugin_t *this_gen, /* send init info to decoders */ if (this->video_fifo && this->video_type) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; buf->decoder_info[1] = 3000; /* initial video_step */ @@ -640,7 +633,6 @@ static int demux_film_start (demux_plugin_t *this_gen, if (this->audio_fifo && this->audio_type) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = BUF_AUDIO_LPCM_BE; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c index e0e65a14c..c6fb59b7e 100644 --- a/src/demuxers/demux_fli.c +++ b/src/demuxers/demux_fli.c @@ -22,7 +22,7 @@ * avoid while programming a FLI decoder, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_fli.c,v 1.3 2002/07/13 19:49:00 tmmm Exp $ + * $Id: demux_fli.c,v 1.4 2002/07/14 22:27:25 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -129,13 +129,11 @@ static void *demux_fli_loop (void *this_gen) { (chunk_magic == FLI_CHUNK_MAGIC_2)) { while (chunk_size) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->type = BUF_VIDEO_FLI; buf->input_pos = current_file_pos; buf->input_time = pts_counter / 90000; buf->input_length = stream_len; buf->pts = pts_counter; - buf->decoder_flags = 0; if (chunk_size > buf->max_size) buf->size = buf->max_size; @@ -319,7 +317,6 @@ static int demux_fli_start (demux_plugin_t *this_gen, /* send init info to FLI decoder */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; buf->decoder_info[1] = this->frame_pts_inc; /* initial video_step */ diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 269b74d04..96764d6ec 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -21,7 +21,7 @@ * For more information regarding the Id CIN file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: demux_idcin.c,v 1.1 2002/07/07 01:24:40 tmmm Exp $ + * $Id: demux_idcin.c,v 1.2 2002/07/14 22:27:25 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -289,7 +289,6 @@ return DEMUX_FINISHED; /* send init info to decoders */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; buf->decoder_info[1] = IDCIN_FRAME_PTS_INC; /* initial video_step */ @@ -305,7 +304,6 @@ return DEMUX_FINISHED; /* send the Huffman table */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_IDCIN_HUFFMAN_TABLE; buf->decoder_info[2] = (unsigned int)&this->huffman_table; @@ -315,7 +313,6 @@ return DEMUX_FINISHED; if (this->audio_fifo && this->audio_channels) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = BUF_AUDIO_LPCM_LE; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 19de5a44d..96b96b789 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.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: demux_mpeg.c,v 1.66 2002/07/05 17:31:59 mroi Exp $ + * $Id: demux_mpeg.c,v 1.67 2002/07/14 22:27:25 miguelfreitas Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -199,8 +199,6 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; buf->input_pos = this->input->get_current_pos (this->input); @@ -251,8 +249,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; + buf->input_pos = this->input->get_current_pos(this->input); if(this->audio_fifo) @@ -297,8 +294,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; + buf->input_pos = this->input->get_current_pos(this->input); this->video_fifo->put (this->video_fifo, buf); @@ -410,8 +406,7 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; + buf->input_pos = this->input->get_current_pos(this->input); if (this->rate) buf->input_time = buf->input_pos / (this->rate * 50); @@ -433,8 +428,7 @@ static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr) if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; + buf->input_pos = this->input->get_current_pos(this->input); if (this->rate) buf->input_time = buf->input_pos / (this->rate * 50); diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 0b1b54859..97480b5e9 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.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: demux_mpeg_block.c,v 1.106 2002/07/05 17:32:00 mroi Exp $ + * $Id: demux_mpeg_block.c,v 1.107 2002/07/14 22:27:25 miguelfreitas Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -249,8 +249,6 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m p = buf->content; /* len = this->mnBlocksize; */ if (preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; buf->input_pos = this->input->get_current_pos (this->input); buf->input_length = this->input->get_length (this->input); @@ -974,7 +972,6 @@ static int demux_mpeg_block_start (demux_plugin_t *this_gen, ((this->input->get_optional_data(this->input, buf->mem, INPUT_OPTIONAL_DATA_CLUT) == INPUT_OPTIONAL_SUCCESS))) { buf->type = BUF_SPU_CLUT; - buf->content = buf->mem; this->video_fifo->put(this->video_fifo, buf); } else { diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index c57cfa1d1..cb7964213 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.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: demux_ogg.c,v 1.30 2002/07/05 17:32:00 mroi Exp $ + * $Id: demux_ogg.c,v 1.31 2002/07/14 22:27:25 miguelfreitas Exp $ * * demultiplexer for ogg streams * @@ -259,7 +259,6 @@ static void demux_ogg_send_package (demux_ogg_t *this) { bih.biClrImportant=0; buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; this->frame_duration = oggh->time_unit * 9 / 1000; buf->decoder_info[1] = this->frame_duration; @@ -288,8 +287,6 @@ static void demux_ogg_send_package (demux_ogg_t *this) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; - { int op_size = sizeof(op); ogg_packet *og_ghost; @@ -307,8 +304,6 @@ static void demux_ogg_send_package (demux_ogg_t *this) { buf->pts = 0; /* FIXME */ buf->size = op.bytes; - buf->decoder_flags = 0; - buf->input_pos = this->input->get_current_pos (this->input); buf->input_time = 0; @@ -329,11 +324,8 @@ static void demux_ogg_send_package (demux_ogg_t *this) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; - if ( (todo-done)>(buf->max_size-1)) { buf->size = buf->max_size-1; - buf->decoder_flags = 0; } else { buf->size = todo-done; buf->decoder_flags = BUF_FLAG_FRAME_END; diff --git a/src/demuxers/demux_pes.c b/src/demuxers/demux_pes.c index 1b06271f5..5b54db737 100644 --- a/src/demuxers/demux_pes.c +++ b/src/demuxers/demux_pes.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: demux_pes.c,v 1.33 2002/07/05 17:32:00 mroi Exp $ + * $Id: demux_pes.c,v 1.34 2002/07/14 22:27:25 miguelfreitas Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -181,8 +181,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { buf->pts = pts; if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; buf->input_pos = this->input->get_current_pos (this->input); @@ -228,8 +226,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { buf->pts = pts; if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; buf->input_pos = this->input->get_current_pos(this->input); @@ -276,8 +272,6 @@ static void parse_mpeg2_packet (demux_pes_t *this, int nID) { buf->pts = pts; if (this->preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; - else - buf->decoder_flags = 0; buf->input_pos = this->input->get_current_pos(this->input); diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 65dba499b..1346d4650 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.63 2002/07/10 05:38:18 pmhahn Exp $ + * $Id: demux_qt.c,v 1.64 2002/07/14 22:27:25 miguelfreitas Exp $ * */ @@ -92,6 +92,8 @@ typedef unsigned int qt_atom; #define STSS_ATOM QT_ATOM('s', 't', 's', 's') #define CO64_ATOM QT_ATOM('c', 'o', '6', '4') +#define ESDS_ATOM QT_ATOM('e', 's', 'd', 's') + /* placeholder for cutting and pasting */ #define _ATOM QT_ATOM('', '', '', '') @@ -432,6 +434,11 @@ static qt_error parse_trak_atom(qt_sample_table *sample_table, sample_table->media_description.audio.channels = trak_atom[i + 0x25]; sample_table->media_description.audio.bits = trak_atom[i + 0x27]; + /* test stuff - will be removed + if( BE_32(&trak_atom[i + 0x34]) == ESDS_ATOM ) { + int atom_len = BE_32(&trak_atom[i + 0x30]) - 8; + printf("esds atom! size=%d\n", atom_len); + }*/ } } else if (current_atom == STSZ_ATOM) { @@ -1138,13 +1145,11 @@ static void *demux_qt_loop (void *this_gen) { while (remaining_sample_bytes) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->type = this->qt->video_type; buf->input_pos = this->qt->frames[i].offset; buf->input_length = this->qt->input_length; buf->input_time = this->qt->frames[i].pts / 90000; buf->pts = this->qt->frames[i].pts; - buf->decoder_flags = 0; if (last_frame_pts) { buf->decoder_flags |= BUF_FLAG_FRAMERATE; @@ -1181,13 +1186,11 @@ static void *demux_qt_loop (void *this_gen) { while (remaining_sample_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = this->qt->audio_type; buf->input_pos = this->qt->frames[i].offset; buf->input_length = this->qt->input_length; buf->input_time = this->qt->frames[i].pts / 90000; buf->pts = this->qt->frames[i].pts; - buf->decoder_flags = 0; if (remaining_sample_bytes > buf->max_size) buf->size = buf->max_size; @@ -1371,7 +1374,6 @@ static int demux_qt_start (demux_plugin_t *this_gen, /* send init info to decoders */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; buf->decoder_info[1] = 3000; /* initial video_step */ @@ -1382,7 +1384,6 @@ static int demux_qt_start (demux_plugin_t *this_gen, if (this->audio_fifo && this->qt->audio_type) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = this->qt->audio_type; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; @@ -1390,9 +1391,7 @@ static int demux_qt_start (demux_plugin_t *this_gen, buf->decoder_info[2] = this->qt->audio_bits; buf->decoder_info[3] = this->qt->audio_channels; this->audio_fifo->put (this->audio_fifo, buf); - } else - buf->free_buffer(buf); - + } this->status = DEMUX_OK; this->send_end_buffers = 1; diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index bbb823e4d..d45b4bbce 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -21,7 +21,7 @@ * For more information regarding the RoQ file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: demux_roq.c,v 1.8 2002/07/07 00:41:24 tmmm Exp $ + * $Id: demux_roq.c,v 1.9 2002/07/14 22:27:25 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -139,10 +139,8 @@ static void *demux_roq_loop (void *this_gen) { /* packetize the audio */ while (chunk_size) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = BUF_AUDIO_ROQ; buf->input_pos = current_file_pos; - buf->decoder_flags = 0; buf->pts = audio_pts; if (chunk_size > buf->max_size) @@ -196,10 +194,8 @@ static void *demux_roq_loop (void *this_gen) { //printf ("total video chunk size = %X\n", chunk_size); while (chunk_size) { buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->type = BUF_VIDEO_ROQ; buf->input_pos = current_file_pos; - buf->decoder_flags = 0; buf->pts = video_pts_counter; if (chunk_size > buf->max_size) @@ -432,7 +428,6 @@ static int demux_roq_start (demux_plugin_t *this_gen, /* send init info to decoders */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; buf->decoder_info[1] = this->frame_pts_inc; /* initial video_step */ @@ -448,7 +443,6 @@ static int demux_roq_start (demux_plugin_t *this_gen, if (this->audio_fifo && this->audio_channels) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = BUF_AUDIO_ROQ; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index fa26f663e..6a55c935f 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -21,7 +21,7 @@ * For more information on the SMJPEG file format, visit: * http://www.lokigames.com/development/smjpeg.php3 * - * $Id: demux_smjpeg.c,v 1.2 2002/07/10 06:28:19 pmhahn Exp $ + * $Id: demux_smjpeg.c,v 1.3 2002/07/14 22:27:25 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -164,12 +164,10 @@ static void *demux_smjpeg_loop (void *this_gen) { buf->type = this->video_type; } - buf->content = buf->mem; buf->input_pos = current_file_pos; buf->input_length = this->input_length; buf->input_time = pts / 90000; buf->pts = pts; - buf->decoder_flags = 0; if (remaining_sample_bytes > buf->max_size) buf->size = buf->max_size; @@ -424,7 +422,6 @@ this->video_type = BUF_VIDEO_JPEG; /* send init info to decoders */ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); - buf->content = buf->mem; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; buf->decoder_info[1] = 3000; /* initial video_step */ @@ -435,7 +432,6 @@ this->video_type = BUF_VIDEO_JPEG; if (this->audio_fifo && this->audio_type) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = this->audio_type; buf->decoder_flags = BUF_FLAG_HEADER; buf->decoder_info[0] = 0; diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index ea0095796..348bef490 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -20,7 +20,7 @@ * MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net) * based on WAV specs that are available far and wide * - * $Id: demux_wav.c,v 1.3 2002/07/10 06:28:19 pmhahn Exp $ + * $Id: demux_wav.c,v 1.4 2002/07/14 22:27:25 miguelfreitas Exp $ * */ @@ -118,13 +118,11 @@ static void *demux_wav_loop (void *this_gen) { while (remaining_sample_bytes) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->content = buf->mem; buf->type = this->audio_type; buf->input_pos = current_file_pos; buf->input_length = this->data_end; buf->input_time = current_pts / 90000; buf->pts = current_pts; - buf->decoder_flags = 0; if (remaining_sample_bytes > buf->max_size) buf->size = buf->max_size; diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index b69752e85..5b9c83dff 100644 --- a/src/xine-engine/buffer.c +++ b/src/xine-engine/buffer.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: buffer.c,v 1.16 2002/03/24 14:15:37 guenter Exp $ + * $Id: buffer.c,v 1.17 2002/07/14 22:27:24 miguelfreitas Exp $ * * * contents: @@ -103,6 +103,12 @@ static buf_element_t *buffer_pool_alloc (fifo_buffer_t *this) { /* needed because cancellation points defined by POSIX (eg. 'read') would leak allocated buffers */ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,NULL); + + /* set sane values to the newly allocated buffer */ + buf->content = buf->mem; /* 99% of demuxers will want this */ + buf->pts = 0; + buf->input_pos = buf->input_length = buf->input_time = 0; + buf->decoder_flags = 0; return buf; } -- cgit v1.2.3