Browse Source

gstdecode: add a switch to toggle direct rendering

Currently, due to few changes in the gstreamer's buffer
handling, the direct-rendering (i.e gstreamer decoders
decoding directly into the downstream VLC provided buffers)
is unstable.

Hence, added a switch to toggle direct-rendering and is disabled
by default. Works fine otherwise (i.e non direct-rendering)

Signed-off-by: Thomas Guillem <thomas@gllm.fr>
pull/73/head
Vikram Fugro 8 years ago
committed by Thomas Guillem
parent
commit
8f94dfb278
  1. 17
      modules/codec/gstreamer/gstdecode.c
  2. 21
      modules/codec/gstreamer/gstvlcvideosink.c
  3. 1
      modules/codec/gstreamer/gstvlcvideosink.h

17
modules/codec/gstreamer/gstdecode.c

@ -84,6 +84,13 @@ static void Flush( decoder_t * );
"more info such as codec profile, level and other attributes, " \
"in the form of GstCaps (Stream Capabilities) to decoder." )
#define USEVLCPOOL_TEXT "Use VLCPool"
#define USEVLCPOOL_LONGTEXT \
"Allow the gstreamer decoders to directly decode (direct render) " \
"into the buffers provided and managed by the (downstream)VLC modules " \
"that follow. Note: Currently this feature is unstable, enable it at " \
"your own risk."
vlc_module_begin( )
set_shortname( "GstDecode" )
add_shortcut( "gstdecode" )
@ -97,6 +104,8 @@ vlc_module_begin( )
set_callbacks( OpenDecoder, CloseDecoder )
add_bool( "use-decodebin", true, USEDECODEBIN_TEXT,
USEDECODEBIN_LONGTEXT, false )
add_bool( "use-vlcpool", false, USEVLCPOOL_TEXT,
USEVLCPOOL_LONGTEXT, false )
vlc_module_end( )
void gst_vlc_dec_ensure_empty_queue( decoder_t *p_dec )
@ -448,7 +457,7 @@ static int OpenDecoder( vlc_object_t *p_this )
GstAppSrcCallbacks cb;
int i_rval = VLC_SUCCESS;
GList *p_list;
bool dbin;
bool dbin, vlc_pool;
#define VLC_GST_CHECK( r, v, s, t ) \
{ if( r == v ){ msg_Err( p_dec, s ); i_rval = t; goto fail; } }
@ -560,10 +569,14 @@ static int OpenDecoder( vlc_object_t *p_this )
p_sys->p_decode_out = gst_element_factory_make( "vlcvideosink", NULL );
VLC_GST_CHECK( p_sys->p_decode_out, NULL, "vlcvideosink not found",
VLC_ENOMOD );
vlc_pool = var_CreateGetBool( p_dec, "use-vlcpool" );
msg_Dbg( p_dec, "Using vlc pool? %s", vlc_pool ? "yes ":"no" );
p_sys->p_allocator = gst_vlc_picture_plane_allocator_new(
(gpointer) p_dec );
g_object_set( G_OBJECT( p_sys->p_decode_out ), "sync", FALSE, "allocator",
p_sys->p_allocator, "id", (gpointer) p_dec, NULL );
p_sys->p_allocator, "id", (gpointer) p_dec, "use-pool", vlc_pool, NULL );
g_signal_connect( G_OBJECT( p_sys->p_decode_out ), "new-buffer",
G_CALLBACK( frame_handoff_cb ), p_dec );

21
modules/codec/gstreamer/gstvlcvideosink.c

@ -40,7 +40,8 @@ enum
{
PROP_0,
PROP_ALLOCATOR,
PROP_ID
PROP_ID,
PROP_USE_POOL
};
static guint gst_vlc_video_sink_signals[ LAST_SIGNAL ] = { 0 };
@ -84,6 +85,11 @@ static void gst_vlc_video_sink_class_init( GstVlcVideoSinkClass *p_klass )
p_gobject_class->get_property = gst_vlc_video_sink_get_property;
p_gobject_class->finalize = gst_vlc_video_sink_finalize;
g_object_class_install_property( G_OBJECT_CLASS( p_klass ), PROP_USE_POOL,
g_param_spec_boolean( "use-pool", "Use-Pool", "Use downstream VLC video output pool",
FALSE, G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
G_PARAM_STATIC_STRINGS ));
g_object_class_install_property( G_OBJECT_CLASS( p_klass ), PROP_ALLOCATOR,
g_param_spec_pointer( "allocator", "Allocator", "VlcPictureAllocator",
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |
@ -162,6 +168,7 @@ static gboolean gst_vlc_video_sink_setcaps( GstBaseSink *p_basesink,
static void gst_vlc_video_sink_init( GstVlcVideoSink *p_vlc_video_sink )
{
p_vlc_video_sink->b_use_pool = FALSE;
gst_base_sink_set_sync( GST_BASE_SINK( p_vlc_video_sink), FALSE );
}
@ -211,7 +218,7 @@ static gboolean gst_vlc_video_sink_propose_allocation( GstBaseSink* p_bsink,
if( p_caps == NULL )
goto no_caps;
if( b_need_pool )
if( p_vsink->b_use_pool && b_need_pool )
{
GstVideoInfo info;
@ -294,6 +301,12 @@ static void gst_vlc_video_sink_set_property( GObject *p_object, guint i_prop_id,
}
break;
case PROP_USE_POOL:
{
p_vsink->b_use_pool = g_value_get_boolean( p_value );
}
break;
default:
break;
}
@ -312,6 +325,10 @@ static void gst_vlc_video_sink_get_property( GObject *p_object, guint i_prop_id,
g_value_set_pointer( p_value, p_vsink->p_allocator );
break;
case PROP_USE_POOL:
g_value_set_boolean( p_value, p_vsink->b_use_pool );
break;
default:
break;
}

1
modules/codec/gstreamer/gstvlcvideosink.h

@ -58,6 +58,7 @@ struct _GstVlcVideoSink
GstAllocator *p_allocator;
GstVideoInfo vinfo;
gboolean b_use_pool;
decoder_t *p_dec;

Loading…
Cancel
Save