diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-08-14 11:17:25 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-08-14 11:17:25 +0200 |
commit | c6b16aed0854117cbbf9801103a10dc0c6c9045b (patch) | |
tree | 30f75b51ea26b555efa636ca7d8fe23a2649d759 /ext/vp8 | |
parent | 14317a34089126a1ad46ed03ce01d4de72fea558 (diff) | |
download | gstreamer-plugins-bad-c6b16aed0854117cbbf9801103a10dc0c6c9045b.tar.gz |
vp8dec: Add support for multiple decoding threads
Diffstat (limited to 'ext/vp8')
-rw-r--r-- | ext/vp8/gstvp8dec.c | 23 | ||||
-rw-r--r-- | ext/vp8/gstvp8dec.h | 1 |
2 files changed, 22 insertions, 2 deletions
diff --git a/ext/vp8/gstvp8dec.c b/ext/vp8/gstvp8dec.c index 1cddb5b1d..611712968 100644 --- a/ext/vp8/gstvp8dec.c +++ b/ext/vp8/gstvp8dec.c @@ -62,6 +62,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vp8dec_debug); #define DEFAULT_POST_PROCESSING_FLAGS (VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE) #define DEFAULT_DEBLOCKING_LEVEL 4 #define DEFAULT_NOISE_LEVEL 0 +#define DEFAULT_THREADS 1 enum { @@ -69,7 +70,8 @@ enum PROP_POST_PROCESSING, PROP_POST_PROCESSING_FLAGS, PROP_DEBLOCKING_LEVEL, - PROP_NOISE_LEVEL + PROP_NOISE_LEVEL, + PROP_THREADS }; #define C_FLAGS(v) ((guint) v) @@ -168,6 +170,11 @@ gst_vp8_dec_class_init (GstVP8DecClass * klass) 0, 16, DEFAULT_NOISE_LEVEL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_THREADS, + g_param_spec_uint ("threads", "Max Threads", + "Maximum number of decoding threads", + 1, 16, DEFAULT_THREADS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_vp8_dec_src_template)); gst_element_class_add_pad_template (element_class, @@ -226,6 +233,9 @@ gst_vp8_dec_set_property (GObject * object, guint prop_id, case PROP_NOISE_LEVEL: dec->noise_level = g_value_get_uint (value); break; + case PROP_THREADS: + dec->threads = g_value_get_uint (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -254,6 +264,9 @@ gst_vp8_dec_get_property (GObject * object, guint prop_id, GValue * value, case PROP_NOISE_LEVEL: g_value_set_uint (value, dec->noise_level); break; + case PROP_THREADS: + g_value_set_uint (value, dec->threads); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -374,11 +387,13 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame) int flags = 0; vpx_codec_stream_info_t stream_info; vpx_codec_caps_t caps; + vpx_codec_dec_cfg_t cfg; GstVideoCodecState *state = dec->input_state; vpx_codec_err_t status; GstMapInfo minfo; memset (&stream_info, 0, sizeof (stream_info)); + memset (&cfg, 0, sizeof (cfg)); stream_info.sz = sizeof (stream_info); if (!gst_buffer_map (frame->input_buffer, &minfo, GST_MAP_READ)) { @@ -403,6 +418,10 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame) GST_VIDEO_FORMAT_I420, stream_info.w, stream_info.h, state); gst_vp8_dec_send_tags (dec); + cfg.w = stream_info.w; + cfg.h = stream_info.h; + cfg.threads = dec->threads; + caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo); if (dec->post_processing) { @@ -414,7 +433,7 @@ open_codec (GstVP8Dec * dec, GstVideoCodecFrame * frame) } status = - vpx_codec_dec_init (&dec->decoder, &vpx_codec_vp8_dx_algo, NULL, flags); + vpx_codec_dec_init (&dec->decoder, &vpx_codec_vp8_dx_algo, &cfg, flags); if (status != VPX_CODEC_OK) { GST_ELEMENT_ERROR (dec, LIBRARY, INIT, ("Failed to initialize VP8 decoder"), ("%s", diff --git a/ext/vp8/gstvp8dec.h b/ext/vp8/gstvp8dec.h index 098426752..c2aaebc83 100644 --- a/ext/vp8/gstvp8dec.h +++ b/ext/vp8/gstvp8dec.h @@ -66,6 +66,7 @@ struct _GstVP8Dec enum vp8_postproc_level post_processing_flags; gint deblocking_level; gint noise_level; + gint threads; GstVideoCodecState *input_state; GstVideoCodecState *output_state; |