[vlc-devel] [PATCH]v2 codec: Add GStreamer based decoder module
Jean-Baptiste Kempf
jb at videolan.org
Sat Apr 26 14:29:15 CEST 2014
On 26 Apr, Vikram Fugro wrote :
> dnl
> +dnl gstreamer decode plugins
> +dnl
> +AC_ARG_ENABLE(gstreamer-decode,
> +[ --enable-gstreamer-decode gstreamer decode plugins support, currently supports only video decoders (default enabled)])
> +
> +dnl
> +dnl gstreamer core libs, will be mandatory for all types of gstreamer based modules
> +dnl
> +AS_IF([test "${enable_gstreamer_decode}" != "no"], [
> + PKG_CHECK_MODULES(GSTREAMER_APP,[gstreamer-app-1.0], [
> + ],[
> + AC_MSG_ERROR([${GSTREAMER_APP_PKG_ERRORS}. Please disable all the gstreamer based modules to ignore this error.])
> + ])
> +],[
> +])
> +
> +dnl
> +dnl gstreamer plugins for decoder codec module.
> +dnl
> +AS_IF([test "${enable_gstreamer_decode}" != "no"], [
> + dnl
> + dnl Currently supports only video decoders
> + dnl
> + PKG_CHECK_MODULES(GSTREAMER_VIDEO,[gstreamer-basevideo-1.0 gstreamer-video-1.0], [
> + VLC_SAVE_FLAGS
> + CPPFLAGS="${CPPFLAGS} ${GSTREAMER_VIDEO_CFLAGS} ${GSTREAMER_APP_CFLAGS}"
> + CFLAGS="${CFLAGS} ${GSTREAMER_VIDEO_CFLAGS} ${GSTREAMER_APP_CFLAGS}"
> + VLC_ADD_PLUGIN([gstdecode])
> + VLC_ADD_LIBS([gstdecode],[$GSTREAMER_VIDEO_LIBS])
> + VLC_ADD_LIBS([gstdecode],[$GSTREAMER_APP_LIBS])
> + VLC_RESTORE_FLAGS
> + ],[
> + AC_MSG_ERROR([${GSTREAMER_VIDEO_PKG_ERRORS}. Pass --disable-gstreamer-decode to ignore this error.])
> + ])
> +],[
> +])
> +AM_CONDITIONAL([HAVE_GSTREAMER_DECODE], [test "${have_gstreamer_decode}" != "no"])
> +
I prefered the old code:
PKG_ENABLE_MODULES_VLC([GSTDECODE], [], [gstreamer-app-1.0
gstreamer-basevideo-1.0 gstreamer-video-1.0 ], [Gstreamer video
decoder], [auto])
> +#define MODULE_DESCRIPTION N_( "Decoders' plugins " \
> + "delivered by the GStreamer library. " \
> + "Currently supports only video decoders such as " \
> + "h264, mpeg4, wmv, mpeg2, vp8, etc. " )
Do not translate stuff that will change "soon".
> +static gboolean seek_data_cb( GstAppSrc* p_src, guint64 l_offset,
> + gpointer p_data )
> +{
> + decoder_t* p_dec = ( decoder_t* )p_data;
> + msg_Dbg( p_dec, "appsrc seeking to %llu", (unsigned long long)l_offset );
%PRIu64 ?
> + return TRUE;
> +}
> +
> +/*****************************************************************************
> + * OpenDecoder: probe the decoder and return score
> + *****************************************************************************/
> +static int OpenDecoder( vlc_object_t *p_this )
> +{
> + decoder_t *p_dec = ( decoder_t* )p_this;
> + decoder_sys_t *p_sys;
> + GstStateChangeReturn i_ret;
> + gboolean b_ret;
> + GstCaps* p_caps = NULL;
> + GstStructure* p_str = NULL;
> + GstAppSrcCallbacks cb;
> + int i_rval = VLC_SUCCESS;
> + GList* p_list = NULL;
> + bool dbin;
> +
> +#define VLC_GST_CHECK(r, v, s, t) \
> + { if(r == v) { msg_Err(p_dec, s); i_rval = t; goto fail; } }
> +
> + vlc_gst_init ( );
> +
> + p_str = vlc_to_gst_fmt( &p_dec->fmt_in );
> + if( !p_str ) {
> + return VLC_EGENERIC;
> + }
> +
> + /* Allocate the memory needed to store the decoder's structure */
> + if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) ) ) == NULL )
> + return VLC_ENOMEM;
> +
> + dbin = var_CreateGetBool( p_dec, "use-decodebin" );
> + msg_Info( p_dec, "Using decodebin? %s", dbin ? "yes ":"no" );
This message is too early. You might fail after.
THe rest looks good
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list