diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-07-02 14:55:24 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-07-02 14:55:24 +0200 |
commit | 98b085ddc29581003d76acb79ca4484fcf25b555 (patch) | |
tree | 424ef54c9f369f485c50cd41f70ef148d5a4cc44 | |
parent | 2ce81d93218aef7cd8fb362d3e1881237b41b5eb (diff) | |
download | xine-lib-98b085ddc29581003d76acb79ca4484fcf25b555.tar.gz xine-lib-98b085ddc29581003d76acb79ca4484fcf25b555.tar.bz2 |
Fix demuxing of wavpack files, and avoid crashing with the tags at the end of the file.
-rw-r--r-- | src/combined/demux_wavpack.c | 8 | ||||
-rw-r--r-- | src/demuxers/demux_matroska.c | 10 | ||||
-rw-r--r-- | src/demuxers/matroska.h | 1 | ||||
-rw-r--r-- | src/libffmpeg/ff_video_decoder.c | 3 | ||||
-rw-r--r-- | src/xine-engine/buffer.h | 1 |
5 files changed, 16 insertions, 7 deletions
diff --git a/src/combined/demux_wavpack.c b/src/combined/demux_wavpack.c index 6a0e33e19..7343976fa 100644 --- a/src/combined/demux_wavpack.c +++ b/src/combined/demux_wavpack.c @@ -28,6 +28,7 @@ #define LOG_MODULE "demux_wavpack" #define LOG_VERBOSE +#define LOG #include "xine_internal.h" #include "xineutils.h" @@ -230,11 +231,12 @@ static int demux_wv_send_chunk(demux_plugin_t *const this_gen) { input_time_guess *= buf->extra_info->input_normpos; input_time_guess /= 65535; buf->extra_info->input_time = input_time_guess; + + if ( ! header_sent ) + offset = sizeof(wvheader_t); - bytes_to_read_now = ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read; + bytes_to_read_now = ( bytes_to_read+offset > buf->max_size ) ? buf->max_size-offset : bytes_to_read; if ( ! header_sent ) { - bytes_to_read_now -= (offset = sizeof(wvheader_t)); - header_sent = 1; xine_fast_memcpy(buf->content, &header, sizeof(wvheader_t)); } diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 1c285a353..502d1d620 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -617,8 +617,7 @@ static void init_codec_real(demux_matroska_t *this, matroska_track_t * track) { track->fifo->put (track->fifo, buf); } - -static void init_codec_vorbis(demux_matroska_t *this, matroska_track_t *track) { +static void init_codec_xiph(demux_matroska_t *this, matroska_track_t *track) { buf_element_t *buf; uint8_t nb_lace; int frame[3]; @@ -1380,6 +1379,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { init_codec = init_codec_real; } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_MJPEG)) { + } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_THEORA)) { + lprintf("MATROSKA_CODEC_ID_V_THEORA\n"); + track->buf_type = BUF_VIDEO_THEORA_RAW; + init_codec = init_codec_xiph; } else if ((!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L1)) || (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L2)) || (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L3))) { @@ -1404,7 +1407,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { lprintf("MATROSKA_CODEC_ID_A_VORBIS\n"); track->buf_type = BUF_AUDIO_VORBIS; - init_codec = init_codec_vorbis; + init_codec = init_codec_xiph; } else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_ACM)) { xine_waveformatex *wfh; @@ -1860,6 +1863,7 @@ static int parse_block (demux_matroska_t *this, uint64_t block_size, gap = flags & 1; lacing = (flags >> 1) & 0x3; + fprintf(stderr, "lacing: %x\n", lacing); if (!find_track_by_id(this, (int)track_num, &track)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h index 3bfdbdc0c..6950a0079 100644 --- a/src/demuxers/matroska.h +++ b/src/demuxers/matroska.h @@ -264,6 +264,7 @@ struct matroska_track_s { #define MATROSKA_CODEC_ID_V_REAL_RV30 "V_REAL/RV30" #define MATROSKA_CODEC_ID_V_REAL_RV40 "V_REAL/RV40" #define MATROSKA_CODEC_ID_V_MJPEG "V_MJPEG" +#define MATROSKA_CODEC_ID_V_THEORA "V_THEORA" #define MATROSKA_CODEC_ID_A_MPEG1_L1 "A_MPEG/L1" #define MATROSKA_CODEC_ID_A_MPEG1_L2 "A_MPEG/L2" diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c index 66cbc7d75..8414875aa 100644 --- a/src/libffmpeg/ff_video_decoder.c +++ b/src/libffmpeg/ff_video_decoder.c @@ -311,6 +311,7 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_KMVC, CODEC_ID_KMVC, "Karl Morton's Video Codec (ffmpeg)"}, {BUF_VIDEO_FLASHSV, CODEC_ID_FLASHSV, "Flash Screen Video (ffmpeg)"}, {BUF_VIDEO_CAVS, CODEC_ID_CAVS, "Chinese AVS (ffmpeg)"}, + {BUF_VIDEO_THEORA_RAW, CODEC_ID_THEORA, "Theora (ffmpeg)"}, }; @@ -1747,7 +1748,7 @@ static uint32_t supported_video_types[] = { #ifdef CONFIG_CAVS_DECODER BUF_VIDEO_CAVS, #endif - + BUF_VIDEO_THEORA_RAW, 0 }; diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index 64fe52a20..706a1765e 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -191,6 +191,7 @@ extern "C" { #define BUF_VIDEO_FLASHSV 0x02610000 #define BUF_VIDEO_CAVS 0x02620000 #define BUF_VIDEO_VP6F 0x02630000 +#define BUF_VIDEO_THEORA_RAW 0x02640000 /* audio buffer types: (please keep in sync with buffer_types.c) */ |