theoraenc: Don't reset the video quality setting the bitrate

libtheora has two encoding modes, CBR, where it tries to hit a target
bitrate and VBR where it tries to achieve a target quality.

Internally if the target bitrate is set to anything other then 0 the
encoding-mode is CBR.

This means that the gstreamer element can leave the video_quality
setting alone as long as the user is tweaking the bitrate. Which has the
nice side-effect that if the user explicitely sets the bitrate to 0
(which is actually the default), the quality value doesn't get reset and
one ends up encoding VBR at quality-level 0...
This commit is contained in:
Sjoerd Simons 2011-02-13 14:42:14 +00:00 committed by Wim Taymans
parent f7dbec9091
commit 46f3e7c6fd

View file

@ -1372,13 +1372,12 @@ theora_enc_set_property (GObject * object, guint prop_id,
case PROP_BITRATE:
GST_OBJECT_LOCK (enc);
enc->video_bitrate = g_value_get_int (value) * 1000;
enc->video_quality = 0;
enc->bitrate_changed = TRUE;
GST_OBJECT_UNLOCK (enc);
break;
case PROP_QUALITY:
GST_OBJECT_LOCK (enc);
if (GST_STATE (enc) >= GST_STATE_PAUSED && enc->video_quality == 0) {
if (GST_STATE (enc) >= GST_STATE_PAUSED && enc->video_bitrate > 0) {
GST_WARNING_OBJECT (object, "Can't change from bitrate to quality mode"
" while playing");
} else {