diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2002-03-18 22:45:53 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2002-03-18 22:45:53 +0000 |
commit | 96d4ac01bc64b3c5f725d553387eb622da64a171 (patch) | |
tree | 615bba08f5036c2b96eb21742c141969083c2c3e | |
parent | 4c688a8804f8205f7e3d49b2be44eba9a57fff6b (diff) | |
download | xine-lib-96d4ac01bc64b3c5f725d553387eb622da64a171.tar.gz xine-lib-96d4ac01bc64b3c5f725d553387eb622da64a171.tar.bz2 |
make asf demuxer handle audio-only streams (important for webradios\! #-))) and introducing the #ifdef LOG concept in more files (I really start to like that concept, much better than xprintf)
CVS patchset: 1589
CVS date: 2002/03/18 22:45:53
-rw-r--r-- | src/demuxers/demux_asf.c | 62 | ||||
-rw-r--r-- | src/libw32dll/w32codec.c | 21 | ||||
-rw-r--r-- | src/xine-engine/audio_decoder.c | 6 | ||||
-rw-r--r-- | src/xine-engine/audio_out.c | 6 |
4 files changed, 59 insertions, 36 deletions
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 9d5307232..e50b36f70 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.29 2002/03/17 19:22:10 guenter Exp $ + * $Id: demux_asf.c,v 1.30 2002/03/18 22:45:53 guenter Exp $ * * demultiplexer for asf streams * @@ -47,6 +47,10 @@ #include "libw32dll/wine/vfw.h" #include "libw32dll/wine/mmreg.h" +/* +#define LOG +*/ + #define PACKET_SIZE 3200 #define PACKET_HEADER_SIZE 12 #define FRAME_HEADER_SIZE 17 @@ -222,7 +226,9 @@ static uint8_t get_byte (demux_asf_t *this) { /* printf ("%02x ", buf); */ if (i != 1) { +#ifdef LOG printf ("demux_asf: end of data\n"); +#endif this->status = DEMUX_FINISHED; } @@ -348,7 +354,9 @@ static void asf_send_audio_header (demux_asf_t *this, int stream_id) { buf->content = buf->mem; memcpy (buf->content, this->wavex, this->wavex_size); +#ifdef LOG printf ("demux_asf: wavex header is %d bytes long\n", this->wavex_size); +#endif buf->size = this->wavex_size; buf->type = this->streams[this->num_streams].buf_type; @@ -388,9 +396,6 @@ static void asf_send_video_header (demux_asf_t *this, int stream_id) { this->streams[this->num_streams].frag_offset = 0; this->streams[this->num_streams].defrag = 0; - /* - printf ("demux_asf: video format : %.4s\n", (char*)&bih->biCompression); - */ xine_log (this->xine, XINE_LOG_FORMAT, _("demux_asf: video format : %s\n"), buf_video_name(this->streams[this->num_streams].buf_type)); @@ -604,7 +609,9 @@ static int asf_get_packet(demux_asf_t *this) { /* packet size given */ packet_size = get_le16(this); +#ifdef LOG printf ("demux_asf: absolute packet size is %d\n", packet_size); +#endif hdr_size += 2; if (this->packet_flags & 0x10) { @@ -845,8 +852,10 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, if (buf->pts && this->last_video_pts) this->frame_duration = (3* this->frame_duration + (buf->pts - this->last_video_pts)) / 4; +#ifdef LOG printf ("demux_asf: frame_duration is %d\n", this->frame_duration); - +#endif + this->last_video_pts = buf->pts; buf->decoder_flags = BUF_FLAG_FRAME_END | BUF_FLAG_FRAMERATE; @@ -889,11 +898,6 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, this->input->read (this->input, &stream->buffer[stream->frag_offset], frag_len); stream->frag_offset += frag_len; } - - /* - printf ("demux_asf: read %d bytes :", frag_len); - hexdump (buf->content, frag_len, this->xine); - */ } @@ -908,8 +912,10 @@ static void asf_read_packet(demux_asf_t *this) { (++this->frame == (this->nb_frames & 0x3f)) ) { /* fail safe */ - /* printf ("demux_asf: reading new packet, packet size left %d\n", this->packet_size_left); - */ +#ifdef LOG + printf ("demux_asf: reading new packet, packet size left %d\n", this->packet_size_left); +#endif + if (this->packet_size_left) this->input->seek (this->input, this->packet_size_left, SEEK_CUR); @@ -926,7 +932,7 @@ static void asf_read_packet(demux_asf_t *this) { stream_id = raw_id & 0x7f; stream = NULL; - if ( (raw_id & 0x80) || this->keyframe_found ) { + if ( (raw_id & 0x80) || this->keyframe_found || (this->num_video_streams==0)) { for (i=0; i<this->num_streams; i++) if (this->streams[i].stream_id == stream_id) stream = &this->streams[i]; @@ -954,10 +960,10 @@ static void asf_read_packet(demux_asf_t *this) { } flags = get_byte(this); - /* - printf ("\ndemux_asf: segment header, stream id %02x, frag_offset %d, flags : %02x\n", - stream_id, frag_offset, flags); - */ +#ifdef LOG + printf ("demux_asf: segment header, stream id %02x, frag_offset %d, flags : %02x\n", + stream_id, frag_offset, flags); +#endif if (flags == 1) { int data_length, data_sent=0; @@ -999,6 +1005,10 @@ static void asf_read_packet(demux_asf_t *this) { */ if (stream) { +#ifdef LOG + printf ("demux_asf: sending buffer of type %08x\n", stream->buf_type); +#endif + if (stream->defrag) asf_send_buffer_defrag (this, stream, 0, seq, timestamp, object_length, object_length); @@ -1007,9 +1017,9 @@ static void asf_read_packet(demux_asf_t *this) { object_length, object_length); } else { - /* - printf ("demux_asf: unhandled stream type, id %d\n", stream_id); - */ +#ifdef LOG + printf ("demux_asf: unhandled stream type, id %d\n", stream_id); +#endif this->input->seek (this->input, object_length, SEEK_CUR); } @@ -1050,6 +1060,11 @@ static void asf_read_packet(demux_asf_t *this) { if (stream) { + +#ifdef LOG + printf ("demux_asf: sending buffer of type %08x\n", stream->buf_type); +#endif + if (stream->defrag) asf_send_buffer_defrag (this, stream, frag_offset, seq, timestamp, frag_len, payload_size); @@ -1057,9 +1072,10 @@ static void asf_read_packet(demux_asf_t *this) { asf_send_buffer_nodefrag (this, stream, frag_offset, seq, timestamp, frag_len, payload_size); } else { - /* - printf ("demux_asf: unhandled stream type, id %d\n", stream_id); - */ + +#ifdef LOG + printf ("demux_asf: unhandled stream type, id %d\n", stream_id); +#endif this->input->seek (this->input, frag_len, SEEK_CUR); } } diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index d197a387e..61589f67e 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.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: w32codec.c,v 1.65 2002/03/16 20:53:50 guenter Exp $ + * $Id: w32codec.c,v 1.66 2002/03/18 22:45:53 guenter Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -1066,12 +1066,12 @@ static void w32a_decode_audio (w32a_decoder_t *this, ash.pbDst=this->outbuf; ash.cbDstLength=this->outsize; - /* +#ifdef LOG printf ("decoding %d of %d bytes (%02x %02x %02x %02x ... %02x %02x)\n", this->rec_audio_src_size, this->size, this->buf[0], this->buf[1], this->buf[2], this->buf[3], this->buf[this->rec_audio_src_size-2], this->buf[this->rec_audio_src_size-1]); - */ +#endif if( !this->ds_driver ) { hr=acmStreamPrepareHeader(this->srcstream,&ash,0); @@ -1091,16 +1091,17 @@ static void w32a_decode_audio (w32a_decoder_t *this, } if(hr){ - printf("w32codec: stream convert error %d, used %d bytes\n",(int)hr,(int)ash.cbSrcLengthUsed); + printf ("w32codec: stream convert error %d, used %d bytes\n", + (int)hr,(int)ash.cbSrcLengthUsed); this->size-=ash.cbSrcLength; } else { int DstLengthUsed, bufsize; audio_buffer_t *audio_buffer; char *p; - /* +#ifdef LOG printf ("acmStreamConvert worked, used %d bytes, generated %d bytes\n", ash.cbSrcLengthUsed, ash.cbDstLengthUsed); - */ +#endif DstLengthUsed = ash.cbDstLengthUsed; p = this->outbuf; @@ -1150,8 +1151,16 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_HEADER) { /* init package containing bih */ +#ifdef LOG + printf ("w32codec: got audio header\n"); +#endif + this->decoder_ok = w32a_init_audio (this, (WAVEFORMATEX *)buf->content, buf->type); } else if (this->decoder_ok) { +#ifdef LOG + printf ("w32codec: decoding %d data bytes...\n", buf->size); +#endif + if( (int)buf->size <= 0 ) return; diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 0aea0e278..2ed4c0522 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_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: audio_decoder.c,v 1.65 2002/03/11 19:49:07 jkeil Exp $ + * $Id: audio_decoder.c,v 1.66 2002/03/18 22:45:53 guenter Exp $ * * * functions that implement audio decoding @@ -215,10 +215,8 @@ void *audio_decoder_loop (void *this_gen) { if (decoder) { xine_event_t event; - printf ("audio_decoder: using decoder >%s< \n", - decoder->get_identifier()); xine_log (this, XINE_LOG_FORMAT, - "using audio decoder plugin '%s'\n", + "audio_decoder: using audio decoder plugin '%s'\n", decoder->get_identifier()); this->cur_audio_decoder_plugin = decoder; diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index df2fdc1b1..a30d99ab2 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001 the xine project + * Copyright (C) 2000-2002 the xine project * * This file is part of xine, a free video player. * @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.46 2002/03/16 13:25:05 esnel Exp $ + * $Id: audio_out.c,v 1.47 2002/03/18 22:45:53 guenter Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -389,7 +389,7 @@ static int ao_open(ao_instance_t *this, int output_sample_rate, err; xine_log (this->xine, XINE_LOG_FORMAT, - "stream audio format is %d kHz sampling rate, %d bits. mode is %d.\n", + "audio_out: stream audio format is %d kHz sampling rate, %d bits. mode is %d.\n", rate, bits, mode); if ((output_sample_rate=this->driver->open(this->driver,bits,(this->force_rate ? this->force_rate : rate),mode)) == 0) { |