From 2408a34f47034a4d1a6a20e2f46b40b282ee9cb2 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Fri, 31 Oct 2003 23:58:32 +0000 Subject: Use info_helper functions. CVS patchset: 5658 CVS date: 2003/10/31 23:58:32 --- src/demuxers/demux_aud.c | 18 ++++----- src/demuxers/demux_avi.c | 6 +-- src/demuxers/demux_ogg.c | 97 ++++++++++++++++++++++++--------------------- src/demuxers/demux_smjpeg.c | 26 ++++++------ 4 files changed, 78 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c index a2f1354b2..723722f52 100644 --- a/src/demuxers/demux_aud.c +++ b/src/demuxers/demux_aud.c @@ -34,7 +34,7 @@ * data. This makes seeking conceptually impossible. Upshot: Random * seeking is not supported. * - * $Id: demux_aud.c,v 1.11 2003/08/25 21:51:38 f1rmb Exp $ + * $Id: demux_aud.c,v 1.12 2003/10/31 23:58:32 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -195,14 +195,14 @@ static void demux_aud_send_headers(demux_plugin_t *this_gen) { this->status = DEMUX_OK; /* load stream information */ - this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 0; - this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = 1; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = - this->audio_channels; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] = - this->audio_samplerate; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] = - this->audio_bits; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, + this->audio_channels); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + this->audio_samplerate); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_BITS, + this->audio_bits); /* send start buffers */ xine_demux_control_start(this->stream); diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 8b3b9d645..e48a407fd 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.170 2003/10/30 00:49:07 tmattern Exp $ + * $Id: demux_avi.c,v 1.171 2003/10/31 23:58:32 tmattern Exp $ * * demultiplexer for avi streams * @@ -1576,8 +1576,8 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { } if(this->avi->n_audio == 1) - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_FOURCC] = - this->avi->audio[0]->wavex->wFormatTag; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, + this->avi->audio[0]->wavex->wFormatTag); } /* diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index f9597b273..ba1a35828 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.111 2003/10/30 00:49:07 tmattern Exp $ + * $Id: demux_ogg.c,v 1.112 2003/10/31 23:58:32 tmattern Exp $ * * demultiplexer for ogg streams * @@ -620,24 +620,26 @@ static void send_ogg_buf (demux_ogg_t *this, xine_event_t uevent; xine_ui_data_t data; int title_len; + char *title; this->chapter_info->current_chapter = chapter; if (chapter >= 0) { char t_title[256]; sprintf(t_title, "%s / %s", this->title, this->chapter_info->entries[chapter].name); - xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, t_title); + title = t_title; } else { - xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, this->title); + title = this->title; } - lprintf("new TITLE: %s\n", this->stream->meta_info[XINE_META_INFO_TITLE]); + xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, title); + lprintf("new TITLE: %s\n", title); uevent.type = XINE_EVENT_UI_SET_TITLE; uevent.stream = this->stream; uevent.data = &data; uevent.data_length = sizeof(data); - title_len = strlen(this->stream->meta_info[XINE_META_INFO_TITLE]) + 1; - memcpy(data.str, this->stream->meta_info[XINE_META_INFO_TITLE], title_len); + title_len = strlen(title) + 1; + memcpy(data.str, title, title_len); data.str_len = title_len; xine_event_send(this->stream, &uevent); } @@ -750,10 +752,10 @@ static void demux_ogg_send_header (demux_ogg_t *this) { vorbis_comment_init(&vc); if (vorbis_synthesis_headerin(&vi, &vc, &op) >= 0) { - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITRATE] - = vi.bitrate_nominal; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] - = vi.rate; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + vi.bitrate_nominal); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + vi.rate); this->factor[stream_num] = 90000; this->quotient[stream_num] = vi.rate; @@ -798,8 +800,8 @@ static void demux_ogg_send_header (demux_ogg_t *this) { if (bitrate <= 1) bitrate = 16000; /* assume 16 kbit */ - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITRATE] - = bitrate; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + bitrate); this->factor[stream_num] = 90000; this->quotient[stream_num] = header->rate; @@ -809,8 +811,8 @@ static void demux_ogg_send_header (demux_ogg_t *this) { lprintf ("detected Speex stream,\trate %d\tbitrate %d\n", header->rate, bitrate); - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] - = header->rate; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + header->rate); this->preview_buffers[stream_num] += header->extra_headers; } @@ -890,12 +892,12 @@ static void demux_ogg_send_header (demux_ogg_t *this) { * video metadata */ - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] - = locwidth; - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] - = locheight; - this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] - = this->frame_duration; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, + locwidth); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, + locheight); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_FRAME_DURATION, + this->frame_duration); this->avg_bitrate += 500000; /* FIXME */ @@ -986,14 +988,14 @@ static void demux_ogg_send_header (demux_ogg_t *this) { * audio metadata */ - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] - = locchannels; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] - = locbits_per_sample; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] - = locsamples_per_unit; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITRATE] - = locavgbytespersec*8; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, + locchannels); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_BITS, + locbits_per_sample); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + locsamples_per_unit); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + locavgbytespersec * 8); } else /* no audio_fifo there */ this->buf_types[stream_num] = BUF_CONTROL_NOP; @@ -1060,12 +1062,12 @@ static void demux_ogg_send_header (demux_ogg_t *this) { * video metadata */ - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] - = bih.biWidth; - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] - = bih.biHeight; - this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] - = this->frame_duration; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, + bih.biWidth); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, + bih.biHeight); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_FRAME_DURATION, + this->frame_duration); this->avg_bitrate += 500000; /* FIXME */ @@ -1144,17 +1146,19 @@ static void demux_ogg_send_header (demux_ogg_t *this) { this->buf_types[stream_num] = BUF_VIDEO_THEORA; xine_set_meta_info(this->stream, XINE_META_INFO_VIDEOCODEC, "theora"); - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] - = this->t_info.frame_width; - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] - = this->t_info.frame_height; - this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] - = ((int64_t) 90000*this->t_info.fps_denominator)/this->t_info.fps_numerator; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, + this->t_info.frame_width); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, + this->t_info.frame_height); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_FRAME_DURATION, + ((int64_t) 90000 * this->t_info.fps_denominator) / + this->t_info.fps_numerator); /*currently aspect_nominator and -denumerator are 0?*/ if (this->t_info.aspect_denominator) - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_RATIO] - = ((int64_t) this->t_info.aspect_numerator*10000)/this->t_info.aspect_denominator; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, + ((int64_t) this->t_info.aspect_numerator * 10000) / + this->t_info.aspect_denominator); #ifdef LOG printf ("demux_ogg: decoded theora header \n"); @@ -1429,9 +1433,12 @@ static void demux_ogg_send_headers (demux_plugin_t *this_gen) { lprintf ("headers sent, avg bitrate is %lld\n", this->avg_bitrate); } - this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = this->num_video_streams>0; - this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = this->num_audio_streams>0; - this->stream->stream_info[XINE_STREAM_INFO_MAX_SPU_CHANNEL] = this->num_spu_streams; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_HAS_VIDEO, + this->num_video_streams > 0); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_HAS_AUDIO, + this->num_audio_streams > 0); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL, + this->num_spu_streams); } static int demux_ogg_seek (demux_plugin_t *this_gen, diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index a3e9d3b74..563ba6116 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -23,7 +23,7 @@ * For more information on the SMJPEG file format, visit: * http://www.lokigames.com/development/smjpeg.php3 * - * $Id: demux_smjpeg.c,v 1.41 2003/08/25 21:51:38 f1rmb Exp $ + * $Id: demux_smjpeg.c,v 1.42 2003/10/31 23:58:32 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -315,17 +315,19 @@ static void demux_smjpeg_send_headers(demux_plugin_t *this_gen) { this->status = DEMUX_OK; /* load stream information */ - this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1; - this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = - (this->audio_channels) ? 1 : 0; - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->bih.biWidth; - this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->bih.biHeight; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] = - this->audio_channels; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] = - this->audio_sample_rate; - this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] = - this->audio_bits; + xine_set_stream_info(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_HAS_AUDIO, + (this->audio_channels) ? 1 : 0); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, + this->bih.biWidth); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, + this->bih.biHeight); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, + this->audio_channels); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, + this->audio_sample_rate); + xine_set_stream_info(this->stream, XINE_STREAM_INFO_AUDIO_BITS, + this->audio_bits); /* send start buffers */ xine_demux_control_start(this->stream); -- cgit v1.2.3