[Gstreamer-openmax] [PATCH] RFC: template caps from config file

Clark, Rob rob at ti.com
Mon Nov 1 08:39:03 PDT 2010


hmm..  let me split this into two patches to make the template caps
from config file a bit easier to review

updated patches in a few minutes

BR,
-R

On Mon, Nov 1, 2010 at 8:53 AM, Rob Clark <rob at ti.com> wrote:
> The omx_mpeg4dec element is converted.. the remaining changes are largly
> manual (ie. adding caps to config file, removing from individual element
> class files and adding appropriate calls to gstomx_template_caps()).  But I
> thought I'd send what I have so far so folks could comment before I spend
> some boring time converting the rest of the elements ;-)
>
> Note that I also move gstomx.conf to gstomx.conf.in and generate the
> gstomx.conf as part of the build process, to make it easier to use the
> preprocessor to avoid too much cut/paste for all the different caps fields.
> ---
>  omx/Makefile.am            |   12 ++-
>  omx/gstomx.c               |   30 ++++++
>  omx/gstomx.conf            |  203 ---------------------------------------
>  omx/gstomx.conf.in         |  224 ++++++++++++++++++++++++++++++++++++++++++++
>  omx/gstomx.h               |    7 +-
>  omx/gstomx_base_videodec.c |   54 -----------
>  omx/gstomx_mpeg4dec.c      |   55 +----------
>  7 files changed, 277 insertions(+), 308 deletions(-)
>  delete mode 100644 omx/gstomx.conf
>  create mode 100644 omx/gstomx.conf.in
>
> diff --git a/omx/Makefile.am b/omx/Makefile.am
> index 915b562..322695c 100644
> --- a/omx/Makefile.am
> +++ b/omx/Makefile.am
> @@ -50,7 +50,17 @@ libgstomx_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
>
>  EXTRA_DIST = headers gstomx.conf
>
> +# Run the C-preprocessor plus some sed voodoo to clean up adjacent strings
> +# (ie. "foo" "bar" becomes "foobar") so they are handled similar to what the
> +# C compiler does itself
> +gstomx.conf: gstomx.conf.in
> +       cat $^ | $(CPP) $(CFLAGS) $(libgstomx_la_CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) - | grep -v "^#" | sed 's/\"\ *\"//g' >> $@
> +
> +# more sed magic to convert the pre-processed config file into a C file
> +# containing one big string.  This is linked in and used as the default
> +# config
>  gstomx_conf.c: gstomx.conf
>        echo "const char *default_config =" > $@
> -       cat $^ | $(CPP) $(CFLAGS) $(libgstomx_la_CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) - | grep -v "^#" | sed 's/^.*/\"&\\\n"/' >> $@
> +       cat $^ | sed 's/\"/\\\"/g' | sed 's/^.*/\"&\\\n"/' >> $@
>        echo ";" >> $@
> +
> diff --git a/omx/gstomx.c b/omx/gstomx.c
> index 8b375c0..7428270 100644
> --- a/omx/gstomx.c
> +++ b/omx/gstomx.c
> @@ -327,6 +327,36 @@ gstomx_core_new (void *object, GType type)
>   return core;
>  }
>
> +GstCaps *
> +gstomx_template_caps (GType type, const gchar *pad_name)
> +{
> +  const gchar *element_name;
> +  GstStructure *element;
> +  const gchar *caps_str;
> +
> +  element_name = g_type_get_qdata (type, element_name_quark);
> +  element = get_element_entry (element_name);
> +
> +
> +  /* this shouldn't really happen.. */
> +  if (!element)
> +    return GST_CAPS_ANY;
> +
> +  caps_str = gst_structure_get_string (element, pad_name);
> +
> +  GST_DEBUG ("%s: %s", element_name, caps_str);
> +
> +  /* default to ANY.. at least for now.. maybe when everything is converted
> +   * over, we should treat missing caps as a more serious condition?
> +   */
> +  if (!caps_str) {
> +    g_warning ("%s is missing required field: %s", element_name, pad_name);
> +    return GST_CAPS_ANY;
> +  }
> +
> +  return gst_caps_from_string (caps_str);
> +}
> +
>  void
>  gstomx_install_property_helper (GObjectClass * gobject_class)
>  {
> diff --git a/omx/gstomx.conf b/omx/gstomx.conf
> deleted file mode 100644
> index c22c6d6..0000000
> --- a/omx/gstomx.conf
> +++ /dev/null
> @@ -1,203 +0,0 @@
> -#include "config.h"
> -
> -/* in case of multiple OMX components mapping to a single gst-openmax element
> - * class, a dynamic subclass can be created by specifying the gst-openmax
> - * type as the 'parent-type' and specifying a new unique type name as the
> - * 'type' parameter:
> - */
> -omx_dummy,
> -  parent-type=GstOmxDummy,
> -  type=GstOmxDummyOne,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.bellagio.dummy,
> -  rank=0;
> -
> -/* for testing: */
> -omx_dummy_2,
> -  parent-type=GstOmxDummy,
> -  type=GstOmxDummyTwo,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.dummy2,
> -  rank=256;
> -
> -omx_mpeg4dec,
> -  type=GstOmxMpeg4Dec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.video_decoder.mpeg4,
> -  rank=256;
> -
> -omx_h264dec,
> -  type=GstOmxH264Dec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.video_decoder.avc,
> -  rank=256;
> -
> -omx_h263dec,
> -  type=GstOmxH263Dec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.video_decoder.h263,
> -  rank=256;
> -
> -omx_wmvdec,
> -  type=GstOmxWmvDec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.video_decoder.wmv,
> -  rank=256;
> -
> -omx_mpeg4enc,
> -  type=GstOmxMpeg4Enc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.video_encoder.mpeg4,
> -  rank=256;
> -
> -omx_h264enc,
> -  type=GstOmxH264Enc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.video_encoder.avc,
> -  rank=256;
> -
> -omx_h263enc,
> -  type=GstOmxH263Enc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.video_encoder.h263,
> -  rank=256;
> -
> -omx_vorbisdec,
> -  type=GstOmxVorbisDec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.ogg.single,
> -  rank=128;
> -
> -omx_mp3dec,
> -  type=GstOmxMp3Dec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.mp3.mad,
> -  rank=256;
> -
> -#ifdef EXPERIMENTAL
> -
> -omx_mp2dec,
> -  type=GstOmxMp2Dec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.mp3.mad,
> -  rank=256;
> -
> -omx_amrnbdec,
> -  type=GstOmxAmrNbDec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.amrnb,
> -  rank=256;
> -
> -omx_amrnbenc,
> -  type=GstOmxAmrNbEnc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_encoder.amrnb,
> -  rank=256;
> -
> -omx_amrwbdec,
> -  type=GstOmxAmrWbDec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.amrwb,
> -  rank=256;
> -
> -omx_amrwbenc,
> -  type=GstOmxAmrWbEnc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_encoder.amrwb,
> -  rank=256;
> -
> -omx_aacdec,
> -  type=GstOmxAacDec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.aac,
> -  rank=256;
> -
> -omx_aacenc,
> -  type=GstOmxAacEnc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_encoder.aac,
> -  rank=256;
> -
> -omx_adpcmdec,
> -  type=GstOmxAdpcmDec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.adpcm,
> -  rank=256;
> -
> -omx_adpcmenc,
> -  type=GstOmxAdpcmEnc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_encoder.adpcm,
> -  rank=256;
> -
> -omx_g711dec,
> -  type=GstOmxG711Dec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.g711,
> -  rank=256;
> -
> -omx_g711enc,
> -  type=GstOmxG711Enc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_encoder.g711,
> -  rank=256;
> -
> -omx_g729dec,
> -  type=GstOmxG729Dec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.g729,
> -  rank=256;
> -
> -omx_g729enc,
> -  type=GstOmxG729Enc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_encoder.g729,
> -  rank=256;
> -
> -omx_ilbcdec,
> -  type=GstOmxIlbcDec,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_decoder.ilbc,
> -  rank=256;
> -
> -omx_ilbcenc,
> -  type=GstOmxIlbcEnc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_encoder.ilbc,
> -  rank=256;
> -
> -omx_jpegenc,
> -  type=GstOmxJpegEnc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.image_encoder.jpeg,
> -  rank=256;
> -
> -#endif /* EXPERIMENTAL */
> -
> -omx_audiosink,
> -  type=GstOmxAudioSink,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.alsa.alsasink,
> -  rank=0;
> -
> -#ifdef EXPERIMENTAL
> -
> -omx_videosink,
> -  type=GstOmxVideoSink,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.videosink,
> -  rank=0;
> -
> -omx_filereadersrc,
> -  type=GstOmxFilereaderSrc,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.audio_filereader,
> -  rank=0;
> -
> -#endif /* EXPERIMENTAL */
> -
> -omx_volume,
> -  type=GstOmxVolume,
> -  library-name=libomxil-bellagio.so.0,
> -  component-name=OMX.st.volume.component,
> -  rank=0;
> diff --git a/omx/gstomx.conf.in b/omx/gstomx.conf.in
> new file mode 100644
> index 0000000..ed74ec2
> --- /dev/null
> +++ b/omx/gstomx.conf.in
> @@ -0,0 +1,224 @@
> +#include "config.h"
> +
> +/* in case of multiple OMX components mapping to a single gst-openmax element
> + * class, a dynamic subclass can be created by specifying the gst-openmax
> + * type as the 'parent-type' and specifying a new unique type name as the
> + * 'type' parameter:
> + */
> +omx_dummy,
> +  parent-type=GstOmxDummy,
> +  type=GstOmxDummyOne,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.bellagio.dummy,
> +  rank=0;
> +
> +/* for testing: */
> +omx_dummy_2,
> +  parent-type=GstOmxDummy,
> +  type=GstOmxDummyTwo,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.dummy2,
> +  rank=256;
> +
> +/* standard width/height/framerate that applies to video decoders and encoders
> + * on both src and sink pad:
> + */
> +#define VIDEO_SIZE_RATE \
> +       "width=(int)[16,4096], " \
> +       "height=(int)[16,4096], " \
> +       "framerate=(fraction)[0,max]"
> +
> +/* standard raw video caps that applies to all video decoder src pads and
> + * video encoder sink pads:
> + */
> +#define RAW_VIDEO_CAPS \
> +       "video/x-raw-yuv, " \
> +       VIDEO_SIZE_RATE ", " \
> +       "format=(fourcc){I420, YUY2, UYVY, NV12}; "
> +
> +omx_mpeg4dec,
> +  type=GstOmxMpeg4Dec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.video_decoder.mpeg4,
> +  src=RAW_VIDEO_CAPS,
> +  sink="video/mpeg, mpegversion=(int)4, systemstream=false, " VIDEO_SIZE_RATE ";"\
> +      "video/x-divx, divxversion=(int)[4,5], " VIDEO_SIZE_RATE ";" \
> +      "video/x-xvid, " VIDEO_SIZE_RATE ";" \
> +      "video/x-3ivx, " VIDEO_SIZE_RATE ";",
> +  rank=256;
> +
> +omx_h264dec,
> +  type=GstOmxH264Dec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.video_decoder.avc,
> +  rank=256;
> +
> +omx_h263dec,
> +  type=GstOmxH263Dec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.video_decoder.h263,
> +  rank=256;
> +
> +omx_wmvdec,
> +  type=GstOmxWmvDec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.video_decoder.wmv,
> +  rank=256;
> +
> +omx_mpeg4enc,
> +  type=GstOmxMpeg4Enc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.video_encoder.mpeg4,
> +  rank=256;
> +
> +omx_h264enc,
> +  type=GstOmxH264Enc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.video_encoder.avc,
> +  rank=256;
> +
> +omx_h263enc,
> +  type=GstOmxH263Enc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.video_encoder.h263,
> +  rank=256;
> +
> +omx_vorbisdec,
> +  type=GstOmxVorbisDec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.ogg.single,
> +  rank=128;
> +
> +omx_mp3dec,
> +  type=GstOmxMp3Dec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.mp3.mad,
> +  rank=256;
> +
> +#ifdef EXPERIMENTAL
> +
> +omx_mp2dec,
> +  type=GstOmxMp2Dec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.mp3.mad,
> +  rank=256;
> +
> +omx_amrnbdec,
> +  type=GstOmxAmrNbDec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.amrnb,
> +  rank=256;
> +
> +omx_amrnbenc,
> +  type=GstOmxAmrNbEnc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_encoder.amrnb,
> +  rank=256;
> +
> +omx_amrwbdec,
> +  type=GstOmxAmrWbDec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.amrwb,
> +  rank=256;
> +
> +omx_amrwbenc,
> +  type=GstOmxAmrWbEnc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_encoder.amrwb,
> +  rank=256;
> +
> +omx_aacdec,
> +  type=GstOmxAacDec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.aac,
> +  rank=256;
> +
> +omx_aacenc,
> +  type=GstOmxAacEnc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_encoder.aac,
> +  rank=256;
> +
> +omx_adpcmdec,
> +  type=GstOmxAdpcmDec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.adpcm,
> +  rank=256;
> +
> +omx_adpcmenc,
> +  type=GstOmxAdpcmEnc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_encoder.adpcm,
> +  rank=256;
> +
> +omx_g711dec,
> +  type=GstOmxG711Dec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.g711,
> +  rank=256;
> +
> +omx_g711enc,
> +  type=GstOmxG711Enc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_encoder.g711,
> +  rank=256;
> +
> +omx_g729dec,
> +  type=GstOmxG729Dec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.g729,
> +  rank=256;
> +
> +omx_g729enc,
> +  type=GstOmxG729Enc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_encoder.g729,
> +  rank=256;
> +
> +omx_ilbcdec,
> +  type=GstOmxIlbcDec,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_decoder.ilbc,
> +  rank=256;
> +
> +omx_ilbcenc,
> +  type=GstOmxIlbcEnc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_encoder.ilbc,
> +  rank=256;
> +
> +omx_jpegenc,
> +  type=GstOmxJpegEnc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.image_encoder.jpeg,
> +  rank=256;
> +
> +#endif /* EXPERIMENTAL */
> +
> +omx_audiosink,
> +  type=GstOmxAudioSink,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.alsa.alsasink,
> +  rank=0;
> +
> +#ifdef EXPERIMENTAL
> +
> +omx_videosink,
> +  type=GstOmxVideoSink,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.videosink,
> +  rank=0;
> +
> +omx_filereadersrc,
> +  type=GstOmxFilereaderSrc,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.audio_filereader,
> +  rank=0;
> +
> +#endif /* EXPERIMENTAL */
> +
> +omx_volume,
> +  type=GstOmxVolume,
> +  library-name=libomxil-bellagio.so.0,
> +  component-name=OMX.st.volume.component,
> +  rank=0;
> diff --git a/omx/gstomx.h b/omx/gstomx.h
> index 37027ec..af527ec 100644
> --- a/omx/gstomx.h
> +++ b/omx/gstomx.h
> @@ -24,8 +24,11 @@
>
>  #include <gst/gst.h>
>
> -G_BEGIN_DECLS GST_DEBUG_CATEGORY_EXTERN (gstomx_debug);
> +G_BEGIN_DECLS
> +
> +GST_DEBUG_CATEGORY_EXTERN (gstomx_debug);
>  GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug);
> +
>  #define GST_CAT_DEFAULT gstomx_debug
>
>  enum
> @@ -40,8 +43,10 @@ enum
>  gboolean gstomx_get_component_info (void *core, GType type);
>
>  void *gstomx_core_new (void *object, GType type);
> +GstCaps * gstomx_template_caps (GType type, const gchar *pad_name);
>  void gstomx_install_property_helper (GObjectClass * gobject_class);
>  gboolean gstomx_get_property_helper (void *core, guint prop_id, GValue * value);
>
>  G_END_DECLS
> +
>  #endif /* GSTOMX_H */
> diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
> index de36899..9148dec 100644
> --- a/omx/gstomx_base_videodec.c
> +++ b/omx/gstomx_base_videodec.c
> @@ -25,63 +25,9 @@
>  GSTOMX_BOILERPLATE (GstOmxBaseVideoDec, gst_omx_base_videodec, GstOmxBaseFilter,
>     GST_OMX_BASE_FILTER_TYPE);
>
> -static GstCaps *
> -generate_src_template (void)
> -{
> -  GstCaps *caps;
> -  GstStructure *struc;
> -
> -  caps = gst_caps_new_empty ();
> -
> -  struc = gst_structure_new ("video/x-raw-yuv",
> -      "width", GST_TYPE_INT_RANGE, 16, 4096,
> -      "height", GST_TYPE_INT_RANGE, 16, 4096,
> -      "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
> -
> -  {
> -    GValue list;
> -    GValue val;
> -
> -    list.g_type = val.g_type = 0;
> -
> -    g_value_init (&list, GST_TYPE_LIST);
> -    g_value_init (&val, GST_TYPE_FOURCC);
> -
> -    gst_value_set_fourcc (&val, GST_MAKE_FOURCC ('I', '4', '2', '0'));
> -    gst_value_list_append_value (&list, &val);
> -
> -    gst_value_set_fourcc (&val, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'));
> -    gst_value_list_append_value (&list, &val);
> -
> -    gst_value_set_fourcc (&val, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'));
> -    gst_value_list_append_value (&list, &val);
> -
> -    gst_structure_set_value (struc, "format", &list);
> -
> -    g_value_unset (&val);
> -    g_value_unset (&list);
> -  }
> -
> -  gst_caps_append_structure (caps, struc);
> -
> -  return caps;
> -}
> -
>  static void
>  type_base_init (gpointer g_class)
>  {
> -  GstElementClass *element_class;
> -
> -  element_class = GST_ELEMENT_CLASS (g_class);
> -
> -  {
> -    GstPadTemplate *template;
> -
> -    template = gst_pad_template_new ("src", GST_PAD_SRC,
> -        GST_PAD_ALWAYS, generate_src_template ());
> -
> -    gst_element_class_add_pad_template (element_class, template);
> -  }
>  }
>
>  static void
> diff --git a/omx/gstomx_mpeg4dec.c b/omx/gstomx_mpeg4dec.c
> index f112ecb..45c7030 100644
> --- a/omx/gstomx_mpeg4dec.c
> +++ b/omx/gstomx_mpeg4dec.c
> @@ -25,48 +25,6 @@
>  GSTOMX_BOILERPLATE (GstOmxMpeg4Dec, gst_omx_mpeg4dec, GstOmxBaseVideoDec,
>     GST_OMX_BASE_VIDEODEC_TYPE);
>
> -static GstCaps *
> -generate_sink_template (void)
> -{
> -  GstCaps *caps;
> -  GstStructure *struc;
> -
> -  caps = gst_caps_new_empty ();
> -
> -  struc = gst_structure_new ("video/mpeg",
> -      "mpegversion", G_TYPE_INT, 4,
> -      "systemstream", G_TYPE_BOOLEAN, FALSE,
> -      "width", GST_TYPE_INT_RANGE, 16, 4096,
> -      "height", GST_TYPE_INT_RANGE, 16, 4096,
> -      "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
> -
> -  gst_caps_append_structure (caps, struc);
> -
> -  struc = gst_structure_new ("video/x-divx",
> -      "divxversion", GST_TYPE_INT_RANGE, 4, 5,
> -      "width", GST_TYPE_INT_RANGE, 16, 4096,
> -      "height", GST_TYPE_INT_RANGE, 16, 4096,
> -      "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
> -
> -  gst_caps_append_structure (caps, struc);
> -
> -  struc = gst_structure_new ("video/x-xvid",
> -      "width", GST_TYPE_INT_RANGE, 16, 4096,
> -      "height", GST_TYPE_INT_RANGE, 16, 4096,
> -      "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
> -
> -  gst_caps_append_structure (caps, struc);
> -
> -  struc = gst_structure_new ("video/x-3ivx",
> -      "width", GST_TYPE_INT_RANGE, 16, 4096,
> -      "height", GST_TYPE_INT_RANGE, 16, 4096,
> -      "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
> -
> -  gst_caps_append_structure (caps, struc);
> -
> -  return caps;
> -}
> -
>  static void
>  type_base_init (gpointer g_class)
>  {
> @@ -79,14 +37,13 @@ type_base_init (gpointer g_class)
>       "Codec/Decoder/Video",
>       "Decodes video in MPEG-4 format with OpenMAX IL", "Felipe Contreras");
>
> -  {
> -    GstPadTemplate *template;
> -
> -    template = gst_pad_template_new ("sink", GST_PAD_SINK,
> -        GST_PAD_ALWAYS, generate_sink_template ());
> +  gst_element_class_add_pad_template (element_class,
> +          gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
> +                  gstomx_template_caps (G_TYPE_FROM_CLASS (g_class), "sink")));
>
> -    gst_element_class_add_pad_template (element_class, template);
> -  }
> +  gst_element_class_add_pad_template (element_class,
> +          gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
> +                  gstomx_template_caps (G_TYPE_FROM_CLASS (g_class), "src")));
>  }
>
>  static void
> --
> 1.7.1.1
>
>




More information about the Gstreamer-openmax mailing list