From b9d7a3c82c160c8871c9f9effbc0a91c0d42fd53 Mon Sep 17 00:00:00 2001 From: Lorenzo Desole Date: Sun, 20 Mar 2011 20:03:30 +0100 Subject: Check that we've found both AAC signatures demux_aac.c looks for 2 signatures in the given stream to detect if it is an AAC stream, however only the absence of the second signature is used to rule out a positive match. This may lead to false positives. --- src/demuxers/demux_aac.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index 6615f4f61..0ac645b78 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -122,6 +122,10 @@ static int open_aac_file(demux_aac_t *this) { syncword = (syncword << 8) | peak[i]; } + /* did we really find the ADTS header? */ + if (i == MAX_PREVIEW_SIZE) + return 0; /* No, we didn't */ + /* Look for second ADTS header to confirm it's really aac */ if (data_start + 5 < MAX_PREVIEW_SIZE) { int frame_size = ((peak[data_start+3] & 0x03) << 11) | -- cgit v1.2.3 From 48a9464eb6f0ec4fe1cadef792e041e67ccb4156 Mon Sep 17 00:00:00 2001 From: Christopher Martin Date: Sun, 15 May 2011 09:09:29 -0400 Subject: Better support for 24-bit lpcm First of all, it improves the qt demuxer, ensuring that 24-bit audio is marked appropriately, and detecting little vs. big endian audio. It also adjusts the buffer size when audio is 24-bit, ensuring that samples aren't chopped in half (8192 does not divide evenly into 3 byte samples). Secondly, in the lpcm decoder, the patch distinguishes between standard 24-bit lpcm (big and little endian) and special DVD-format 24-bit lpcm (see http://wiki.multimedia.cx/index.php?title=PCM) and now handles both, instead of only handling the DVD format. The result is that xine now correctly plays all the 24-bit lpcm samples I throw at it, whereas before only a few worked. --- src/demuxers/demux_qt.c | 27 ++++++++++++--- src/libxineadec/xine_lpcm_decoder.c | 66 +++++++++++++++++++++++++------------ src/xine-engine/buffer_types.c | 1 + 3 files changed, 69 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index d446cc17b..7c6f7efe3 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -90,6 +90,7 @@ typedef unsigned int qt_atom; #define WAVE_ATOM QT_ATOM('w', 'a', 'v', 'e') #define FRMA_ATOM QT_ATOM('f', 'r', 'm', 'a') #define AVCC_ATOM QT_ATOM('a', 'v', 'c', 'C') +#define ENDA_ATOM QT_ATOM('e', 'n', 'd', 'a') #define IMA4_FOURCC ME_FOURCC('i', 'm', 'a', '4') #define MAC3_FOURCC ME_FOURCC('M', 'A', 'C', '3') @@ -103,6 +104,8 @@ typedef unsigned int qt_atom; #define TWOS_FOURCC ME_FOURCC('t', 'w', 'o', 's') #define SOWT_FOURCC ME_FOURCC('s', 'o', 'w', 't') #define RAW_FOURCC ME_FOURCC('r', 'a', 'w', ' ') +#define IN24_FOURCC ME_FOURCC('i', 'n', '2', '4') +#define NI42_FOURCC ME_FOURCC('4', '2', 'n', 'i') #define AVC1_FOURCC ME_FOURCC('a', 'v', 'c', '1') #define UDTA_ATOM QT_ATOM('u', 'd', 't', 'a') @@ -1250,6 +1253,13 @@ static qt_error parse_trak_atom (qt_trak *trak, trak->stsd_atoms[k].audio.channels = trak_atom[atom_pos + 0x15]; trak->stsd_atoms[k].audio.bits = trak_atom[atom_pos + 0x17]; + /* 24-bit audio doesn't always declare itself properly, and can be big- or little-endian */ + if (trak->stsd_atoms[k].audio.codec_fourcc == IN24_FOURCC) { + trak->stsd_atoms[k].audio.bits = 24; + if (_X_BE_32(&trak_atom[atom_pos + 0x48]) == ENDA_ATOM && trak_atom[atom_pos + 0x4D]) + trak->stsd_atoms[k].audio.codec_fourcc = NI42_FOURCC; + } + /* assume uncompressed audio parameters */ trak->stsd_atoms[k].audio.bytes_per_sample = trak->stsd_atoms[k].audio.bits / 8; @@ -1312,11 +1322,13 @@ static qt_error parse_trak_atom (qt_trak *trak, * appears to be a handler for uncompressed data; if there are an * extra 0x10 bytes, there are some more useful decoding params; * further, do not do load these parameters if the audio is just - * PCM ('raw ', 'twos', or 'sowt') */ + * PCM ('raw ', 'twos', 'sowt' or 'in24') */ if ((current_stsd_atom_size > 0x24) && (trak->stsd_atoms[k].audio.codec_fourcc != TWOS_FOURCC) && (trak->stsd_atoms[k].audio.codec_fourcc != SOWT_FOURCC) && - (trak->stsd_atoms[k].audio.codec_fourcc != RAW_FOURCC)) { + (trak->stsd_atoms[k].audio.codec_fourcc != RAW_FOURCC) && + (trak->stsd_atoms[k].audio.codec_fourcc != IN24_FOURCC) && + (trak->stsd_atoms[k].audio.codec_fourcc != NI42_FOURCC)) { if (_X_BE_32(&trak_atom[atom_pos + 0x20])) trak->stsd_atoms[k].audio.samples_per_packet = @@ -2400,6 +2412,7 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { buf_element_t *buf = NULL; unsigned int i, j; unsigned int remaining_sample_bytes; + unsigned int frame_aligned_buf_size; int frame_duration; int first_buf; qt_trak *video_trak = NULL; @@ -2655,8 +2668,14 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) { buf->pts = audio_trak->frames[i].pts; } - if (remaining_sample_bytes > buf->max_size) - buf->size = buf->max_size; + /* 24-bit audio doesn't fit evenly into the default 8192-byte buffers */ + if (audio_trak->properties->audio.bits == 24) + frame_aligned_buf_size = 8184; + else + frame_aligned_buf_size = buf->max_size; + + if (remaining_sample_bytes > frame_aligned_buf_size) + buf->size = frame_aligned_buf_size; else buf->size = remaining_sample_bytes; remaining_sample_bytes -= buf->size; diff --git a/src/libxineadec/xine_lpcm_decoder.c b/src/libxineadec/xine_lpcm_decoder.c index 6f4e71003..17db68550 100644 --- a/src/libxineadec/xine_lpcm_decoder.c +++ b/src/libxineadec/xine_lpcm_decoder.c @@ -94,6 +94,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { int stream_be; audio_buffer_t *audio_buffer; int format_changed = 0; + int special_dvd_audio = 0; /* Drop preview data */ if (buf->decoder_flags & BUF_FLAG_PREVIEW) @@ -116,7 +117,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { switch ((buf->decoder_info[2] >> (24+6)) & 0x03) { case 1: bits_per_sample = 16; break; case 2: bits_per_sample = 20; break; - case 3: bits_per_sample = 24; break; + case 3: bits_per_sample = 24; special_dvd_audio = 1; break; default: bits_per_sample = 0; break; } switch ((buf->decoder_info[2] >> 16) & 0x0f) { @@ -152,7 +153,7 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { switch ((buf->decoder_info[2]>>6) & 3) { case 0: bits_per_sample = 16; break; case 1: bits_per_sample = 20; break; - case 2: bits_per_sample = 24; break; + case 2: bits_per_sample = 24; special_dvd_audio = 1; break; } } @@ -270,35 +271,58 @@ static void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { int n = buf_size; if ( stream_be ) { - while (n >= 12) { + if (special_dvd_audio) + while (n >= 12) { + if ( stream_be == this->cpu_be ) { + *d++ = s[0]; + *d++ = s[1]; + *d++ = s[2]; + *d++ = s[3]; + *d++ = s[4]; + *d++ = s[5]; + *d++ = s[6]; + *d++ = s[7]; + } else { + *d++ = s[1]; + *d++ = s[0]; + *d++ = s[3]; + *d++ = s[2]; + *d++ = s[5]; + *d++ = s[4]; + *d++ = s[7]; + *d++ = s[6]; + } + s += 12; + n -= 12; + } + else + while (n >= 3) { + if ( stream_be == this->cpu_be ) { + *d++ = s[0]; + *d++ = s[1]; + } else { + *d++ = s[1]; + *d++ = s[0]; + } + s += 3; + n -= 3; + } + } else { + while (n >= 3) { if ( stream_be == this->cpu_be ) { - *d++ = s[0]; *d++ = s[1]; *d++ = s[2]; - *d++ = s[3]; - *d++ = s[4]; - *d++ = s[5]; - *d++ = s[6]; - *d++ = s[7]; } else { - *d++ = s[1]; - *d++ = s[0]; - *d++ = s[3]; *d++ = s[2]; - *d++ = s[5]; - *d++ = s[4]; - *d++ = s[7]; - *d++ = s[6]; + *d++ = s[1]; } - s += 12; - n -= 12; + s += 3; + n -= 3; } - } else { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "lpcm_decoder: I don't know what should decode lpcm 24bit little endian byte stream"); } if ( (d - (uint8_t*)audio_buffer->mem)/2*3 < buf_size ) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "lpcm_decoder: lost %i bytes\n", (int)(buf_size - (d - (uint8_t*)audio_buffer->mem))/2*3); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "lpcm_decoder: lost %i bytes of %i in the buffer\n", (int)(buf_size - (d - (uint8_t*)audio_buffer->mem)/2*3), buf_size); } else { memcpy (audio_buffer->mem, sample_buffer, buf_size); diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index 1db073851..e6b846d64 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -836,6 +836,7 @@ static const audio_db_t audio_db[] = { 0x01, ME_FOURCC('r','a','w',' '), ME_FOURCC('s','o','w','t'), + ME_FOURCC('4','2','n','i'), 0 }, BUF_AUDIO_LPCM_LE, -- cgit v1.2.3 From 4decf418a1f1bd0be76734f656c2f4d63f2fe204 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 16 May 2011 15:49:02 +0100 Subject: Remove an excess "{". --- src/video_out/video_out_directfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 47ba056ae..d9968151c 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.c @@ -707,7 +707,7 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen || (frame->vo_frame.crop_left != this->sc.crop_left) || (frame->vo_frame.crop_right != this->sc.crop_right) || (frame->vo_frame.crop_top != this->sc.crop_top) - || (frame->vo_frame.crop_bottom != this->sc.crop_bottom) ) { + || (frame->vo_frame.crop_bottom != this->sc.crop_bottom) ) { lprintf ("forcing redraw.\n"); this->sc.force_redraw = 1; -- cgit v1.2.3 From c5159206dcea00766b7d567193e1c4fd13f12cf3 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Tue, 17 May 2011 02:15:12 +0000 Subject: Fix build with very recent copies of FFmpeg This is a backport of the 1.2 code that was commited to utilize the new API provided by FFmpeg for awhile now but this is especially important because the old API has been eliminated all together from said copies of FFmpeg. --- src/combined/ffmpeg/ff_audio_decoder.c | 30 +++++++++++- src/combined/ffmpeg/ff_video_decoder.c | 86 +++++++++++++++++++++++++--------- src/post/planar/pp.c | 56 ++++++++++++---------- 3 files changed, 124 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index 125eff12c..60544ad0c 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -46,6 +46,12 @@ #define AUDIOBUFSIZE (64 * 1024) +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) +# define AVAUDIO 3 +#else +# define AVAUDIO 2 +#endif + typedef struct { audio_decoder_class_t decoder_class; } ff_audio_class_t; @@ -255,6 +261,9 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) buf->decoder_info[2]); } else if (!(buf->decoder_flags & BUF_FLAG_SPECIAL)) { +#if AVAUDIO > 2 + AVPacket avpkt; +#endif if( !this->decoder_ok ) { if ( ! this->context || ! this->codec ) { @@ -286,11 +295,21 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if (!this->output_open) { if (!this->audio_bits || !this->audio_sample_rate || !this->audio_channels) { decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; +#if AVAUDIO > 2 + av_init_packet (&avpkt); + avpkt.data = (uint8_t *)&this->buf[0]; + avpkt.size = this->size; + avpkt.flags = AV_PKT_FLAG_KEY; + avcodec_decode_audio3 (this->context, + (int16_t *)this->decode_buffer, + &decode_buffer_size, &avpkt); +#else avcodec_decode_audio2 (this->context, (int16_t *)this->decode_buffer, &decode_buffer_size, &this->buf[0], this->size); +#endif this->audio_bits = this->context->bits_per_sample; this->audio_sample_rate = this->context->sample_rate; this->audio_channels = this->context->channels; @@ -311,12 +330,21 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) offset = 0; while (this->size>0) { decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; +#if AVAUDIO > 2 + av_init_packet (&avpkt); + avpkt.data = (uint8_t *)&this->buf[offset]; + avpkt.size = this->size; + avpkt.flags = AV_PKT_FLAG_KEY; + bytes_consumed = avcodec_decode_audio3 (this->context, + (int16_t *)this->decode_buffer, + &decode_buffer_size, &avpkt); +#else bytes_consumed = avcodec_decode_audio2 (this->context, (int16_t *)this->decode_buffer, &decode_buffer_size, &this->buf[offset], this->size); - +#endif if (bytes_consumed<0) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_audio_dec: error decompressing audio frame\n"); diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 7d0d74b77..ad0ee6022 100644 --- a/src/combined/ffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -58,6 +58,14 @@ #define ENABLE_DIRECT_RENDERING +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) +# define AVVIDEO 2 +#else +# define AVVIDEO 1 +# define pp_context pp_context_t +# define pp_mode pp_mode_t +#endif + /* reordered_opaque appeared in libavcodec 51.68.0 */ #define AVCODEC_HAS_REORDERED_OPAQUE #if LIBAVCODEC_VERSION_INT < 0x334400 @@ -116,8 +124,8 @@ struct ff_video_decoder_s { int pp_quality; int pp_flags; - pp_context_t *pp_context; - pp_mode_t *pp_mode; + pp_context *our_context; + pp_mode *our_mode; /* mpeg-es parsing */ mpeg_parser_t *mpeg_parser; @@ -444,23 +452,23 @@ static void pp_change_quality (ff_video_decoder_t *this) { this->pp_quality = this->class->pp_quality; if(this->pp_available && this->pp_quality) { - if(!this->pp_context && this->context) - this->pp_context = pp_get_context(this->context->width, this->context->height, + if(!this->our_context && this->context) + this->our_context = pp_get_context(this->context->width, this->context->height, this->pp_flags); - if(this->pp_mode) - pp_free_mode(this->pp_mode); + if(this->our_mode) + pp_free_mode(this->our_mode); - this->pp_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a", + this->our_mode = pp_get_mode_by_name_and_quality("hb:a,vb:a,dr:a", this->pp_quality); } else { - if(this->pp_mode) { - pp_free_mode(this->pp_mode); - this->pp_mode = NULL; + if(this->our_mode) { + pp_free_mode(this->our_mode); + this->our_mode = NULL; } - if(this->pp_context) { - pp_free_context(this->pp_context); - this->pp_context = NULL; + if(this->our_context) { + pp_free_context(this->our_context); + this->our_context = NULL; } } } @@ -1055,12 +1063,26 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu } /* skip decoding b frames if too late */ +#if AVVIDEO > 1 + this->context->skip_frame = (this->skipframes > 0) ? AVDISCARD_NONREF : AVDISCARD_DEFAULT; +#else this->context->hurry_up = (this->skipframes > 0); +#endif lprintf("avcodec_decode_video: size=%d\n", this->mpeg_parser->buffer_size); +#if AVVIDEO > 1 + AVPacket avpkt; + av_init_packet(&avpkt); + avpkt.data = (uint8_t *)this->mpeg_parser->chunk_buffer; + avpkt.size = this->mpeg_parser->buffer_size; + avpkt.flags = AV_PKT_FLAG_KEY; + len = avcodec_decode_video2 (this->context, this->av_frame, + &got_picture, &avpkt); +#else len = avcodec_decode_video (this->context, this->av_frame, &got_picture, this->mpeg_parser->chunk_buffer, this->mpeg_parser->buffer_size); +#endif lprintf("avcodec_decode_video: decoded_size=%d, got_picture=%d\n", len, got_picture); len = current - buf->content - offset; @@ -1112,7 +1134,13 @@ static void ff_handle_mpeg12_buffer (ff_video_decoder_t *this, buf_element_t *bu } else { - if (this->context->hurry_up) { + if ( +#if AVVIDEO > 1 + this->context->skip_frame != AVDISCARD_DEFAULT +#else + this->context->hurry_up +#endif + ) { /* skipped frame, output a bad frame */ img = this->stream->video_out->get_frame (this->stream->video_out, this->bih.biWidth, @@ -1304,13 +1332,25 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { got_picture = 0; } else { /* skip decoding b frames if too late */ +#if AVVIDEO > 1 + this->context->skip_frame = (this->skipframes > 0) ? AVDISCARD_NONREF : AVDISCARD_DEFAULT; +#else this->context->hurry_up = (this->skipframes > 0); - +#endif lprintf("buffer size: %d\n", this->size); +#if AVVIDEO > 1 + AVPacket avpkt; + av_init_packet(&avpkt); + avpkt.data = (uint8_t *)&chunk_buf[offset]; + avpkt.size = this->size; + avpkt.flags = AV_PKT_FLAG_KEY; + len = avcodec_decode_video2 (this->context, this->av_frame, + &got_picture, &avpkt); +#else len = avcodec_decode_video (this->context, this->av_frame, &got_picture, &chunk_buf[offset], this->size); - +#endif #ifdef AVCODEC_HAS_REORDERED_OPAQUE /* reset consumed pts value */ this->context->reordered_opaque = ff_tag_pts(this, 0); @@ -1432,7 +1472,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { img->base, img->pitches, img->width, img->height, this->av_frame->qscale_table, this->av_frame->qstride, - this->pp_mode, this->pp_context, + this->our_mode, this->our_context, this->av_frame->pict_type); } else if (!this->av_frame->opaque) { @@ -1676,11 +1716,11 @@ static void ff_dispose (video_decoder_t *this_gen) { free(this->buf); this->buf = NULL; - if(this->pp_context) - pp_free_context(this->pp_context); + if(this->our_context) + pp_free_context(this->our_context); - if(this->pp_mode) - pp_free_mode(this->pp_mode); + if(this->our_mode) + pp_free_mode(this->our_mode); mpeg_parser_dispose(this->mpeg_parser); @@ -1721,8 +1761,8 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, this->aspect_ratio = 0; this->pp_quality = 0; - this->pp_context = NULL; - this->pp_mode = NULL; + this->our_context = NULL; + this->our_mode = NULL; this->mpeg_parser = NULL; diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index c9db99f2c..6b805e20b 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -35,6 +35,12 @@ # include #endif +#if LIBPOSTPROC_VERSION_MAJOR < 52 +# define pp_context pp_context_t +# define pp_mode pp_mode_t +# define PP_PARAMETERS_T +#endif + #define PP_STRING_SIZE 256 /* size of pp mode string (including all options) */ /* plugin class initialization function */ @@ -76,14 +82,15 @@ struct post_plugin_pp_s { /* libpostproc specific stuff */ int pp_flags; - pp_context_t *pp_context; - pp_mode_t *pp_mode; + pp_context *our_context; + pp_mode *our_mode; pthread_mutex_t lock; }; static int set_parameters (xine_post_t *this_gen, void *param_gen) { +#ifdef PP_PARAMETERS_T post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; pp_parameters_t *param = (pp_parameters_t *)param_gen; @@ -92,17 +99,18 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen) { memcpy( &this->params, param, sizeof(pp_parameters_t) ); pthread_mutex_unlock (&this->lock); - +#endif return 1; } static int get_parameters (xine_post_t *this_gen, void *param_gen) { +#ifdef PP_PARAMETERS_T post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; pp_parameters_t *param = (pp_parameters_t *)param_gen; memcpy( param, &this->params, sizeof(pp_parameters_t) ); - +#endif return 1; } @@ -202,8 +210,8 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, if(cpu_caps & MM_ACCEL_X86_3DNOW) this->pp_flags |= PP_CPU_CAPS_3DNOW; - this->pp_mode = NULL; - this->pp_context = NULL; + this->our_mode = NULL; + this->our_context = NULL; pthread_mutex_init (&this->lock, NULL); @@ -248,13 +256,13 @@ static void pp_dispose(post_plugin_t *this_gen) post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; if (_x_post_dispose(this_gen)) { - if(this->pp_mode) { - pp_free_mode(this->pp_mode); - this->pp_mode = NULL; + if(this->our_mode) { + pp_free_mode(this->our_mode); + this->our_mode = NULL; } - if(this->pp_context) { - pp_free_context(this->pp_context); - this->pp_context = NULL; + if(this->our_context) { + pp_free_context(this->our_context); + this->our_context = NULL; } free(this); } @@ -304,7 +312,7 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) pthread_mutex_lock (&this->lock); - if( !this->pp_context || + if( !this->our_context || this->frame_width != yv12_frame->width || this->frame_height != yv12_frame->height ) { @@ -312,32 +320,32 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream) this->frame_height = yv12_frame->height; pp_flags = this->pp_flags; - if(this->pp_context) - pp_free_context(this->pp_context); + if(this->our_context) + pp_free_context(this->our_context); - this->pp_context = pp_get_context(frame->width, frame->height, pp_flags); + this->our_context = pp_get_context(frame->width, frame->height, pp_flags); - if(this->pp_mode) { - pp_free_mode(this->pp_mode); - this->pp_mode = NULL; + if(this->our_mode) { + pp_free_mode(this->our_mode); + this->our_mode = NULL; } } - if(!this->pp_mode) - this->pp_mode = pp_get_mode_by_name_and_quality(this->params.mode, + if(!this->our_mode) + this->our_mode = pp_get_mode_by_name_and_quality(this->params.mode, this->params.quality); - if(this->pp_mode) + if(this->our_mode) pp_postprocess(yv12_frame->base, yv12_frame->pitches, out_frame->base, out_frame->pitches, (frame->width+7)&(~7), frame->height, NULL, 0, - this->pp_mode, this->pp_context, + this->our_mode, this->our_context, 0 /*this->av_frame->pict_type*/); pthread_mutex_unlock (&this->lock); - if(this->pp_mode) { + if(this->our_mode) { skip = out_frame->draw(out_frame, stream); _x_post_frame_copy_up(frame, out_frame); } else { -- cgit v1.2.3