From 2ce81d93218aef7cd8fb362d3e1881237b41b5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 25 Jun 2007 13:05:45 +0200 Subject: Instead of declaring op_size, use sizeof(ogg_packet) directly. --- src/libxinevdec/xine_theora_decoder.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libxinevdec/xine_theora_decoder.c b/src/libxinevdec/xine_theora_decoder.c index 032f8800f..237eed0a9 100644 --- a/src/libxinevdec/xine_theora_decoder.c +++ b/src/libxinevdec/xine_theora_decoder.c @@ -123,23 +123,22 @@ static void yuv2frame(yuv_buffer *yuv, vo_frame_t *frame, int offset_x, int offs static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { /* Assembles an ogg_packet which was sent with send_ogg_packet over xinebuffers */ /* this->done, this->rejected, this->op and this->decoder->flags are needed*/ - int op_size = sizeof (ogg_packet); if (buf->decoder_flags & BUF_FLAG_FRAME_START) { this->done=0; /*start from the beginnig*/ this->reject=0;/*new packet - new try*/ /*copy the ogg_packet struct and the sum, correct the adress of the packet*/ - xine_fast_memcpy (&this->op, buf->content, op_size); + xine_fast_memcpy (&this->op, buf->content, sizeof(ogg_packet)); this->op.packet=this->packet; - readin_op (this, buf->content + op_size, buf->size - op_size ); + readin_op (this, buf->content + sizeof(ogg_packet), buf->size - sizeof(ogg_packet) ); /*read the rest of the data*/ } else { if (this->done==0 || this->reject) { /*we are starting to collect an packet without the beginnig - reject the rest*/ + reject the rest*/ printf ("libtheora: rejecting packet\n"); this->reject=1; return 0; -- cgit v1.2.3 From 98b085ddc29581003d76acb79ca4484fcf25b555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 2 Jul 2007 14:55:24 +0200 Subject: Fix demuxing of wavpack files, and avoid crashing with the tags at the end of the file. --- src/combined/demux_wavpack.c | 8 +++++--- src/demuxers/demux_matroska.c | 10 +++++++--- src/demuxers/matroska.h | 1 + src/libffmpeg/ff_video_decoder.c | 3 ++- 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) */ -- cgit v1.2.3