From 9c59211e1b6f6c41c5915a49e42737408ba7a680 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Sat, 19 Jan 2008 13:43:30 +0100 Subject: Be sure libmad has enough data. Fixed random glitches. --- src/libmad/xine_mad_decoder.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/libmad/xine_mad_decoder.c b/src/libmad/xine_mad_decoder.c index 2f6d7cfe3..be616be36 100644 --- a/src/libmad/xine_mad_decoder.c +++ b/src/libmad/xine_mad_decoder.c @@ -48,6 +48,20 @@ #define INPUT_BUF_SIZE 16384 +/* According to Rob Leslie (libmad author) : + * The absolute theoretical maximum frame size is 2881 bytes: MPEG 2.5 Layer II, + * 8000 Hz @ 160 kbps, with a padding slot. (Such a frame is unlikely, but it was + * a useful exercise to compute all possible frame sizes.) Add to this an 8 byte + * MAD_BUFFER_GUARD, and the minimum buffer size you should be streaming to + * libmad in the general case is 2889 bytes. + + * Theoretical frame sizes for Layer III range from 24 to 1441 bytes, but there + * is a "soft" limit imposed by the standard of 960 bytes. Nonetheless MAD can + * decode frames of any size as long as they fit entirely in the buffer you pass, + * not including the MAD_BUFFER_GUARD bytes. + */ +#define MAD_MIN_SIZE 2889 + typedef struct { audio_decoder_class_t decoder_class; } mad_class_t; @@ -136,8 +150,8 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { mad_decoder_t *this = (mad_decoder_t *) this_gen; - lprintf ("decode data, decoder_flags: %d\n", buf->decoder_flags); - + lprintf ("decode data, size: %d, decoder_flags: %d\n", buf->size, buf->decoder_flags); + if (buf->size>(INPUT_BUF_SIZE-this->bytes_in_buffer)) { xprintf (this->xstream->xine, XINE_VERBOSITY_DEBUG, "libmad: ALERT input buffer too small (%d bytes, %d avail)!\n", @@ -167,6 +181,9 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { mad_stream_buffer (&this->stream, this->buffer, this->bytes_in_buffer); + if (this->bytes_in_buffer < MAD_MIN_SIZE) + return; + while (1) { if (mad_frame_decode (&this->frame, &this->stream) != 0) { @@ -187,6 +204,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { return; default: + lprintf ("error 0x%04X, mad_stream_buffer %d bytes\n", this->stream.error, this->bytes_in_buffer); mad_stream_buffer (&this->stream, this->buffer, this->bytes_in_buffer); } -- cgit v1.2.3 From ce16be132cec33879e3f1521997aa30993d7fd93 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Sat, 19 Jan 2008 13:52:43 +0100 Subject: Initial support of free bitrate streams. --- src/demuxers/demux_mpgaudio.c | 284 ++++++++++++++++++++++++++++++------------ 1 file changed, 203 insertions(+), 81 deletions(-) diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 8e716f095..027c46c45 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -35,9 +35,9 @@ #define LOG_MODULE "demux_mpeg_audio" #define LOG_VERBOSE -/* + #define LOG -*/ + #include "xine_internal.h" #include "xineutils.h" #include "demux.h" @@ -52,7 +52,6 @@ */ #define NUM_PREVIEW_BUFFERS 2 -#define WRAP_THRESHOLD 120000 #define FOURCC_TAG BE_FOURCC #define RIFF_CHECK_BYTES 1024 @@ -77,16 +76,16 @@ /* mp3 frame struct */ typedef struct { /* header */ - double duration; - uint32_t size; /* in bytes */ + double duration; /* in milliseconds */ + uint32_t size; /* in bytes; including padding */ uint32_t bitrate; /* in bit per second */ uint16_t freq; /* in Hz */ - uint8_t layer; - uint8_t version_idx:2; /* 0: mpeg1, 1: mpeg2, 2: mpeg2.5 */ uint8_t lsf_bit:1; uint8_t channel_mode:3; + uint8_t padding:3; /* in bytes */ + uint8_t is_free_bitrate:1; } mpg_audio_frame_t; /* Xing Vbr Header struct */ @@ -125,7 +124,16 @@ typedef struct { int br; /* bitrate in bits/second */ uint32_t blocksize; + /* current mp3 frame */ mpg_audio_frame_t cur_frame; + + /* next mp3 frame, used when the frame size cannot be computed from the + * current frame header */ + mpg_audio_frame_t next_frame; + + /* reference mp3 frame, used for extra validation when sync is lost */ + mpg_audio_frame_t ref_frame; + double cur_time; /* in milliseconds */ off_t mpg_frame_start; /* offset */ @@ -135,7 +143,12 @@ typedef struct { int check_vbr_header; xing_header_t *xing_header; vbri_header_t *vbri_header; - + + int found_next_frame:1; + int has_ref_frame:1; + off_t free_bitrate_size; + uint8_t next_header[4]; + } demux_mpgaudio_t ; /* demuxer class struct */ @@ -206,14 +219,14 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con const uint32_t head = _X_BE_32(buf); const uint16_t frame_sync = head >> 21; - lprintf("header: %08X\n", head); if (frame_sync != 0x7ff) { - lprintf("invalid frame sync\n"); + lprintf("invalid frame sync %08X\n", head); return 0; } + lprintf("header: %08X\n", head); frame_header.mpeg25_bit = (head >> 20) & 0x1; - frame->lsf_bit = (head >> 19) & 0x1; + frame->lsf_bit = (head >> 19) & 0x1; if (!frame_header.mpeg25_bit) { if (frame->lsf_bit) { lprintf("reserved mpeg25 lsf combination\n"); @@ -234,14 +247,14 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con } frame_header.bitrate_idx = (head >> 12) & 0xf; - if ((frame_header.bitrate_idx == 0) || (frame_header.bitrate_idx == 15)) { - lprintf("invalid bitrate index\n"); + if (frame_header.bitrate_idx == 15) { + lprintf("invalid bitrate index: %d\n", frame_header.bitrate_idx); return 0; } frame_header.freq_idx = (head >> 10) & 0x3; if (frame_header.freq_idx == 3) { - lprintf("invalid frequence index\n"); + lprintf("invalid frequence index: %d\n", frame_header.freq_idx); return 0; } @@ -274,19 +287,27 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con const uint16_t samples = mp3_samples[frame->version_idx][frame->layer - 1]; frame->bitrate = mp3_bitrates[frame->version_idx][frame->layer - 1][frame_header.bitrate_idx] * 1000; frame->freq = mp3_freqs[frame->version_idx][frame_header.freq_idx]; - - frame->size = samples * (frame->bitrate / 8); - frame->size /= frame->freq; - /* Padding: only if padding_bit is set; 4 bytes for Layer 1 and 1 byte for others */ - frame->size += ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 ); - frame->duration = 1000.0f * (double)samples / (double)frame->freq; + frame->padding = ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 ); + frame->channel_mode = frame_header.channel_mode; + + if (frame->bitrate > 0) { + frame->size = samples * (frame->bitrate / 8); + frame->size /= frame->freq; + /* Padding: only if padding_bit is set; 4 bytes for Layer 1 and 1 byte for others */ + frame->size += frame->padding; + } else { + /* Free bitrate frame, the size of the frame cannot be computed from the header. */ + frame->is_free_bitrate = 1; + frame->size = 0; + } } - lprintf("mpeg %d, layer %d\n", frame->version_idx + 1, frame->layer); - lprintf("bitrate: %d bps, samplerate: %d Hz\n", frame->bitrate, frame->freq); + lprintf("mpeg %d, layer %d, channel_mode: %d\n", frame->version_idx + 1, + frame->layer, frame->channel_mode); + lprintf("bitrate: %d bps, output freq: %d Hz\n", frame->bitrate, frame->freq); lprintf("length: %d bytes, %f ms\n", frame->size, frame->duration); - lprintf("padding: %d bytes\n", ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 )); + lprintf("padding: %d bytes\n", frame->padding); return 1; } @@ -478,6 +499,25 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, } } +static int check_frame_validity(demux_mpgaudio_t *const this, mpg_audio_frame_t *const frame) { + int result = 0; + + if (this->ref_frame.is_free_bitrate) { + if ((frame->bitrate == 0) && + (this->ref_frame.freq == frame->freq) && + (this->ref_frame.version_idx == frame->version_idx) && + (this->ref_frame.channel_mode == frame->channel_mode)) { + result = 1; + } + } else { + if ((this->ref_frame.version_idx == frame->version_idx) && + (this->ref_frame.channel_mode == frame->channel_mode)) { + result = 1; + } + } + return result; +} + /* * Parse a mp3 frame paylod * return 1 on success, 0 on error @@ -488,9 +528,10 @@ static int parse_frame_payload(demux_mpgaudio_t *this, buf_element_t *buf; off_t frame_pos, len; uint64_t pts = 0; + int payload_size = 0; frame_pos = this->input->get_current_pos(this->input) - 4; - lprintf("frame_pos = %"PRId64"\n", frame_pos); + lprintf("frame_pos = %"PRId64", header: %08X\n", frame_pos, _X_BE_32(frame_header)); buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); @@ -500,31 +541,93 @@ static int parse_frame_payload(demux_mpgaudio_t *this, buf->free_buffer(buf); return 0; } - + /* the decoder needs the frame header */ - memcpy(buf->mem, frame_header, 4); + if (!this->found_next_frame) { + memcpy(buf->content, frame_header, 4); + } - len = this->input->read(this->input, buf->mem + 4, this->cur_frame.size - 4); - if (len != (this->cur_frame.size - 4)) { - buf->free_buffer(buf); - return 0; + /* compute the payload size */ + if (this->cur_frame.size > 0) { + payload_size = this->cur_frame.size - 4; + } else if (this->free_bitrate_size > 0) { +// payload_size = this->free_bitrate_size + this->cur_frame.padding - 4; +// this->cur_frame.size = payload_size + 4; + payload_size = 0; + } else { + payload_size = 0; + } + + /* Read the payload data. */ + if (payload_size > 0) { + off_t len; + + /* If we know the payload size, it's easy */ + this->found_next_frame = 0; + len = this->input->read(this->input, buf->content + 4, payload_size); + if (len != payload_size) { + buf->free_buffer(buf); + return 0; + } + } else { + /* Search for the beginning of the next frame and deduce the size of the + * current frame from the position of the next one. */ + int payload_size = 0; + int max_size = buf->max_size - 4; + int header_size = 4 * !this->found_next_frame; + + while (payload_size < max_size) { + len = this->input->read(this->input, + &buf->content[header_size + payload_size], 1); + if (len != 1) { + lprintf("EOF\n"); + buf->free_buffer(buf); + return 0; + } + payload_size += len; + + if ((header_size + payload_size) >= 4) { + if (parse_frame_header(&this->next_frame, + &buf->content[header_size + payload_size - 4])) { + if (check_frame_validity(this, &this->next_frame)) { + lprintf("found next frame header\n"); + if (this->free_bitrate_size == 0) { + this->free_bitrate_size = payload_size - this->cur_frame.padding; + } + /* don't read the frame header twice */ + this->found_next_frame = 1; + memcpy(&this->next_header[0], &buf->content[header_size + payload_size], 4); + payload_size -= 4; + break; + } else { + lprintf("invalid frame\n"); + } + } + } + } + this->cur_frame.size = header_size + payload_size + 4; + if (this->br == 0) { + this->br = 8000 * this->cur_frame.size / this->cur_frame.duration; + } + this->cur_frame.bitrate = this->br; + lprintf("free bitrate: bitrate: %d, frame size: %d\n", this->br, this->cur_frame.size); + } if (this->check_vbr_header) { this->check_vbr_header = 0; this->mpg_frame_start = frame_pos; - this->xing_header = parse_xing_header(&this->cur_frame, buf->mem, this->cur_frame.size); + this->xing_header = parse_xing_header(&this->cur_frame, buf->content, this->cur_frame.size); if (this->xing_header) { buf->free_buffer(buf); return 1; } - this->vbri_header = parse_vbri_header(&this->cur_frame, buf->mem, this->cur_frame.size); + this->vbri_header = parse_vbri_header(&this->cur_frame, buf->content, this->cur_frame.size); if (this->vbri_header) { buf->free_buffer(buf); return 1; } } - pts = (int64_t)(this->cur_time * 90.0f); @@ -533,14 +636,13 @@ static int parse_frame_payload(demux_mpgaudio_t *this, buf->extra_info->input_time = this->cur_time; buf->pts = pts; - buf->size = len + 4; - buf->content = buf->mem; + buf->size = this->cur_frame.size; buf->type = BUF_AUDIO_MPEG; buf->decoder_info[0] = 1; buf->decoder_flags = decoder_flags|BUF_FLAG_FRAME_END; + lprintf("send buffer: size=%d, pts=%"PRId64"\n", buf->size, pts); this->audio_fifo->put(this->audio_fifo, buf); - lprintf("send buffer: pts=%"PRId64"\n", pts); this->cur_time += this->cur_frame.duration; return 1; } @@ -604,56 +706,74 @@ static int read_frame_header(demux_mpgaudio_t *this, uint8_t *header_buf, int by * Parse next mp3 frame */ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int send_header) { - uint8_t header_buf[4]; - int bytes = 4; - - for (;;) { - - if (read_frame_header(this, header_buf, bytes)) { - - if (parse_frame_header(&this->cur_frame, header_buf)) { - - /* send header buffer */ - if ( send_header ) { - buf_element_t *buf; - - buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); - - buf->type = BUF_AUDIO_MPEG; - buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; - - buf->decoder_info[0] = 0; - buf->decoder_info[1] = this->cur_frame.freq; - buf->decoder_info[2] = 0; /* bits_per_sample */ - - /* Only for channel_mode == 3 (mono) there is one channel, for any other case, there are 2 */ - buf->decoder_info[3] = ( this->cur_frame.channel_mode == 3 ) ? 1 : 2; - - buf->size = 0; /* No extra header data */ - - this->audio_fifo->put(this->audio_fifo, buf); - } - - return parse_frame_payload(this, header_buf, decoder_flags); - - } else if ( id3v2_istag(header_buf) ) { - if (!id3v2_parse_tag(this->input, this->stream, header_buf)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2 tag parsing error\n"); - bytes = 1; /* resync */ + uint8_t buffer[4]; + uint8_t *header = buffer; + + if (this->found_next_frame) { + lprintf("skip header reading\n"); + header = this->next_header; + memcpy(&this->cur_frame, &this->next_frame, sizeof(mpg_audio_frame_t)); + } else { + int bytes = 4; + + for (;;) { + if (!read_frame_header(this, header, bytes)) + return 0; + if (parse_frame_header(&this->cur_frame, header)) { + if (!this->has_ref_frame) { + this->has_ref_frame = 1; + memcpy(&this->ref_frame, &this->cur_frame, sizeof(mpg_audio_frame_t)); + lprintf("ref frame saved\n"); } else { - bytes = 4; + if (!check_frame_validity(this, &this->cur_frame)) { + lprintf("invalid frame\n"); + bytes = 1; /* resync */ + continue; + } } + lprintf("frame found\n"); + break; } else { - /* skip */ - bytes = 1; + lprintf("loose sync\n"); + + if ( id3v2_istag(header) ) { + if (!id3v2_parse_tag(this->input, this->stream, header)) { + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2 tag parsing error\n"); + bytes = 1; /* resync */ + } else { + bytes = 4; + } + } else { + /* skip */ + bytes = 1; + } } - - } else { - lprintf("read error\n"); - return 0; } } + + /* send header buffer */ + if ( send_header ) { + buf_element_t *buf; + + buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); + + buf->type = BUF_AUDIO_MPEG; + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; + + buf->decoder_info[0] = 0; + buf->decoder_info[1] = this->cur_frame.freq; + buf->decoder_info[2] = 0; /* bits_per_sample */ + + /* Only for channel_mode == 3 (mono) there is one channel, for any other case, there are 2 */ + buf->decoder_info[3] = ( this->cur_frame.channel_mode == 3 ) ? 1 : 2; + + buf->size = 0; /* No extra header data */ + + this->audio_fifo->put(this->audio_fifo, buf); + } + + return parse_frame_payload(this, header, decoder_flags); } static int demux_mpgaudio_send_chunk (demux_plugin_t *this_gen) { @@ -779,6 +899,7 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { */ this->check_vbr_header = 1; for (i = 0; i < NUM_PREVIEW_BUFFERS; i++) { + lprintf("preview buffer number %d / %d\n", i + 1, NUM_PREVIEW_BUFFERS); if (!demux_mpgaudio_next (this, BUF_FLAG_PREVIEW, i == 0)) { break; } @@ -965,7 +1086,8 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen, /* assume seeking is always perfect... */ this->cur_time = start_time; this->input->seek (this->input, seek_pos, SEEK_SET); - + this->found_next_frame = 0; + if (playing) { _x_demux_flush_engine(this->stream); } -- cgit v1.2.3 From ead9fc9aabadff4ea507e442a272ca2847ec537d Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Sat, 19 Jan 2008 20:33:21 +0100 Subject: Cleanup. --- src/demuxers/demux_mpgaudio.c | 50 ++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 027c46c45..afd695d84 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -542,17 +542,14 @@ static int parse_frame_payload(demux_mpgaudio_t *this, return 0; } - /* the decoder needs the frame header */ - if (!this->found_next_frame) { - memcpy(buf->content, frame_header, 4); - } + memcpy(buf->content, frame_header, 4); /* compute the payload size */ if (this->cur_frame.size > 0) { payload_size = this->cur_frame.size - 4; } else if (this->free_bitrate_size > 0) { -// payload_size = this->free_bitrate_size + this->cur_frame.padding - 4; -// this->cur_frame.size = payload_size + 4; + payload_size = this->free_bitrate_size + this->cur_frame.padding - 4; + this->cur_frame.size = payload_size + 4; payload_size = 0; } else { payload_size = 0; @@ -574,11 +571,9 @@ static int parse_frame_payload(demux_mpgaudio_t *this, * current frame from the position of the next one. */ int payload_size = 0; int max_size = buf->max_size - 4; - int header_size = 4 * !this->found_next_frame; while (payload_size < max_size) { - len = this->input->read(this->input, - &buf->content[header_size + payload_size], 1); + len = this->input->read(this->input, &buf->content[payload_size], 1); if (len != 1) { lprintf("EOF\n"); buf->free_buffer(buf); @@ -586,32 +581,29 @@ static int parse_frame_payload(demux_mpgaudio_t *this, } payload_size += len; - if ((header_size + payload_size) >= 4) { - if (parse_frame_header(&this->next_frame, - &buf->content[header_size + payload_size - 4])) { - if (check_frame_validity(this, &this->next_frame)) { - lprintf("found next frame header\n"); - if (this->free_bitrate_size == 0) { - this->free_bitrate_size = payload_size - this->cur_frame.padding; - } - /* don't read the frame header twice */ - this->found_next_frame = 1; - memcpy(&this->next_header[0], &buf->content[header_size + payload_size], 4); - payload_size -= 4; - break; - } else { - lprintf("invalid frame\n"); + if (parse_frame_header(&this->next_frame, + &buf->content[payload_size - 4])) { + if (check_frame_validity(this, &this->next_frame)) { + lprintf("found next frame header\n"); + if (this->free_bitrate_size == 0) { + this->free_bitrate_size = payload_size - this->cur_frame.padding; } + /* don't read the frame header twice */ + this->found_next_frame = 1; + memcpy(&this->next_header[0], &buf->content[payload_size], 4); + payload_size -= 4; + break; + } else { + lprintf("invalid frame\n"); } } } - this->cur_frame.size = header_size + payload_size + 4; + this->cur_frame.size = payload_size + 4; if (this->br == 0) { this->br = 8000 * this->cur_frame.size / this->cur_frame.duration; } this->cur_frame.bitrate = this->br; lprintf("free bitrate: bitrate: %d, frame size: %d\n", this->br, this->cur_frame.size); - } if (this->check_vbr_header) { @@ -904,7 +896,7 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { break; } } - + if (this->xing_header) { xing_header_t *xing = this->xing_header; @@ -915,7 +907,7 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { if (this->stream_length) { this->br = ((uint64_t)xing->stream_size * 8 * 1000) / this->stream_length; } - + } else if (this->vbri_header) { vbri_header_t *vbri = this->vbri_header; @@ -958,7 +950,7 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { { char scratch_buf[256]; char *mpeg_ver[3] = {"1", "2", "2.5"}; - + snprintf(scratch_buf, 256, "MPEG %s Layer %1d%s", mpeg_ver[this->cur_frame.version_idx], this->cur_frame.layer, (this->xing_header)? " VBR" : " CBR" ); -- cgit v1.2.3 From 831fa3d538480c035102864007dc4eb4969f2fd7 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 17 Jan 2008 23:51:26 +0000 Subject: Correct the changelog entry for the security fix in 1.1.9.1. --HG-- extra : transplant_source : AR%05H%29fH%3B%A37F%22h%85%7D%09%11/%FE%DF --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ec47096eb..9da723f22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,8 @@ xine-lib (1.1.10) (unreleased) xine-lib (1.1.9.1) * Security fixes: - - Fix a buffer overflow in RTSP header-handling code. (CVE-2008-0225) + - Buffer overflow which allows a remote attacker to execute arbitrary + code via a crafted SDP Abstract attribute. (CVE-2008-0225) (Fix ported from mplayer changeset 22821) * Fix a read-past-end bug in xine-lib's internal strtok_r replacement. (Only affects systems without strtok_r.) [Bug #19] -- cgit v1.2.3 From e372abc3772aa47b90fa0aadddb65ba33c54f574 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 20 Jan 2008 01:09:10 +0000 Subject: Comment out "#define LOG" again. --- src/demuxers/demux_mpgaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index afd695d84..ee1dc915c 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -35,9 +35,9 @@ #define LOG_MODULE "demux_mpeg_audio" #define LOG_VERBOSE - +/* #define LOG - +*/ #include "xine_internal.h" #include "xineutils.h" #include "demux.h" -- cgit v1.2.3 From 21cdfa5236fa3a76c87ef9ea9a783fcce394eafe Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 20 Jan 2008 01:40:38 +0000 Subject: Update suggested packages: drop libartsc0, move -doc from Recommends. --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 7d93d2f7e..de1467cc5 100644 --- a/debian/control +++ b/debian/control @@ -64,8 +64,8 @@ Description: the xine video player library, development packages Package: libxine1 Architecture: any Depends: ${shlibs:Depends} -Recommends: ${shlibs:Recommends}, libxine1-doc | libxine-doc -Suggests: ${shlibs:Suggests}, libartsc0 +Recommends: ${shlibs:Recommends} +Suggests: ${shlibs:Suggests}, libxine1-doc | libxine-doc Conflicts: libxine1-all-plugins, libxine1-bin, libxine1-console, libxine1-ffmpeg, libxine1-gnome, libxine1-misc-plugins, libxine1-plugins, libxine1-x Replaces: libxine1-all-plugins, libxine1-bin, libxine1-console, libxine1-ffmpeg, libxine1-gnome, libxine1-misc-plugins, libxine1-plugins, libxine1-x Provides: libxine1-all-plugins, libxine1-bin, libxine1-console, libxine1-ffmpeg, libxine1-gnome, libxine1-misc-plugins, libxine1-plugins, libxine1-x -- cgit v1.2.3 From dd125c93bdfbef26909ad684b678781abfd88c4a Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 20 Jan 2008 15:14:25 +0000 Subject: Don't unescape #subtitle:scheme://data. This was broken in 1.1.8 when #subtitle:/file was fixed. --- ChangeLog | 2 ++ src/xine-engine/xine.c | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9da723f22..97c69817b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ xine-lib (1.1.10) (unreleased) * Update Ogg and Annodex mimetypes and extensions. * Change the default v4l device paths to /dev/video0 and /dev/radio0. + * Fix support for subtitles with schemes (e.g. http://), partly broken + since 1.1.8. xine-lib (1.1.9.1) * Security fixes: diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index eae13bec9..4f6ba2a80 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -780,6 +780,19 @@ void _x_flush_events_queues (xine_stream_t *stream) { pthread_mutex_unlock (&stream->event_queues_lock); } +static inline int _x_path_looks_like_mrl (const char *path) +{ + if ((*path & 0xDF) < 'A' || (*path & 0xDF) > 'Z') + return 0; + + for (++path; *path; ++path) + if ((*path != '-' && *path < '0') || (*path > '9' && *path < 'A') || + (*path > 'Z' && *path < 'a') || *path > 'z') + break; + + return path[0] == ':' && path[1] == '/'; +} + /*static*/ int open_internal (xine_stream_t *stream, const char *mrl) { const char *stream_setup = NULL; @@ -1091,7 +1104,9 @@ void _x_flush_events_queues (xine_stream_t *stream) { memcpy(subtitle_mrl, tmp, strlen(tmp)); subtitle_mrl[strlen(tmp)] = '\0'; } - _x_mrl_unescape(subtitle_mrl); + /* unescape for xine_open() if the MRL looks like a raw pathname */ + if (!_x_path_looks_like_mrl(subtitle_mrl)) + _x_mrl_unescape(subtitle_mrl); stream->slave = xine_stream_new (stream->xine, NULL, stream->video_out ); stream->slave_affection = XINE_MASTER_SLAVE_PLAY | XINE_MASTER_SLAVE_STOP; if( xine_open( stream->slave, subtitle_mrl ) ) { -- cgit v1.2.3 From 94cf4ac059aa99952196af650401cdfa684e04a2 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 20 Jan 2008 15:35:05 +0000 Subject: Unescape the "#save:" filename, allowing ";" etc. in file names. This has a side effect: versions older than 1.1.10 do not unescape, so "#save:foo%23.ts" will result in a file named "foo%23.ts". Front end maintainers, beware :-) --- ChangeLog | 3 +++ src/xine-engine/xine.c | 1 + 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 97c69817b..34cf8ddb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ xine-lib (1.1.10) (unreleased) * Change the default v4l device paths to /dev/video0 and /dev/radio0. * Fix support for subtitles with schemes (e.g. http://), partly broken since 1.1.8. + * Unescape the filename in "#save:". This allows filenames to contain ';' + etc. without ambiguity, e.g. "#save:foo%3B1.ts" -> "foo;1.ts", but front + end authors should be careful with xine-lib older than 1.1.10. xine-lib (1.1.9.1) * Security fixes: diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 4f6ba2a80..13c6d19e9 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -930,6 +930,7 @@ static inline int _x_path_looks_like_mrl (const char *path) memcpy(filename, tmp, strlen(tmp)); filename[strlen(tmp)] = '\0'; } + _x_mrl_unescape(filename);# xine_log(stream->xine, XINE_LOG_MSG, _("xine: join rip input plugin\n")); input_saver = _x_rip_plugin_get_instance (stream, filename); -- cgit v1.2.3 From d19e7735c81d329742dd4a75d7115d2a2e2ed969 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 20 Jan 2008 16:06:31 +0000 Subject: Unmaking a # of it. --- src/xine-engine/xine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 13c6d19e9..0558f2f81 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -930,7 +930,7 @@ static inline int _x_path_looks_like_mrl (const char *path) memcpy(filename, tmp, strlen(tmp)); filename[strlen(tmp)] = '\0'; } - _x_mrl_unescape(filename);# + _x_mrl_unescape(filename); xine_log(stream->xine, XINE_LOG_MSG, _("xine: join rip input plugin\n")); input_saver = _x_rip_plugin_get_instance (stream, filename); -- cgit v1.2.3 From 76f79f2572257261d451b89d7c4f8a0d05a3aefe Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Mon, 21 Jan 2008 22:40:54 +0100 Subject: Fixed problems introduced by the free bitrate handling when frame sync is lost. --- src/demuxers/demux_mpgaudio.c | 133 ++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 70 deletions(-) diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index ee1dc915c..8ccaa9810 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -126,14 +126,11 @@ typedef struct { /* current mp3 frame */ mpg_audio_frame_t cur_frame; - + /* next mp3 frame, used when the frame size cannot be computed from the * current frame header */ mpg_audio_frame_t next_frame; - - /* reference mp3 frame, used for extra validation when sync is lost */ - mpg_audio_frame_t ref_frame; - + double cur_time; /* in milliseconds */ off_t mpg_frame_start; /* offset */ @@ -145,9 +142,12 @@ typedef struct { vbri_header_t *vbri_header; int found_next_frame:1; - int has_ref_frame:1; - off_t free_bitrate_size; + int free_bitrate_count; + off_t free_bitrate_size; /* use this size if 3 free bitrate frames are encountered */ uint8_t next_header[4]; + int mpg_version; + int mpg_layer; + int valid_frames; } demux_mpgaudio_t ; @@ -344,7 +344,7 @@ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, if (!xing) goto exit_error; - lprintf("Xing header found\n"); + lprintf("found Xing header\n"); ptr += 4; if (ptr >= (buf + bufsize - 4)) goto exit_error; @@ -435,7 +435,7 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, if ((ptr + 4) >= (buf + bufsize)) return 0; lprintf("Checking %08X\n", *ptr); if (_X_BE_32(ptr) == VBRI_TAG) { - lprintf("Vbri header found\n"); + lprintf("found Vbri header\n"); ptr += 4; if ((ptr + 22) >= (buf + bufsize)) return 0; @@ -499,24 +499,6 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, } } -static int check_frame_validity(demux_mpgaudio_t *const this, mpg_audio_frame_t *const frame) { - int result = 0; - - if (this->ref_frame.is_free_bitrate) { - if ((frame->bitrate == 0) && - (this->ref_frame.freq == frame->freq) && - (this->ref_frame.version_idx == frame->version_idx) && - (this->ref_frame.channel_mode == frame->channel_mode)) { - result = 1; - } - } else { - if ((this->ref_frame.version_idx == frame->version_idx) && - (this->ref_frame.channel_mode == frame->channel_mode)) { - result = 1; - } - } - return result; -} /* * Parse a mp3 frame paylod @@ -547,11 +529,12 @@ static int parse_frame_payload(demux_mpgaudio_t *this, /* compute the payload size */ if (this->cur_frame.size > 0) { payload_size = this->cur_frame.size - 4; - } else if (this->free_bitrate_size > 0) { + this->free_bitrate_count = 0; + } else if (this->free_bitrate_count >= 3) { payload_size = this->free_bitrate_size + this->cur_frame.padding - 4; this->cur_frame.size = payload_size + 4; - payload_size = 0; } else { + this->free_bitrate_count++; payload_size = 0; } @@ -573,7 +556,7 @@ static int parse_frame_payload(demux_mpgaudio_t *this, int max_size = buf->max_size - 4; while (payload_size < max_size) { - len = this->input->read(this->input, &buf->content[payload_size], 1); + len = this->input->read(this->input, &buf->content[4 + payload_size], 1); if (len != 1) { lprintf("EOF\n"); buf->free_buffer(buf); @@ -581,28 +564,22 @@ static int parse_frame_payload(demux_mpgaudio_t *this, } payload_size += len; - if (parse_frame_header(&this->next_frame, - &buf->content[payload_size - 4])) { - if (check_frame_validity(this, &this->next_frame)) { - lprintf("found next frame header\n"); - if (this->free_bitrate_size == 0) { - this->free_bitrate_size = payload_size - this->cur_frame.padding; - } - /* don't read the frame header twice */ - this->found_next_frame = 1; - memcpy(&this->next_header[0], &buf->content[payload_size], 4); - payload_size -= 4; - break; - } else { - lprintf("invalid frame\n"); + if (parse_frame_header(&this->next_frame, &buf->content[payload_size])) { + lprintf("found next frame header\n"); + + if (this->free_bitrate_size == 0) { + this->free_bitrate_size = payload_size - this->cur_frame.padding; } + + /* don't read the frame header twice */ + this->found_next_frame = 1; + memcpy(&this->next_header[0], &buf->content[payload_size], 4); + payload_size -= 4; + break; } } this->cur_frame.size = payload_size + 4; - if (this->br == 0) { - this->br = 8000 * this->cur_frame.size / this->cur_frame.duration; - } - this->cur_frame.bitrate = this->br; + this->cur_frame.bitrate = 8000 * this->cur_frame.size / this->cur_frame.duration; lprintf("free bitrate: bitrate: %d, frame size: %d\n", this->br, this->cur_frame.size); } @@ -612,11 +589,15 @@ static int parse_frame_payload(demux_mpgaudio_t *this, this->xing_header = parse_xing_header(&this->cur_frame, buf->content, this->cur_frame.size); if (this->xing_header) { buf->free_buffer(buf); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + "demux_mpgaudio: found Xing header at offset %PRId64\n", frame_pos); return 1; } this->vbri_header = parse_vbri_header(&this->cur_frame, buf->content, this->cur_frame.size); if (this->vbri_header) { buf->free_buffer(buf); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + "demux_mpgaudio: found Vbri header at offset %PRId64\n", frame_pos); return 1; } } @@ -707,39 +688,51 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s memcpy(&this->cur_frame, &this->next_frame, sizeof(mpg_audio_frame_t)); } else { int bytes = 4; + int loose_sync = 0; for (;;) { if (!read_frame_header(this, header, bytes)) return 0; if (parse_frame_header(&this->cur_frame, header)) { - if (!this->has_ref_frame) { - this->has_ref_frame = 1; - memcpy(&this->ref_frame, &this->cur_frame, sizeof(mpg_audio_frame_t)); - lprintf("ref frame saved\n"); - } else { - if (!check_frame_validity(this, &this->cur_frame)) { - lprintf("invalid frame\n"); - bytes = 1; /* resync */ - continue; - } - } lprintf("frame found\n"); - break; - } else { - lprintf("loose sync\n"); - if ( id3v2_istag(header) ) { - if (!id3v2_parse_tag(this->input, this->stream, header)) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - LOG_MODULE ": ID3V2 tag parsing error\n"); - bytes = 1; /* resync */ + /* additionnal checks */ + if ((this->mpg_version == (this->cur_frame.version_idx + 1)) && + (this->mpg_layer == this->cur_frame.layer)) { + this->valid_frames++; + break; + } else { + if (this->valid_frames > 3) { + lprintf("invalid frame. expected mpeg %d, layer %d\n", this->mpg_version, this->mpg_layer); } else { - bytes = 4; + this->mpg_version = this->cur_frame.version_idx + 1; + this->mpg_layer = this->cur_frame.layer; + this->valid_frames = 0; + break; } + } + } + + if (!loose_sync) { + off_t frame_pos = this->input->get_current_pos(this->input) - 4; + loose_sync = 1; + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": loose mp3 sync at offset %"PRId64"\n", frame_pos); + } + /* the stream is broken, don't keep info about previous frames */ + this->free_bitrate_size = 0; + + if ( id3v2_istag(header) ) { + if (!id3v2_parse_tag(this->input, this->stream, header)) { + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": ID3V2 tag parsing error\n"); + bytes = 1; /* resync */ } else { - /* skip */ - bytes = 1; + bytes = 4; } + } else { + /* skip */ + bytes = 1; } } } -- cgit v1.2.3 From e6a7cabd6e6bf25145eaef168823ab3f42dcbdc8 Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Mon, 21 Jan 2008 23:05:28 +0100 Subject: Fixed logging. Replaced a magic number by #define. --- src/demuxers/demux_mpgaudio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 8ccaa9810..180a9752c 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -33,7 +33,7 @@ #include #include -#define LOG_MODULE "demux_mpeg_audio" +#define LOG_MODULE "demux_mpgaudio" #define LOG_VERBOSE /* #define LOG @@ -51,6 +51,7 @@ * the second mp3 frame is sent to the decoder */ #define NUM_PREVIEW_BUFFERS 2 +#define NUM_VALID_FRAMES 3 #define FOURCC_TAG BE_FOURCC @@ -519,7 +520,7 @@ static int parse_frame_payload(demux_mpgaudio_t *this, if (this->cur_frame.size > buf->max_size) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: frame size is greater than fifo buffer size\n"); + LOG_MODULE ": frame size is greater than fifo buffer size\n"); buf->free_buffer(buf); return 0; } @@ -530,7 +531,7 @@ static int parse_frame_payload(demux_mpgaudio_t *this, if (this->cur_frame.size > 0) { payload_size = this->cur_frame.size - 4; this->free_bitrate_count = 0; - } else if (this->free_bitrate_count >= 3) { + } else if (this->free_bitrate_count >= NUM_VALID_FRAMES) { payload_size = this->free_bitrate_size + this->cur_frame.padding - 4; this->cur_frame.size = payload_size + 4; } else { @@ -590,14 +591,14 @@ static int parse_frame_payload(demux_mpgaudio_t *this, if (this->xing_header) { buf->free_buffer(buf); xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: found Xing header at offset %PRId64\n", frame_pos); + LOG_MODULE ": found Xing header at offset %PRId64\n", frame_pos); return 1; } this->vbri_header = parse_vbri_header(&this->cur_frame, buf->content, this->cur_frame.size); if (this->vbri_header) { buf->free_buffer(buf); xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: found Vbri header at offset %PRId64\n", frame_pos); + LOG_MODULE ": found Vbri header at offset %PRId64\n", frame_pos); return 1; } } @@ -702,7 +703,7 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s this->valid_frames++; break; } else { - if (this->valid_frames > 3) { + if (this->valid_frames >= NUM_VALID_FRAMES) { lprintf("invalid frame. expected mpeg %d, layer %d\n", this->mpg_version, this->mpg_layer); } else { this->mpg_version = this->cur_frame.version_idx + 1; -- cgit v1.2.3 From 9c0f263985b4612e7e67244d6140c087f880602c Mon Sep 17 00:00:00 2001 From: Thibaut Mattern Date: Mon, 21 Jan 2008 23:06:12 +0100 Subject: Fixed logging. --- src/demuxers/id3.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 6b36cc666..cd72646ef 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -349,21 +349,21 @@ int id3v22_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V22_ZERO_FLAG) { /* invalid flags */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid header flags (%02x)\n", tag_header.flags); + LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V22_COMPRESS_FLAG) { /* compressed tag: not supported */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: compressed tags are not supported\n"); + LOG_MODULE ": compressed tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V22_UNSYNCH_FLAG) { /* unsynchronized tag: not supported */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: unsynchronized tags are not supported\n"); + LOG_MODULE ": unsynchronized tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } @@ -375,11 +375,11 @@ int id3v22_parse_tag(input_plugin_t *input, if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v22_interp_frame(input, stream, &tag_frame_header)) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame content\n"); + LOG_MODULE ": invalid frame content\n"); } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame header\n"); + LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; } @@ -391,13 +391,13 @@ int id3v22_parse_tag(input_plugin_t *input, } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: id3v2_parse_frame_header problem\n"); + LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } } return 1; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "id3: id3v2_parse_header problem\n"); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_header problem\n"); return 0; } } @@ -543,14 +543,14 @@ int id3v23_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V23_ZERO_FLAG) { /* invalid flags */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid header flags (%02x)\n", tag_header.flags); + LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V23_UNSYNCH_FLAG) { /* unsynchronized tag: not supported */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: unsynchronized tags are not supported\n"); + LOG_MODULE ": unsynchronized tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } @@ -568,11 +568,11 @@ int id3v23_parse_tag(input_plugin_t *input, if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v23_interp_frame(input, stream, &tag_frame_header)) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame content\n"); + LOG_MODULE ": invalid frame content\n"); } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame header\n"); + LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; } @@ -584,13 +584,13 @@ int id3v23_parse_tag(input_plugin_t *input, } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: id3v2_parse_frame_header problem\n"); + LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } } return 1; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "id3v23: id3v2_parse_header problem\n"); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_header problem\n"); return 0; } } @@ -794,7 +794,7 @@ int id3v24_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V24_ZERO_FLAG) { /* invalid flags */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid header flags (%02x)\n", tag_header.flags); + LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } @@ -818,11 +818,11 @@ int id3v24_parse_tag(input_plugin_t *input, if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v24_interp_frame(input, stream, &tag_frame_header)) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame content\n"); + LOG_MODULE ": invalid frame content\n"); } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame header\n"); + LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; } @@ -834,7 +834,7 @@ int id3v24_parse_tag(input_plugin_t *input, } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: id3v2_parse_frame_header problem\n"); + LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } } @@ -844,7 +844,7 @@ int id3v24_parse_tag(input_plugin_t *input, } return 1; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "id3v23: id3v2_parse_header problem\n"); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_header problem\n"); return 0; } } @@ -858,22 +858,22 @@ int id3v2_parse_tag(input_plugin_t *input, switch(mp3_frame_header[3]) { case 2: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.2 tag\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.2 tag\n"); result = id3v22_parse_tag(input, stream, mp3_frame_header); break; case 3: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.3 tag\n"); result = id3v23_parse_tag(input, stream, mp3_frame_header); break; case 4: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.4 tag\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.4 tag\n"); result = id3v24_parse_tag(input, stream, mp3_frame_header); break; default: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "Unknown ID3v2 version: 0x%02x.\n", mp3_frame_header[3]); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": Unknown ID3v2 version: 0x%02x.\n", mp3_frame_header[3]); } return result; -- cgit v1.2.3