theoraenc: Don't reset the video quality setting the bitrate
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Sun, 13 Feb 2011 14:42:14 +0000 (14:42 +0000)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 14 Feb 2011 15:03:56 +0000 (16:03 +0100)
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...

ext/theora/gsttheoraenc.c

index d31485b..03acef8 100644 (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 {