summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Hintukainen <phintuka@users.sourceforge.net>2012-05-04 14:07:19 +0300
committerPetri Hintukainen <phintuka@users.sourceforge.net>2012-05-04 14:07:19 +0300
commitd54db9736e41937be623353887349f0ceaf3a192 (patch)
tree187235734fe6e43826b6ac6dbf2f1a85f9215aab
parentd58bd4546f602bf2957ae3b7c2094d1432142921 (diff)
downloadxine-lib-d54db9736e41937be623353887349f0ceaf3a192.tar.gz
xine-lib-d54db9736e41937be623353887349f0ceaf3a192.tar.bz2
ff_video_decoder: enable direct rendering for H.264. Added config option to disable direct rendering.
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index 8f1b7c4c7..d28af5e50 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -68,6 +68,7 @@ typedef struct ff_video_class_s {
int thread_count;
int8_t skip_loop_filter_enum;
int8_t choose_speed_over_accuracy;
+ uint8_t enable_dri;
xine_t *xine;
} ff_video_class_t;
@@ -92,7 +93,7 @@ struct ff_video_decoder_s {
uint8_t is_mpeg12:1;
uint8_t pp_available:1;
uint8_t yuv_init:1;
- uint8_t is_direct_rendering_disabled:1;
+ uint8_t is_direct_rendering_disabled:1; /* used only to avoid flooding log */
uint8_t cs_convert_init:1;
uint8_t assume_bad_field_picture:1;
@@ -197,6 +198,8 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){
}
}
+ this->is_direct_rendering_disabled = 0;
+
img = this->stream->video_out->get_frame (this->stream->video_out,
width,
height,
@@ -313,7 +316,7 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type)
/* Some codecs (eg rv10) copy flags in init so it's necessary to set
* this flag here in case we are going to use direct rendering */
- if(this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264) {
+ if(this->codec->capabilities & CODEC_CAP_DR1 && this->class->enable_dri) {
this->context->flags |= CODEC_FLAG_EMU_EDGE;
}
@@ -393,7 +396,7 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type)
/* enable direct rendering by default */
this->output_format = XINE_IMGFMT_YV12;
#ifdef ENABLE_DIRECT_RENDERING
- if( this->codec->capabilities & CODEC_CAP_DR1 && this->codec->id != CODEC_ID_H264 ) {
+ if( this->codec->capabilities & CODEC_CAP_DR1 && this->class->enable_dri ) {
this->context->get_buffer = get_buffer;
this->context->release_buffer = release_buffer;
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
@@ -452,6 +455,12 @@ static void pp_quality_cb(void *user_data, xine_cfg_entry_t *entry) {
class->pp_quality = entry->num_value;
}
+static void dri_cb(void *user_data, xine_cfg_entry_t *entry) {
+ ff_video_class_t *class = (ff_video_class_t *) user_data;
+
+ class->enable_dri = entry->num_value;
+}
+
static void pp_change_quality (ff_video_decoder_t *this) {
this->pp_quality = this->class->pp_quality;
@@ -1855,6 +1864,12 @@ void *init_video_plugin (xine_t *xine, void *data) {
"A change of this setting will take effect with playing the next stream."),
10, choose_speed_over_accuracy_cb, this);
+ this->enable_dri = xine->config->register_bool(config, "video.processing.ffmpeg_direct_rendering", 1,
+ _("Enable direct rendering"),
+ _("Disable direct rendering if you are experiencing lock-ups with\n"
+ "streams with lot of reference frames."),
+ 10, dri_cb, this);
+
return this;
}