From 1e80044eedd60d6521235c2bfe865e1956cb9cb8 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Tue, 10 Dec 2002 19:47:02 +0000 Subject: some metainfo CVS patchset: 3478 CVS date: 2002/12/10 19:47:02 --- src/demuxers/demux_real.c | 31 +++++++++++++++++++++++-------- src/libreal/audio_decoder.c | 12 +++++++++++- src/libreal/xine_decoder.c | 10 +++++++++- 3 files changed, 43 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index cdc688ec2..c35ac9c4e 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -21,7 +21,7 @@ * For more information regarding the Real file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_real.c,v 1.20 2002/12/08 21:43:51 miguelfreitas Exp $ + * $Id: demux_real.c,v 1.21 2002/12/10 19:47:30 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -107,6 +107,8 @@ typedef struct { int old_seqnum; int packet_size_cur; + off_t avg_bitrate; + int64_t last_pts[2]; int send_newpts; int buf_flag_seek; @@ -308,9 +310,15 @@ static void real_parse_headers (demux_real_t *this) { if (chunk_type == PROP_TAG) { - this->packet_count = BE_32(&chunk_buffer[18]); - this->duration = BE_32(&chunk_buffer[22]); - this->data_start = BE_32(&chunk_buffer[34]); + this->packet_count = BE_32(&chunk_buffer[18]); + this->duration = BE_32(&chunk_buffer[22]); + this->data_start = BE_32(&chunk_buffer[34]); + this->avg_bitrate = BE_32(&chunk_buffer[6]); + + if (this->avg_bitrate<1) + this->avg_bitrate = 1; + + this->stream->stream_info[XINE_STREAM_INFO_BITRATE] = this->avg_bitrate; } else if (chunk_type == MDPR_TAG) { @@ -484,6 +492,8 @@ static void real_parse_headers (demux_real_t *this) { this->video_fifo->put (this->video_fifo, buf); + this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1; + } else if (!strncmp (mdpr->type_specific_data+4, "VIDORV30", 8)) { buf_element_t *buf; @@ -513,6 +523,8 @@ static void real_parse_headers (demux_real_t *this) { this->video_fifo->put (this->video_fifo, buf); + this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1; + } else { #ifdef LOG @@ -790,8 +802,8 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { buf->content = buf->mem; buf->pts = timestamp; - buf->input_pos = 0 ; /* FIXME */ - buf->input_time = 0 ; /* FIXME */ + buf->input_pos = this->input->get_current_pos (this->input); + buf->input_time = buf->input_pos * 8 / this->avg_bitrate ; buf->type = this->video_buf_type; check_newpts (this, pts, PTS_VIDEO, 0); @@ -870,8 +882,8 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { buf->content = buf->mem; buf->pts = timestamp; - buf->input_pos = 0 ; /* FIXME */ - buf->input_time = 0 ; /* FIXME */ + buf->input_pos = this->input->get_current_pos (this->input); + buf->input_time = buf->input_pos * 8 / this->avg_bitrate ; buf->type = this->audio_buf_type; buf->decoder_flags = 0; buf->size = size; @@ -953,6 +965,9 @@ static void demux_real_send_headers(demux_plugin_t *this_gen) { this->last_pts[0] = 0; this->last_pts[1] = 0; + this->avg_bitrate = 1; + + /* send start buffers */ xine_demux_control_start(this->stream); diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index b8e8eca53..c3b9a8efe 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/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.8 2002/12/10 16:26:05 holstsn Exp $ + * $Id: audio_decoder.c,v 1.9 2002/12/10 19:47:02 guenter Exp $ * * thin layer to use real binary-only codecs in xine * @@ -260,28 +260,38 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { if (!load_syms_linux (this, "cook.so.6.0")) return 0; + this->stream->meta_info[XINE_META_INFO_AUDIOCODEC] + = strdup ("Cook"); break; case BUF_AUDIO_ATRK: if (!load_syms_linux (this, "atrc.so.6.0")) return 0; this->block_align = 384; + this->stream->meta_info[XINE_META_INFO_AUDIOCODEC] + = strdup ("Atrac"); break; case BUF_AUDIO_14_4: if (!load_syms_linux (this, "14_4.so.6.0")) return 0; + this->stream->meta_info[XINE_META_INFO_AUDIOCODEC] + = strdup ("Real 14.4"); break; case BUF_AUDIO_28_8: if (!load_syms_linux (this, "28_8.so.6.0")) return 0; + this->stream->meta_info[XINE_META_INFO_AUDIOCODEC] + = strdup ("Real 28.8"); break; case BUF_AUDIO_SIPRO: if (!load_syms_linux (this, "sipr.so.6.0")) return 0; /* this->block_align = 19; */ + this->stream->meta_info[XINE_META_INFO_AUDIOCODEC] + = strdup ("Sipro"); break; default: diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index 346781e77..13026fb8b 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_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: xine_decoder.c,v 1.13 2002/12/07 01:55:36 guenter Exp $ + * $Id: xine_decoder.c,v 1.14 2002/12/10 19:47:02 guenter Exp $ * * thin layer to use real binary-only codecs in xine * @@ -183,10 +183,14 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { case BUF_VIDEO_RV20: if (!load_syms_linux (this, "drv2.so.6.0")) return 0; + this->stream->meta_info[XINE_META_INFO_VIDEOCODEC] + = strdup ("RV 20"); break; case BUF_VIDEO_RV30: if (!load_syms_linux (this, "drv3.so.6.0")) return 0; + this->stream->meta_info[XINE_META_INFO_VIDEOCODEC] + = strdup ("RV 30"); break; default: printf ("libreal: error, i don't handle buf type 0x%08x\n", @@ -200,6 +204,9 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { this->width = init_data.w; this->height = init_data.h; + this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->width; + this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->height; + init_data.subformat = BE_32(&buf->content[26]); init_data.format = BE_32(&buf->content[30]); @@ -308,6 +315,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) this->last_pts = this->pts; img->duration = this->duration; + this->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] = this->duration; img->bad_frame = 0; #ifdef LOG -- cgit v1.2.3