[vlc-devel] [PATCH] gstdecode: add a switch to toggle direct rendering

Thomas Guillem thomas at gllm.fr
Wed Aug 8 14:15:42 CEST 2018


Merged, thanks.

I just removed the N_() to avoid new advanced translations (since this
module and options are for advanced users/developers).
On Mon, Jul 30, 2018, at 05:53, Vikram Fugro wrote:
> Please review.
> 
> On Tue, Jul 24, 2018 at 8:06 PM, Vikram Fugro
> <vikram.fugro at gmail.com> wrote:>> 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)
>>  ---
>>   modules/codec/gstreamer/gstdecode.c       | 17 +++++++++++++++--
>>   modules/codec/gstreamer/gstvlcvideosink.c | 21 +++++++++++++++++++-->>   modules/codec/gstreamer/gstvlcvideosink.h |  1 +
>>   3 files changed, 35 insertions(+), 4 deletions(-)
>> 
>>  diff --git a/modules/codec/gstreamer/gstdecode.c
>>  b/modules/codec/gstreamer/gstdecode.c>>  index 3a90ad4e04..ee7d7900f7 100644
>>  --- a/modules/codec/gstreamer/gstdecode.c
>>  +++ b/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 N_("Use VLCPool")
>>  +#define USEVLCPOOL_LONGTEXT N_( \
>>  +    "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 );
>> 
>>  diff --git a/modules/codec/gstreamer/gstvlcvideosink.c
>>  b/modules/codec/gstreamer/gstvlcvideosink.c>>  index 6988e0d0a1..eff97f87dd 100644
>>  --- a/modules/codec/gstreamer/gstvlcvideosink.c
>>  +++ b/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;
>>      }
>>  diff --git a/modules/codec/gstreamer/gstvlcvideosink.h
>>  b/modules/codec/gstreamer/gstvlcvideosink.h>>  index 5ce0dd2f26..4ec92be880 100644
>>  --- a/modules/codec/gstreamer/gstvlcvideosink.h
>>  +++ b/modules/codec/gstreamer/gstvlcvideosink.h
>>  @@ -58,6 +58,7 @@ struct _GstVlcVideoSink
>> 
>>       GstAllocator *p_allocator;
>>       GstVideoInfo vinfo;
>>  +    gboolean b_use_pool;
>> 
>>       decoder_t *p_dec;
>>  
>>  -- 
>>  2.17.1
> _________________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180808/670653f9/attachment.html>


More information about the vlc-devel mailing list