/* Print the current and maximum speed level settings */ int print_speed_level(th_enc_ctx *ctx) { int current = -1; int max = -1; int ret; ret = check_speed_level(ctx, ¤t, &max); if (ret == 0) { fprintf(stdout, "Default speed level: %d\n", current); fprintf(stdout, "Maximum speed level: %d\n", max); } return ret; }
static void gst_theora_enc_class_init (GstTheoraEncClass * klass) { GObjectClass *gobject_class = (GObjectClass *) klass; GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); /* query runtime encoder properties */ th_enc_ctx *th_ctx; int default_speed_level = THEORA_DEF_SPEEDLEVEL; int max_speed_level = default_speed_level; GST_DEBUG_CATEGORY_INIT (theoraenc_debug, "theoraenc", 0, "Theora encoder"); th_ctx = dummy_encode_ctx (); if (th_ctx) { if (!check_speed_level (th_ctx, &default_speed_level, &max_speed_level)) GST_WARNING ("Failed to determine settings for the speed-level property."); th_encode_free (th_ctx); } gobject_class->set_property = theora_enc_set_property; gobject_class->get_property = theora_enc_get_property; gobject_class->finalize = theora_enc_finalize; g_object_class_install_property (gobject_class, PROP_CENTER, g_param_spec_boolean ("center", "Center", "ignored and kept for API compat only", TRUE, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_BORDER, g_param_spec_enum ("border", "Border", "ignored and kept for API compat only", GST_TYPE_BORDER_MODE, BORDER_BLACK, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* general encoding stream options */ g_object_class_install_property (gobject_class, PROP_BITRATE, g_param_spec_int ("bitrate", "Bitrate", "Compressed video bitrate (kbps)", 0, (1 << 24) - 1, THEORA_DEF_BITRATE, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_PLAYING)); g_object_class_install_property (gobject_class, PROP_QUALITY, g_param_spec_int ("quality", "Quality", "Video quality", 0, 63, THEORA_DEF_QUALITY, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_PLAYING)); g_object_class_install_property (gobject_class, PROP_QUICK, g_param_spec_boolean ("quick", "Quick", "ignored and kept for API compat only", TRUE, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_KEYFRAME_AUTO, g_param_spec_boolean ("keyframe-auto", "Keyframe Auto", "Automatic keyframe detection", THEORA_DEF_KEYFRAME_AUTO, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_KEYFRAME_FREQ, g_param_spec_int ("keyframe-freq", "Keyframe frequency", "Keyframe frequency", 1, 32768, THEORA_DEF_KEYFRAME_FREQ, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_KEYFRAME_FREQ_FORCE, g_param_spec_int ("keyframe-force", "Keyframe force", "Force keyframe every N frames", 1, 32768, THEORA_DEF_KEYFRAME_FREQ_FORCE, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_KEYFRAME_THRESHOLD, g_param_spec_int ("keyframe-threshold", "Keyframe threshold", "ignored and kept for API compat only", 0, 32768, 80, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_KEYFRAME_MINDISTANCE, g_param_spec_int ("keyframe-mindistance", "Keyframe mindistance", "ignored and kept for API compat only", 1, 32768, 8, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_NOISE_SENSITIVITY, g_param_spec_int ("noise-sensitivity", "Noise sensitivity", "ignored and kept for API compat only", 0, 32768, 1, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SHARPNESS, g_param_spec_int ("sharpness", "Sharpness", "ignored and kept for API compat only", 0, 2, 0, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SPEEDLEVEL, g_param_spec_int ("speed-level", "Speed level", "Controls the amount of analysis performed when encoding." " Higher values trade compression quality for speed." " This property requires libtheora version >= 1.0" ", and the maximum value may vary based on encoder version.", 0, max_speed_level, default_speed_level, (GParamFlags) G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_VP3_COMPATIBLE, g_param_spec_boolean ("vp3-compatible", "VP3 Compatible", "Disables non-VP3 compatible features", THEORA_DEF_VP3_COMPATIBLE, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DROP_FRAMES, g_param_spec_boolean ("drop-frames", "VP3 Compatible", "Allow or disallow frame dropping", THEORA_DEF_DROP_FRAMES, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CAP_OVERFLOW, g_param_spec_boolean ("cap-overflow", "VP3 Compatible", "Enable capping of bit reservoir overflows", THEORA_DEF_CAP_OVERFLOW, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CAP_UNDERFLOW, g_param_spec_boolean ("cap-underflow", "VP3 Compatible", "Enable capping of bit reservoir underflows", THEORA_DEF_CAP_UNDERFLOW, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_RATE_BUFFER, g_param_spec_int ("rate-buffer", "Rate Control Buffer", "Sets the size of the rate control buffer, in units of frames. " "The default value of 0 instructs the encoder to automatically " "select an appropriate value", 0, 1000, THEORA_DEF_RATE_BUFFER, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_MULTIPASS_CACHE_FILE, g_param_spec_string ("multipass-cache-file", "Multipass Cache File", "Multipass cache file", THEORA_DEF_MULTIPASS_CACHE_FILE, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_MULTIPASS_MODE, g_param_spec_enum ("multipass-mode", "Multipass mode", "Single pass or first/second pass", GST_TYPE_MULTIPASS_MODE, THEORA_DEF_MULTIPASS_MODE, (GParamFlags) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gstelement_class->change_state = theora_enc_change_state; }