From 0b76e73f92bdac7ddcac493c736fe594ed4cffd5 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Mon, 27 Oct 2003 23:23:29 +0000 Subject: Use info_helper functions CVS patchset: 5622 CVS date: 2003/10/27 23:23:29 --- src/demuxers/demux_asf.c | 11 ++++----- src/demuxers/demux_mpgaudio.c | 56 +++++++++---------------------------------- src/demuxers/demux_ogg.c | 18 ++++++-------- src/demuxers/demux_real.c | 38 +++++++++-------------------- src/demuxers/demux_wc3movie.c | 4 ++-- 5 files changed, 35 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index b33ecd86d..eb6f01502 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.135 2003/10/16 21:38:03 tmattern Exp $ + * $Id: demux_asf.c,v 1.136 2003/10/27 23:23:29 tmattern Exp $ * * demultiplexer for asf streams * @@ -627,12 +627,9 @@ static int demux_asf_send_headers_common (demux_asf_t *this, int send_ctrl_start xine_demux_control_start(this->stream); } - this->stream->meta_info[XINE_META_INFO_TITLE] = - strdup (this->title); - this->stream->meta_info[XINE_META_INFO_ARTIST] = - strdup (this->author); - this->stream->meta_info[XINE_META_INFO_COMMENT] = - strdup (this->comment); + xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, this->title); + xine_set_meta_info(this->stream, XINE_META_INFO_ARTIST, this->author); + xine_set_meta_info(this->stream, XINE_META_INFO_COMMENT, this->comment); /* Choose the best audio and the best video stream. diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 0f91d3184..c59993b14 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.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_mpgaudio.c,v 1.118 2003/10/13 18:31:34 valtri Exp $ + * $Id: demux_mpgaudio.c,v 1.119 2003/10/27 23:23:29 tmattern Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -518,19 +518,6 @@ static int sniff_buffer_looks_like_mp3 (input_plugin_t *input) return 0; } -static void chomp (char *str) { - - int i,len; - - len = strlen(str); - i = len - 1; - - while (((unsigned char)str[i] <= 32) && (i >= 0)) { - str[i] = 0; - i--; - } -} - static void read_id3_tags (demux_mpgaudio_t *this) { off_t len; @@ -544,25 +531,10 @@ static void read_id3_tags (demux_mpgaudio_t *this) { if ( (tag.tag[0]=='T') && (tag.tag[1]=='A') && (tag.tag[2]=='G') ) { lprintf("id3v1 tag found\n"); - - tag.title[29] = 0; - tag.artist[29] = 0; - tag.album[29] = 0; - tag.comment[29] = 0; - - chomp (tag.title); - chomp (tag.artist); - chomp (tag.album); - chomp (tag.comment); - - this->stream->meta_info [XINE_META_INFO_TITLE] - = strdup (tag.title); - this->stream->meta_info [XINE_META_INFO_ARTIST] - = strdup (tag.artist); - this->stream->meta_info [XINE_META_INFO_ALBUM] - = strdup (tag.album); - this->stream->meta_info [XINE_META_INFO_COMMENT] - = strdup (tag.comment); + xine_set_metan_info(this->stream, XINE_META_INFO_TITLE, tag.title, 30); + xine_set_metan_info(this->stream, XINE_META_INFO_ARTIST, tag.artist, 30); + xine_set_metan_info(this->stream, XINE_META_INFO_ALBUM, tag.album, 30); + xine_set_metan_info(this->stream, XINE_META_INFO_COMMENT, tag.comment, 30); } } } @@ -606,12 +578,6 @@ static int id3v22_parse_frame_header(input_plugin_t *input, } } -static void mpg123_set_meta_info(xine_stream_t *stream, int info, char* txt) { - if (stream->meta_info [info]) - free(stream->meta_info [info]); - stream->meta_info [info] = strdup(txt); -} - static int id3v22_interp_frame(demux_mpgaudio_t *this, id3v22_frame_header_t *frame_header) { /* @@ -629,27 +595,27 @@ static int id3v22_interp_frame(demux_mpgaudio_t *this, switch (frame_header->id) { case (FOURCC_TAG(0, 'T', 'T', '1')): - mpg123_set_meta_info(this->stream, XINE_META_INFO_GENRE, buf + 1); + xine_set_meta_info(this->stream, XINE_META_INFO_GENRE, buf + 1); break; case (FOURCC_TAG(0, 'T', 'T', '2')): - mpg123_set_meta_info(this->stream, XINE_META_INFO_TITLE, buf + 1); + xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, buf + 1); break; case (FOURCC_TAG(0, 'T', 'P', '1')): - mpg123_set_meta_info(this->stream, XINE_META_INFO_ARTIST, buf + 1); + xine_set_meta_info(this->stream, XINE_META_INFO_ARTIST, buf + 1); break; case (FOURCC_TAG(0, 'T', 'A', 'L')): - mpg123_set_meta_info(this->stream, XINE_META_INFO_ALBUM, buf + 1); + xine_set_meta_info(this->stream, XINE_META_INFO_ALBUM, buf + 1); break; case (FOURCC_TAG(0, 'T', 'Y', 'E')): - mpg123_set_meta_info(this->stream, XINE_META_INFO_YEAR, buf + 1); + xine_set_meta_info(this->stream, XINE_META_INFO_YEAR, buf + 1); break; case (FOURCC_TAG(0, 'C', 'O', 'M')): - mpg123_set_meta_info(this->stream, XINE_META_INFO_COMMENT, buf + 1 + 3); + xine_set_meta_info(this->stream, XINE_META_INFO_COMMENT, buf + 1 + 3); break; default: diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 654f74d5e..0c25bdaea 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.109 2003/10/06 15:46:20 mroi Exp $ + * $Id: demux_ogg.c,v 1.110 2003/10/27 23:23:29 tmattern Exp $ * * demultiplexer for ogg streams * @@ -514,8 +514,8 @@ static void send_ogg_buf (demux_ogg_t *this, while(*ptr) { comment=*ptr; if ( !strncasecmp ("TITLE=", comment,6) ) { - this->title=strdup (comment + strlen ("TITLE=") ); - this->stream->meta_info[XINE_META_INFO_TITLE] = strdup (this->title); + this->title = strdup (comment + strlen ("TITLE=") ); + xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, this->title); } if ( !chapter_time && strlen(comment) == 22 && !strncasecmp ("CHAPTER" , comment, 7) && @@ -622,15 +622,13 @@ static void send_ogg_buf (demux_ogg_t *this, int title_len; this->chapter_info->current_chapter = chapter; - if (this->stream->meta_info[XINE_META_INFO_TITLE]) - free (this->stream->meta_info[XINE_META_INFO_TITLE]); if (chapter >= 0) { char t_title[256]; sprintf(t_title, "%s / %s", this->title, this->chapter_info->entries[chapter].name); - this->stream->meta_info[XINE_META_INFO_TITLE] = strdup(t_title); + xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, t_title); } else { - this->stream->meta_info[XINE_META_INFO_TITLE] = strdup (this->title); + xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, this->title); } lprintf("new TITLE: %s\n", this->stream->meta_info[XINE_META_INFO_TITLE]); @@ -1145,8 +1143,7 @@ static void demux_ogg_send_header (demux_ogg_t *this) { this->preview_buffers[stream_num]=3; this->buf_types[stream_num] = BUF_VIDEO_THEORA; - this->stream->meta_info[XINE_META_INFO_VIDEOCODEC] - = strdup ("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] @@ -1174,8 +1171,7 @@ static void demux_ogg_send_header (demux_ogg_t *this) { } #else this->buf_types[stream_num] = BUF_VIDEO_THEORA; - this->stream->meta_info[XINE_META_INFO_VIDEOCODEC] - = strdup ("theora"); + xine_set_meta_info(this->stream, XINE_META_INFO_VIDEOCODEC, "theora"); #endif } else { diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index fe5dbb6c1..cfcdbab8b 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -30,7 +30,7 @@ * * Based on FFmpeg's libav/rm.c. * - * $Id: demux_real.c,v 1.65 2003/07/25 21:02:05 miguelfreitas Exp $ + * $Id: demux_real.c,v 1.66 2003/10/27 23:23:29 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -473,45 +473,29 @@ unknown: /* load the title string */ field_size = BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; - this->stream->meta_info[XINE_META_INFO_TITLE] = - realloc (this->stream->meta_info[XINE_META_INFO_TITLE], - field_size + 1); - strncpy(this->stream->meta_info[XINE_META_INFO_TITLE], - &chunk_buffer[stream_ptr], field_size); - this->stream->meta_info[XINE_META_INFO_TITLE][field_size] = '\0'; + xine_set_metan_info(this->stream, XINE_META_INFO_TITLE, + &chunk_buffer[stream_ptr], field_size); stream_ptr += field_size; /* load the author string */ field_size = BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; - this->stream->meta_info[XINE_META_INFO_ARTIST] = - realloc (this->stream->meta_info[XINE_META_INFO_ARTIST], - field_size + 1); - strncpy(this->stream->meta_info[XINE_META_INFO_ARTIST], - &chunk_buffer[stream_ptr], field_size); - this->stream->meta_info[XINE_META_INFO_ARTIST][field_size] = '\0'; + xine_set_metan_info(this->stream, XINE_META_INFO_ARTIST, + &chunk_buffer[stream_ptr], field_size); stream_ptr += field_size; /* load the copyright string as the year */ field_size = BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; - this->stream->meta_info[XINE_META_INFO_YEAR] = - realloc (this->stream->meta_info[XINE_META_INFO_YEAR], - field_size + 1); - strncpy(this->stream->meta_info[XINE_META_INFO_YEAR], - &chunk_buffer[stream_ptr], field_size); - this->stream->meta_info[XINE_META_INFO_YEAR][field_size] = '\0'; + xine_set_metan_info(this->stream, XINE_META_INFO_YEAR, + &chunk_buffer[stream_ptr], field_size); stream_ptr += field_size; /* load the comment string */ field_size = BE_16(&chunk_buffer[stream_ptr]); stream_ptr += 2; - this->stream->meta_info[XINE_META_INFO_COMMENT] = - realloc (this->stream->meta_info[XINE_META_INFO_COMMENT], - field_size + 1); - strncpy(this->stream->meta_info[XINE_META_INFO_COMMENT], - &chunk_buffer[stream_ptr], field_size); - this->stream->meta_info[XINE_META_INFO_COMMENT][field_size] = '\0'; + xine_set_metan_info(this->stream, XINE_META_INFO_COMMENT, + &chunk_buffer[stream_ptr], field_size); stream_ptr += field_size; } @@ -520,8 +504,8 @@ unknown: case DATA_TAG: if (this->input->read(this->input, data_chunk_header, - DATA_CHUNK_HEADER_SIZE) != DATA_CHUNK_HEADER_SIZE) { - this->status = DEMUX_FINISHED; + DATA_CHUNK_HEADER_SIZE) != DATA_CHUNK_HEADER_SIZE) { + this->status = DEMUX_FINISHED; return ; } diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index 7d316b911..0a3abf0c1 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -24,7 +24,7 @@ * For more information on the MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_wc3movie.c,v 1.41 2003/10/23 05:18:59 tmmm Exp $ + * $Id: demux_wc3movie.c,v 1.42 2003/10/27 23:23:29 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -506,7 +506,7 @@ static int open_mve_file(demux_mve_t *this) { this->data_size = this->input->get_length(this->input) - this->data_start; this->video_pts = 0; - this->stream->meta_info[XINE_META_INFO_TITLE] = title; + xine_set_meta_info(this->stream, XINE_META_INFO_TITLE, title); return 1; } -- cgit v1.2.3