From: <li...@yo...> - 2007-10-03 19:08:08
|
# HG changeset patch # User Darren Salt <li...@yo...> # Date 1191438239 -3600 # Node ID a33843a7bc9d39a609ef55a4c71999ed5ba4dcb3 # Parent 0221391e6bdcf968d4b3a3ba38e63950809c97c0 # Parent c6d9391b15e9aaa4c7a9cf0bb021f630ae209105 Merge from 1.1. diff -r a33843a7bc9d39a609ef55a4c71999ed5ba4dcb3 -r 0221391e6bdcf968d4b3a3ba38e63950809c97c0 ChangeLog --- a/ChangeLog Wed Oct 03 20:03:59 2007 +0100 +++ b/ChangeLog Tue Oct 02 17:07:25 2007 +0100 @@ -46,6 +46,10 @@ xine-lib (1.1.9) (unreleased) * Fix switching DVB subtitles channels. * DVB sub: switch to dyn mem alloc and allow multiple CLUTs per page. * Check if DVB sub PTS is reliable and show sub immediately if it's not. + * Fix incorrect H.264 detection on successive MPEG1/2 B frames. + * Add UI option to configure FFmpeg's video decoder thread count. + * Improve syncing of audio and video in the presence of bad frames. + * Improve handling of invalid or unknown frame sizes. xine-lib (1.1.8) * Send a channel-changed event to the frontend when receiving the SYNC diff -r a33843a7bc9d39a609ef55a4c71999ed5ba4dcb3 -r 0221391e6bdcf968d4b3a3ba38e63950809c97c0 src/demuxers/demux_mpeg_pes.c --- a/src/demuxers/demux_mpeg_pes.c Wed Oct 03 20:03:59 2007 +0100 +++ b/src/demuxers/demux_mpeg_pes.c Tue Oct 02 17:07:25 2007 +0100 @@ -1110,7 +1110,7 @@ static int32_t parse_video_stream(demux_ uint8_t *pp = p + 2, *pp_limit = p + payload_size - 1; while (0 < pp && pp < pp_limit) { if (pp[0] == 0x01 && pp[-1] == 0x00 && pp[-2] == 0x00) { - if (pp[1] >= 0x80) { /* MPEG 1/2 start code */ + if (pp[1] >= 0x80 || !pp[1]) { /* MPEG 1/2 start code */ this->mpeg12_h264_detected = 2; break; } else { diff -r a33843a7bc9d39a609ef55a4c71999ed5ba4dcb3 -r 0221391e6bdcf968d4b3a3ba38e63950809c97c0 src/libffmpeg/ff_video_decoder.c --- a/src/libffmpeg/ff_video_decoder.c Wed Oct 03 20:03:59 2007 +0100 +++ b/src/libffmpeg/ff_video_decoder.c Tue Oct 02 17:07:25 2007 +0100 @@ -65,6 +65,7 @@ typedef struct ff_video_class_s { video_decoder_class_t decoder_class; int pp_quality; + int thread_count; xine_t *xine; } ff_video_class_t; @@ -366,6 +367,12 @@ static void init_video_codec (ff_video_d _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); return; } + + if (this->class->thread_count > 1) { + avcodec_thread_init(this->context, this->class->thread_count); + this->context->thread_count = this->class->thread_count; + } + pthread_mutex_unlock(&ffmpeg_lock); lprintf("lavc decoder opened\n"); @@ -418,6 +425,12 @@ static void init_video_codec (ff_video_d break; } +} + +static void thread_count_cb(void *user_data, xine_cfg_entry_t *entry) { + ff_video_class_t *class = (ff_video_class_t *) user_data; + + class->thread_count = entry->num_value; } static void pp_quality_cb(void *user_data, xine_cfg_entry_t *entry) { @@ -1292,14 +1305,17 @@ static void ff_handle_buffer (ff_video_d } if (!got_one_picture) { - /* skipped frame, output a bad frame */ + /* skipped frame, output a bad frame (of size 1x1 when size still uninitialized) */ img = this->stream->video_out->get_frame (this->stream->video_out, - this->bih.biWidth, - this->bih.biHeight, + (this->bih.biWidth <= 0) ? 1 : this->bih.biWidth, + (this->bih.biHeight <= 0) ? 1 : this->bih.biHeight, this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); - img->pts = 0; + /* set PTS to allow early syncing */ + img->pts = this->pts; + this->pts = 0; + img->duration = this->video_step; img->bad_frame = 1; this->skipframes = img->draw(img, this->stream); @@ -1525,6 +1541,15 @@ void *init_video_plugin (xine_t *xine, v "too much."), 10, pp_quality_cb, this); + this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1, + _("FFmpeg video decoding thread count"), + _("You can adjust the number of video decoding threads which FFmpeg may use.\n" + "Higher values should speed up decoding but it depends on the codec used " + "whether parallel decoding is supported. A rule of thumb is to have one " + "decoding thread per logical CPU (typically 1 to 4). A change will take " + "effect with playing the next stream."), + 10, thread_count_cb, this); + return this; } diff -r a33843a7bc9d39a609ef55a4c71999ed5ba4dcb3 -r 0221391e6bdcf968d4b3a3ba38e63950809c97c0 src/video_out/video_out_xv.c --- a/src/video_out/video_out_xv.c Wed Oct 03 20:03:59 2007 +0100 +++ b/src/video_out/video_out_xv.c Tue Oct 02 17:07:25 2007 +0100 @@ -252,11 +252,6 @@ static XvImage *create_ximage (xv_driver unsigned int xv_format; XvImage *image = NULL; - if (width <= 0) - width = 1; - if (height <= 0) - height = 1; - if (this->use_pitch_alignment) { lprintf ("use_pitch_alignment old width=%d",width); width = (width + 7) & ~0x7; diff -r a33843a7bc9d39a609ef55a4c71999ed5ba4dcb3 -r 0221391e6bdcf968d4b3a3ba38e63950809c97c0 src/video_out/video_out_xxmc.c --- a/src/video_out/video_out_xxmc.c Wed Oct 03 20:03:59 2007 +0100 +++ b/src/video_out/video_out_xxmc.c Tue Oct 02 17:07:25 2007 +0100 @@ -605,11 +605,6 @@ static XvImage *create_ximage (xxmc_driv int width, int height, int format) { unsigned int xv_format; XvImage *image = NULL; - - if (width <= 0) - width = 1; - if (height <= 0) - height = 1; if (this->use_pitch_alignment) { width = (width + 7) & ~0x7; |