gint total_ls;
- GstCaps *metadata;
- GstCaps *streaminfo;
- GstCaps *caps;
+ GstCaps *metadata;
+ GstCaps *streaminfo;
+ GstCaps *caps;
};
static void
print_caps (GstCaps *caps)
{
- if (caps == NULL) return;
- if (!strcmp (gst_caps_get_mime (caps), "application/x-gst-metadata") ||
- !strcmp (gst_caps_get_mime (caps), "application/x-gst-streaminfo"))
- {
- GstProps *props = caps->properties;
- GList *walk;
- /* ugly hack, but ok for now. If needed, fix by individual strcmp */
- g_print (" %s:\n", gst_caps_get_mime (caps) + 18);
- if (props == NULL) {
- g_print (" none\n");
- return;
- }
- walk = props->properties;
-
- while (walk) {
- GstPropsEntry *entry = (GstPropsEntry *) walk->data;
- const gchar *name;
- const gchar *str_val;
- gint int_val;
- GstPropsType type;
-
- name = gst_props_entry_get_name (entry);
- type = gst_props_entry_get_props_type (entry);
- switch (type) {
- case GST_PROPS_STRING_TYPE:
- gst_props_entry_get_string (entry, &str_val);
- g_print (" %s='%s'\n", name, str_val);
- break;
- case GST_PROPS_INT_TYPE:
- gst_props_entry_get_int (entry, &int_val);
- g_print (" %s=%d\n", name, int_val);
- break;
- default:
- break;
- }
- walk = g_list_next (walk);
- }
- }
- else {
- g_print (" unkown caps type\n");
- }
+ char *s;
+ s = gst_caps_to_string (caps);
+ g_print(" %s\n", s);
+ g_free (s);
}
static void
print_format (GstCaps *caps)
{
- g_print (" format:\n");
- if (!caps || caps->properties == NULL) {
- g_print (" unkown\n");
- return;
- }
- if (!strcmp (gst_caps_get_mime (caps), "audio/raw")) {
- gint channels;
- gint rate;
-
- gst_caps_get_int (caps, "channels", &channels);
- gst_caps_get_int (caps, "rate", &rate);
-
- g_print (" channels: %d\n", channels);
- g_print (" rate: %d\n", rate);
- }
- else {
- g_print (" unkown format\n");
- }
+ char *s;
+ s = gst_caps_to_string (caps);
+ g_print(" format: %s\n", s);
+ g_free (s);
}
static void
ARG_FRAME_TIME,
};
-GST_PAD_TEMPLATE_FACTORY (sink_template,
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "aasink_caps",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
static void gst_aasink_base_init (gpointer g_class);
static void gst_aasink_class_init (GstAASinkClass *klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template));
+ gst_static_pad_template_get (&sink_template));
gst_element_class_set_details (element_class, &gst_aasink_details);
}
}
static GstPadLinkReturn
-gst_aasink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_aasink_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstAASink *aasink;
+ GstStructure *structure;
aasink = GST_AASINK (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "width", &aasink->width);
- gst_caps_get_int (caps, "height", &aasink->height);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &aasink->width);
+ gst_structure_get_int (structure, "height", &aasink->height);
/* FIXME aasink->format is never set */
gst_aasink_init (GstAASink *aasink)
{
aasink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template), "sink");
+ gst_element_get_pad_template (GST_ELEMENT (aasink), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (aasink), aasink->sinkpad);
gst_pad_set_chain_function (aasink->sinkpad, gst_aasink_chain);
gst_pad_set_link_function (aasink->sinkpad, gst_aasink_sinkconnect);
#define NTSC_HEIGHT 480
#define NTSC_BUFFER 120000
+#define NTSC_FRAMERATE 29.997
+
#define PAL_HEIGHT 576
#define PAL_BUFFER 144000
+#define PAL_FRAMERATE 25.0
/* The ElementDetails structure gives a human-readable description
* of the plugin, as well as author and version data.
* can have. They can be quite complex, but for this dvdec plugin
* they are rather simple.
*/
-GST_PAD_TEMPLATE_FACTORY (sink_temp,
- "sink",
+static GstStaticPadTemplate sink_temp =
+GST_STATIC_PAD_TEMPLATE
+(
+ "sink" ,
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "dv_dec_sink",
- "video/x-dv",
- "systemstream", GST_PROPS_BOOLEAN (TRUE)
+ GST_STATIC_CAPS (
+ "video/x-dv, systemstream = (boolean) true"
)
-)
-
+);
-GST_PAD_TEMPLATE_FACTORY (video_src_temp,
+static GstStaticPadTemplate video_src_temp =
+GST_STATIC_PAD_TEMPLATE
+(
"video",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "dv_dec_src",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (NTSC_HEIGHT),
- GST_PROPS_INT (PAL_HEIGHT)
- ),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001)
- )
- ),
- GST_CAPS_NEW (
- "dv_dec_src",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT(32),
- "depth", GST_PROPS_INT(32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT(0x000000ff),
- "green_mask", GST_PROPS_INT(0x0000ff00),
- "blue_mask", GST_PROPS_INT(0x00ff0000),
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (NTSC_HEIGHT),
- GST_PROPS_INT (PAL_HEIGHT)
- ),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001)
- )
- ),
- GST_CAPS_NEW (
- "dv_dec_src",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT(24),
- "depth", GST_PROPS_INT(24),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT(0x0000ff),
- "green_mask", GST_PROPS_INT(0x00ff00),
- "blue_mask", GST_PROPS_INT(0xff0000),
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (NTSC_HEIGHT),
- GST_PROPS_INT (PAL_HEIGHT)
- ),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001)
- )
+ GST_STATIC_CAPS (
+ "video/x-raw-yuv, "
+ "format = (fourcc) YUY2, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY(NTSC_HEIGHT) ", "
+ G_STRINGIFY(PAL_HEIGHT)
+ " }, "
+ "framerate = (float) { "
+ G_STRINGIFY(PAL_FRAMERATE) ", "
+ G_STRINGIFY(NTSC_FRAMERATE)
+ " }; "
+
+ "video/x-raw-rgb, "
+ "bpp = (int) 32, "
+ "depth = (int) 32, "
+ "endianness = (int) " G_STRINGIFY(G_BIG_ENDIAN) ", "
+ "red_mask = (int) 0x000000ff, "
+ "green_mask = (int) 0x0000ff00, "
+ "blue_mask = (int) 0x00ff0000, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY(NTSC_HEIGHT) ", "
+ G_STRINGIFY(PAL_HEIGHT)
+ " }, "
+ "framerate = (float) { "
+ G_STRINGIFY(PAL_FRAMERATE) ", "
+ G_STRINGIFY(NTSC_FRAMERATE)
+ " }; "
+
+ "video/x-raw-rgb, "
+ "bpp = (int) 24, "
+ "depth = (int) 24, "
+ "endianness = (int) " G_STRINGIFY(G_BIG_ENDIAN) ", "
+ "red_mask = (int) 0x000000ff, "
+ "green_mask = (int) 0x0000ff00, "
+ "blue_mask = (int) 0x00ff0000, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY(NTSC_HEIGHT) ", "
+ G_STRINGIFY(PAL_HEIGHT)
+ " }, "
+ "framerate = (float) { "
+ G_STRINGIFY(PAL_FRAMERATE) ", "
+ G_STRINGIFY(NTSC_FRAMERATE)
+ " }"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY ( audio_src_temp,
+static GstStaticPadTemplate audio_src_temp =
+GST_STATIC_PAD_TEMPLATE
+(
"audio",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "arts_sample",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "channels", GST_PROPS_INT (2),
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "rate", GST_PROPS_INT_RANGE (4000, 48000)
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) TRUE, "
+ "channels = (int) 2, "
+ "endianness = (int) " G_STRINGIFY(G_LITTLE_ENDIAN) ", "
+ "rate = (int) [ 4000, 48000 ]"
)
-)
+);
#define GST_TYPE_DVDEC_QUALITY (gst_dvdec_quality_get_type())
GType
* Note that the generated padtemplates are stored in static global
* variables, for the gst_dvdec_init function to use later on.
*/
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET(sink_temp));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET(video_src_temp));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET(audio_src_temp));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&sink_temp));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&video_src_temp));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&audio_src_temp));
gst_element_class_set_details (element_class, &dvdec_details);
}
{
gint i;
- dvdec->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_temp), "sink");
+ dvdec->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&sink_temp), "sink");
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->sinkpad);
gst_pad_set_query_function (dvdec->sinkpad, NULL);
gst_pad_set_convert_function (dvdec->sinkpad, GST_DEBUG_FUNCPTR (gst_dvdec_sink_convert));
gst_pad_set_formats_function (dvdec->sinkpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
- dvdec->videosrcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (video_src_temp), "video");
+ dvdec->videosrcpad = gst_pad_new_from_template (gst_static_pad_template_get (&video_src_temp), "video");
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->videosrcpad);
gst_pad_set_query_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
gst_pad_set_query_type_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
gst_pad_set_convert_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_convert));
gst_pad_set_formats_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
- dvdec->audiosrcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET(audio_src_temp), "audio");
+ dvdec->audiosrcpad = gst_pad_new_from_template (gst_static_pad_template_get (&audio_src_temp), "audio");
gst_element_add_pad(GST_ELEMENT(dvdec),dvdec->audiosrcpad);
gst_pad_set_query_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
gst_pad_set_query_type_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
gst_element_set_loop_function (GST_ELEMENT (dvdec), gst_dvdec_loop);
- dvdec->pool = NULL;
dvdec->length = 0;
dvdec->next_ts = 0LL;
dvdec->end_position = -1LL;
dvdec->PAL = dv_system_50_fields (dvdec->decoder);
dvdec->framerate = (dvdec->PAL ? 2500 : 2997);
- fps = (dvdec->PAL ? 25. : 30/1.001);
+ fps = (dvdec->PAL ? PAL_FRAMERATE : NTSC_FRAMERATE);
dvdec->height = height = (dvdec->PAL ? PAL_HEIGHT : NTSC_HEIGHT);
length = (dvdec->PAL ? PAL_BUFFER : NTSC_BUFFER);
/* if we did not negotiate yet, do it now */
if (!GST_PAD_CAPS (dvdec->videosrcpad)) {
- GstCaps *allowed;
- GstCaps *trylist;
+ GstCaps *caps = NULL;
+ GstCaps *negotiated_caps = NULL;
+ GstPadTemplate *src_pad_template;
+ int i;
- /* we what we are allowed to do */
- allowed = gst_pad_get_allowed_caps (dvdec->videosrcpad);
-
/* try to fix our height */
- trylist = gst_caps_intersect (allowed, gst_caps_append (
- GST_CAPS_NEW (
- "dvdec_negotiate",
- "video/x-raw-yuv",
- "height", GST_PROPS_INT (height),
- "framerate", GST_PROPS_FLOAT (fps)
- ), GST_CAPS_NEW (
- "dvdec_negotiate",
- "video/x-raw-rgb",
- "height", GST_PROPS_INT (height),
- "framerate", GST_PROPS_FLOAT (fps)
- )));
-
- /* prepare for looping */
- trylist = gst_caps_normalize (trylist);
+ src_pad_template = gst_static_pad_template_get (&video_src_temp);
+ caps = gst_caps_copy(gst_pad_template_get_caps (src_pad_template));
+
+ for (i = 0; i < gst_caps_get_size (caps); i++)
+ {
+ GstStructure *structure = gst_caps_get_structure (caps, i);
+ gst_structure_set(structure,
+ "height", G_TYPE_INT, height,
+ "framerate", G_TYPE_INT, fps, NULL
+ );
+ }
- while (trylist) {
- GstCaps *to_try = gst_caps_copy_1 (trylist);
+ for (i=0; i < gst_caps_get_size(caps); i++) {
+ GstStructure *to_try_struct = gst_caps_get_structure (caps, i);
+ GstCaps *try_caps = gst_caps_new_full (to_try_struct);
/* try each format */
- if (gst_pad_try_set_caps (dvdec->videosrcpad, to_try) > 0) {
- guint32 fourcc;
+ if (gst_pad_try_set_caps (dvdec->videosrcpad, try_caps) > 0) {
+ negotiated_caps = try_caps;
+ break;
+ }
+
+ gst_caps_free(try_caps);
+ }
+
+ gst_caps_free (caps);
+
+ /* Check if we negotiated caps successfully */
+ if (negotiated_caps != NULL) {
+ GstStructure *structure = gst_caps_get_structure (negotiated_caps, 0);
+ guint32 fourcc;
/* it worked, try to find what it was again */
- gst_caps_get_fourcc_int (to_try, "format", &fourcc);
+ gst_structure_get_fourcc (structure, "format", &fourcc);
if (fourcc == GST_STR_FOURCC ("RGB ")) {
gint bpp;
- gst_caps_get_int (to_try, "bpp", &bpp);
+ gst_structure_get_int (structure, "bpp", &bpp);
if (bpp == 24) {
dvdec->space = e_dv_color_rgb;
dvdec->bpp = 3;
dvdec->space = e_dv_color_yuv;
dvdec->bpp = 2;
}
- break;
- }
- trylist = trylist->next;
- }
- /* oops list exhausted an nothing was found... */
- if (!trylist) {
+ } else {
gst_element_error (element, "could not negotiate");
return;
}
/* if we did not negotiate yet, do it now */
if (!GST_PAD_CAPS (dvdec->audiosrcpad)) {
gst_pad_try_set_caps (dvdec->audiosrcpad,
- GST_CAPS_NEW (
- "dvdec_audio_caps",
- "audio/x-raw-int",
- "rate", GST_PROPS_INT (dvdec->decoder->audio->frequency),
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "channels", GST_PROPS_INT (dvdec->decoder->audio->num_channels),
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN)
+ gst_caps_new_simple (
+ "audio/x-raw-int",
+ "rate", G_TYPE_INT, dvdec->decoder->audio->frequency,
+ "depth", G_TYPE_INT, 16,
+ "width", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "channels", G_TYPE_INT, dvdec->decoder->audio->num_channels,
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN
));
}
guint8 *outframe_ptrs[3];
gint outframe_pitches[3];
- /* try to grab a pool */
- if (!dvdec->pool) {
- dvdec->pool = gst_pad_get_bufferpool (dvdec->videosrcpad);
- }
-
- outbuf = NULL;
- /* try to get a buffer from the pool if we have one */
- if (dvdec->pool) {
- outbuf = gst_buffer_new_from_pool (dvdec->pool, 0, 0);
- }
- /* no buffer from pool, allocate one ourselves */
- if (!outbuf) {
- outbuf = gst_buffer_new ();
-
- GST_BUFFER_SIZE (outbuf) = (720 * height) * dvdec->bpp;
- GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
- }
+ outbuf = gst_buffer_new_and_alloc ((720 * height) * dvdec->bpp);
outframe = GST_BUFFER_DATA (outbuf);
case GST_STATE_PAUSED_TO_PLAYING:
break;
case GST_STATE_PLAYING_TO_PAUSED:
- if (dvdec->pool)
- gst_buffer_pool_unref (dvdec->pool);
- dvdec->pool = NULL;
break;
case GST_STATE_PAUSED_TO_READY:
dv_decoder_free (dvdec->decoder);
gint quality;
GstByteStream *bs;
- GstBufferPool *pool;
dv_color_space_t space;
gint bpp;
gboolean PAL;
ARG_HOST,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src", /* the name of the pads */
- GST_PAD_SRC, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "esdmon_src", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (2)
- )
+static GstStaticPadTemplate src_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]; "
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]"
)
);
static void gst_esdmon_base_init (gpointer g_class);
-static void gst_esdmon_class_init (GstEsdmonClass *klass);
-static void gst_esdmon_init (GstEsdmon *esdmon);
+static void gst_esdmon_class_init (gpointer g_class, gpointer class_data);
+static void gst_esdmon_init (GTypeInstance *instance, gpointer g_class);
static gboolean gst_esdmon_open_audio (GstEsdmon *src);
static void gst_esdmon_close_audio (GstEsdmon *src);
sizeof(GstEsdmonClass),
gst_esdmon_base_init,
NULL,
- (GClassInitFunc)gst_esdmon_class_init,
+ gst_esdmon_class_init,
NULL,
NULL,
sizeof(GstEsdmon),
0,
- (GInstanceInitFunc)gst_esdmon_init,
+ gst_esdmon_init,
};
esdmon_type = g_type_register_static(GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0);
}
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_factory));
gst_element_class_set_details (element_class, &esdmon_details);
}
static void
-gst_esdmon_class_init (GstEsdmonClass *klass)
+gst_esdmon_class_init (gpointer g_class, gpointer class_data)
{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ parent_class = g_type_class_peek_parent (g_class);
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_BYTESPERREAD,
+ g_object_class_install_property(gobject_class, ARG_BYTESPERREAD,
g_param_spec_ulong("bytes_per_read","bytes_per_read","bytes_per_read",
0,G_MAXULONG,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CUROFFSET,
+ g_object_class_install_property(gobject_class, ARG_CUROFFSET,
g_param_spec_ulong("curoffset","curoffset","curoffset",
0,G_MAXULONG,0,G_PARAM_READABLE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_DEPTH,
+ g_object_class_install_property(gobject_class, ARG_DEPTH,
g_param_spec_enum("depth","depth","depth",
GST_TYPE_ESDMON_DEPTHS,16,G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CHANNELS,
+ g_object_class_install_property(gobject_class, ARG_CHANNELS,
g_param_spec_enum("channels","channels","channels",
GST_TYPE_ESDMON_CHANNELS,2,G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_RATE,
+ g_object_class_install_property(gobject_class, ARG_RATE,
g_param_spec_int("frequency","frequency","frequency",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HOST,
+ g_object_class_install_property(gobject_class, ARG_HOST,
g_param_spec_string("host","host","host",
NULL, G_PARAM_READWRITE)); /* CHECKME */
}
static void
-gst_esdmon_init(GstEsdmon *esdmon)
+gst_esdmon_init(GTypeInstance *instance, gpointer g_class)
{
+ GstEsdmon *esdmon = GST_ESDMON (instance);
+
esdmon->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_factory), "src");
+ gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (esdmon), "src"),
+ "src");
gst_pad_set_get_function(esdmon->srcpad, gst_esdmon_get);
gst_element_add_pad(GST_ELEMENT(esdmon), esdmon->srcpad);
if (!GST_PAD_CAPS (pad)) {
gint sign = (esdmon->depth == 8 ? FALSE : TRUE);
/* set caps on src pad */
+ /* FIXME: do this dynamically */
if (gst_pad_try_set_caps (esdmon->srcpad,
- GST_CAPS_NEW (
- "oss_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), /*FIXME */
- "signed", GST_PROPS_BOOLEAN (sign), /*FIXME */
- "width", GST_PROPS_INT (esdmon->depth),
- "depth", GST_PROPS_INT (esdmon->depth),
- "rate", GST_PROPS_INT (esdmon->frequency),
- "channels", GST_PROPS_INT (esdmon->channels)
- )) <= 0)
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, sign,
+ "width", G_TYPE_INT, esdmon->depth,
+ "depth", G_TYPE_INT, esdmon->depth,
+ "rate", G_TYPE_INT, esdmon->frequency,
+ "channels", G_TYPE_INT, esdmon->channels
+ )) <= 0)
{
gst_element_error (GST_ELEMENT (esdmon), "could not set caps");
return NULL;
ARG_FALLBACK,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "esdsink_sink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (2)
- )
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]; "
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]"
)
);
static void gst_esdsink_base_init (gpointer g_class);
-static void gst_esdsink_class_init (GstEsdsinkClass *klass);
-static void gst_esdsink_init (GstEsdsink *esdsink);
+static void gst_esdsink_class_init (gpointer g_class, gpointer class_data);
+static void gst_esdsink_init (GTypeInstance *instance, gpointer g_class);
static gboolean gst_esdsink_open_audio (GstEsdsink *sink);
static void gst_esdsink_close_audio (GstEsdsink *sink);
static GstElementStateReturn gst_esdsink_change_state (GstElement *element);
-static GstPadLinkReturn gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_esdsink_link (GstPad *pad, const GstCaps *caps);
static GstClockTime gst_esdsink_get_time (GstClock *clock, gpointer data);
static GstClock * gst_esdsink_get_clock (GstElement *element);
sizeof(GstEsdsinkClass),
gst_esdsink_base_init,
NULL,
- (GClassInitFunc)gst_esdsink_class_init,
+ gst_esdsink_class_init,
NULL,
NULL,
sizeof(GstEsdsink),
0,
- (GInstanceInitFunc)gst_esdsink_init,
+ gst_esdsink_init,
};
esdsink_type = g_type_register_static(GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info, 0);
}
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &esdsink_details);
}
static void
-gst_esdsink_class_init (GstEsdsinkClass *klass)
+gst_esdsink_class_init (gpointer g_class, gpointer class_data)
{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ parent_class = g_type_class_peek_parent (g_class);
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_MUTE,
+ g_object_class_install_property(gobject_class, ARG_MUTE,
g_param_spec_boolean("mute","mute","mute",
TRUE,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HOST,
+ g_object_class_install_property(gobject_class, ARG_HOST,
g_param_spec_string("host","host","host",
NULL, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SYNC,
+ g_object_class_install_property(gobject_class, ARG_SYNC,
g_param_spec_boolean("sync","sync","Synchronize output to clock",
FALSE,G_PARAM_READWRITE));
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_FALLBACK,
+ g_object_class_install_property(gobject_class, ARG_FALLBACK,
g_param_spec_boolean("fallback","fallback","Fall back to using OSS if Esound daemon is not present",
FALSE,G_PARAM_READWRITE));
}
static void
-gst_esdsink_init(GstEsdsink *esdsink)
+gst_esdsink_init(GTypeInstance *instance, gpointer g_class)
{
+ GstEsdsink *esdsink = GST_ESDSINK (instance);
+
esdsink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (instance), "sink"),
+ "sink");
gst_element_add_pad(GST_ELEMENT(esdsink), esdsink->sinkpad);
gst_pad_set_chain_function(esdsink->sinkpad, GST_DEBUG_FUNCPTR(gst_esdsink_chain));
- gst_pad_set_link_function(esdsink->sinkpad, gst_esdsink_sinkconnect);
+ gst_pad_set_link_function(esdsink->sinkpad, gst_esdsink_link);
GST_FLAG_SET (esdsink, GST_ELEMENT_EVENT_AWARE);
}
static GstPadLinkReturn
-gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_esdsink_link (GstPad *pad, const GstCaps *caps)
{
GstEsdsink *esdsink;
- gboolean sign;
+ GstStructure *structure;
esdsink = GST_ESDSINK (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "depth", &esdsink->depth);
- gst_caps_get_int (caps, "signed", &sign);
- gst_caps_get_int (caps, "channels", &esdsink->channels);
- gst_caps_get_int (caps, "rate", &esdsink->frequency);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "signed", &esdsink->depth);
+ gst_structure_get_int (structure, "channels", &esdsink->channels);
+ gst_structure_get_int (structure, "rate", &esdsink->frequency);
esdsink->bytes_per_sample = esdsink->channels * (esdsink->depth/8);
- /* only u8/s16 */
- if ((sign == FALSE && esdsink->depth != 8) ||
- (sign == TRUE && esdsink->depth != 16)) {
- return GST_PAD_LINK_REFUSED;
- }
-
gst_esdsink_close_audio (esdsink);
if (gst_esdsink_open_audio (esdsink)) {
esdsink->negotiated = TRUE;
return GST_PAD_LINK_OK;
}
+ /* FIXME: is it supposed to be correct to have closed audio when caps nego
+ failed? */
return GST_PAD_LINK_REFUSED;
}
static GstCaps*
flac_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_flac",
- "audio/x-flac",
- /*gst_props_new (
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL)*/ NULL);
+ return gst_caps_new_simple ("audio/x-flac", NULL);
+ /* "rate", GST_PROPS_INT_RANGE (11025, 48000),
+ * "channels", GST_PROPS_INT_RANGE (1, 2), */
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_raw",
- "audio/x-raw-int",
- gst_props_new (
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", GST_TYPE_INT_RANGE, 11025, 48000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static void
raw_caps = raw_caps_factory ();
flac_caps = flac_caps_factory ();
- sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- flac_caps, NULL);
+ sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
+ GST_PAD_ALWAYS, flac_caps);
src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
+ GST_PAD_ALWAYS, raw_caps);
gst_element_class_add_pad_template (element_class, sink_template);
gst_element_class_add_pad_template (element_class, src_template);
gst_element_class_set_details (element_class, &flacdec_details);
if (!GST_PAD_CAPS (flacdec->srcpad)) {
gst_pad_try_set_caps (flacdec->srcpad,
- GST_CAPS_NEW (
- "flac_caps",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (depth),
- "depth", GST_PROPS_INT (depth),
- "rate", GST_PROPS_INT (frame->header.sample_rate),
- "channels", GST_PROPS_INT (channels)
- ));
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, depth,
+ "depth", G_TYPE_INT, depth,
+ "rate", G_TYPE_INT, frame->header.sample_rate,
+ "channels", G_TYPE_INT, channels,
+ NULL));
flacdec->depth = depth;
flacdec->channels = channels;
static void gst_flacenc_dispose (GObject *object);
static GstPadLinkReturn
- gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps);
+ gst_flacenc_sinkconnect (GstPad *pad, const GstCaps *caps);
static void gst_flacenc_chain (GstPad *pad, GstData *_data);
static gboolean gst_flacenc_update_quality (FlacEnc *flacenc, gint quality);
static GstCaps*
flac_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_flac",
- "audio/x-flac",
- /* gst_props_new (
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL) */NULL);
+ return gst_caps_new_simple ("audio/x-flac", NULL);
+ /* "rate", GST_PROPS_INT_RANGE (11025, 48000),
+ * "channels", GST_PROPS_INT_RANGE (1, 2), */
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_raw",
- "audio/x-raw-int",
- gst_props_new (
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", GST_TYPE_INT_RANGE, 11025, 48000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static void
sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- flac_caps, NULL);
+ flac_caps);
gst_element_class_add_pad_template (element_class, sink_template);
gst_element_class_add_pad_template (element_class, src_template);
gst_element_class_set_details (element_class, &flacenc_details);
}
static GstPadLinkReturn
-gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_flacenc_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstPadLinkReturn ret;
FlacEnc *flacenc;
+ GstStructure *structure;
flacenc = GST_FLACENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "channels", &flacenc->channels);
- gst_caps_get_int (caps, "depth", &flacenc->depth);
- gst_caps_get_int (caps, "rate", &flacenc->sample_rate);
+ gst_structure_get_int (structure, "channels", &flacenc->channels);
+ gst_structure_get_int (structure, "depth", &flacenc->depth);
+ gst_structure_get_int (structure, "rate", &flacenc->sample_rate);
- caps = GST_CAPS_NEW ("flacenc_srccaps",
- "audio/x-flac",
- "channels", GST_PROPS_INT (flacenc->channels),
- "rate", GST_PROPS_INT (flacenc->sample_rate));
+ caps = gst_caps_new_simple ("audio/x-flac",
+ "channels", G_TYPE_INT, flacenc->channels,
+ "rate", G_TYPE_INT, flacenc->sample_rate, NULL);
ret = gst_pad_try_set_caps (flacenc->srcpad, caps);
if (ret <= 0) {
return ret;
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (flac_tag_src_template_factory,
+static GstStaticPadTemplate flac_tag_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flac_tag_tag_src",
- "audio/x-flac",
- NULL
- ),
- GST_CAPS_NEW (
- "flac_tag_tag_src",
- "application/x-gst-tags",
- NULL
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (flac_tag_sink_template_factory,
+ GST_STATIC_CAPS ("audio/x-flac; application/x-gst-tags")
+);
+
+static GstStaticPadTemplate flac_tag_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flac_tag_data_sink",
- "audio/x-flac",
- NULL
- )
-)
+ GST_STATIC_CAPS ("audio/x-flac")
+);
static void gst_flac_tag_base_init (gpointer g_class);
gst_element_class_set_details (element_class, &gst_flac_tag_details);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (flac_tag_sink_template_factory));
+ gst_static_pad_template_get (&flac_tag_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory));
+ gst_static_pad_template_get (&flac_tag_src_template));
}
{
/* do caps nego */
GstCaps *caps;
- capsnego:
- caps = GST_CAPS_NEW ("flac_tag_data_src", "audio/x-flac", NULL);
+
+ caps = gst_caps_new_simple ("audio/x-flac", NULL);
if (gst_pad_try_set_caps (tag->srcpad, caps) != GST_PAD_LINK_REFUSED) {
tag->only_output_tags = FALSE;
GST_LOG_OBJECT (tag, "normal operation, using audio/x-flac output");
} else {
- if (gst_pad_try_set_caps (tag->srcpad,
- GST_CAPS_NEW ("flac_tag_tag_src", "application/x-gst-tags", NULL))
+ if (gst_pad_try_set_caps (tag->srcpad, gst_caps_new_simple (
+ "application/x-gst-tags", NULL))
!= GST_PAD_LINK_REFUSED) {
tag->only_output_tags = TRUE;
GST_LOG_OBJECT (tag, "fast operation, just outputting tags");
printf ("output tags only\n");
} else {
- caps = gst_pad_template_get_caps (GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory));
- if (gst_pad_recover_caps_error (tag->srcpad, caps)) {
- goto capsnego;
- } else {
- return FALSE;
- }
+ return FALSE;
}
}
return TRUE;
{
/* create the sink and src pads */
tag->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (flac_tag_sink_template_factory), "sink");
+ gst_static_pad_template_get (&flac_tag_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (tag), tag->sinkpad);
gst_pad_set_chain_function (tag->sinkpad, GST_DEBUG_FUNCPTR (gst_flac_tag_chain));
tag->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory), "src");
+ gst_static_pad_template_get (&flac_tag_src_template), "src");
gst_element_add_pad (GST_ELEMENT (tag), tag->srcpad);
tag->buffer = NULL;
#endif
#include <gst/gst.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gst/video/video.h>
#include <string.h>
#include "gstgdkpixbuf.h"
ARG_SILENT
};
-GST_PAD_TEMPLATE_FACTORY (gst_gdk_pixbuf_sink_factory,
+static GstStaticPadTemplate gst_gdk_pixbuf_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/png", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/jpeg", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/gif", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-icon", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "application/x-navi-animation", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-cmu-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-sun-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/tiff", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-anymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-graymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-MS-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/vnd.wap.wbmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-tga", NULL)
+ GST_STATIC_CAPS (
+ "image/png; "
+ "image/jpeg; "
+ "image/gif; "
+ "image/x-icon; "
+ "application/x-navi-animation; "
+ "image/x-cmu-raster; "
+ "image/x-sun-raster; "
+ "image/x-pixmap; "
+ "image/tiff; "
+ "image/x-portable-anymap; "
+ "image/x-portable-bitmap; "
+ "image/x-portable-graymap; "
+ "image/x-portable-pixmap; "
+ "image/bmp; "
+ "image/x-bmp; "
+ "image/x-MS-bmp; "
+ "image/vnd.wap.wbmp; "
+ "image/x-bitmap; "
+ "image/x-tga")
);
-GST_PAD_TEMPLATE_FACTORY (gst_gdk_pixbuf_src_factory,
+static GstStaticPadTemplate gst_gdk_pixbuf_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "gdk_pixbuf_src",
- "video/x-raw-rgb",
- "width", GST_PROPS_INT_RANGE(1,INT_MAX),
- "height", GST_PROPS_INT_RANGE(1,INT_MAX),
- /* well, it's needed for connectivity but this
- * doesn't really make sense... */
- "framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT),
- "bpp", GST_PROPS_INT(32),
- "depth", GST_PROPS_INT(24),
- "endianness", GST_PROPS_INT(G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT(0x00ff0000),
- "green_mask", GST_PROPS_INT(0x0000ff00),
- "blue_mask", GST_PROPS_INT(0x000000ff)
- )
+ GST_STATIC_CAPS (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24)
);
static void gst_gdk_pixbuf_base_init (gpointer g_class);
static GstElementClass *parent_class = NULL;
static GstPadLinkReturn
-gst_gdk_pixbuf_sink_link (GstPad *pad, GstCaps *caps)
+gst_gdk_pixbuf_sink_link (GstPad *pad, const GstCaps *caps)
{
GstGdkPixbuf *filter;
g_return_val_if_fail (GST_IS_GDK_PIXBUF (filter),
GST_PAD_LINK_REFUSED);
- if (GST_CAPS_IS_FIXED (caps))
- {
- return GST_PAD_LINK_OK;
- }
-
return GST_PAD_LINK_DELAYED;
}
* library. */
static GstCaps *gst_gdk_pixbuf_get_capslist(void)
{
- GstCaps *capslist;
-
- capslist = gst_caps_chain(
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/png", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/jpeg", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/gif", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-icon", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "application/x-navi-animation", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-cmu-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-sun-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/tiff", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-anymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-graymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-MS-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/vnd.wap.wbmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-tga", NULL),
- NULL);
-
- return capslist;
+ return gst_caps_copy (gst_static_caps_get (
+ &gst_gdk_pixbuf_sink_template.static_caps));
}
#else
static GstCaps *gst_gdk_pixbuf_get_capslist(void)
GdkPixbufFormat *pixbuf_format;
char **mimetypes;
char **mimetype;
- static GstCaps *capslist = NULL;
-
- if(capslist==NULL){
- slist0 = gdk_pixbuf_get_formats();
-
- for(slist = slist0;slist;slist=g_slist_next(slist)){
- pixbuf_format = slist->data;
- mimetypes = gdk_pixbuf_format_get_mime_types(pixbuf_format);
- for(mimetype = mimetypes; *mimetype; mimetype++){
- capslist = gst_caps_append(capslist, gst_caps_new("ack",*mimetype,NULL));
- }
- g_free(mimetypes);
- }
- gst_caps_ref(capslist);
- gst_caps_sink(capslist);
- g_slist_free(slist0);
+ GstCaps *capslist = NULL;
- g_print("%s\n",gst_caps_to_string(capslist));
+ capslist = gst_caps_new_empty ();
+ slist0 = gdk_pixbuf_get_formats();
+
+ for(slist = slist0;slist;slist=g_slist_next(slist)){
+ pixbuf_format = slist->data;
+ mimetypes = gdk_pixbuf_format_get_mime_types(pixbuf_format);
+ for(mimetype = mimetypes; *mimetype; mimetype++){
+ gst_caps_append_structure (capslist,
+ gst_structure_new (*mimetype,NULL));
+ }
+ g_free(mimetypes);
}
+ g_slist_free(slist0);
return capslist;
}
#endif
-static GstCaps *gst_gdk_pixbuf_sink_getcaps(GstPad *pad, GstCaps *caps)
+static GstCaps *gst_gdk_pixbuf_sink_getcaps(GstPad *pad)
{
GstGdkPixbuf *filter;
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_gdk_pixbuf_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_gdk_pixbuf_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get( &gst_gdk_pixbuf_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get( &gst_gdk_pixbuf_sink_template));
gst_element_class_set_details (element_class, &plugin_details);
}
static void
gst_gdk_pixbuf_init (GstGdkPixbuf *filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_gdk_pixbuf_sink_factory (),
- "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get( &gst_gdk_pixbuf_sink_template), "sink");
gst_pad_set_link_function (filter->sinkpad, gst_gdk_pixbuf_sink_link);
gst_pad_set_getcaps_function (filter->sinkpad, gst_gdk_pixbuf_sink_getcaps);
- filter->srcpad = gst_pad_new_from_template (gst_gdk_pixbuf_src_factory (),
- "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get( &gst_gdk_pixbuf_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
GstBuffer *outbuf;
GError *error = NULL;
- g_print("gst_gdk_pixbuf_chain\n");
+ GST_DEBUG ("gst_gdk_pixbuf_chain");
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
filter->image_size = filter->rowstride * filter->height;
caps = gst_pad_get_caps(filter->srcpad);
- gst_caps_set(caps, "width", GST_PROPS_INT(filter->width));
- gst_caps_set(caps, "height", GST_PROPS_INT(filter->height));
- gst_caps_set(caps, "framerate", GST_PROPS_FLOAT(0.));
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, filter->width,
+ "height", G_TYPE_INT, filter->height,
+ "framerate", G_TYPE_DOUBLE, 0., NULL);
gst_pad_try_set_caps(filter->srcpad, caps);
}
gchar **mlist = gdk_pixbuf_format_get_mime_types(format);
gst_type_find_suggest (tf, GST_TYPE_FIND_MINIMUM,
- gst_caps_new ("gdk_pixbuf_type_find", mlist[0], NULL));
+ gst_caps_new_simple (mlist[0], NULL));
}
gdk_pixbuf_loader_close (pixbuf_loader, NULL);
return FALSE;
gst_type_find_register (plugin, "image/*", GST_RANK_MARGINAL,
- gst_gdk_pixbuf_type_find, NULL, GST_CAPS_ANY, NULL);
+ gst_gdk_pixbuf_type_find, NULL,
+ gst_caps_copy(GST_CAPS_ANY), NULL);
/* plugin initialisation succeeded */
return TRUE;
static void gst_jpegdec_chain (GstPad *pad, GstData *_data);
static GstPadLinkReturn
- gst_jpegdec_link (GstPad *pad, GstCaps *caps);
+ gst_jpegdec_link (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_jpegdec_signals[LAST_SIGNAL] = { 0 }; */
static GstCaps*
jpeg_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_jpeg",
- "image/jpeg",
- gst_props_new (
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL));
+ return gst_caps_new_simple ("image/jpeg",
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_raw",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
+ return gst_caps_from_string (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"));
}
static void
jpegdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- jpeg_caps, NULL);
+ jpeg_caps);
jpegdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
gst_element_class_add_pad_template (element_class, jpegdec_sink_template);
gst_element_class_add_pad_template (element_class, jpegdec_src_template);
gst_element_class_set_details (element_class, &gst_jpegdec_details);
}
static GstPadLinkReturn
-gst_jpegdec_link (GstPad *pad, GstCaps *caps)
+gst_jpegdec_link (GstPad *pad, const GstCaps *caps)
{
GstJpegDec *jpegdec = GST_JPEGDEC (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get (caps,
- "framerate", &jpegdec->fps,
- "width", &jpegdec->width,
- "height", &jpegdec->height,
- NULL);
+ gst_structure_get_double (structure, "framerate", &jpegdec->fps);
+ gst_structure_get_int (structure, "width", &jpegdec->width);
+ gst_structure_get_int (structure, "height", &jpegdec->height);
- caps = GST_CAPS_NEW ("jpegdec_srccaps",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (
- GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT (jpegdec->width),
- "height", GST_PROPS_INT (jpegdec->height),
- "framerate", GST_PROPS_FLOAT (jpegdec->fps));
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'),
+ "width", G_TYPE_INT, jpegdec->width,
+ "height", G_TYPE_INT, jpegdec->height,
+ "framerate", G_TYPE_DOUBLE, jpegdec->fps,
+ NULL);
return gst_pad_try_set_caps (jpegdec->srcpad, caps);
}
jpegdec->line[2] = g_realloc(jpegdec->line[2], height*sizeof(char*));
jpegdec->height = height;
- gst_pad_try_set_caps (jpegdec->srcpad,
- GST_CAPS_NEW (
- "jpegdec_caps",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (
- GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT (width),
- "height", GST_PROPS_INT (height),
- "framerate", GST_PROPS_FLOAT (jpegdec->fps)
- ));
+ gst_pad_try_set_caps (jpegdec->srcpad,
+ gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'),
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", G_TYPE_DOUBLE, jpegdec->fps,
+ NULL));
}
/* mind the swap, jpeglib outputs blue chroma first */
gint format;
gint width;
gint height;
- gfloat fps;
+ gdouble fps;
/* the size of the output buffer */
gint outsize;
/* the jpeg line buffer */
static void gst_jpegenc_class_init (GstJpegEnc *klass);
static void gst_jpegenc_init (GstJpegEnc *jpegenc);
-static void gst_jpegenc_chain (GstPad *pad,GstData *_data);
-static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, GstCaps *caps);
+static void gst_jpegenc_chain (GstPad *pad, GstData *_data);
+static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, const GstCaps *caps);
static GstData *gst_jpegenc_get (GstPad *pad);
static GstCaps*
jpeg_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_jpeg",
- "video/x-jpeg",
- gst_props_new (
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL));
+ return gst_caps_new_simple ("video/x-jpeg",
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_raw",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
+ return gst_caps_from_string (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"));
}
static void
jpegenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
jpegenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- jpeg_caps, NULL);
+ jpeg_caps);
gst_element_class_add_pad_template (element_class, jpegenc_sink_template);
gst_element_class_add_pad_template (element_class, jpegenc_src_template);
}
static GstPadLinkReturn
-gst_jpegenc_link (GstPad *pad, GstCaps *caps)
+gst_jpegenc_link (GstPad *pad, const GstCaps *caps)
{
GstJpegEnc *jpegenc = GST_JPEGENC (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get (caps,
- "framerate", &jpegenc->fps,
- "width", &jpegenc->width,
- "height", &jpegenc->height,
- NULL);
-
- caps = GST_CAPS_NEW ("jpegdec_srccaps",
- "video/x-jpeg",
- "width", GST_PROPS_INT (jpegenc->width),
- "height", GST_PROPS_INT (jpegenc->height),
- "framerate", GST_PROPS_FLOAT (jpegenc->fps));
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_double (structure, "framerate", &jpegenc->fps);
+ gst_structure_get_int (structure, "width", &jpegenc->width);
+ gst_structure_get_int (structure, "height", &jpegenc->height);
+
+ caps = gst_caps_new_simple ("video/x-jpeg",
+ "width", G_TYPE_INT, jpegenc->width,
+ "height", G_TYPE_INT, jpegenc->height,
+ "framerate", G_TYPE_DOUBLE, jpegenc->fps,
+ NULL);
return gst_pad_try_set_caps (jpegenc->srcpad, caps);
}
gint format;
gint width;
gint height;
- gfloat fps;
+ gdouble fps;
/* the video buffer */
gint bufsize;
GstBuffer *buffer;
#define LADSPA_VERSION "1.0"
#endif
-/* takes ownership of the name */
-static GstPadTemplate*
-ladspa_sink_factory (gchar *name)
-{
- return GST_PAD_TEMPLATE_NEW (
- name,
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "ladspa_sink",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
- );
-}
-
-/* takes ownership of the name */
-static GstPadTemplate*
-ladspa_src_factory (gchar *name)
-{
- return GST_PAD_TEMPLATE_NEW (
- name,
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "ladspa_src",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
- );
-}
+static GstStaticCaps ladspa_pad_caps =
+GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
static void gst_ladspa_class_init (GstLADSPAClass *klass);
static void gst_ladspa_base_init (GstLADSPAClass *klass);
static void gst_ladspa_init (GstLADSPA *ladspa);
static void gst_ladspa_update_int (const GValue *value, gpointer data);
-static GstPadLinkReturn gst_ladspa_link (GstPad *pad, GstCaps *caps);
-static void gst_ladspa_force_src_caps (GstLADSPA *ladspa, GstPad *pad);
+static GstPadLinkReturn gst_ladspa_link (GstPad *pad, const GstCaps *caps);
static void gst_ladspa_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_ladspa_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
/* the factories take ownership of the name */
if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[j])) {
- templ = ladspa_sink_factory (name);
+ templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsinkpads++;
} else {
- templ = ladspa_src_factory (name);
+ templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsrcpads++;
}
ladspa->buffer_frames = 0; /* should be set with caps */
ladspa->activated = FALSE;
- ladspa->bufpool = NULL;
ladspa->inplace_broken = LADSPA_IS_INPLACE_BROKEN(ladspa->descriptor->Properties);
if (sinkcount==0 && srccount == 1) {
}
static GstPadLinkReturn
-gst_ladspa_link (GstPad *pad, GstCaps *caps)
+gst_ladspa_link (GstPad *pad, const GstCaps *caps)
{
GstElement *element = (GstElement*)GST_PAD_PARENT (pad);
GstLADSPA *ladspa = (GstLADSPA*)element;
const GList *l = NULL;
gint rate;
+ GstStructure *structure;
- if (GST_CAPS_IS_FIXED (caps)) {
- /* if this fails in some other plugin, the graph is left in an inconsistent
- state */
- for (l=gst_element_get_pad_list (element); l; l=l->next)
- if (pad != (GstPad*)l->data)
- if (gst_pad_try_set_caps ((GstPad*)l->data, caps) <= 0)
- return GST_PAD_LINK_REFUSED;
-
- /* we assume that the ladspa plugin can handle any sample rate, so this
- check gets put last */
- gst_caps_get_int (caps, "rate", &rate);
- /* have to instantiate ladspa plugin when samplerate changes (groan) */
- if (ladspa->samplerate != rate) {
- ladspa->samplerate = rate;
- if (! gst_ladspa_instantiate(ladspa))
+ /* if this fails in some other plugin, the graph is left in an inconsistent
+ state */
+ for (l=gst_element_get_pad_list (element); l; l=l->next)
+ if (pad != (GstPad*)l->data)
+ if (gst_pad_try_set_caps ((GstPad*)l->data, caps) <= 0)
return GST_PAD_LINK_REFUSED;
- }
-
- gst_caps_get_int (caps, "buffer-frames", &ladspa->buffer_frames);
-
- if (ladspa->bufpool)
- gst_buffer_pool_unref (ladspa->bufpool);
- ladspa->bufpool = gst_buffer_pool_get_default (ladspa->buffer_frames * sizeof(gfloat),
- 3);
-
- return GST_PAD_LINK_OK;
+
+ /* we assume that the ladspa plugin can handle any sample rate, so this
+ check gets put last */
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
+ /* have to instantiate ladspa plugin when samplerate changes (groan) */
+ if (ladspa->samplerate != rate) {
+ ladspa->samplerate = rate;
+ if (! gst_ladspa_instantiate(ladspa))
+ return GST_PAD_LINK_REFUSED;
}
- return GST_PAD_LINK_DELAYED;
+ gst_structure_get_int (structure, "buffer-frames", &ladspa->buffer_frames);
+
+ return GST_PAD_LINK_OK;
}
+#if 0
static void
gst_ladspa_force_src_caps(GstLADSPA *ladspa, GstPad *pad)
{
if (!ladspa->buffer_frames) {
ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */
- g_return_if_fail (ladspa->bufpool == NULL);
- ladspa->bufpool =
- gst_buffer_pool_get_default (ladspa->buffer_frames * sizeof(gfloat), 3);
}
DEBUG_OBJ (ladspa, "forcing caps with rate=%d, buffer-frames=%d",
"ladspa_src_caps",
"audio/x-raw-float",
gst_props_new (
- "width", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT (ladspa->samplerate),
- "buffer-frames", GST_PROPS_INT (ladspa->buffer_frames),
- "channels", GST_PROPS_INT (1),
+ "width", G_TYPE_INT (32),
+ "endianness", G_TYPE_INT (G_BYTE_ORDER),
+ "rate", G_TYPE_INT (ladspa->samplerate),
+ "buffer-frames", G_TYPE_INT (ladspa->buffer_frames),
+ "channels", G_TYPE_INT (1),
NULL)));
}
+#endif
static void
gst_ladspa_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
GST_BUFFER_TIMESTAMP(buffers_in[i]) = ladspa->timestamp;
}
- if (!ladspa->bufpool) {
- gst_element_error (element, "Caps were never set, bailing...");
- return;
- }
-
i=0;
if (!ladspa->inplace_broken) {
for (; i<numsrcpads && i<numsinkpads; i++) {
}
}
for (; i<numsrcpads; i++) {
- /* we have to make new buffers -- at least we're taking them from a pool */
- buffers_out[i] = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
+ buffers_out[i] = gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof(gfloat));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data*)GST_BUFFER_DATA (buffers_out[i]);
}
/* we shouldn't get events here... */
g_return_if_fail (GST_IS_BUFFER (buffer_in));
- if (!ladspa->bufpool) {
- gst_element_error ((GstElement*)ladspa, "Caps were never set, bailing...");
- return;
- }
-
/* FIXME: this function shouldn't need to malloc() anything */
if (numsrcpads > 0) {
buffers_out = g_new(GstBuffer*, numsrcpads);
i++;
}
for (; i<numsrcpads; i++) {
- /* we have to make new buffers -- at least we're taking them from a pool */
- buffers_out[i] = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
- /* the size of the buffer returned from the pool is the maximum size; this
- chained buffer might be smaller */
- GST_BUFFER_SIZE (buffers_out[i]) = GST_BUFFER_SIZE (buffer_in);
+ buffers_out[i] = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(buffer_in));
DEBUG ("new %d", GST_BUFFER_SIZE (buffer_in));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data*)GST_BUFFER_DATA (buffers_out[i]);
oclass = (GstLADSPAClass*)(G_OBJECT_GET_CLASS(ladspa));
desc = ladspa->descriptor;
- if (!ladspa->bufpool) {
- /* capsnego hasn't happened... */
- gst_ladspa_force_src_caps(ladspa, ladspa->srcpads[0]);
- }
-
- buf = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
+ /* 4096 is arbitrary */
+ buf = gst_buffer_new_and_alloc (4096);
GST_BUFFER_TIMESTAMP(buf) = ladspa->timestamp;
data = (LADSPA_Data *) GST_BUFFER_DATA(buf);
GstPad **sinkpads,
**srcpads;
- GstBufferPool *bufpool;
-
gboolean activated;
gint samplerate, buffer_frames;
static GstCaps*
png_caps_factory (void)
{
- return gst_caps_new ( "png_png",
- "video/x-png",
- gst_props_new (
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL));
+ return gst_caps_new_simple ("video/x-png",
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
static GstCaps*
raw_caps_factory (void)
{
- return gst_caps_new ( "png_raw",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24
- );
+ return gst_caps_from_string (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24);
}
static void
pngenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
pngenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- png_caps, NULL);
+ png_caps);
gst_element_class_add_pad_template (element_class, pngenc_sink_template);
gst_element_class_add_pad_template (element_class, pngenc_src_template);
static GstPadLinkReturn
-gst_pngenc_sinklink (GstPad *pad, GstCaps *caps)
+gst_pngenc_sinklink (GstPad *pad, const GstCaps *caps)
{
GstPngEnc *pngenc;
- gfloat fps;
+ gdouble fps;
+ GstStructure *structure;
pngenc = GST_PNGENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &pngenc->width);
+ gst_structure_get_int (structure, "height", &pngenc->height);
+ gst_structure_get_double (structure, "framerate", &fps);
+ gst_structure_get_int (structure, "bpp", &pngenc->bpp);
- gst_caps_get_int (caps, "width", &pngenc->width);
- gst_caps_get_int (caps, "height", &pngenc->height);
- gst_caps_get_float (caps, "framerate", &fps);
- gst_caps_get_int (caps, "bpp", &pngenc->bpp);
-
- caps = GST_CAPS_NEW ("png_src",
- "video/x-png",
- "framerate", GST_PROPS_FLOAT (fps),
- "width", GST_PROPS_INT (pngenc->width),
- "height", GST_PROPS_INT (pngenc->height));
+ caps = gst_caps_new_simple ("video/x-png",
+ "framerate", G_TYPE_DOUBLE, fps,
+ "width", G_TYPE_INT, pngenc->width,
+ "height", G_TYPE_INT, pngenc->height, NULL);
return gst_pad_try_set_caps (pngenc->srcpad, caps);
}
};
-static GstPadTemplate*
-mikmod_src_factory (void)
-{
- static GstPadTemplate *template = NULL;
-
- if (!template) {
- template = gst_pad_template_new (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "mikmod_src",
- "audio/x-raw-int",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
- ), NULL);
- }
- return template;
-}
-
-
-static GstPadTemplate*
-mikmod_sink_factory (void)
-{
- static GstPadTemplate *template = NULL;
-
- if (!template) {
- template = gst_pad_template_new (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "mikmod_sink",
- "audio/x-mod",
- NULL),NULL
- );
- }
- return template;
-}
+static GstStaticPadTemplate mikmod_src_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+);
+
+static GstStaticPadTemplate mikmod_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-mod")
+);
static void gst_mikmod_base_init (gpointer g_class);
static void gst_mikmod_class_init (GstMikModClass *klass);
static void gst_mikmod_init (GstMikMod *filter);
static void gst_mikmod_set_property (GObject *object, guint id, const GValue *value, GParamSpec *pspec );
static void gst_mikmod_get_property (GObject *object, guint id, GValue *value, GParamSpec *pspec );
-static GstPadLinkReturn gst_mikmod_srclink (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_mikmod_srclink (GstPad *pad, const GstCaps *caps);
static void gst_mikmod_loop (GstElement *element);
static gboolean gst_mikmod_setup (GstMikMod *mikmod);
static GstElementStateReturn gst_mikmod_change_state (GstElement *element);
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, mikmod_src_factory ());
- gst_element_class_add_pad_template (element_class, mikmod_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mikmod_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mikmod_sink_factory));
gst_element_class_set_details (element_class, &mikmod_details);
}
static void
gst_mikmod_init (GstMikMod *filter)
{
- filter->sinkpad = gst_pad_new_from_template(mikmod_sink_factory (),"sink");
- filter->srcpad = gst_pad_new_from_template(mikmod_src_factory (),"src");
+ filter->sinkpad = gst_pad_new_from_template(
+ gst_static_pad_template_get (&mikmod_sink_factory),"sink");
+ filter->srcpad = gst_pad_new_from_template(
+ gst_static_pad_template_get (&mikmod_src_factory),"src");
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
sign = FALSE;
}
- return gst_pad_try_set_caps (mikmod->srcpad,
- GST_CAPS_NEW (
- "mikmod_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (sign),
- "width", GST_PROPS_INT (width),
- "depth", GST_PROPS_INT (width),
- "rate", GST_PROPS_INT (mikmod->mixfreq),
- "channels", GST_PROPS_INT (mikmod->stereo ? 2 : 1)));
+ return gst_pad_try_set_caps (mikmod->srcpad,
+ gst_caps_new_simple ( "audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, sign,
+ "width", G_TYPE_INT, width,
+ "depth", G_TYPE_INT, width,
+ "rate", G_TYPE_INT, mikmod->mixfreq,
+ "channels", G_TYPE_INT, mikmod->stereo ? 2 : 1,
+ NULL));
}
static GstPadLinkReturn
-gst_mikmod_srclink (GstPad *pad, GstCaps *caps)
+gst_mikmod_srclink (GstPad *pad, const GstCaps *caps)
{
GstMikMod *filter;
+ GstStructure *structure;
+ gint depth;
+ gint channels;
filter = GST_MIKMOD (gst_pad_get_parent (pad));
- if (gst_caps_has_property_typed (caps, "depth", GST_PROPS_INT_TYPE)) {
- gint depth;
- gst_caps_get_int (caps, "depth", &depth);
- filter->_16bit = (depth == 16);
- }
- if (gst_caps_has_property_typed (caps, "channels", GST_PROPS_INT_TYPE)) {
- gint channels;
- gst_caps_get_int (caps, "channels", &channels);
- filter->stereo = (channels == 2);
- }
- if (gst_caps_has_property_typed (caps, "rate", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "rate", &filter->mixfreq);
- }
+ structure = gst_caps_get_structure (caps, 0);
+
+ gst_structure_get_int (structure, "depth", &depth);
+ filter->_16bit = (depth == 16);
+ gst_structure_get_int (structure, "channels", &channels);
+ filter->stereo = (channels == 2);
+ gst_structure_get_int (structure, "rate", &filter->mixfreq);
return gst_mikmod_negotiate(filter);
}
};
-GST_PAD_TEMPLATE_FACTORY(textoverlay_src_template_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "textoverlay_src",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST(
- GST_PROPS_FOURCC(GST_STR_FOURCC("I420"))
- ),
- "width", GST_PROPS_INT_RANGE(0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE(0, G_MAXINT)
- )
- )
-
-GST_PAD_TEMPLATE_FACTORY(video_sink_template_factory,
- "video_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "video_sink",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST(
- GST_PROPS_FOURCC(GST_STR_FOURCC("I420"))
- ),
- "width", GST_PROPS_INT_RANGE(0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE(0, G_MAXINT)
- )
- )
-
-GST_PAD_TEMPLATE_FACTORY(text_sink_template_factory,
- "text_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "text_sink",
- "text/x-pango-markup",
- NULL
- )
- )
+static GstStaticPadTemplate textoverlay_src_template_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-raw-yuv, "
+ "format = (fourcc) I420, "
+ "width = (int) [ 1, MAX ], "
+ "height = (int) [ 1, MAX ]")
+);
+
+static GstStaticPadTemplate video_sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "video_sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-raw-yuv, "
+ "format = (fourcc) I420, "
+ "width = (int) [ 1, MAX ], "
+ "height = (int) [ 1, MAX ]")
+);
+
+static GstStaticPadTemplate text_sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "text_sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("text/x-pango-markup; text/plain")
+);
static void gst_textoverlay_base_init (gpointer g_class);
static void gst_textoverlay_class_init(GstTextOverlayClass *klass);
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (textoverlay_src_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (video_sink_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (text_sink_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&textoverlay_src_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&video_sink_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&text_sink_template_factory));
gst_element_class_set_details (element_class, &textoverlay_details);
}
static GstPadLinkReturn
-gst_textoverlay_video_sinkconnect(GstPad *pad, GstCaps *caps)
+gst_textoverlay_video_sinkconnect(GstPad *pad, const GstCaps *caps)
{
GstTextOverlay *overlay;
+ GstStructure *structure;
overlay = GST_TEXTOVERLAY(gst_pad_get_parent(pad));
- if (!GST_CAPS_IS_FIXED(caps))
- return GST_PAD_LINK_DELAYED;
-
+ structure = gst_caps_get_structure (caps, 0);
overlay->width = overlay->height = 0;
- gst_caps_get_int(caps, "width", &overlay->width);
- gst_caps_get_int(caps, "height", &overlay->height);
+ gst_structure_get_int (structure, "width", &overlay->width);
+ gst_structure_get_int (structure, "height", &overlay->height);
return gst_pad_try_set_caps(overlay->srcpad, caps);
}
{
/* video sink */
overlay->video_sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(video_sink_template_factory), "video_sink");
+ gst_static_pad_template_get (&video_sink_template_factory), "video_sink");
/* gst_pad_set_chain_function(overlay->video_sinkpad, gst_textoverlay_video_chain); */
gst_pad_set_link_function(overlay->video_sinkpad, gst_textoverlay_video_sinkconnect);
gst_element_add_pad(GST_ELEMENT(overlay), overlay->video_sinkpad);
/* text sink */
overlay->text_sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(text_sink_template_factory), "text_sink");
+ gst_static_pad_template_get (&text_sink_template_factory), "text_sink");
/* gst_pad_set_link_function(overlay->text_sinkpad, gst_textoverlay_text_sinkconnect); */
gst_element_add_pad(GST_ELEMENT(overlay), overlay->text_sinkpad);
/* (video) source */
overlay->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(textoverlay_src_template_factory), "src");
+ gst_static_pad_template_get (&textoverlay_src_template_factory), "src");
gst_element_add_pad(GST_ELEMENT(overlay), overlay->srcpad);
overlay->layout = pango_layout_new(GST_TEXTOVERLAY_GET_CLASS(overlay)->pango_context);
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"dv1394src",
"video/dv",
/*
gst_props_new (
"format", GST_PROPS_LIST (
- GST_PROPS_STRING ("NTSC"),
- GST_PROPS_STRING ("PAL")
+ G_TYPE_STRING ("NTSC"),
+ G_TYPE_STRING ("PAL")
),
NULL)
),
/* initialized when first header received */
dv1394src->frameSize=0;
- dv1394src->pool = NULL;
dv1394src->buf = NULL;
dv1394src->frame = NULL;
int dif_block = p[2];
/* if we are at the beginning of a frame,
- we set buf=frame, and get a new buffer from pool for frame
+ we set buf=frame, and alloc a new buffer for frame
*/
if (section_type == 0 && dif_sequence == 0) { // dif header
- if( dv1394src->pool == NULL ) {
+ if( !dv1394src->negotiated) {
// figure format (NTSC/PAL)
if( p[3] & 0x80 ) {
// PAL
dv1394src->frameSize = PAL_FRAMESIZE;
GST_DEBUG ("PAL data");
if (gst_pad_try_set_caps (dv1394src->srcpad,
- GST_CAPS_NEW ( "dv1394src", "video/dv",
- "format", GST_PROPS_STRING("PAL"),
- NULL)
- ) <= 0) {
+ gst_caps_new_simple ("video/dv",
+ "format", G_TYPE_STRING, "PAL", NULL)) <= 0) {
gst_element_error (GST_ELEMENT(dv1394src), "Could not set source caps for PAL");
return 0;
}
dv1394src->frameSize = NTSC_FRAMESIZE;
GST_DEBUG ("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
if (gst_pad_try_set_caps (dv1394src->srcpad,
- GST_CAPS_NEW ( "dv1394src", "video/dv",
- "format", GST_PROPS_STRING ("NTSC"),
- NULL)
- ) <= 0) {
+ gst_caps_new_simple ("video/dv",
+ "format", G_TYPE_STRING, "NTSC", NULL)) <= 0) {
gst_element_error (GST_ELEMENT(dv1394src), "Could not set source caps for NTSC");
return 0;
}
}
-
- dv1394src->pool = gst_buffer_pool_get_default( dv1394src->frameSize, N_BUFFERS_IN_POOL );
- if (dv1394src->pool == NULL) {
- gst_element_error (GST_ELEMENT(dv1394src), "gst_buffer_pool_get_default returned NULL");
- }
+ dv1394src->negotiated = TRUE;
}
// drop last frame when not complete
dv1394src->frameSequence++;
if( dv1394src->frameSequence % (dv1394src->skip+dv1394src->consecutive) < dv1394src->consecutive ) {
- if( dv1394src->pool ) dv1394src->frame = gst_buffer_new_from_pool( dv1394src->pool, 0, dv1394src->frameSize );
- dv1394src->bytesInFrame = 0;
+ dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize);
}
+ dv1394src->bytesInFrame = 0;
}
if (dv1394src->frame != NULL) {
raw1394_stop_iso_rcv(dv1394src->handle, dv1394src->channel);
break;
case GST_STATE_READY_TO_NULL:
- if (dv1394src->pool != NULL) {
- gst_buffer_pool_unref(dv1394src->pool);
- dv1394src->pool = NULL;
- }
raw1394_destroy_handle(dv1394src->handle);
break;
default:
guint frameSize;
guint bytesInFrame;
guint frameSequence;
- GstBufferPool *pool;
+
+ gboolean negotiated;
};
struct _GstDV1394SrcClass {
static void gst_speexdec_init (GstSpeexDec *speexdec);
static void gst_speexdec_chain (GstPad *pad, GstData *_data);
-static GstPadLinkReturn gst_speexdec_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_speexdec_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_speexdec_signals[LAST_SIGNAL] = { 0 }; */
return speexdec_type;
}
-GST_CAPS_FACTORY (speex_caps_factory,
- GST_CAPS_NEW (
- "speex_speex",
- "audio/x-speex",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+static GstStaticPadTemplate speex_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-speex, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "speex_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+);
+
+static GstStaticPadTemplate speex_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
+);
static void
gst_speexdec_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *raw_caps, *speex_caps;
- raw_caps = GST_CAPS_GET (raw_caps_factory);
- speex_caps = GST_CAPS_GET (speex_caps_factory);
-
- speexdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- speex_caps, NULL);
- speexdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- gst_element_class_add_pad_template (element_class, speexdec_sink_template);
- gst_element_class_add_pad_template (element_class, speexdec_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_sink_template));
gst_element_class_set_details (element_class, &gst_speexdec_details);
}
}
static GstPadLinkReturn
-gst_speexdec_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_speexdec_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstSpeexDec *speexdec;
gint rate;
+ GstStructure *structure;
speexdec = GST_SPEEXDEC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "rate", &rate);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
if (gst_pad_try_set_caps (speexdec->srcpad,
- GST_CAPS_NEW (
- "speex_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (1)
- )))
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)))
{
return GST_PAD_LINK_OK;
}
static void gst_speexenc_init (GstSpeexEnc *speexenc);
static void gst_speexenc_chain (GstPad *pad,GstData *_data);
-static GstPadLinkReturn gst_speexenc_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_speexenc_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
static guint gst_speexenc_signals[LAST_SIGNAL] = { 0 };
return speexenc_type;
}
-GST_CAPS_FACTORY (speex_caps_factory,
- GST_CAPS_NEW (
- "speex_speex",
- "audio/x-speex",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+static GstStaticPadTemplate speex_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "speex_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+);
+
+static GstStaticPadTemplate speex_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-speex, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
+);
static void
gst_speexenc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *raw_caps, *speex_caps;
- raw_caps = GST_CAPS_GET (raw_caps_factory);
- speex_caps = GST_CAPS_GET (speex_caps_factory);
-
- speexenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- speexenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- speex_caps, NULL);
- gst_element_class_add_pad_template (element_class, speexenc_sink_template);
- gst_element_class_add_pad_template (element_class, speexenc_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_src_template));
gst_element_class_set_details (element_class, &gst_speexenc_details);
}
}
static GstPadLinkReturn
-gst_speexenc_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_speexenc_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstSpeexEnc *speexenc;
+ GstStructure *structure;
speexenc = GST_SPEEXENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "rate", &speexenc->rate);
- if (gst_pad_try_set_caps (speexenc->srcpad, GST_CAPS_NEW (
- "speex_speex",
- "audio/x-speex",
- "rate", GST_PROPS_INT (speexenc->rate),
- "channels", GST_PROPS_INT (1)
- )))
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &speexenc->rate);
+ if (gst_pad_try_set_caps (speexenc->srcpad,
+ gst_caps_new_simple ("audio/x-speex",
+ "rate", G_TYPE_INT, speexenc->rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)))
{
speex_init_header(&speexenc->header, speexenc->rate, 1, speexenc->mode);
speexenc->header.frames_per_packet = speexenc->n_packets;
if (!GST_PAD_CAPS (speexenc->srcpad)) {
if (!gst_pad_try_set_caps (speexenc->srcpad,
- GST_CAPS_NEW (
- "speex_enc",
- "audio/x-speex",
- "rate", GST_PROPS_INT (speexenc->rate),
- "channels", GST_PROPS_INT (1)
- )))
+ gst_caps_new_simple ("audio/x-speex",
+ "rate", G_TYPE_INT, speexenc->rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)))
{
gst_element_error (GST_ELEMENT (speexenc), "could not negotiate");
return;
static void gst_bpwsinc_chain (GstPad * pad, GstData *_data);
static GstPadLinkReturn
- gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps);
+ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_bpwsinc_signals[LAST_SIGNAL] = { 0 }; */
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
/* register src pads */
- gst_element_class_add_pad_template (element_class, gst_filter_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_sink_template));
gst_element_class_set_details (element_class, &gst_bpwsinc_details);
}
static void
gst_bpwsinc_init (GstBPWSinc * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_filter_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_bpwsinc_chain);
gst_pad_set_link_function (filter->sinkpad, gst_bpwsinc_sink_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_filter_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->wing_size = 50;
}
static GstPadLinkReturn
-gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
+gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
{
int i = 0;
double sum = 0.0;
g_assert (GST_IS_PAD (pad));
g_assert (caps != NULL);
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- set_retval = gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ set_retval = gst_pad_try_set_caps (filter->srcpad, caps);
if (set_retval > 0)
{
static void gst_lpwsinc_chain (GstPad * pad, GstData *_data);
static GstPadLinkReturn
- gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps);
+ gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_lpwsinc_signals[LAST_SIGNAL] = { 0 }; */
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
/* register src pads */
- gst_element_class_add_pad_template (element_class, gst_filter_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_sink_template));
gst_element_class_set_details (element_class, &gst_lpwsinc_details);
}
static void
gst_lpwsinc_init (GstLPWSinc * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_filter_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_lpwsinc_chain);
gst_pad_set_link_function (filter->sinkpad, gst_lpwsinc_sink_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_filter_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->wing_size = 50;
}
static GstPadLinkReturn
-gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
+gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
{
int i = 0;
double sum = 0.0;
g_assert (GST_IS_PAD (pad));
g_assert (caps != NULL);
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- set_retval = gst_pad_try_set_caps(filter->srcpad, gst_caps_ref (caps));
+ set_retval = gst_pad_try_set_caps(filter->srcpad, caps);
if (set_retval > 0)
{
#include <string.h>
#include <gstauparse.h>
+#include <gst/audio/audio.h>
/* elementfactory information */
static GstElementDetails gst_auparse_details = GST_ELEMENT_DETAILS (
"Erik Walthinsen <omega@cse.ogi.edu>"
);
-GST_PAD_TEMPLATE_FACTORY (sink_factory_templ,
+static GstStaticPadTemplate gst_auparse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "auparse_sink",
- "audio/x-au",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "audio/x-au" )
+);
-GST_PAD_TEMPLATE_FACTORY (src_factory_templ,
+static GstStaticPadTemplate gst_auparse_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "auparse_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "signed", GST_PROPS_LIST(
- GST_PROPS_BOOLEAN (FALSE),
- GST_PROPS_BOOLEAN (TRUE)
- ),
- "width", GST_PROPS_LIST(
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST(
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000,48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "auparse_src_alaw",
- "audio/x-alaw",
- "rate", GST_PROPS_INT_RANGE (8000,48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS (
+ GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ "audio/x-alaw, "
+ "rate = (int) [ 8000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
)
-)
+);
/* AuParse signals and args */
enum {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory_templ));
+ gst_static_pad_template_get (&gst_auparse_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory_templ));
+ gst_static_pad_template_get (&gst_auparse_src_template));
gst_element_class_set_details (element_class, &gst_auparse_details);
}
gst_auparse_init (GstAuParse *auparse)
{
auparse->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory_templ), "sink");
+ gst_static_pad_template_get (&gst_auparse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (auparse), auparse->sinkpad);
gst_pad_set_chain_function (auparse->sinkpad, gst_auparse_chain);
auparse->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_factory_templ), "src");
+ gst_static_pad_template_get (&gst_auparse_src_template), "src");
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
auparse->offset = 0;
GstAuParse *auparse;
gchar *data;
glong size;
- GstCaps* tempcaps;
+ GstCaps *tempcaps;
gint law, depth;
gboolean sign;
}
if (law) {
- tempcaps = GST_CAPS_NEW ("auparse_src",
- "audio/x-alaw",
- "rate", GST_PROPS_INT (auparse->frequency),
- "channels", GST_PROPS_INT (auparse->channels));
+ tempcaps = gst_caps_new_simple ("audio/x-alaw",
+ "rate", G_TYPE_INT, auparse->frequency,
+ "channels", G_TYPE_INT, auparse->channels, NULL);
} else {
- tempcaps = GST_CAPS_NEW ("auparse_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "rate", GST_PROPS_INT (auparse->frequency),
- "channels", GST_PROPS_INT (auparse->channels),
- "depth", GST_PROPS_INT (depth),
- "width", GST_PROPS_INT (depth),
- "signed", GST_PROPS_BOOLEAN (sign));
+ tempcaps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+ "rate", G_TYPE_INT, auparse->frequency,
+ "channels", G_TYPE_INT, auparse->channels,
+ "depth", G_TYPE_INT, depth,
+ "width", G_TYPE_INT, depth,
+ "signed", G_TYPE_BOOLEAN, sign, NULL);
}
if (gst_pad_try_set_caps (auparse->srcpad, tempcaps) <= 0) {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (sink_templ,
+static GstStaticPadTemplate sink_templ =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "avidemux_sink",
- "video/x-msvideo",
- NULL
- )
+ GST_STATIC_CAPS ("video/x-msvideo")
);
static void gst_avi_demux_base_init (GstAviDemuxClass *klass);
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- audcaps, NULL);
+ audcaps);
- vidcaps = gst_caps_append (
- gst_riff_create_video_template_caps (),
- gst_riff_create_iavs_template_caps ());
+ vidcaps = gst_riff_create_video_template_caps ();
+ gst_caps_append (vidcaps, gst_riff_create_iavs_template_caps ());
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- vidcaps, NULL);
+ vidcaps);
gst_element_class_add_pad_template (element_class, audiosrctempl);
gst_element_class_add_pad_template (element_class, videosrctempl);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_templ));
+ gst_static_pad_template_get (&sink_templ));
gst_element_class_set_details (element_class, &gst_avi_demux_details);
}
GST_FLAG_SET (avi, GST_ELEMENT_EVENT_AWARE);
avi->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_templ), "sink");
+ gst_static_pad_template_get (&sink_templ), "sink");
gst_element_add_pad (GST_ELEMENT (avi), avi->sinkpad);
GST_RIFF_READ (avi)->sinkpad = avi->sinkpad;
static void
gst_avi_demux_streaminfo (GstAviDemux *avi)
{
- GstProps *props;
-
- props = gst_props_empty_new ();
-
/* compression formats are added later - a bit hacky */
- gst_caps_replace_sink (&avi->streaminfo,
- gst_caps_new ("avi_streaminfo",
- "application/x-gst-streaminfo",
- props));
+ gst_caps_replace (&avi->streaminfo,
+ gst_caps_new_simple ("application/x-gst-streaminfo", NULL));
/*g_object_notify(G_OBJECT(avi), "streaminfo");*/
}
ARG_BIGFILE,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
+static GstStaticPadTemplate src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "avimux_src_video",
- "video/x-msvideo",
- NULL
- )
-)
+ GST_STATIC_CAPS ("video/x-msvideo")
+);
-GST_PAD_TEMPLATE_FACTORY (video_sink_factory,
+static GstStaticPadTemplate video_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW (
- "avimux_sink_video_yuv",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC('Y','U','Y','2')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC('I','4','2','0'))
- ),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_jpeg",
- "video/x-jpeg",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_divx",
- "video/x-divx",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "divxversion", GST_PROPS_INT_RANGE (3, 5)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_xvid",
- "video/x-xvid",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_3ivx",
- "video/x-3ivx",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_msmpeg",
- "video/x-msmpeg",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "msmpegversion", GST_PROPS_INT_RANGE (41, 43)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_mpeg",
- "video/mpeg",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "mpegversion", GST_PROPS_INT (1),
- "systemstream", GST_PROPS_BOOLEAN (FALSE)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_h263",
- "video/x-h263",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_dv",
- "video/x-dv",
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (576),
- GST_PROPS_INT (480)
- ),
- "systemstream", GST_PROPS_BOOLEAN (FALSE)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_hfyu",
- "video/x-huffyuv",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
+ GST_STATIC_CAPS (
+ "video/x-raw-yuv, "
+ "format = (fourcc) { YUY2, I420 }, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-jpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-divx, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "divxversion = (int) [ 3, 5 ]; "
+ "video/x-xvid, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-3ivx, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-msmpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "msmpegversion = (int) [ 41, 43 ]; "
+ "video/mpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "mpegversion = (int) 1, "
+ "systemstream = (boolean) FALSE; "
+ "video/x-h263, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-dv, "
+ "width = (int) 720, "
+ "height = (int) { 576, 480 }, "
+ "systemstream = (boolean) FALSE; "
+ "video/x-huffyuv, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (audio_sink_factory,
+static GstStaticPadTemplate audio_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"audio_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW (
- "avimux_sink_audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "avimux_sink_audio_mpeg",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT_RANGE (1, 3),
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "avimux_sink_audio_vorbis",
- "audio/x-vorbis",
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "avimux_sink_audio_ac3",
- "audio/x-ac3",
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 6)
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/mpeg, "
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-vorbis, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-ac3, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]"
)
-)
+);
static void gst_avimux_base_init (gpointer g_class);
);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (audio_sink_factory));
+ gst_static_pad_template_get (&audio_sink_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (video_sink_factory));
+ gst_static_pad_template_get (&video_sink_factory));
gst_element_class_set_details (element_class, &gst_avimux_details);
}
}
static GstPadLinkReturn
-gst_avimux_vidsinkconnect (GstPad *pad, GstCaps *vscaps)
+gst_avimux_vidsinkconnect (GstPad *pad, const GstCaps *vscaps)
{
GstAviMux *avimux;
- GstCaps *caps;
+ GstStructure *structure;
+ const gchar* mimetype;
+ gdouble fps = 0.;
+ gboolean ret;
avimux = GST_AVIMUX (gst_pad_get_parent (pad));
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED (vscaps))
- return GST_PAD_LINK_DELAYED;
-
GST_DEBUG ("avimux: video sinkconnect triggered on %s",
gst_pad_get_name (pad));
- for (caps = vscaps; caps != NULL; caps = vscaps = vscaps->next)
- {
- const gchar* mimetype = gst_caps_get_mime(caps);
- gfloat fps = 0.;
-
- /* global */
- avimux->vids.size = sizeof(gst_riff_strf_vids);
- avimux->vids.planes = 1;
- gst_caps_get (caps, "width", &avimux->vids.width,
- "height", &avimux->vids.height,
- "framerate", &fps,
- NULL);
- if (fps != 0.)
- avimux->vids_hdr.scale = avimux->vids_hdr.rate / fps;
-
- if (!strcmp (mimetype, "video/x-raw-yuv"))
- {
- guint32 format;
-
- gst_caps_get_fourcc_int (caps, "format", &format);
- avimux->vids.compression = format;
- switch (format)
- {
- case GST_MAKE_FOURCC('Y','U','Y','2'):
- avimux->vids.bit_cnt = 16;
- break;
- case GST_MAKE_FOURCC('I','4','2','0'):
- avimux->vids.bit_cnt = 12;
- break;
- }
+ structure = gst_caps_get_structure (vscaps, 0);
+ mimetype = gst_structure_get_name (structure);
- goto done;
- }
- else
+ /* global */
+ avimux->vids.size = sizeof(gst_riff_strf_vids);
+ avimux->vids.planes = 1;
+ ret = gst_structure_get_int (structure, "width", &avimux->vids.width);
+ ret &= gst_structure_get_int (structure, "height", &avimux->vids.height);
+ ret &= gst_structure_get_double (structure, "framerate", &fps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
+
+ if (fps != 0.)
+ avimux->vids_hdr.scale = avimux->vids_hdr.rate / fps;
+
+ if (!strcmp (mimetype, "video/x-raw-yuv")) {
+ guint32 format;
+
+ gst_structure_get_fourcc (structure, "format", &format);
+ avimux->vids.compression = format;
+ switch (format)
{
- avimux->vids.bit_cnt = 24;
- avimux->vids.compression = 0;
-
- /* find format */
- if (!strcmp (mimetype, "video/x-huffyuv")) {
- avimux->vids.compression = GST_MAKE_FOURCC('H','F','Y','U');
- } else if (!strcmp (mimetype, "video/x-jpeg")) {
- avimux->vids.compression = GST_MAKE_FOURCC('M','J','P','G');
- } else if (!strcmp (mimetype, "video/x-divx")) {
- gint divxversion;
- gst_caps_get_int (caps, "divxversion", &divxversion);
- switch (divxversion) {
- case 3:
- avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','3');
- break;
- case 4:
- avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','X');
- break;
- case 5:
- avimux->vids.compression = GST_MAKE_FOURCC('D','X','5','0');
- break;
- }
- } else if (!strcmp (mimetype, "video/x-xvid")) {
- avimux->vids.compression = GST_MAKE_FOURCC('X','V','I','D');
- } else if (!strcmp (mimetype, "video/x-3ivx")) {
- avimux->vids.compression = GST_MAKE_FOURCC('3','I','V','2');
- } else if (!strcmp (mimetype, "video/x-msmpeg")) {
- gint msmpegversion;
- gst_caps_get_int (caps, "msmpegversion", &msmpegversion);
- switch (msmpegversion) {
- case 41:
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','G','4');
- break;
- case 42:
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','2');
- break;
- case 43:
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','3');
+ case GST_MAKE_FOURCC('Y','U','Y','2'):
+ avimux->vids.bit_cnt = 16;
+ break;
+ case GST_MAKE_FOURCC('I','4','2','0'):
+ avimux->vids.bit_cnt = 12;
+ break;
+ }
+ } else {
+ avimux->vids.bit_cnt = 24;
+ avimux->vids.compression = 0;
+
+ /* find format */
+ if (!strcmp (mimetype, "video/x-huffyuv")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('H','F','Y','U');
+ } else if (!strcmp (mimetype, "video/x-jpeg")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('M','J','P','G');
+ } else if (!strcmp (mimetype, "video/x-divx")) {
+ gint divxversion;
+ gst_structure_get_int (structure, "divxversion", &divxversion);
+ switch (divxversion) {
+ case 3:
+ avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','3');
+ break;
+ case 4:
+ avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','X');
+ break;
+ case 5:
+ avimux->vids.compression = GST_MAKE_FOURCC('D','X','5','0');
break;
- }
- } else if (!strcmp (mimetype, "video/x-dv")) {
- avimux->vids.compression = GST_MAKE_FOURCC('D','V','S','D');
- } else if (!strcmp (mimetype, "video/x-h263")) {
- avimux->vids.compression = GST_MAKE_FOURCC('H','2','6','3');
- } else if (!strcmp (mimetype, "video/mpeg")) {
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','E','G');
}
-
- if (!avimux->vids.compression) {
- continue;
+ } else if (!strcmp (mimetype, "video/x-xvid")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('X','V','I','D');
+ } else if (!strcmp (mimetype, "video/x-3ivx")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('3','I','V','2');
+ } else if (!strcmp (mimetype, "video/x-msmpeg")) {
+ gint msmpegversion;
+ gst_structure_get_int (structure, "msmpegversion", &msmpegversion);
+ switch (msmpegversion) {
+ case 41:
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','G','4');
+ break;
+ case 42:
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','2');
+ break;
+ case 43:
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','3');
+ break;
}
+ } else if (!strcmp (mimetype, "video/x-dv")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('D','V','S','D');
+ } else if (!strcmp (mimetype, "video/x-h263")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('H','2','6','3');
+ } else if (!strcmp (mimetype, "video/mpeg")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','E','G');
+ }
- goto done;
+ if (!avimux->vids.compression) {
+ return GST_PAD_LINK_DELAYED;
}
}
- return GST_PAD_LINK_REFUSED;
-done:
avimux->vids_hdr.fcc_handler = avimux->vids.compression;
avimux->vids.image_size = avimux->vids.height * avimux->vids.width;
avimux->avi_hdr.width = avimux->vids.width;
}
static GstPadLinkReturn
-gst_avimux_audsinkconnect (GstPad *pad, GstCaps *vscaps)
+gst_avimux_audsinkconnect (GstPad *pad, const GstCaps *vscaps)
{
GstAviMux *avimux;
- GstCaps *caps;
+ GstStructure *structure;
+ const gchar* mimetype;
+ int i;
avimux = GST_AVIMUX (gst_pad_get_parent (pad));
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED (vscaps))
- return GST_PAD_LINK_DELAYED;
-
GST_DEBUG ("avimux: audio sinkconnect triggered on %s",
gst_pad_get_name (pad));
- for (caps = vscaps; caps != NULL; caps = vscaps = vscaps->next)
- {
- const gchar* mimetype = gst_caps_get_mime(caps);
+ structure = gst_caps_get_structure (vscaps, 0);
+ mimetype = gst_structure_get_name (structure);
- /* we want these for all */
- gst_caps_get (caps, "channels", &avimux->auds.channels,
- "rate", &avimux->auds.rate,
- NULL);
+ /* we want these for all */
+ gst_structure_get_int (structure, "channels", &i);
+ avimux->auds.channels = i;
+ gst_structure_get_int (structure, "rate", &i);
+ avimux->auds.rate = i;
- if (!strcmp (mimetype, "audio/x-raw-int"))
- {
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
+ if (!strcmp (mimetype, "audio/x-raw-int")) {
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
- gst_caps_get (caps, "width", &avimux->auds.blockalign,
- "depth", &avimux->auds.size,
- NULL);
+ gst_structure_get_int (structure, "width", &i);
+ avimux->auds.blockalign = i;
+ gst_structure_get_int (structure, "depth", &i);
+ avimux->auds.size = i;
- /* set some more info straight */
- avimux->auds.blockalign /= 8;
- avimux->auds.blockalign *= avimux->auds.channels;
- avimux->auds.av_bps = avimux->auds.blockalign * avimux->auds.rate;
- goto done;
- }
- else if (!strcmp (mimetype, "audio/mpeg") ||
+ /* set some more info straight */
+ avimux->auds.blockalign /= 8;
+ avimux->auds.blockalign *= avimux->auds.channels;
+ avimux->auds.av_bps = avimux->auds.blockalign * avimux->auds.rate;
+ } else if (!strcmp (mimetype, "audio/mpeg") ||
!strcmp (mimetype, "audio/x-vorbis") ||
- !strcmp (mimetype, "audio/x-ac3"))
- {
- avimux->auds.format = 0;
-
- if (!strcmp (mimetype, "audio/mpeg")) {
- gint layer = 3;
- gst_caps_get_int(caps, "layer", &layer);
- switch (layer) {
- case 3:
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
- break;
- case 1: case 2:
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
- break;
- }
- } else if (!strcmp (mimetype, "audio/x-vorbis")) {
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3;
- } else if (!strcmp (mimetype, "audio/x-ac3")) {
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_A52;
+ !strcmp (mimetype, "audio/x-ac3")) {
+ avimux->auds.format = 0;
+
+ if (!strcmp (mimetype, "audio/mpeg")) {
+ gint layer = 3;
+ gst_structure_get_int (structure, "layer", &layer);
+ switch (layer) {
+ case 3:
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
+ break;
+ case 1: case 2:
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
+ break;
}
+ } else if (!strcmp (mimetype, "audio/x-vorbis")) {
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3;
+ } else if (!strcmp (mimetype, "audio/x-ac3")) {
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_A52;
+ }
- avimux->auds.blockalign = 1;
- avimux->auds.av_bps = 0;
- avimux->auds.size = 16;
-
- if (!avimux->auds.format) {
- continue;
- }
+ avimux->auds.blockalign = 1;
+ avimux->auds.av_bps = 0;
+ avimux->auds.size = 16;
- goto done;
+ if (!avimux->auds.format) {
+ return GST_PAD_LINK_REFUSED;
}
}
- return GST_PAD_LINK_REFUSED;
-done:
avimux->auds_hdr.rate = avimux->auds.blockalign * avimux->auds.rate;
avimux->auds_hdr.samplesize = avimux->auds.blockalign;
avimux->auds_hdr.scale = avimux->auds.blockalign;
ARG_LEAKY
};
-GST_PAD_TEMPLATE_FACTORY (cutter_src_factory,
+static GstStaticPadTemplate cutter_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "cutter_src_int",
- "audio/x-raw-int",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
- ),
- gst_caps_new (
- "cutter_src_float",
- "audio/x-raw-float",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
+ GST_STATIC_CAPS (
+ GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS
)
);
-GST_PAD_TEMPLATE_FACTORY (cutter_sink_factory,
+static GstStaticPadTemplate cutter_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "cutter_sink_int",
- "audio/x-raw-int",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
- ),
- gst_caps_new (
- "cutter_sink_float",
- "audio/x-raw-float",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
+ GST_STATIC_CAPS (
+ GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS
)
);
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (cutter_src_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (cutter_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&cutter_src_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&cutter_sink_factory));
gst_element_class_set_details (element_class, &cutter_details);
}
static GstPadLinkReturn
-gst_cutter_link (GstPad *pad, GstCaps *caps)
+gst_cutter_link (GstPad *pad, const GstCaps*caps)
{
GstCutter *filter;
GstPad *otherpad;
g_return_val_if_fail (GST_IS_CUTTER (filter), GST_PAD_LINK_REFUSED);
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
- if (GST_CAPS_IS_FIXED (caps))
- return gst_pad_try_set_caps (otherpad, gst_caps_ref (caps));
- return GST_PAD_LINK_DELAYED;
+ return gst_pad_try_set_caps (otherpad, caps);
}
static void
static void
gst_cutter_init (GstCutter *filter)
{
- filter->sinkpad = gst_pad_new_from_template (cutter_sink_factory (),"sink");
- filter->srcpad = gst_pad_new_from_template (cutter_src_factory (),"src");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&cutter_sink_factory),"sink");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&cutter_src_factory),"src");
filter->threshold_level = 0.1;
filter->threshold_length = 0.5;
gst_cutter_get_caps (GstPad *pad, GstCutter* filter)
{
GstCaps *caps = NULL;
+ GstStructure *structure;
caps = GST_PAD_CAPS (pad);
/* FIXME : Please change this to a better warning method ! */
g_assert (caps != NULL);
if (caps == NULL)
printf ("WARNING: get_caps: Could not get caps of pad !\n");
- gst_caps_get_int (caps, "width", &filter->width);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &filter->width);
filter->max_sample = gst_audio_highest_sample_value (pad);
filter->have_caps = TRUE;
}
+
ARG_FENCE_TOP
};
-GST_PAD_TEMPLATE_FACTORY (gst_efence_sink_factory,
+static GstStaticPadTemplate gst_efence_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_ANY
+ GST_STATIC_CAPS_ANY
);
-GST_PAD_TEMPLATE_FACTORY (gst_efence_src_factory,
+static GstStaticPadTemplate gst_efence_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_ANY
+ GST_STATIC_CAPS_ANY
);
static void gst_efence_base_init (gpointer g_class);
GstBuffer *gst_fenced_buffer_new(void);
static GstPadLinkReturn
-gst_efence_link (GstPad *pad, GstCaps *caps)
+gst_efence_link (GstPad *pad, const GstCaps *caps)
{
GstEFence *filter;
GstPad *otherpad;
GST_PAD_LINK_REFUSED);
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
- if (GST_CAPS_IS_FIXED (caps))
- {
- /* caps are not fixed, so try to link on the other side and see if
- * that works */
-
- if (!gst_pad_try_set_caps (otherpad, caps))
- return GST_PAD_LINK_REFUSED;
-
- /* caps on other side were accepted, so we're ok */
- return GST_PAD_LINK_OK;
- }
- /* not enough information yet, delay negotation */
- return GST_PAD_LINK_DELAYED;
+ return gst_pad_try_set_caps (otherpad, caps);
}
GType
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_efence_sink_factory ());
- gst_element_class_add_pad_template (element_class, gst_efence_src_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_efence_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_efence_src_factory));
gst_element_class_set_details (element_class, &plugin_details);
}
static void
gst_efence_init (GstEFence *filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_efence_sink_factory (),
- "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_efence_sink_factory), "sink");
gst_pad_set_link_function (filter->sinkpad, gst_efence_link);
- filter->srcpad = gst_pad_new_from_template (gst_efence_src_factory (),
- "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_efence_src_factory), "src");
gst_pad_set_link_function (filter->srcpad, gst_efence_link);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_agingtv_details);
}
}
static GstPadLinkReturn
-gst_agingtv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_agingtv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstAgingTV *filter;
+ GstStructure *structure;
filter = GST_AGINGTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
filter->video_size = filter->width * filter->height;
filter->aging_mode = 0;
aging_mode_switch (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_agingtv_init (GstAgingTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_agingtv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_agingtv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
}
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_dicetv_details);
}
}
static GstPadLinkReturn
-gst_dicetv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_dicetv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstDiceTV *filter;
+ GstStructure *structure;
filter = GST_DICETV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
g_free (filter->dicemap);
filter->dicemap = (gchar *) g_malloc (filter->height * filter->width * sizeof(char));
gst_dicetv_create_map (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_dicetv_init (GstDiceTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_dicetv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_dicetv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->dicemap = NULL;
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_edgetv_details);
}
}
static GstPadLinkReturn
-gst_edgetv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_edgetv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstEdgeTV *filter;
+ GstStructure *structure;
filter = GST_EDGETV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
filter->map_width = filter->width / 4;
filter->map_height = filter->height / 4;
filter->map = (guint32 *)g_malloc (filter->map_width * filter->map_height * sizeof(guint32) * 2);
bzero(filter->map, filter->map_width * filter->map_height * sizeof(guint32) * 2);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_edgetv_init (GstEdgeTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_edgetv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_edgetv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->map = NULL;
};
-GstPadTemplate*
-gst_effectv_src_factory (void)
-{
- static GstPadTemplate *templ = NULL;
- if (!templ) {
- templ = GST_PAD_TEMPLATE_NEW (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "effectv_src",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
- )
- );
- }
- return templ;
-}
+GstStaticPadTemplate gst_effectv_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
-GstPadTemplate*
-gst_effectv_sink_factory (void)
-{
- static GstPadTemplate *templ = NULL;
- if (!templ) {
- templ = GST_PAD_TEMPLATE_NEW (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "effectv_sink",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
- )
- );
- }
- return templ;
-}
+GstStaticPadTemplate gst_effectv_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
static gboolean
plugin_init (GstPlugin * plugin)
while (_elements[i].name) {
if (!gst_element_register (plugin, _elements[i].name,
- GST_RANK_NONE, (_elements[i].type) ()))
+ GST_RANK_NONE, (_elements[i].type) ()))
return FALSE;
i++;
}
GType gst_revtv_get_type (void);
GType gst_quarktv_get_type (void);
-extern GstPadTemplate *gst_effectv_sink_factory ();
-extern GstPadTemplate *gst_effectv_src_factory ();
+extern GstStaticPadTemplate gst_effectv_sink_template;
+extern GstStaticPadTemplate gst_effectv_src_template;
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_quarktv_details);
}
}
static GstPadLinkReturn
-gst_quarktv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_quarktv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstQuarkTV *filter;
gint i;
+ GstStructure *structure;
filter = GST_QUARKTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
filter->area = filter->width * filter->height;
filter->planetable[i] = NULL;
}
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_quarktv_init (GstQuarkTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_quarktv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_quarktv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->planes = PLANES;
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_revtv_details);
}
}
static GstPadLinkReturn
-gst_revtv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_revtv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRevTV *filter;
+ GstStructure *structure;
filter = GST_REVTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_revtv_init (GstRevTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_revtv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_revtv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->vgrabtime = 1;
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_shagadelictv_details);
}
}
static GstPadLinkReturn
-gst_shagadelictv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_shagadelictv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstShagadelicTV *filter;
gint area;
+ GstStructure *structure;
filter = GST_SHAGADELICTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
area = filter->width * filter->height;
gst_shagadelic_initialize (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_shagadelictv_init (GstShagadelicTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_shagadelictv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_shagadelictv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->ripple = NULL;
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_vertigotv_details);
}
static GstPadLinkReturn
-gst_vertigotv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_vertigotv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstVertigoTV *filter;
gint area;
+ GstStructure *structure;
filter = GST_VERTIGOTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
area = filter->width * filter->height;
filter->alt_buffer = filter->buffer + area;
filter->phase = 0;
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_vertigotv_init (GstVertigoTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_vertigotv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_vertigotv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->buffer = NULL;
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_warptv_details);
}
}
static GstPadLinkReturn
-gst_warptv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_warptv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstWarpTV *filter;
+ GstStructure *structure;
filter = GST_WARPTV (gst_pad_get_parent (pad));
+ structure = gst_caps_get_structure (caps, 0);
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
gst_warptv_initialize (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_warptv_init (GstWarpTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_warptv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_warptv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->tval = 0;
};
/* input */
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flxdec_sink",
- "video/x-fli",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "video/x-fli" )
+);
/* output */
-GST_PAD_TEMPLATE_FACTORY (src_video_factory,
+static GstStaticPadTemplate src_video_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT_RANGE(320, 1280),
- "height", GST_PROPS_INT_RANGE(200, 1024),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
static void gst_flxdec_class_init (GstFlxDecClass *klass);
gst_element_class_set_details (gstelement_class, &flxdec_details);
gst_element_class_add_pad_template (gstelement_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_add_pad_template (gstelement_class,
- GST_PAD_TEMPLATE_GET (src_video_factory));
+ gst_static_pad_template_get (&src_video_factory));
}
static void
gst_flxdec_init(GstFlxDec *flxdec)
{
flxdec->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_static_pad_template_get (&sink_factory), "sink");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->sinkpad);
gst_element_set_loop_function(GST_ELEMENT(flxdec),gst_flxdec_loop);
flxdec->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_video_factory), "src");
+ gst_static_pad_template_get (&src_video_factory), "src");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad);
flxdec->bs = NULL;
GstBuffer *buf;
GstBuffer *databuf;
guchar *data, *chunk;
+ GstCaps *caps;
GstFlxDec *flxdec;
FlxHeader *flxh;
flxdec->frame_time = flxh->speed * GST_MSECOND;
}
- gst_pad_try_set_caps (flxdec->srcpad,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT (flxh->width),
- "height", GST_PROPS_INT (flxh->height),
- "framerate", GST_PROPS_FLOAT (GST_SECOND/flxdec->frame_time)));
+ caps = gst_caps_from_string (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32);
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, flxh->width,
+ "height", G_TYPE_INT, flxh->height,
+ "framerate", G_TYPE_DOUBLE, GST_SECOND/flxdec->frame_time, NULL);
if (flxh->depth <= 8)
flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height);
g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", flxh->oframe1);
g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", flxh->oframe2);
}
-
flxdec->size = (flxh->width * flxh->height);
gint16 datain[2][512];
/* video state */
- gfloat fps;
+ gdouble fps;
gint width;
gint height;
gint channels;
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (src_template,
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "goomsrc",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
- )
-)
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
-GST_PAD_TEMPLATE_FACTORY (sink_template,
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink", /* the name of the pads */
GST_PAD_SINK, /* type of the pad */
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "goomsink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 8000, 96000 ], "
+ "channels = (int) [ 1, 2 ]"
)
-)
+);
static void gst_goom_class_init (GstGOOMClass *klass);
static void gst_goom_chain (GstPad *pad, GstData *_data);
-static GstPadLinkReturn gst_goom_sinkconnect (GstPad *pad, GstCaps *caps);
-static GstPadLinkReturn gst_goom_srcconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps);
+static GstPadLinkReturn gst_goom_srcconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
gst_element_class_set_details (element_class, &gst_goom_details);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template));
+ gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_template));
+ gst_static_pad_template_get (&src_template));
}
static void
{
/* create the sink and src pads */
goom->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template ), "sink");
+ gst_static_pad_template_get (&sink_template ), "sink");
goom->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_template ), "src");
+ gst_static_pad_template_get (&src_template ), "src");
gst_element_add_pad (GST_ELEMENT (goom), goom->sinkpad);
gst_element_add_pad (GST_ELEMENT (goom), goom->srcpad);
}
static GstPadLinkReturn
-gst_goom_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstGOOM *goom;
+ GstStructure *structure;
+
goom = GST_GOOM (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "channels", &goom->channels);
+ gst_structure_get_int (structure, "channels", &goom->channels);
return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
-gst_goom_srcconnect (GstPad *pad, GstCaps *caps)
+gst_goom_srcconnect (GstPad *pad, const GstCaps *caps)
{
GstGOOM *goom;
+ GstStructure *structure;
+
goom = GST_GOOM (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
- if (gst_caps_has_property_typed (caps, "width", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "width", &goom->width);
- }
- if (gst_caps_has_property_typed (caps, "height", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "height", &goom->height);
- }
- if (gst_caps_has_property_typed (caps, "framerate", GST_PROPS_FLOAT_TYPE)) {
- gst_caps_get_float (caps, "framerate", &goom->fps);
- }
+ gst_structure_get_int (structure, "width", &goom->width);
+ gst_structure_get_int (structure, "height", &goom->height);
+ gst_structure_get_double (structure, "framerate", &goom->fps);
goom_set_resolution (goom->width, goom->height);
goom->srcnegotiated = TRUE;
return GST_PAD_LINK_OK;
}
-static gboolean
-gst_goom_negotiate_default (GstGOOM *goom)
-{
- GstCaps *caps;
-
- caps = GST_CAPS_NEW (
- "goomsrc",
- "video/x-raw-rgb",
- "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT (goom->width),
- "height", GST_PROPS_INT (goom->height),
- "framerate", GST_PROPS_FLOAT (goom->fps)
- );
-
- if (gst_pad_try_set_caps (goom->srcpad, caps) <= 0) {
- return FALSE;
- }
-
- goom_set_resolution (goom->width, goom->height);
- goom->srcnegotiated = TRUE;
-
- return TRUE;
-}
-
static void
gst_goom_chain (GstPad *pad, GstData *_data)
{
if (!GST_PAD_IS_USABLE (goom->srcpad))
goto done;
- if (!goom->srcnegotiated) {
- if (!gst_goom_negotiate_default (goom)) {
- gst_element_error (GST_ELEMENT (goom), "could not negotiate src format");
- goto done;
- }
- }
-
samples_in = GST_BUFFER_SIZE (bufin) / (sizeof (gint16) * goom->channels);
GST_DEBUG ("input buffer has %d samples", samples_in);
}
static GstPadLinkReturn
-alawdec_link (GstPad *pad, GstCaps *caps)
+alawdec_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstALawDec* alawdec = GST_ALAWDEC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret &= gst_structure_get_int (structure, "channels", &channels);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- tempcaps = GST_CAPS_NEW (
- "alawdec_src_caps",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
+ tempcaps = gst_caps_new_simple ( "audio/x-raw-int",
+ "depth", G_TYPE_INT, 16,
+ "width", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
return gst_pad_try_set_caps (alawdec->srcpad, tempcaps);
}
/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */
static GstPadLinkReturn
-alawenc_link (GstPad *pad, GstCaps *caps)
+alawenc_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstALawEnc* alawenc = GST_ALAWENC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret &= gst_structure_get_int (structure, "channels", &channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
- tempcaps = GST_CAPS_NEW (
- "alawenc_src_caps",
- "audio/x-alaw",
- "depth", GST_PROPS_INT (8),
- "width", GST_PROPS_INT (8),
- "signed", GST_PROPS_BOOLEAN (FALSE),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
+ tempcaps = gst_caps_new_simple ("audio/x-alaw",
+ "depth", G_TYPE_INT, 8,
+ "width", G_TYPE_INT, 8,
+ "signed", G_TYPE_BOOLEAN, FALSE,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
return gst_pad_try_set_caps (alawenc->srcpad, tempcaps);
}
static GstCaps*
alaw_factory (void)
{
- return
- gst_caps_new (
- "test_src",
- "audio/x-alaw",
- gst_props_new (
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-alaw",
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static GstCaps*
linear_factory (void)
{
- return
- gst_caps_new (
- "test_sink",
- "audio/x-raw-int",
- gst_props_new (
- "width", GST_PROPS_INT(16),
- "depth", GST_PROPS_INT(16),
- "endianness", GST_PROPS_INT(G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN(TRUE),
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
GstPadTemplate *alawenc_src_template, *alawenc_sink_template;
alaw_caps = alaw_factory ();
linear_caps = linear_factory ();
- alawenc_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,alaw_caps, NULL);
- alawenc_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,linear_caps, NULL);
+ alawenc_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,alaw_caps);
+ alawenc_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,linear_caps);
- alawdec_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,linear_caps, NULL);
- alawdec_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,alaw_caps, NULL);
+ alawdec_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,linear_caps);
+ alawdec_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,alaw_caps);
if (!gst_element_register (plugin, "alawenc",
GST_RANK_NONE, GST_TYPE_ALAWENC) ||
static GstPadLinkReturn
-mulawdec_link (GstPad *pad, GstCaps *caps)
+mulawdec_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstMuLawDec* mulawdec = GST_MULAWDEC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
-
- tempcaps = GST_CAPS_NEW (
- "sinesrc_src_caps",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
-
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret = gst_structure_get_int (structure, "channels", &channels);
+ if (!ret) return GST_PAD_LINK_REFUSED;
+
+ tempcaps = gst_caps_new_simple ("audio/x-mulaw",
+ "depth", G_TYPE_INT, 16,
+ "width", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
+
return gst_pad_try_set_caps (mulawdec->srcpad, tempcaps);
}
/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */
static GstPadLinkReturn
-mulawenc_link (GstPad *pad, GstCaps *caps)
+mulawenc_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstMuLawEnc* mulawenc = GST_MULAWENC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret = gst_structure_get_int (structure, "channels", &channels);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
-
- tempcaps = GST_CAPS_NEW (
- "sinesrc_src_caps",
- "audio/x-mulaw",
- "depth", GST_PROPS_INT (8),
- "width", GST_PROPS_INT (8),
- "signed", GST_PROPS_BOOLEAN (FALSE),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
+ tempcaps = gst_caps_new_simple ("audio/x-mulaw",
+ "depth", G_TYPE_INT, 8,
+ "width", G_TYPE_INT, 8,
+ "signed", G_TYPE_BOOLEAN, FALSE,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
return gst_pad_try_set_caps (mulawenc->srcpad, tempcaps);
-}
+}
GType
gst_mulawenc_get_type(void) {
static GstCaps*
mulaw_factory (void)
{
- return
- gst_caps_new (
- "test_src",
- "audio/x-mulaw",
- gst_props_new (
- "width", GST_PROPS_INT(8),
- "depth", GST_PROPS_INT(8),
- "signed", GST_PROPS_BOOLEAN(FALSE),
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-mulaw",
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static GstCaps*
linear_factory (void)
{
- return
- gst_caps_new (
- "test_sink",
- "audio/x-raw-int",
- gst_props_new (
- "width", GST_PROPS_INT(16),
- "depth", GST_PROPS_INT(16),
- "signed", GST_PROPS_BOOLEAN(TRUE),
- "endianness", GST_PROPS_INT(G_BYTE_ORDER),
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template;
linear_caps = linear_factory ();
mulawenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- mulaw_caps, NULL);
+ mulaw_caps);
mulawenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- linear_caps, NULL);
+ linear_caps);
mulawdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- linear_caps, NULL);
+ linear_caps);
mulawdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- mulaw_caps, NULL);
+ mulaw_caps);
if (!gst_element_register (plugin, "mulawenc",
GST_RANK_NONE, GST_TYPE_MULAWENC) ||
#include "config.h"
#endif
#include <gst/gst.h>
+#include <gst/audio/audio.h>
#include "gstlevel.h"
#include "math.h"
/* pad templates */
-GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"level_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "level_sink",
- "audio/x-raw-int",
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
-)
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+);
-GST_PAD_TEMPLATE_FACTORY (src_template_factory,
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"level_src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "level_src",
- "audio/x-raw-int",
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
-)
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+);
/* Filter signals and args */
enum {
}
static GstPadLinkReturn
-gst_level_link (GstPad *pad, GstCaps *caps)
+gst_level_link (GstPad *pad, const GstCaps *caps)
{
GstLevel *filter;
GstPad *otherpad;
GstPadLinkReturn res;
+ GstStructure *structure;
int i;
+ gboolean ret;
filter = GST_LEVEL (gst_pad_get_parent (pad));
g_return_val_if_fail (filter != NULL, GST_PAD_LINK_REFUSED);
g_return_val_if_fail (GST_IS_LEVEL (filter), GST_PAD_LINK_REFUSED);
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
res = gst_pad_try_set_caps (otherpad, caps);
/* if ok, set filter */
if (res != GST_PAD_LINK_OK && res != GST_PAD_LINK_DONE) {
filter->num_samples = 0;
- if (!gst_caps_get_int (caps, "rate", &(filter->rate)))
- return GST_PAD_LINK_REFUSED;
- if (!gst_caps_get_int (caps, "width", &(filter->width)))
- return GST_PAD_LINK_REFUSED;
- if (!gst_caps_get_int (caps, "channels", &(filter->channels)))
- return GST_PAD_LINK_REFUSED;
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "rate", &filter->rate);
+ ret &= gst_structure_get_int (structure, "width", &filter->width);
+ ret &= gst_structure_get_int (structure, "channels", &filter->channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* allocate channel variable arrays */
if (filter->CS) g_free (filter->CS);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template_factory));
+ gst_static_pad_template_get (&sink_template_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_template_factory));
+ gst_static_pad_template_get (&src_template_factory));
gst_element_class_set_details (element_class, &level_details);
element_class->change_state = gst_level_change_state;
static void
gst_level_init (GstLevel *filter)
{
- filter->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_template_factory), "sink");
+ filter->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&sink_template_factory), "sink");
gst_pad_set_link_function (filter->sinkpad, gst_level_link);
- filter->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_template_factory), "src");
+ filter->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&src_template_factory), "src");
gst_pad_set_link_function (filter->srcpad, gst_level_link);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (sink_templ,
+static GstStaticPadTemplate sink_templ =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "matroskademux_sink",
- "video/x-matroska",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "video/x-matroska" )
+);
/* gobject magic foo */
static void gst_matroska_demux_base_init (GstMatroskaDemuxClass *klass);
gst_element_class_add_pad_template (element_class, audiosrctempl);
gst_element_class_add_pad_template (element_class, subtitlesrctempl);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_templ));
+ gst_static_pad_template_get (&sink_templ));
gst_element_class_set_details (element_class,
&gst_matroska_demux_details);
}
g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "Metadata",
- GST_TYPE_CAPS, G_PARAM_READABLE));
+ GST_TYPE_STRUCTURE, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo",
- GST_TYPE_CAPS, G_PARAM_READABLE));
+ GST_TYPE_STRUCTURE, G_PARAM_READABLE));
parent_class = g_type_class_ref (GST_TYPE_EBML_READ);
demux->num_v_streams = 0;
/* reset media info */
+
gst_caps_replace (&demux->metadata, NULL);
gst_caps_replace (&demux->streaminfo, NULL);
gst_matroska_demux_loop_stream (demux);
}
+#if 0
+static GstCaps *
+gst_matroska_demux_vfw_caps (guint32 codec_fcc,
+ gst_riff_strf_vids *vids)
+{
+ GstCaps *caps = NULL;
+
+ switch (codec_fcc) {
+ case GST_MAKE_FOURCC('I','4','2','0'):
+ case GST_MAKE_FOURCC('Y','U','Y','2'):
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, codec_fcc, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('M','J','P','G'): /* YUY2 MJPEG */
+ case GST_MAKE_FOURCC('J','P','E','G'): /* generic (mostly RGB) MJPEG */
+ case GST_MAKE_FOURCC('P','I','X','L'): /* Miro/Pinnacle fourccs */
+ case GST_MAKE_FOURCC('V','I','X','L'): /* Miro/Pinnacle fourccs */
+ caps = gst_caps_new_simple ("video/x-jpeg", NULL);
+ break;
+
+ case GST_MAKE_FOURCC('H','F','Y','U'):
+ caps = gst_caps_new_simple ("video/x-huffyuv", NULL);
+ break;
+
+ case GST_MAKE_FOURCC('M','P','E','G'):
+ case GST_MAKE_FOURCC('M','P','G','I'):
+ caps = gst_caps_new_simple ("video/mpeg",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_BOOLEAN, 1, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('H','2','6','3'):
+ case GST_MAKE_FOURCC('i','2','6','3'):
+ case GST_MAKE_FOURCC('L','2','6','3'):
+ case GST_MAKE_FOURCC('M','2','6','3'):
+ case GST_MAKE_FOURCC('V','D','O','W'):
+ case GST_MAKE_FOURCC('V','I','V','O'):
+ case GST_MAKE_FOURCC('x','2','6','3'):
+ caps = gst_caps_new_simple ("video/x-h263", NULL);
+ break;
+
+ case GST_MAKE_FOURCC('D','I','V','3'):
+ case GST_MAKE_FOURCC('D','I','V','4'):
+ case GST_MAKE_FOURCC('D','I','V','5'):
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 3, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('d','i','v','x'):
+ case GST_MAKE_FOURCC('D','I','V','X'):
+ case GST_MAKE_FOURCC('D','X','5','0'):
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 5, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('X','V','I','D'):
+ case GST_MAKE_FOURCC('x','v','i','d'):
+ caps = gst_caps_new_simple ("video/x-xvid", NULL);
+ break;
+
+ case GST_MAKE_FOURCC('M','P','G','4'):
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 41, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('M','P','4','2'):
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 42, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('M','P','4','3'):
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 43, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('3','I','V','1'):
+ case GST_MAKE_FOURCC('3','I','V','2'):
+ caps = gst_caps_new_simple ("video/x-3ivx", NULL);
+ break;
+
+ case GST_MAKE_FOURCC('D','V','S','D'):
+ case GST_MAKE_FOURCC('d','v','s','d'):
+ caps = gst_caps_new_simple ("video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('W','M','V','1'):
+ caps = gst_caps_new_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 1, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('W','M','V','2'):
+ caps = gst_caps_new_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 2, NULL);
+ break;
+
+ default:
+ GST_WARNING ("matroskademux: unkown VFW video format " GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (codec_fcc));
+ return NULL;
+ break;
+ }
+
+ return caps;
+}
+#endif
+
static GstCaps *
gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
const gchar *codec_id,
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC)) {
gst_riff_strf_vids *vids = NULL;
- GstCaps *t;
if (data) {
vids = (gst_riff_strf_vids *) data;
} else {
caps = gst_riff_create_video_template_caps ();
}
-
- for (t = caps; t != NULL; t = t->next) {
- gst_props_remove_entry_by_name (t->properties, "width");
- gst_props_remove_entry_by_name (t->properties, "height");
- gst_props_remove_entry_by_name (t->properties, "framerate");
- }
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) {
/* how nice, this is undocumented... */
if (videocontext != NULL) {
return NULL;
}
- caps = GST_CAPS_NEW ("matroskademux_src_uncompressed",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (fourcc));
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
} else {
- caps = GST_CAPS_NEW ("matroskademux_src_uncompressed",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2'))
- )
- );
+ caps = gst_caps_from_string ("video/x-raw-yuv, "
+ "format = (fourcc) { I420, YUY2, YV12 }");
}
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP)) {
- caps = GST_CAPS_NEW ("matroskademux_src_divx4",
- "video/x-divx",
- "divxversion", GST_PROPS_INT (4));
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 4, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP)) {
- caps = GST_CAPS_NEW ("matroskademux_src_divx5",
- "video/x-divx",
- "divxversion", GST_PROPS_INT (5));
- caps = gst_caps_append (caps,
- GST_CAPS_NEW ("matroskademux_src_xvid",
- "video/x-xvid",
- NULL));
- caps = gst_caps_append (caps,
- GST_CAPS_NEW ("matroskademux_src_mpeg4asp/ap",
- "video/mpeg",
- "mpegversion", GST_PROPS_INT (4),
- "systemstream", GST_PROPS_BOOLEAN (FALSE)));
+ caps = gst_caps_new_full (
+ gst_structure_new ("video/x-divx",
+ "divxversion", G_TYPE_INT, 5, NULL),
+ gst_structure_new ("video/x-xvid", NULL),
+ gst_structure_new ("video/mpeg",
+ "mpegversion", G_TYPE_INT, 4,
+ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL),
+ NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3)) {
- caps = GST_CAPS_NEW ("matroskademux_src_msmpeg4v3",
- "video/x-divx",
- "divxversion", GST_PROPS_INT (3));
- caps = gst_caps_append (caps,
- GST_CAPS_NEW ("matroskademux_src_divx3",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (43)));
+ caps = gst_caps_new_full (
+ gst_structure_new ("video/x-divx",
+ "divxversion", G_TYPE_INT, 3, NULL),
+ gst_structure_new ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 43, NULL),
+ NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG1) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG2)) {
gint mpegversion = -1;
else
g_assert (0);
- caps = GST_CAPS_NEW ("matroska_demux_mpeg1",
- "video/mpeg",
- "systemstream", GST_PROPS_BOOLEAN (FALSE),
- "mpegversion", GST_PROPS_INT (mpegversion));
+ caps = gst_caps_new_simple ("video/mpeg",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_INT, mpegversion, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MJPEG)) {
- caps = GST_CAPS_NEW ("matroska_demux_mjpeg",
- "video/x-jpeg",
- NULL);
+ caps = gst_caps_new_simple ("video/x-jpeg", NULL);
} else {
GST_WARNING ("Unknown codec '%s', cannot build Caps",
codec_id);
+ return NULL;
}
if (caps != NULL) {
- GstCaps *one;
- GstPropsEntry *fps = NULL;
- GstPropsEntry *width = NULL, *height = NULL;
- GstPropsEntry *pixel_width = NULL, *pixel_height = NULL;
+ int i;
+ GstStructure *structure;
- for (one = caps; one != NULL; one = one->next) {
+ for (i=0;i<gst_caps_get_size(caps);i++){
+ structure = gst_caps_get_structure (caps, i);
if (videocontext != NULL) {
if (videocontext->pixel_width > 0 &&
videocontext->pixel_height > 0) {
gint w = videocontext->pixel_width;
gint h = videocontext->pixel_height;
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (w));
- height = gst_props_entry_new ("height",
- GST_PROPS_INT (h));
+ gst_structure_set (structure,
+ "width", G_TYPE_INT, w,
+ "height", G_TYPE_INT, h, NULL);
+ } else {
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ NULL);
}
#if 0
if (videocontext->display_width > 0 &&
gint w = 100 * videocontext->display_width / videocontext->pixel_width;
gint h = 100 * videocontext->display_height / videocontext->pixel_height;
- pixel_width = gst_props_entry_new ("pixel_width",
- GST_PROPS_INT (w));
- pixel_height = gst_props_entry_new ("pixel_height",
- GST_PROPS_INT (h));
+ gst_structure_set (structure,
+ "pixel_width", G_TYPE_INT, w,
+ "pixel_height", G_TYPE_INT, h,
+ NULL);
}
#endif
if (context->default_duration > 0) {
gfloat framerate = 1. * GST_SECOND / context->default_duration;
- fps = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT (framerate));
+ gst_structure_set (structure,
+ "framerate", G_TYPE_DOUBLE, framerate, NULL);
} else {
/* sort of a hack to get most codecs to support,
* even if the default_duration is missing */
- fps = gst_props_entry_new ("framerate", GST_PROPS_FLOAT (25.));
+ gst_structure_set (structure,
+ "framerate", G_TYPE_DOUBLE, 25.0, NULL);
}
} else {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT_RANGE (16, 4096));
- height = gst_props_entry_new ("height",
- GST_PROPS_INT_RANGE (16, 4096));
-#if 0
- pixel_width = gst_props_entry_new ("pixel_width",
- GST_PROPS_INT_RANGE (0, 255));
- pixel_height = gst_props_entry_new ("pixel_height",
- GST_PROPS_INT_RANGE (0, 255));
-#endif
- fps = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "pixel_width", GST_TYPE_INT_RANGE, 0, 255,
+ "pixel_height", GST_TYPE_INT_RANGE, 0, 255,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
+ }
+ }
- if (one->properties == NULL) {
- one->properties = gst_props_empty_new ();
- }
+ return caps;
+}
+
+#if 0
+static GstCaps *
+gst_matroskademux_acm_caps (guint16 codec_id,
+ gst_riff_strf_auds *auds)
+{
+ GstCaps *caps = NULL;
+
+ switch (codec_id) {
+ case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "layer", G_TYPE_INT, 3, NULL);
+ break;
- if (width != NULL && height != NULL) {
- gst_props_add_entry (one->properties, width);
- gst_props_add_entry (one->properties, height);
+ case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "layer", G_TYPE_INT, 2, NULL);
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ {
+ if (auds != NULL) {
+ gint ba = GUINT16_FROM_LE (auds->blockalign);
+ gint ch = GUINT16_FROM_LE (auds->channels);
+ gint ws = GUINT16_FROM_LE (auds->size);
+
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "width", G_TYPE_INT, ba * 8 / ch,
+ "depth", G_TYPE_INT, ws,
+ "signed", G_TYPE_BOOLEAN, ws != 8, NULL);
+ } else {
+ caps = gst_caps_from_string ("audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "depth = (int) { 8, 16 }, "
+ "width = (int) { 8, 16 }");
}
- if (pixel_width != NULL && pixel_height != NULL) {
- gst_props_add_entry (one->properties, pixel_width);
- gst_props_add_entry (one->properties, pixel_height);
+ }
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_MULAW:
+ if (auds != NULL && auds->size != 8) {
+ g_warning ("invalid depth (%d) of mulaw audio, overwriting.",
+ auds->size);
}
+ caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
+ break;
- if (fps != NULL) {
- gst_props_add_entry (one->properties, fps);
+ case GST_RIFF_WAVE_FORMAT_ALAW:
+ if (auds != NULL && auds->size != 8) {
+ g_warning ("invalid depth (%d) of alaw audio, overwriting.",
+ auds->size);
}
- }
+ caps = gst_caps_new_simple ("audio/x-alaw", NULL);
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
+ case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
+ case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
+ caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_A52:
+ caps = gst_caps_new_simple ("audio/x-ac3", NULL);
+ break;
+
+ default:
+ GST_WARNING ("matroskademux: unkown ACM audio format 0x%04x",
+ codec_id);
+ return NULL;
+ break;
}
return caps;
}
+#endif
static GstCaps *
gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
else
g_assert (0);
- caps = GST_CAPS_NEW ("matroskademux_mpeg1-l1",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (layer));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, layer, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE)) {
gint endianness = -1;
- GstPropsEntry *depth, *width, *sign;
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE))
endianness = G_BIG_ENDIAN;
g_assert (0);
if (context != NULL) {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (audiocontext->bitdepth));
- depth = gst_props_entry_new ("depth",
- GST_PROPS_INT (audiocontext->bitdepth));
- sign = gst_props_entry_new ("signed",
- GST_PROPS_BOOLEAN (audiocontext->bitdepth == 8));
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, audiocontext->bitdepth,
+ "depth", G_TYPE_INT, audiocontext->bitdepth,
+ "signed", G_TYPE_BOOLEAN, audiocontext->bitdepth == 8, NULL);
} else {
- width = gst_props_entry_new ("width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)));
- depth = gst_props_entry_new ("depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)));
- sign = gst_props_entry_new ("signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)));
+ caps = gst_caps_from_string ("audio/x-raw-int, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "depth = (int) { 8, 16 }, "
+ "width = (int) { 8, 16 }");
}
-
- caps = GST_CAPS_NEW ("matroskademux_audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (endianness));
- gst_props_add_entry (caps->properties, width);
- gst_props_add_entry (caps->properties, depth);
- gst_props_add_entry (caps->properties, sign);
+ gst_caps_set_simple (caps, "endianness", G_TYPE_INT, endianness, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) {
- GstPropsEntry *width;
-
+ caps = gst_caps_new_simple ("audio/x-raw-float",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
if (audiocontext != NULL) {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (audiocontext->bitdepth));
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, audiocontext->bitdepth, NULL);
} else {
- width = gst_props_entry_new ("width", GST_PROPS_LIST (
- GST_PROPS_INT (32),
- GST_PROPS_INT (64)));
+ gst_caps_set_simple (caps,
+ "width", GST_TYPE_INT_RANGE, 32, 64, NULL);
}
-
- caps = GST_CAPS_NEW ("matroskademux_audio_float",
- "audio/x-raw-float",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT));
-
- gst_props_add_entry (caps->properties, width);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AC3) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_DTS)) {
- caps = GST_CAPS_NEW ("matroskademux_audio_ac3/dts",
- "audio/x-ac3",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-ac3", NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_VORBIS)) {
- caps = GST_CAPS_NEW ("matroskademux_audio_vorbis",
- "audio/x-vorbis",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_ACM)) {
gst_riff_strf_auds *auds = NULL;
- GstCaps *t;
if (data) {
auds = (gst_riff_strf_auds *) data;
} else {
caps = gst_riff_create_audio_template_caps ();
}
-
- for (t = caps; t != NULL; t = t->next) {
- gst_props_remove_entry_by_name (t->properties, "rate");
- gst_props_remove_entry_by_name (t->properties, "channels");
- }
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG2,
strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)) ||
!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4,
else
g_assert (0);
- caps = GST_CAPS_NEW ("matroska_demux_aac_mpeg2",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (mpegversion));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, mpegversion, NULL);
} else {
GST_WARNING ("Unknown codec '%s', cannot build Caps",
codec_id);
+ return NULL;
}
if (caps != NULL) {
- GstCaps *one;
- GstPropsEntry *chans = NULL, *rate = NULL;
+ GstStructure *structure;
+ int i;
- for (one = caps; one != NULL; one = one->next) {
+ for (i=0; i<gst_caps_get_size(caps); i++){
+ structure = gst_caps_get_structure (caps, i);
if (audiocontext != NULL) {
if (audiocontext->samplerate > 0 &&
audiocontext->channels > 0) {
- chans = gst_props_entry_new ("channels",
- GST_PROPS_INT (audiocontext->channels));
- rate = gst_props_entry_new ("rate",
- GST_PROPS_INT (audiocontext->samplerate));
+ gst_structure_set (structure,
+ "channels", G_TYPE_INT, audiocontext->channels,
+ "rate", G_TYPE_INT, audiocontext->samplerate,
+ NULL);
}
} else {
- chans = gst_props_entry_new ("channels",
- GST_PROPS_INT_RANGE (1, 6));
- rate = gst_props_entry_new ("rate",
- GST_PROPS_INT_RANGE (4000, 96000));
- }
-
- if (caps->properties == NULL) {
- caps->properties = gst_props_empty_new ();
- }
-
- if (chans != NULL && rate != NULL) {
- gst_props_add_entry (caps->properties, chans);
- gst_props_add_entry (caps->properties, rate);
+ gst_structure_set (structure,
+ "channels", GST_TYPE_INT_RANGE, 1, 6,
+ "rate", GST_TYPE_INT_RANGE, 4000, 96000,
+ NULL);
}
}
}
gst_matroska_demux_plugin_init (GstPlugin *plugin)
{
gint i;
- GstCaps *videosrccaps = NULL, *audiosrccaps = NULL,
- *subtitlesrccaps = NULL, *temp;
+ GstCaps *videosrccaps, *audiosrccaps, *subtitlesrccaps, *temp;
const gchar *video_id[] = {
GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC,
GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED,
return FALSE;
/* video src template */
+ videosrccaps = gst_caps_new_empty ();
for (i = 0; video_id[i] != NULL; i++) {
temp = gst_matroska_demux_video_caps (NULL, video_id[i], NULL, 0);
- videosrccaps = gst_caps_append (videosrccaps, temp);
+ gst_caps_append (videosrccaps, temp);
}
for (i = 0; complex_id[i] != NULL; i++) {
temp = gst_matroska_demux_complex_caps (NULL, video_id[i], NULL, 0);
- videosrccaps = gst_caps_append (videosrccaps, temp);
+ gst_caps_append (videosrccaps, temp);
}
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- videosrccaps, NULL);
+ videosrccaps);
+ audiosrccaps = gst_caps_new_empty ();
/* audio src template */
for (i = 0; audio_id[i] != NULL; i++) {
temp = gst_matroska_demux_audio_caps (NULL, audio_id[i], NULL, 0);
- audiosrccaps = gst_caps_append (audiosrccaps, temp);
+ gst_caps_append (audiosrccaps, temp);
}
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- audiosrccaps, NULL);
+ audiosrccaps);
+ subtitlesrccaps = gst_caps_new_empty ();
/* subtitle src template */
for (i = 0; subtitle_id[i] != NULL; i++) {
temp = gst_matroska_demux_subtitle_caps (NULL, subtitle_id[i], NULL, 0);
- subtitlesrccaps = gst_caps_append (subtitlesrccaps, temp);
+ gst_caps_append (subtitlesrccaps, temp);
}
subtitlesrctempl = gst_pad_template_new ("subtitle_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- subtitlesrccaps, NULL);
+ subtitlesrccaps);
/* create an elementfactory for the matroska_demux element */
if (!gst_element_register (plugin, "matroskademux",
GstClock *clock;
/* metadata */
- GstCaps *metadata,
- *streaminfo;
+ GstCaps *metadata;
+ GstCaps *streaminfo;
gchar *muxing_app, *writing_app;
gint64 created;
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (src_templ,
+static GstStaticPadTemplate src_templ =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "matroskamux_src",
- "video/x-matroska",
- NULL
- )
-)
+ GST_STATIC_CAPS ("video/x-matroska")
+);
-#define COMMON_VIDEO_PROPERTIES \
- "width", GST_PROPS_INT_RANGE (16, 4096), \
- "height", GST_PROPS_INT_RANGE (16, 4096), \
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
+#define COMMON_VIDEO_CAPS \
+ "width = (int) [ 16, 4096 ], " \
+ "height = (int) [ 16, 4096 ], " \
+ "framerate = (double) [ 0, MAX ]"
-GST_PAD_TEMPLATE_FACTORY (videosink_templ,
+static GstStaticPadTemplate videosink_templ =
+GST_STATIC_PAD_TEMPLATE (
"video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW ("matroska_video_sink_mpeg",
- "video/mpeg",
- "mpegversion", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (2),
- GST_PROPS_INT (4)
- ),
- "systemstream", GST_PROPS_BOOLEAN (FALSE),
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_divx",
- "video/x-divx",
- "divxversion", GST_PROPS_INT_RANGE (3, 5),
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_xvid",
- "video/x-xvid",
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_msmpeg4v3",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (43),
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_jpeg",
- "video/x-jpeg",
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_rawyuv",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))
- ),
- COMMON_VIDEO_PROPERTIES)
-)
-
-#define COMMON_AUDIO_PROPERTIES \
- "channels", GST_PROPS_INT_RANGE (1, 8), \
- "rate", GST_PROPS_INT_RANGE (8000, 96000)
+ GST_STATIC_CAPS (
+ "video/mpeg, "
+ "mpegversion = (int) { 1, 2, 4 }, "
+ "systemstream = (boolean) false, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-divx, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-xvid, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-msmpeg, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-jpeg, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-raw-yuv, "
+ "format = (fourcc) { YUY2, I420 }, "
+ COMMON_VIDEO_CAPS
+ )
+);
+
+#define COMMON_AUDIO_CAPS \
+ "channels = (int) [ 1, 8 ], " \
+ "rate = (int) [ 8000, 96000 ]"
/* FIXME:
* * audio/x-raw-float: endianness needs defining.
* * audio/x-vorbis: private data setup needs work.
*/
-GST_PAD_TEMPLATE_FACTORY (audiosink_templ,
+static GstStaticPadTemplate audiosink_templ =
+GST_STATIC_PAD_TEMPLATE (
"audio_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW ("matroska_audio_sink_mpeg1",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT_RANGE (1, 3),
- COMMON_AUDIO_PROPERTIES),
- GST_CAPS_NEW ("matroska_audio_sink_mpeg24",
- "audio/mpeg",
- "mpegversion", GST_PROPS_LIST (
- GST_PROPS_INT (2),
- GST_PROPS_INT (4)
- ),
- COMMON_AUDIO_PROPERTIES),
- GST_CAPS_NEW ("matroska_audio_sink_ac3",
- "audio/x-ac3",
- COMMON_AUDIO_PROPERTIES),
- GST_CAPS_NEW ("matroska_audio_sink_raw_int",
- "audio/x-raw-int",
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16),
- GST_PROPS_INT (24)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16),
- GST_PROPS_INT (24)
- ),
- "endianness", GST_PROPS_LIST (
- GST_PROPS_INT (G_BIG_ENDIAN),
- GST_PROPS_INT (G_LITTLE_ENDIAN)
- ),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- COMMON_AUDIO_PROPERTIES)
-)
-
-GST_PAD_TEMPLATE_FACTORY (subtitlesink_templ,
+ GST_STATIC_CAPS (
+ "audio/mpeg, "
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ COMMON_AUDIO_CAPS "; "
+ "audio/mpeg, "
+ "mpegversion = (int) { 2, 4 }, "
+ COMMON_AUDIO_CAPS "; "
+ "audio/x-ac3, "
+ COMMON_AUDIO_CAPS "; "
+ "audio/x-raw-int, "
+ "width = (int) { 8, 16, 24 }, "
+ "depth = (int) { 8, 16, 24 }, "
+ "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
+ "signed = (boolean) { true, false }, "
+ COMMON_AUDIO_CAPS
+ )
+);
+
+static GstStaticPadTemplate subtitlesink_templ =
+GST_STATIC_PAD_TEMPLATE (
"subtitle_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- NULL
-)
+ GST_STATIC_CAPS_ANY
+);
/* gobject magic foo */
static void gst_matroska_mux_base_init (GstMatroskaMuxClass *klass);
};
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (videosink_templ));
+ gst_static_pad_template_get (&videosink_templ));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (audiosink_templ));
+ gst_static_pad_template_get (&audiosink_templ));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (subtitlesink_templ));
+ gst_static_pad_template_get (&subtitlesink_templ));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_templ));
+ gst_static_pad_template_get (&src_templ));
gst_element_class_set_details (element_class,
&gst_matroska_mux_details);
}
/* reset media info (to default) */
gst_caps_replace (&mux->metadata,
- GST_CAPS_NEW ("matroska_metadata",
- "application/x-gst-metadata",
- "application", GST_PROPS_STRING (""),
- "date", GST_PROPS_STRING ("")));
+ gst_caps_new_simple ("application/x-gst-metadata",
+ "application", G_TYPE_STRING, "",
+ "date", G_TYPE_STRING, "", NULL));
/* reset indexes */
mux->num_indexes = 0;
}
static GstPadLinkReturn
-gst_matroska_mux_video_pad_link (GstPad *pad,
- GstCaps *caps)
+gst_matroska_mux_video_pad_link (GstPad *pad, const GstCaps *caps)
{
GstMatroskaTrackContext *context = NULL;
GstMatroskaTrackVideoContext *videocontext;
GstMatroskaMux *mux = GST_MATROSKA_MUX (gst_pad_get_parent (pad));
const gchar *mimetype;
gint width, height, pixel_width, pixel_height, i;
- gfloat framerate;
-
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ gdouble framerate;
+ GstStructure *structure;
+ gboolean ret;
/* find context */
for (i = 0; i < mux->num_streams; i++) {
videocontext = (GstMatroskaTrackVideoContext *) context;
/* gst -> matroska ID'ing */
- for (; caps != NULL; caps = caps->next) {
- mimetype = gst_caps_get_mime (caps);
-
- /* get general properties */
- gst_caps_get (caps,
- "width", &width,
- "height", &height,
- "framerate", &framerate,
- NULL);
- videocontext->pixel_width = width;
- videocontext->pixel_height = height;
- context->default_duration = GST_SECOND / framerate;
-
- if (gst_caps_has_property (caps, "pixel_width") &&
- gst_caps_has_property (caps, "pixel_height")) {
- gst_caps_get (caps,
- "pixel_width", &pixel_width,
- "pixel_height", &pixel_height,
- NULL);
- if (pixel_width > pixel_height) {
- videocontext->display_width = width * pixel_width / pixel_height;
- videocontext->display_height = height;
- } else if (pixel_width < pixel_height) {
- videocontext->display_width = width;
- videocontext->display_height = height * pixel_height / pixel_width;
- } else {
- videocontext->display_width = 0;
- videocontext->display_height = 0;
- }
+ structure = gst_caps_get_structure (caps, 0);
+
+ mimetype = gst_structure_get_name (structure);
+
+ /* get general properties */
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "height", &height);
+ gst_structure_get_double (structure, "framerate", &framerate);
+
+ videocontext->pixel_width = width;
+ videocontext->pixel_height = height;
+ context->default_duration = GST_SECOND / framerate;
+
+ ret = gst_structure_get_int (structure, "pixel_width", &pixel_width);
+ ret &= gst_structure_get_int (structure, "pixel_height", &pixel_height);
+ if (ret) {
+ if (pixel_width > pixel_height) {
+ videocontext->display_width = width * pixel_width / pixel_height;
+ videocontext->display_height = height;
+ } else if (pixel_width < pixel_height) {
+ videocontext->display_width = width;
+ videocontext->display_height = height * pixel_height / pixel_width;
} else {
videocontext->display_width = 0;
videocontext->display_height = 0;
}
+ } else {
+ videocontext->display_width = 0;
+ videocontext->display_height = 0;
+ }
- videocontext->asr_mode = GST_MATROSKA_ASPECT_RATIO_MODE_FREE;
- videocontext->eye_mode = GST_MATROSKA_EYE_MODE_MONO;
- videocontext->fourcc = 0;
-
- /* find type */
- if (!strcmp (mimetype, "video/x-raw-yuv")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED);
- gst_caps_get_fourcc_int (caps, "format", &videocontext->fourcc);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-jpeg")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MJPEG);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-divx")) {
- gint divxversion;
-
- gst_caps_get_int (caps, "divxversion", &divxversion);
- switch (divxversion) {
- case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
- break;
- case 4:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
- break;
- case 5:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
- break;
- }
+ videocontext->asr_mode = GST_MATROSKA_ASPECT_RATIO_MODE_FREE;
+ videocontext->eye_mode = GST_MATROSKA_EYE_MODE_MONO;
+ videocontext->fourcc = 0;
+
+ /* find type */
+ if (!strcmp (mimetype, "video/x-raw-yuv")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED);
+ gst_structure_get_fourcc (structure, "format", &videocontext->fourcc);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-jpeg")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MJPEG);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-divx")) {
+ gint divxversion;
+
+ gst_structure_get_int (structure, "divxversion", &divxversion);
+ switch (divxversion) {
+ case 3:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
+ break;
+ case 4:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
+ break;
+ case 5:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ break;
+ }
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-xvid")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/mpeg")) {
- gint mpegversion;
-
- gst_caps_get_int (caps, "mpegversion", &mpegversion);
- switch (mpegversion) {
- case 1:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
- break;
- case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
- break;
- case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
- break;
- }
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-xvid")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/mpeg")) {
+ gint mpegversion;
+
+ gst_structure_get_int (structure, "mpegversion", &mpegversion);
+ switch (mpegversion) {
+ case 1:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
+ break;
+ case 2:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
+ break;
+ case 3:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ break;
+ }
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-msmpeg")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-msmpeg")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
- return GST_PAD_LINK_OK;
- }
+ return GST_PAD_LINK_OK;
}
return GST_PAD_LINK_REFUSED;
static GstPadLinkReturn
gst_matroska_mux_audio_pad_link (GstPad *pad,
- GstCaps *caps)
+ const GstCaps *caps)
{
GstMatroskaTrackContext *context = NULL;
GstMatroskaTrackAudioContext *audiocontext;
GstMatroskaMux *mux = GST_MATROSKA_MUX (gst_pad_get_parent (pad));
const gchar *mimetype;
gint samplerate, channels, i;
-
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ GstStructure *structure;
/* find context */
for (i = 0; i < mux->num_streams; i++) {
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_AUDIO);
audiocontext = (GstMatroskaTrackAudioContext *) context;
- for (; caps != NULL; caps = caps->next) {
- mimetype = gst_caps_get_mime (caps);
-
- /* general setup */
- gst_caps_get (caps,
- "rate", &samplerate,
- "channels", &channels,
- NULL);
- audiocontext->samplerate = samplerate;
- audiocontext->channels = channels;
- audiocontext->bitdepth = 0;
-
- if (!strcmp (mimetype, "audio/mpeg")) {
- gint mpegversion = 0;
-
- gst_caps_get_int (caps, "mpegversion", &mpegversion);
- switch (mpegversion) {
- case 1: {
- gint layer;
-
- gst_caps_get_int (caps, "layer", &layer);
- switch (layer) {
- case 1:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
- break;
- case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
- break;
- case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
- break;
- }
- break;
+ structure = gst_caps_get_structure (caps, 0);
+ mimetype = gst_structure_get_name (structure);
+
+ /* general setup */
+ gst_structure_get_int (structure, "rate", &samplerate);
+ gst_structure_get_int (structure, "channels", &channels);
+
+ audiocontext->samplerate = samplerate;
+ audiocontext->channels = channels;
+ audiocontext->bitdepth = 0;
+
+ if (!strcmp (mimetype, "audio/mpeg")) {
+ gint mpegversion = 0;
+
+ gst_structure_get_int (structure, "mpegversion", &mpegversion);
+ switch (mpegversion) {
+ case 1: {
+ gint layer;
+
+ gst_structure_get_int (structure, "layer", &layer);
+ switch (layer) {
+ case 1:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
+ break;
+ case 2:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
+ break;
+ case 3:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
+ break;
}
- case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2
- "MAIN");
- break;
- case 4:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4
- "MAIN");
- break;
+ break;
}
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "audio/x-raw-int")) {
- gint endianness, width, depth;
- gboolean signedness;
-
- gst_caps_get (caps,
- "endianness", &endianness,
- "width", &width,
- "depth", &depth,
- "signed", &signedness,
- NULL);
- if (width != depth ||
- (width == 8 && signedness) || (width != 8 && !signedness))
- continue;
-
- audiocontext->bitdepth = depth;
- if (endianness == G_BIG_ENDIAN)
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE);
- else
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "audio/x-raw-float")) {
- /* FIXME: endianness is undefined */
- } else if (!strcmp (mimetype, "audio/x-vorbis")) {
- /* FIXME: private data setup needs work */
- } else if (!strcmp (mimetype, "audio/x-ac3")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_AC3);
-
- return GST_PAD_LINK_OK;
+ case 2:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2
+ "MAIN");
+ break;
+ case 4:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4
+ "MAIN");
+ break;
}
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "audio/x-raw-int")) {
+ gint endianness, width, depth;
+ gboolean signedness;
+
+ gst_structure_get_int (structure, "endianness", &endianness);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "depth", &depth);
+ gst_structure_get_int (structure, "signed", &signedness);
+ if (width != depth ||
+ (width == 8 && signedness) || (width == 16 && !signedness))
+ return GST_PAD_LINK_REFUSED;
+
+ audiocontext->bitdepth = depth;
+ if (endianness == G_BIG_ENDIAN)
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE);
+ else
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "audio/x-raw-float")) {
+ /* FIXME: endianness is undefined */
+ } else if (!strcmp (mimetype, "audio/x-vorbis")) {
+ /* FIXME: private data setup needs work */
+ } else if (!strcmp (mimetype, "audio/x-ac3")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_AC3);
+
+ return GST_PAD_LINK_OK;
}
return GST_PAD_LINK_REFUSED;
static GstPadLinkReturn
gst_matroska_mux_subtitle_pad_link (GstPad *pad,
- GstCaps *caps)
+ const GstCaps *caps)
{
/* Consider this as boilerplate code for now. There is
* no single subtitle creation element in GStreamer,
gst_ebml_write_float (ebml, GST_MATROSKA_ID_DURATION, 0);
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_MUXINGAPP, "GStreamer");
if (mux->metadata &&
- gst_caps_has_property (mux->metadata, "application")) {
+ gst_structure_has_field (gst_caps_get_structure(mux->metadata,0),
+ "application")) {
const gchar *app;
- gst_caps_get_string (mux->metadata, "application", &app);
+ app = gst_structure_get_string (gst_caps_get_structure(mux->metadata, 0),
+ "application");
if (app && app[0]) {
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_WRITINGAPP, app);
}
num_v_streams, num_a_streams, num_t_streams;
/* metadata - includes writing_app and creation_time */
- GstCaps *metadata;
+ GstCaps *metadata;
/* state */
GstMatroskaMuxState state;
"Wim Taymans <wim.taymans@chello.be>"
};
-GST_PAD_TEMPLATE_FACTORY (median_src_factory,
+static GstStaticPadTemplate median_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "median_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
- )
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
-GST_PAD_TEMPLATE_FACTORY (median_sink_factory,
+static GstStaticPadTemplate median_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "median_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
- )
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
/* Median signals and args */
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (median_sink_factory));
+ gst_static_pad_template_get (&median_sink_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (median_src_factory));
+ gst_static_pad_template_get (&median_src_factory));
gst_element_class_set_details (element_class, &median_details);
}
}
static gboolean
-gst_median_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_median_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstMedian *filter;
+ GstStructure *structure;
filter = GST_MEDIAN (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
/* forward to the next plugin */
- return gst_pad_try_set_caps(filter->srcpad, gst_caps_copy_1(caps));
+ return gst_pad_try_set_caps(filter->srcpad, caps);
}
void gst_median_init (GstMedian *median)
{
median->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (median_sink_factory), "sink");
+ gst_static_pad_template_get (&median_sink_factory), "sink");
gst_pad_set_link_function (median->sinkpad, gst_median_sinkconnect);
gst_pad_set_chain_function (median->sinkpad, gst_median_chain);
gst_element_add_pad (GST_ELEMENT (median), median->sinkpad);
median->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (median_src_factory), "src");
+ gst_static_pad_template_get (&median_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (median), median->srcpad);
median->filtersize = 5;
#include <gst/gst.h>
#include <gst/video/video.h>
+#include <gst/audio/audio.h>
#include "monoscope.h"
#define GST_TYPE_MONOSCOPE (gst_monoscope_get_type())
/* pads */
GstPad *sinkpad,*srcpad;
- GstBufferPool *peerpool;
/* the timestamp of the next frame */
guint64 next_time;
gint16 datain[512];
/* video state */
- gfloat fps;
+ gdouble fps;
gint width;
gint height;
gboolean first_buffer;
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (src_template,
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "monoscopesrc",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32)
+);
-GST_PAD_TEMPLATE_FACTORY (sink_template,
- "sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "monoscopesink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_INT (1)
- )
-)
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS)
+);
static void gst_monoscope_class_init (GstMonoscopeClass *klass);
static void gst_monoscope_chain (GstPad *pad, GstData *_data);
static GstPadLinkReturn
- gst_monoscope_sinkconnect (GstPad *pad, GstCaps *caps);
+ gst_monoscope_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstPadLinkReturn
- gst_monoscope_srcconnect (GstPad *pad, GstCaps *caps);
+ gst_monoscope_srcconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_template));
+ gst_static_pad_template_get (&src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template));
+ gst_static_pad_template_get (&sink_template));
gst_element_class_set_details (element_class, &gst_monoscope_details);
}
{
/* create the sink and src pads */
monoscope->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template ), "sink");
+ gst_static_pad_template_get (&sink_template ), "sink");
monoscope->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_template ), "src");
+ gst_static_pad_template_get (&src_template ), "src");
gst_element_add_pad (GST_ELEMENT (monoscope), monoscope->sinkpad);
gst_element_add_pad (GST_ELEMENT (monoscope), monoscope->srcpad);
gst_pad_set_link_function (monoscope->srcpad, gst_monoscope_srcconnect);
monoscope->next_time = 0;
- monoscope->peerpool = NULL;
/* reset the initial video state */
monoscope->first_buffer = TRUE;
}
static GstPadLinkReturn
-gst_monoscope_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_monoscope_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstMonoscope *monoscope;
monoscope = GST_MONOSCOPE (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
return GST_PAD_LINK_OK;
}
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "monoscopesrc",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT (monoscope->width),
- "height", GST_PROPS_INT (monoscope->height),
- "framerate", GST_PROPS_FLOAT (monoscope->fps)
- );
+ caps = gst_caps_new_simple ("video/x-raw-rgb",
+ "bpp", G_TYPE_INT, 32,
+ "depth", G_TYPE_INT, 32,
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+ "red_mask", G_TYPE_INT, R_MASK_32,
+ "green_mask", G_TYPE_INT, G_MASK_32,
+ "blue_mask", G_TYPE_INT, B_MASK_32,
+ "width", G_TYPE_INT, monoscope->width,
+ "height", G_TYPE_INT, monoscope->height,
+ "framerate", G_TYPE_DOUBLE, monoscope->fps, NULL);
return gst_pad_try_set_caps (monoscope->srcpad, caps);
}
static GstPadLinkReturn
-gst_monoscope_srcconnect (GstPad *pad, GstCaps *caps)
+gst_monoscope_srcconnect (GstPad *pad, const GstCaps *caps)
{
GstPadLinkReturn ret;
GstMonoscope *monoscope = GST_MONOSCOPE (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (gst_caps_has_property_typed (caps, "width", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "width", &monoscope->width);
- }
- if (gst_caps_has_property_typed (caps, "height", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "height", &monoscope->height);
- }
- if (gst_caps_has_property_typed (caps, "framerate", GST_PROPS_FLOAT_TYPE)) {
- gst_caps_get_float (caps, "framerate", &monoscope->fps);
- }
+ structure = gst_caps_get_structure (caps, 0);
+
+ gst_structure_get_int (structure, "width", &monoscope->width);
+ gst_structure_get_int (structure, "height", &monoscope->height);
+ gst_structure_get_double (structure, "framerate", &monoscope->fps);
if ((ret = gst_monoscope_negotiate (monoscope)) <= 0)
return ret;
ARG_0
};
-GST_PAD_TEMPLATE_FACTORY (sink_templ,
+static GstStaticPadTemplate gst_qtdemux_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "qtdemux_sink",
- "video/quicktime",
- NULL
- ),
- GST_CAPS_NEW (
- "qtdemux_sink",
- "audio/x-m4a",
- NULL
- )
-)
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY
+);
+
+static GstStaticPadTemplate gst_qtdemux_videosrc_template =
+GST_STATIC_PAD_TEMPLATE (
+ "audio_%02d",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY
+);
+
+static GstStaticPadTemplate gst_qtdemux_audiosrc_template =
+GST_STATIC_PAD_TEMPLATE (
+ "video_%02d",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY
+);
-static GstPadTemplate *videosrctempl, *audiosrctempl;
static GstElementClass *parent_class = NULL;
static void gst_qtdemux_class_init (GstQTDemuxClass *klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_templ));
- gst_element_class_add_pad_template (element_class, videosrctempl);
- gst_element_class_add_pad_template (element_class, audiosrctempl);
+ gst_static_pad_template_get (&gst_qtdemux_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_qtdemux_videosrc_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_qtdemux_audiosrc_template));
gst_element_class_set_details (element_class, &gst_qtdemux_details);
+
}
static void gst_qtdemux_class_init (GstQTDemuxClass *klass)
static void
gst_qtdemux_init (GstQTDemux *qtdemux)
{
- qtdemux->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_templ), "sink");
- gst_element_set_loop_function (GST_ELEMENT (qtdemux), gst_qtdemux_loop_header);
+ qtdemux->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_qtdemux_sink_template), "sink");
+ gst_element_set_loop_function (GST_ELEMENT (qtdemux),
+ gst_qtdemux_loop_header);
gst_element_add_pad (GST_ELEMENT (qtdemux), qtdemux->sinkpad);
}
static gboolean
plugin_init (GstPlugin *plugin)
{
+#if 0
GstCaps *audiocaps = NULL, *videocaps = NULL, *temp;
const guint32 audio_fcc[] = {
/* FILLME */
GST_PAD_SRC,
GST_PAD_SOMETIMES,
videocaps, NULL);
+#endif
return gst_element_register (plugin, "qtdemux",
GST_RANK_PRIMARY, GST_TYPE_QTDEMUX);
if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
float fps = 1. * GST_SECOND / stream->samples[stream->sample_index].duration;
if (fps != stream->fps) {
- gst_props_remove_entry_by_name(stream->caps->properties, "framerate");
- gst_props_add_entry(stream->caps->properties,
- gst_props_entry_new("framerate", GST_PROPS_FLOAT(fps)));
+ gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps,
+ NULL);
stream->fps = fps;
gst_pad_try_set_caps(stream->pad, stream->caps);
}
}
-static GstCaps *gst_qtdemux_src_getcaps(GstPad *pad, GstCaps *caps)
+static GstCaps *gst_qtdemux_src_getcaps(GstPad *pad)
{
GstQTDemux *qtdemux;
QtDemuxStream *stream;
- int i;
GST_DEBUG ("gst_qtdemux_src_getcaps");
g_return_val_if_fail(GST_IS_QTDEMUX(qtdemux), NULL);
- GST_DEBUG ("looking for pad %p in qtdemux %p", pad, qtdemux);
- GST_DEBUG ("n_streams is %d", qtdemux->n_streams);
- for(i=0;i<qtdemux->n_streams;i++){
- stream = qtdemux->streams[i];
- if(stream->pad == pad){
- return stream->caps;
- }
- }
-
- GST_DEBUG ("Couldn't find stream cooresponding to pad\n");
-
- return NULL;
+ stream = GST_PAD_ELEMENT_PRIVATE (pad);
+ return gst_caps_copy(stream->caps);
}
+#if 0
+/* This function doesn't do anything useful, but might be useful later */
static GstPadLinkReturn
gst_qtdemux_src_link(GstPad *pad, GstCaps *caps)
{
return GST_PAD_LINK_REFUSED;
}
+#endif
void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
{
if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
- stream->pad = gst_pad_new_from_template (videosrctempl,
+ stream->pad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_qtdemux_videosrc_template),
g_strdup_printf ("video_%02d", qtdemux->n_video_streams));
stream->fps = 1. * GST_SECOND / stream->samples[0].duration;
if(stream->caps){
- GstProps *properties = gst_props_intersect(
- stream->caps->properties,
- gst_props_new("width",GST_PROPS_INT(stream->width),
- "height",GST_PROPS_INT(stream->height),
- "framerate", GST_PROPS_FLOAT(stream->fps), NULL));
- if (stream->caps->properties != NULL)
- gst_props_unref (stream->caps->properties);
- stream->caps->properties = properties;
+ gst_caps_set_simple(stream->caps,
+ "width", G_TYPE_INT, stream->width,
+ "height", G_TYPE_INT, stream->height,
+ "framerate", G_TYPE_DOUBLE, stream->fps, NULL);
}
qtdemux->n_video_streams++;
}else{
- stream->pad = gst_pad_new_from_template (audiosrctempl,
+ stream->pad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_qtdemux_audiosrc_template),
g_strdup_printf ("audio_%02d", qtdemux->n_audio_streams));
if(stream->caps){
- GstProps *properties = gst_props_intersect(
- stream->caps->properties,
- gst_props_new("rate",GST_PROPS_INT((int)stream->rate),
- "channels",GST_PROPS_INT(stream->n_channels), NULL));
- if (stream->caps->properties != NULL)
- gst_props_unref (stream->caps->properties);
- stream->caps->properties = properties;
+ gst_caps_set_simple(stream->caps,
+ "rate", G_TYPE_INT, (int)stream->rate,
+ "channels", G_TYPE_INT, stream->n_channels, NULL);
}
qtdemux->n_audio_streams++;
}
gst_pad_set_getcaps_function(stream->pad, gst_qtdemux_src_getcaps);
+#ifdef unused
gst_pad_set_link_function(stream->pad, gst_qtdemux_src_link);
+#endif
+ GST_PAD_ELEMENT_PRIVATE(stream->pad) = stream;
qtdemux->streams[qtdemux->n_streams] = stream;
qtdemux->n_streams++;
GST_DEBUG ("n_streams is now %d", qtdemux->n_streams);
/* Note: we need to have everything set up before calling try_set_caps */
if(stream->caps){
- g_print("setting caps to %s\n",gst_caps_to_string(stream->caps));
+ GST_DEBUG_CAPS ("setting caps",stream->caps);
gst_pad_try_set_caps(stream->pad, stream->caps);
}
return;
}
- if(stream->caps){
- gst_caps_ref(stream->caps);
- gst_caps_sink(stream->caps);
- }
-
/* sample to chunk */
stsc = qtdemux_tree_get_child_by_type(stbl, FOURCC_stsc);
g_assert(stsc);
switch(fourcc){
case GST_MAKE_FOURCC('j','p','e','g'):
/* JPEG */
- return GST_CAPS_NEW("jpeg_caps","image/jpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/jpeg");
case GST_MAKE_FOURCC('m','j','p','a'):
/* Motion-JPEG (format A) */
- return GST_CAPS_NEW("mjpa_caps","image/jpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/jpeg");
case GST_MAKE_FOURCC('m','j','p','b'):
/* Motion-JPEG (format B) */
- return GST_CAPS_NEW("mjpb_caps","image/jpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/jpeg");
case GST_MAKE_FOURCC('S','V','Q','3'):
- return GST_CAPS_NEW("SVQ3_caps","video/x-svq",
- "svqversion", GST_PROPS_INT(3),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-svq, "
+ "svqversion = (int) 3");
case GST_MAKE_FOURCC('s','v','q','i'):
case GST_MAKE_FOURCC('S','V','Q','1'):
- return GST_CAPS_NEW("SVQ1_caps","video/x-svq",
- "svqversion", GST_PROPS_INT(1),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-svq, "
+ "svqversion = (int) 1");
case GST_MAKE_FOURCC('r','a','w',' '):
/* uncompressed RGB */
- return GST_CAPS_NEW("raw__caps","video/x-raw-rgb",
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
+ return gst_caps_from_string ("video/x-raw-rgb, "
+ "endianness = (int) BIG_ENDIAN");
/*"bpp", GST_PROPS_INT(x),
"depth", GST_PROPS_INT(x),
"red_mask", GST_PROPS_INT(x),
"green_mask", GST_PROPS_INT(x),
"blue_mask", GST_PROPS_INT(x), FIXME! */
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('Y','u','v','2'):
/* uncompressed YUV2 */
- return GST_CAPS_NEW("Yuv2_caps","video/x-raw-yuv",
- "format",GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','V','2')),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-raw-yuv, "
+ "format = (fourcc) YUY2");
case GST_MAKE_FOURCC('m','p','e','g'):
/* MPEG */
- return GST_CAPS_NEW("mpeg_caps","video/mpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "systemstream", GST_PROPS_BOOLEAN(FALSE),
- "mpegversion", GST_PROPS_INT(1));
+ return gst_caps_from_string ("video/mpeg, "
+ "systemstream = (boolean) false, "
+ "mpegversion = (int) 1");
case GST_MAKE_FOURCC('g','i','f',' '):
- return GST_CAPS_NEW("gif__caps","image/gif",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/gif");
case GST_MAKE_FOURCC('h','2','6','3'):
/* H.263 */
/* ffmpeg uses the height/width props, don't know why */
- return GST_CAPS_NEW("h263_caps","video/x-h263",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-h263");
case GST_MAKE_FOURCC('m','p','4','v'):
/* MPEG-4 */
- return GST_CAPS_NEW("mp4v_caps", "video/mpeg",
- "mpegversion",GST_PROPS_INT(4),
- "systemstream", GST_PROPS_BOOLEAN(FALSE),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/mpeg, "
+ "mpegversion = (int) 4, "
+ "systemstream = (boolean) false");
case GST_MAKE_FOURCC('3','I','V','1'):
- return GST_CAPS_NEW("3IV1_caps", "video/x-3ivx",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-3ivx");
case GST_MAKE_FOURCC('r','p','z','a'):
case GST_MAKE_FOURCC('c','v','i','d'):
/* Cinepak */
case GST_MAKE_FOURCC('s','m','c',' '):
case GST_MAKE_FOURCC('k','p','c','d'):
default:
- g_print("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
+ g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
"' to caps\n", GST_FOURCC_ARGS(fourcc));
return NULL;
}
{
switch(fourcc){
case GST_MAKE_FOURCC('N','O','N','E'):
- return NULL; /*GST_CAPS_NEW("NONE_caps","audio/raw",NULL);*/
+ return NULL; /*gst_caps_from_string ("audio/raw");*/
case GST_MAKE_FOURCC('r','a','w',' '):
/* FIXME */
- return GST_CAPS_NEW("raw__caps","audio/x-raw-int",
- "width",GST_PROPS_INT(8),
- "depth",GST_PROPS_INT(8),
- "signed",GST_PROPS_BOOLEAN(FALSE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('t','w','o','s'):
/* FIXME */
- return GST_CAPS_NEW("twos_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(16),
- "depth",GST_PROPS_INT(16),
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
- "signed",GST_PROPS_BOOLEAN(TRUE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "endianness = (int) G_BIG_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('s','o','w','t'):
/* FIXME */
- return GST_CAPS_NEW("sowt_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(16),
- "depth",GST_PROPS_INT(16),
- "endianness",GST_PROPS_INT(G_LITTLE_ENDIAN),
- "signed",GST_PROPS_BOOLEAN(TRUE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "endianness = (int) G_LITTLE_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('f','l','6','4'):
- return GST_CAPS_NEW("fl64_caps","audio/x-raw-float",
- "width",GST_PROPS_INT (64),
- "endianness",GST_PROPS_INT (G_BIG_ENDIAN),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-float, "
+ "width = (int) 64, "
+ "endianness = (int) G_BIG_ENDIAN");
case GST_MAKE_FOURCC('f','l','3','2'):
- return GST_CAPS_NEW("fl32_caps","audio/x-raw-float",
- "width",GST_PROPS_INT (32),
- "endianness",GST_PROPS_INT (G_BIG_ENDIAN),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-float, "
+ "width = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN");
case GST_MAKE_FOURCC('i','n','2','4'):
/* FIXME */
- return GST_CAPS_NEW("in24_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(24),
- "depth",GST_PROPS_INT(32),
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
- "signed",GST_PROPS_BOOLEAN(TRUE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 24, "
+ "depth = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('i','n','3','2'):
/* FIXME */
- return GST_CAPS_NEW("in32_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(24),
- "depth",GST_PROPS_INT(32),
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 32, "
+ "depth = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('u','l','a','w'):
/* FIXME */
- return GST_CAPS_NEW("ulaw_caps","audio/x-mulaw",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-mulaw");
case GST_MAKE_FOURCC('a','l','a','w'):
/* FIXME */
- return GST_CAPS_NEW("alaw_caps","audio/x-alaw",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-alaw");
case 0x6d730002:
/* Microsoft ADPCM-ACM code 2 */
- return GST_CAPS_NEW("msxx_caps","audio/x-adpcm",
- "layout", GST_PROPS_STRING("microsoft"),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-adpcm, "
+ "layout = (string) microsoft");
case 0x6d730011:
/* FIXME DVI/Intel IMA ADPCM/ACM code 17 */
- return GST_CAPS_NEW("msxx_caps","audio/x-adpcm",
- "layout", GST_PROPS_STRING("quicktime"),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-adpcm, "
+ "layout = (string) quicktime");
case 0x6d730055:
/* MPEG layer 3, CBR only (pre QT4.1) */
case 0x5500736d:
case GST_MAKE_FOURCC('.','m','p','3'):
/* MPEG layer 3, CBR & VBR (QT4.1 and later) */
- return GST_CAPS_NEW("_mp3_caps","audio/mpeg",
- "mpegversion", GST_PROPS_INT(1),
- "layer", GST_PROPS_INT(3),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/mpeg, "
+ "layer = (int) 3, "
+ "mpegversion = (int) 1");
case GST_MAKE_FOURCC('M','A','C','3'):
/* MACE 3:1 */
- return GST_CAPS_NEW("MAC3_caps","audio/x-mace",
- "maceversion",GST_PROPS_INT(3),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-mace, "
+ "maceversion = (int) 3");
case GST_MAKE_FOURCC('M','A','C','6'):
/* MACE 6:1 */
- return GST_CAPS_NEW("MAC3_caps","audio/x-mace",
- "maceversion",GST_PROPS_INT(6),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-mace, "
+ "maceversion = (int) 6");
case GST_MAKE_FOURCC('O','g','g','V'):
/* Ogg Vorbis */
- return GST_CAPS_NEW("OggV_caps","application/ogg",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("application/ogg");
case GST_MAKE_FOURCC('d','v','c','a'):
/* DV audio */
- return GST_CAPS_NEW("dvca_caps","audio/x-dv",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-dv");
case GST_MAKE_FOURCC('m','p','4','a'):
/* MPEG-4 AAC */
- return GST_CAPS_NEW("mp4a_caps", "audio/mpeg",
- "mpegversion", GST_PROPS_INT(4),
- "rate", GST_PROPS_INT_RANGE(1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE(1, G_MAXINT),
- "systemstream", GST_PROPS_BOOLEAN(FALSE), NULL);
+ return gst_caps_from_string ("audio/mpeg, "
+ "mpegversion = (int) 4");
case GST_MAKE_FOURCC('q','t','v','r'):
/* ? */
case GST_MAKE_FOURCC('Q','D','M','2'):
case GST_MAKE_FOURCC('a','g','s','m'):
/* ? */
default:
- g_print("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
+ g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
"' to caps\n", GST_FOURCC_ARGS(fourcc));
return NULL;
}
ARG_PAYLOAD_TYPE,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16parse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpL16parse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_L16parse_details);
}
static void
gst_rtpL16parse_init (GstRtpL16Parse * rtpL16parse)
{
- rtpL16parse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpL16parse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpL16parse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template), "src");
+ rtpL16parse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->sinkpad);
gst_pad_set_chain_function (rtpL16parse->sinkpad, gst_rtpL16parse_chain);
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT (rtpL16parse->frequency),
- "channels", GST_PROPS_INT (rtpL16parse->channels));
+ caps = gst_caps_copy(gst_static_caps_get (&gst_rtpL16parse_src_template.static_caps));
+
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, rtpL16parse->frequency,
+ "channel", G_TYPE_INT, rtpL16parse->channels, NULL);
gst_pad_try_set_caps (rtpL16parse->srcpad, caps);
}
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
+static GstStaticPadTemplate gst_rtpL16enc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
);
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16enc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16enc_class_init (GstRtpL16EncClass * klass);
const GValue * value, GParamSpec * pspec);
static void gst_rtpL16enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpL16enc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template));
gst_element_class_set_details (element_class, &gst_rtpL16enc_details);
}
static void
gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
{
- rtpL16enc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpL16enc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpL16enc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template), "sink");
+ rtpL16enc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->srcpad);
gst_pad_set_chain_function (rtpL16enc->sinkpad, gst_rtpL16enc_chain);
}
static GstPadLinkReturn
-gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpL16Enc *rtpL16enc;
+ GstStructure *structure;
+ gboolean ret;
rtpL16enc = GST_RTP_L16_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpL16enc->frequency);
- gst_caps_get_int (caps, "channels", &rtpL16enc->channels);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency);
+ ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpL16enc->time_interval = GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency);
ARG_PAYLOAD_TYPE,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16parse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpL16parse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_L16parse_details);
}
static void
gst_rtpL16parse_init (GstRtpL16Parse * rtpL16parse)
{
- rtpL16parse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpL16parse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpL16parse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template), "src");
+ rtpL16parse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->sinkpad);
gst_pad_set_chain_function (rtpL16parse->sinkpad, gst_rtpL16parse_chain);
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT (rtpL16parse->frequency),
- "channels", GST_PROPS_INT (rtpL16parse->channels));
+ caps = gst_caps_copy(gst_static_caps_get (&gst_rtpL16parse_src_template.static_caps));
+
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, rtpL16parse->frequency,
+ "channel", G_TYPE_INT, rtpL16parse->channels, NULL);
gst_pad_try_set_caps (rtpL16parse->srcpad, caps);
}
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
+static GstStaticPadTemplate gst_rtpL16enc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
);
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16enc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16enc_class_init (GstRtpL16EncClass * klass);
const GValue * value, GParamSpec * pspec);
static void gst_rtpL16enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpL16enc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template));
gst_element_class_set_details (element_class, &gst_rtpL16enc_details);
}
static void
gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
{
- rtpL16enc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpL16enc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpL16enc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template), "sink");
+ rtpL16enc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->srcpad);
gst_pad_set_chain_function (rtpL16enc->sinkpad, gst_rtpL16enc_chain);
}
static GstPadLinkReturn
-gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpL16Enc *rtpL16enc;
+ GstStructure *structure;
+ gboolean ret;
rtpL16enc = GST_RTP_L16_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpL16enc->frequency);
- gst_caps_get_int (caps, "channels", &rtpL16enc->channels);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency);
+ ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpL16enc->time_interval = GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency);
ARG_FREQUENCY
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpgsmparse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
);
+static GstStaticPadTemplate gst_rtpgsmparse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
+
static void gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_gsmparse_details);
}
static void
gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse)
{
- rtpgsmparse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpgsmparse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpgsmparse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template), "src");
+ rtpgsmparse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->sinkpad);
gst_pad_set_chain_function (rtpgsmparse->sinkpad, gst_rtpgsmparse_chain);
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (rtpgsmparse->frequency));
+ caps = gst_caps_new_simple ("audio/x-gsm",
+ "rate", G_TYPE_INT, rtpgsmparse->frequency);
gst_pad_try_set_caps (rtpgsmparse->srcpad, caps);
}
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000)
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
-)
+static GstStaticPadTemplate gst_rtpgsmenc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpgsmenc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
static void gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass);
static void gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass);
const GValue * value, GParamSpec * pspec);
static void gst_rtpgsmenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpgsmenc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_src_template));
gst_element_class_set_details (element_class, &gst_rtpgsmenc_details);
}
static void
gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
{
- rtpgsmenc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpgsmenc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpgsmenc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "sink");
+ rtpgsmenc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->srcpad);
gst_pad_set_chain_function (rtpgsmenc->sinkpad, gst_rtpgsmenc_chain);
}
static GstPadLinkReturn
-gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpGSMEnc *rtpgsmenc;
+ GstStructure *structure;
+ gboolean ret;
rtpgsmenc = GST_RTP_GSM_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpgsmenc->frequency);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpgsmenc->frequency);
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpgsmenc->time_interval = GST_SECOND / (2 * rtpgsmenc->frequency);
ARG_FREQUENCY
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpgsmparse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
);
+static GstStaticPadTemplate gst_rtpgsmparse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
+
static void gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_gsmparse_details);
}
static void
gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse)
{
- rtpgsmparse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpgsmparse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpgsmparse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template), "src");
+ rtpgsmparse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->sinkpad);
gst_pad_set_chain_function (rtpgsmparse->sinkpad, gst_rtpgsmparse_chain);
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (rtpgsmparse->frequency));
+ caps = gst_caps_new_simple ("audio/x-gsm",
+ "rate", G_TYPE_INT, rtpgsmparse->frequency);
gst_pad_try_set_caps (rtpgsmparse->srcpad, caps);
}
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000)
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
-)
+static GstStaticPadTemplate gst_rtpgsmenc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpgsmenc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
static void gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass);
static void gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass);
const GValue * value, GParamSpec * pspec);
static void gst_rtpgsmenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpgsmenc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_src_template));
gst_element_class_set_details (element_class, &gst_rtpgsmenc_details);
}
static void
gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
{
- rtpgsmenc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpgsmenc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpgsmenc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "sink");
+ rtpgsmenc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->srcpad);
gst_pad_set_chain_function (rtpgsmenc->sinkpad, gst_rtpgsmenc_chain);
}
static GstPadLinkReturn
-gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpGSMEnc *rtpgsmenc;
+ GstStructure *structure;
+ gboolean ret;
rtpgsmenc = GST_RTP_GSM_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpgsmenc->frequency);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpgsmenc->frequency);
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpgsmenc->time_interval = GST_SECOND / (2 * rtpgsmenc->frequency);
"Wim Taymans <wim.taymans@chello.be>"
};
-GST_PAD_TEMPLATE_FACTORY (smpte_src_factory,
+static GstStaticPadTemplate gst_smpte_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "smpte_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (smpte_sink1_factory,
+static GstStaticPadTemplate gst_smpte_sink1_template =
+GST_STATIC_PAD_TEMPLATE (
"sink1",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "smpte_sink1",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (smpte_sink2_factory,
+static GstStaticPadTemplate gst_smpte_sink2_template =
+GST_STATIC_PAD_TEMPLATE (
"sink2",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "smpte_sink2",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")
)
-)
+);
/* SMPTE signals and args */
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (smpte_sink1_factory));
+ gst_static_pad_template_get(&gst_smpte_sink1_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (smpte_sink2_factory));
+ gst_static_pad_template_get(&gst_smpte_sink2_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (smpte_src_factory));
+ gst_static_pad_template_get(&gst_smpte_src_template));
gst_element_class_set_details (element_class, &smpte_details);
}
}
static gboolean
-gst_smpte_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_smpte_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstSMPTE *smpte;
+ GstStructure *structure;
+ gboolean ret;
smpte = GST_SMPTE (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &smpte->width);
- gst_caps_get_int (caps, "height", &smpte->height);
- gst_caps_get_float (caps, "framerate", &smpte->fps);
+ ret = gst_structure_get_int (structure, "width", &smpte->width);
+ ret &= gst_structure_get_int (structure, "height", &smpte->height);
+ ret &= gst_structure_get_double (structure, "framerate", &smpte->fps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, smpte->height);
/* forward to the next plugin */
- return gst_pad_try_set_caps(smpte->srcpad, gst_caps_copy_1(caps));
+ return gst_pad_try_set_caps(smpte->srcpad, caps);
}
static void
gst_smpte_init (GstSMPTE *smpte)
{
smpte->sinkpad1 = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (smpte_sink1_factory), "sink1");
+ gst_static_pad_template_get(&gst_smpte_sink1_template), "sink1");
gst_pad_set_link_function (smpte->sinkpad1, gst_smpte_sinkconnect);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad1);
smpte->sinkpad2 = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (smpte_sink2_factory), "sink2");
+ gst_static_pad_template_get(&gst_smpte_sink2_template), "sink2");
gst_pad_set_link_function (smpte->sinkpad2, gst_smpte_sinkconnect);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad2);
smpte->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (smpte_src_factory), "src");
+ gst_static_pad_template_get(&gst_smpte_src_template), "src");
gst_element_add_pad (GST_ELEMENT (smpte), smpte->srcpad);
gst_element_set_loop_function (GST_ELEMENT (smpte), gst_smpte_loop);
outbuf = gst_buffer_new_and_alloc (smpte->width * smpte->height * 3);
if (!GST_PAD_CAPS (smpte->srcpad)) {
- if (!gst_pad_try_set_caps (smpte->srcpad,
- GST_CAPS_NEW (
- "smpte_srccaps",
- "video/raw",
- "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT (smpte->width),
- "height", GST_PROPS_INT (smpte->height),
- "framerate", GST_PROPS_FLOAT (smpte->fps)
- )))
- {
+ GstCaps *caps;
+ caps = gst_caps_copy (gst_static_caps_get (
+ &gst_smpte_src_template.static_caps));
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, smpte->width,
+ "height", G_TYPE_INT, smpte->height,
+ "framerate", G_TYPE_DOUBLE, smpte->fps, NULL);
+
+ if (!gst_pad_try_set_caps (smpte->srcpad, caps)) {
gst_element_error (element, "cannot set caps");
return;
}
gint format;
gint width;
gint height;
- gfloat fps;
+ gdouble fps;
gint duration;
gint position;
static GstPadLinkReturn
-gst_udpsink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_udpsink_sink_link (GstPad *pad, const GstCaps *caps)
{
GstUDPSink *udpsink;
struct sockaddr_in serv_addr;
udpsink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (udpsink), udpsink->sinkpad);
gst_pad_set_chain_function (udpsink->sinkpad, gst_udpsink_chain);
- gst_pad_set_link_function (udpsink->sinkpad, gst_udpsink_sinkconnect);
+ gst_pad_set_link_function (udpsink->sinkpad, gst_udpsink_sink_link);
udpsink->host = g_strdup (UDP_DEFAULT_HOST);
udpsink->port = UDP_DEFAULT_PORT;
/* caps */
gint width, height;
- gfloat fps;
+ gdouble fps;
gint crop_left, crop_right, crop_top, crop_bottom;
};
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (video_crop_src_template_factory,
+static GstStaticPadTemplate gst_video_crop_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "video_crop_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
-GST_PAD_TEMPLATE_FACTORY (video_crop_sink_template_factory,
+static GstStaticPadTemplate gst_video_crop_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "video_crop_sink",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
static void gst_video_crop_base_init (gpointer g_class);
GValue *value, GParamSpec *pspec);
static GstPadLinkReturn
- gst_video_crop_sink_connect (GstPad *pad, GstCaps *caps);
+ gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps);
static void gst_video_crop_chain (GstPad *pad, GstData *_data);
static GstElementStateReturn
gst_element_class_set_details (element_class, &gst_video_crop_details);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (video_crop_sink_template_factory));
+ gst_static_pad_template_get (&gst_video_crop_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (video_crop_src_template_factory));
+ gst_static_pad_template_get (&gst_video_crop_src_template));
}
static void
gst_video_crop_class_init (GstVideoCropClass *klass)
{
/* create the sink and src pads */
video_crop->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (video_crop_sink_template_factory), "sink");
+ gst_static_pad_template_get (&gst_video_crop_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (video_crop), video_crop->sinkpad);
- gst_pad_set_chain_function (video_crop->sinkpad, GST_DEBUG_FUNCPTR (gst_video_crop_chain));
- gst_pad_set_link_function (video_crop->sinkpad, GST_DEBUG_FUNCPTR (gst_video_crop_sink_connect));
+ gst_pad_set_chain_function (video_crop->sinkpad, gst_video_crop_chain);
+ gst_pad_set_link_function (video_crop->sinkpad, gst_video_crop_sink_link);
video_crop->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (video_crop_src_template_factory), "src");
+ gst_static_pad_template_get (&gst_video_crop_src_template), "src");
gst_element_add_pad (GST_ELEMENT (video_crop), video_crop->srcpad);
video_crop->crop_right = 0;
}
static GstPadLinkReturn
-gst_video_crop_sink_connect (GstPad *pad, GstCaps *caps)
+gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps)
{
GstVideoCrop *video_crop;
-
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ GstStructure *structure;
+ gboolean ret;
video_crop = GST_VIDEO_CROP (gst_pad_get_parent (pad));
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &video_crop->width);
- gst_caps_get_int (caps, "height", &video_crop->height);
- gst_caps_get_float (caps, "framerate", &video_crop->fps);
+ ret = gst_structure_get_int (structure, "width", &video_crop->width);
+ ret &= gst_structure_get_int (structure, "height", &video_crop->height);
+ ret &= gst_structure_get_double (structure, "framerate", &video_crop->fps);
return GST_PAD_LINK_OK;
}
new_height = video_crop->height -
(video_crop->crop_top + video_crop->crop_bottom);
- if (GST_PAD_CAPS (video_crop->srcpad) == NULL) {
- if (gst_pad_try_set_caps (video_crop->srcpad,
- GST_CAPS_NEW (
- "video_crop_caps",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- "width", GST_PROPS_INT (new_width),
- "height", GST_PROPS_INT (new_height),
- "framerate", GST_PROPS_FLOAT (video_crop->fps)
- )) <= 0)
- {
- gst_element_error (GST_ELEMENT (video_crop), "could not negotiate pads");
- return;
- }
- }
-
outbuf = gst_buffer_new_and_alloc ((new_width * new_height * 3) / 2);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer);
gobject_class->get_property = gst_videofilter_get_property;
}
-static GstCaps *gst_videofilter_format_get_caps(GstVideofilterFormat *format)
+static GstStructure *gst_videofilter_format_get_structure(GstVideofilterFormat *format)
{
unsigned int fourcc;
- GstCaps *caps;
+ GstStructure *structure;
if(format->filter_func==NULL)
return NULL;
fourcc = GST_MAKE_FOURCC(format->fourcc[0],format->fourcc[1],format->fourcc[2],format->fourcc[3]);
if(format->bpp){
- caps = GST_CAPS_NEW ("videofilter", "video/x-raw-rgb",
- "depth", GST_PROPS_INT(format->bpp),
- "bpp", GST_PROPS_INT(format->depth),
- "endianness", GST_PROPS_INT(format->endianness),
- "red_mask", GST_PROPS_INT(format->red_mask),
- "green_mask", GST_PROPS_INT(format->green_mask),
- "blue_mask", GST_PROPS_INT(format->blue_mask));
+ structure = gst_structure_new ("video/x-raw-rgb",
+ "depth", G_TYPE_INT, format->bpp,
+ "bpp", G_TYPE_INT, format->depth,
+ "endianness", G_TYPE_INT, format->endianness,
+ "red_mask", G_TYPE_INT, format->red_mask,
+ "green_mask", G_TYPE_INT, format->green_mask,
+ "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
}else{
- caps = GST_CAPS_NEW ("videoflip", "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (fourcc),
- "height", GST_PROPS_INT_RANGE (1,G_MAXINT),
- "width", GST_PROPS_INT_RANGE (1,G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0,G_MAXFLOAT)
- );
+ structure = gst_structure_new ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
}
- return caps;
+ gst_structure_set(structure,
+ "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
+
+ return structure;
}
GstCaps * gst_videofilter_class_get_capslist(GstVideofilterClass *klass)
{
- static GstCaps *capslist = NULL;
GstCaps *caps;
+ GstStructure *structure;
int i;
- if (capslist){
- gst_caps_ref(capslist);
- return capslist;
- }
-
+ caps = gst_caps_new_empty();
for(i=0;i<klass->formats->len;i++){
- caps = gst_videofilter_format_get_caps(g_ptr_array_index(klass->formats,i));
- capslist = gst_caps_append(capslist, caps);
+ structure = gst_videofilter_format_get_structure(g_ptr_array_index(klass->formats,i));
+ gst_caps_append_structure (caps, structure);
}
- gst_caps_ref(capslist);
- return capslist;
-}
-
-static GstCaps* gst_videofilter_caps_add_variable_part (GstCaps *caps)
-{
- GstCaps *yuv, *rgb;
-
- if (caps == NULL)
- return NULL;
-
- yuv = GST_CAPS_NEW("videofilter_size","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
- rgb = GST_CAPS_NEW("videofilter_size","video/x-raw-rgb",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
- yuv = gst_caps_intersect (yuv, caps);
- rgb = gst_caps_intersect (rgb, caps);
- if (yuv) {
- gst_caps_append (yuv, rgb);
- } else {
- g_assert (rgb);
- yuv = rgb;
- }
- gst_caps_unref (caps);
-
- return yuv;
+ return caps;
}
static GstCaps *
-gst_videofilter_sink_getcaps (GstPad *pad, GstCaps *caps)
+gst_videofilter_sink_getcaps (GstPad *pad)
{
GstVideofilter *videofilter;
GstVideofilterClass *klass;
- GstCaps *capslist = NULL;
+ GstCaps *caps;
GstCaps *peercaps;
int i;
/* Look through our list of caps and find those that match with
* the peer's formats. Create a list of them. */
/* FIXME optimize if peercaps == NULL */
+ caps = gst_caps_new_empty ();
for(i=0;i<klass->formats->len;i++){
GstCaps *icaps;
- GstCaps *fromcaps = gst_videofilter_format_get_caps(g_ptr_array_index(
- klass->formats,i));
+ GstCaps *fromcaps;
+
+ fromcaps = gst_caps_new_full (gst_videofilter_format_get_structure (
+ g_ptr_array_index (klass->formats,i)));
- icaps = gst_caps_intersect(fromcaps, peercaps);
- //if(gst_caps_is_always_compatible(fromcaps, peercaps)){
+ icaps = gst_caps_intersect (fromcaps, peercaps);
if(icaps != NULL){
- capslist = gst_caps_append(capslist, fromcaps);
+ gst_caps_append (caps, fromcaps);
+ } else {
+ gst_caps_free (fromcaps);
}
- //gst_caps_unref (fromcaps);
- if(icaps) gst_caps_unref (icaps);
+ if(icaps) gst_caps_free (icaps);
}
- gst_caps_unref (peercaps);
+ gst_caps_free (peercaps);
- capslist = gst_videofilter_caps_add_variable_part (capslist);
-
- return capslist;
+ return caps;
}
static GstPadLinkReturn
-gst_videofilter_src_link (GstPad *pad, GstCaps *caps)
+gst_videofilter_src_link (GstPad *pad, const GstCaps *caps)
{
GstVideofilter *videofilter;
- GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
+ gboolean ret;
GST_DEBUG("gst_videofilter_src_link");
videofilter = GST_VIDEOFILTER (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
- gst_caps_debug(caps,"ack");
+ structure = gst_caps_get_structure (caps, 0);
videofilter->format = gst_videofilter_find_format_by_caps (videofilter,caps);
g_return_val_if_fail(videofilter->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videofilter->to_width);
- gst_caps_get_int (caps, "height", &videofilter->to_height);
-
- GST_DEBUG("width %d height %d",videofilter->to_width,videofilter->to_height);
-
- peercaps = gst_caps_copy(caps);
-
- gst_caps_set(peercaps, "width", GST_PROPS_INT_RANGE (0, G_MAXINT));
- gst_caps_set(peercaps, "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
-
- ret = gst_pad_try_set_caps (videofilter->srcpad, peercaps);
+ ret = gst_structure_get_int (structure, "width", &videofilter->to_width);
+ ret &= gst_structure_get_int (structure, "height", &videofilter->to_height);
+ ret &= gst_structure_get_double (structure, "framerate", &videofilter->framerate);
- gst_caps_unref(peercaps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- if(ret==GST_PAD_LINK_OK){
- caps = gst_pad_get_caps (videofilter->srcpad);
+ GST_DEBUG("width %d height %d",videofilter->to_width,videofilter->to_height);
- gst_caps_get_int (caps, "width", &videofilter->from_width);
- gst_caps_get_int (caps, "height", &videofilter->from_height);
- //gst_videofilter_setup(videofilter);
- }
+ gst_videofilter_setup(videofilter);
- return ret;
+ return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
-gst_videofilter_sink_link (GstPad *pad, GstCaps *caps)
+gst_videofilter_sink_link (GstPad *pad, const GstCaps *caps)
{
GstVideofilter *videofilter;
GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
GST_DEBUG("gst_videofilter_sink_link");
videofilter = GST_VIDEOFILTER (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
videofilter->format = gst_videofilter_find_format_by_caps (videofilter,caps);
- GST_DEBUG("sink_link: %s\n",gst_caps_to_string(caps));
g_return_val_if_fail(videofilter->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videofilter->from_width);
- gst_caps_get_int (caps, "height", &videofilter->from_height);
- gst_caps_get_float (caps, "framerate", &videofilter->framerate);
-
- gst_videofilter_setup(videofilter);
-
- peercaps = gst_caps_copy(caps);
-
- gst_caps_set(peercaps, "width", GST_PROPS_INT (videofilter->to_width));
- gst_caps_set(peercaps, "height", GST_PROPS_INT (videofilter->to_height));
- gst_caps_set(peercaps, "framerate", GST_PROPS_FLOAT (videofilter->framerate));
+ ret = gst_structure_get_int (structure, "width", &videofilter->from_width);
+ ret &= gst_structure_get_int (structure, "height", &videofilter->from_height);
+ ret &= gst_structure_get_double (structure, "framerate", &videofilter->framerate);
- GST_DEBUG("setting %s\n",gst_caps_to_string(peercaps));
+ if (!ret) return GST_PAD_LINK_REFUSED;
- ret = gst_pad_try_set_caps (videofilter->srcpad, peercaps);
+ GST_DEBUG("width %d height %d",videofilter->from_width,videofilter->from_height);
- //gst_caps_unref(peercaps);
-
- if(ret==GST_PAD_LINK_OK || ret==GST_PAD_LINK_DONE){
- caps = gst_pad_get_caps (videofilter->srcpad);
-
- //gst_caps_get_int (caps, "width", &videofilter->to_width);
- //gst_caps_get_int (caps, "height", &videofilter->to_height);
- //gst_videofilter_setup(videofilter);
- }
+ gst_videofilter_setup(videofilter);
- return ret;
+ return GST_PAD_LINK_OK;
}
static void
{
int ret;
GstCaps *srccaps;
+ GstStructure *structure;
g_return_if_fail(GST_IS_VIDEOFILTER(videofilter));
* videofilter->format->depth)/8;
srccaps = gst_caps_copy(gst_pad_get_caps(videofilter->srcpad));
+ structure = gst_caps_get_structure (srccaps, 0);
- if(!GST_CAPS_IS_FIXED(srccaps)){
- gst_caps_unref (srccaps);
- return;
- }
-
- gst_caps_set(srccaps, "width", GST_PROPS_INT (videofilter->to_width));
- gst_caps_set(srccaps, "height", GST_PROPS_INT (videofilter->to_height));
+ gst_structure_set (structure, "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height, NULL);
ret = gst_pad_try_set_caps (videofilter->srcpad, srccaps);
- g_return_if_fail(ret<0);
+ if (ret < 0) {
+ g_critical ("could not set output size");
+ }
}
static void gst_videofilter_setup(GstVideofilter *videofilter)
}
GstVideofilterFormat *gst_videofilter_find_format_by_caps(GstVideofilter *videofilter,
- GstCaps *caps)
+ const GstCaps *caps)
{
int i;
- GstCaps *c;
GstVideofilterClass *klass;
GstVideofilterFormat *format;
+ gboolean ret;
+ GstStructure *structure;
klass = GST_VIDEOFILTER_CLASS(G_OBJECT_GET_CLASS(videofilter));
for(i=0;i<klass->formats->len;i++){
format = g_ptr_array_index(klass->formats,i);
- c = gst_videofilter_format_get_caps(format);
+ structure = gst_videofilter_format_get_structure(format);
+
+ if(structure){
+ GstCaps *format_caps;
+ format_caps = gst_caps_new_full (structure, NULL);
+ ret = gst_caps_is_always_compatible (caps, format_caps);
+ gst_caps_free (format_caps);
- if(c){
- if(gst_caps_is_always_compatible(caps, c)){
- gst_caps_unref(c);
- return format;
- }
+ if (ret) return format;
}
- gst_caps_unref(c);
}
return NULL;
void gst_videofilter_class_add_pad_templates (GstVideofilterClass *videofilter_class)
{
- GstCaps *caps;
GstElementClass *element_class = GST_ELEMENT_CLASS (videofilter_class);
- caps = gst_videofilter_class_get_capslist (videofilter_class);
- caps = gst_videofilter_caps_add_variable_part (caps);
-
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, gst_caps_copy (caps)));
+ gst_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_videofilter_class_get_capslist (videofilter_class)));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_NEW("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps));
+ gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_videofilter_class_get_capslist (videofilter_class)));
}
static gboolean
/* private */
gint from_buf_size;
gint to_buf_size;
- gfloat framerate;
+ gdouble framerate;
GstBuffer *in_buf;
GstBuffer *out_buf;
void gst_videofilter_set_output_size(GstVideofilter *videofilter,
int width, int height);
GstVideofilterFormat *gst_videofilter_find_format_by_caps(GstVideofilter *filter,
- GstCaps *caps);
+ const GstCaps *caps);
GstCaps *gst_videofilter_class_get_capslist(GstVideofilterClass *videofilterclass);
void gst_videofilter_class_add_format(GstVideofilterClass *videofilterclass,
static void gst_videoflip_chain (GstPad *pad, GstData *_data);
static GstCaps * gst_videoflip_get_capslist(void);
+
static GstElementClass *parent_class = NULL;
#define GST_TYPE_VIDEOFLIP_METHOD (gst_videoflip_method_get_type())
static GstPadTemplate *
gst_videoflip_src_template_factory(void)
{
- static GstPadTemplate *templ = NULL;
-
- if(!templ){
- /* well, actually RGB too, but since there's no RGB format anyway */
- GstCaps *caps = GST_CAPS_NEW("src","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ /* well, actually RGB too, but since there's no RGB format anyway */
+ GstCaps *caps = gst_caps_from_string ("video/x-raw-yuv, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0, MAX ]");
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
+ caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
- }
- return templ;
+ return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
}
static GstPadTemplate *
gst_videoflip_sink_template_factory(void)
{
- static GstPadTemplate *templ = NULL;
-
- if(!templ){
- GstCaps *caps = GST_CAPS_NEW("sink","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ GstCaps *caps = gst_caps_from_string ("video/x-raw-yuv, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0, MAX ]");
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
+ caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
- }
- return templ;
+ return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
}
GType
gst_element_class_set_details (element_class, &videoflip_details);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_videoflip_sink_template_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_videoflip_src_template_factory ());
}
static void
gst_videoflip_class_init (GstVideoflipClass *klass)
static GstCaps *
gst_videoflip_get_capslist(void)
{
- static GstCaps *capslist = NULL;
GstCaps *caps;
+ GstStructure *structure;
int i;
- if (capslist){
- gst_caps_ref(capslist);
- return capslist;
- }
-
+ caps = gst_caps_new_empty ();
for(i=0;i<videoflip_n_formats;i++){
- caps = videoflip_get_caps(videoflip_formats + i);
- capslist = gst_caps_append(capslist, caps);
+ structure = videoflip_get_cap (videoflip_formats + i);
+ gst_caps_append_structure (caps, structure);
}
- gst_caps_ref(capslist);
- return capslist;
+ return caps;
}
static GstCaps *
-gst_videoflip_sink_getcaps (GstPad *pad, GstCaps *caps)
+gst_videoflip_sink_getcaps (GstPad *pad)
{
GstVideoflip *videoflip;
GstCaps *capslist = NULL;
GstCaps *peercaps;
GstCaps *sizecaps;
+ GstCaps *caps;
int i;
- GST_DEBUG ("gst_videoflip_src_link");
+ GST_DEBUG ("gst_videoflip_sink_getcaps");
videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad));
/* get list of peer's caps */
/* Look through our list of caps and find those that match with
* the peer's formats. Create a list of them. */
for(i=0;i<videoflip_n_formats;i++){
- GstCaps *fromcaps = videoflip_get_caps(videoflip_formats + i);
+ GstCaps *fromcaps = gst_caps_new_full(videoflip_get_cap(
+ videoflip_formats + i), NULL);
if(gst_caps_is_always_compatible(fromcaps, peercaps)){
- capslist = gst_caps_append(capslist, fromcaps);
+ gst_caps_append(capslist, fromcaps);
}
- gst_caps_unref (fromcaps);
}
- gst_caps_unref (peercaps);
+ gst_caps_free (peercaps);
- sizecaps = GST_CAPS_NEW("videoflip_size","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ sizecaps = gst_caps_from_string ("video/x-raw-yuv, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0, MAX ]");
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
- gst_caps_unref (sizecaps);
+ caps = gst_caps_intersect(capslist, sizecaps);
+ gst_caps_free (sizecaps);
return caps;
}
static GstPadLinkReturn
-gst_videoflip_src_link (GstPad *pad, GstCaps *caps)
+gst_videoflip_src_link (GstPad *pad, const GstCaps *caps)
{
GstVideoflip *videoflip;
- GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
+ gboolean ret;
GST_DEBUG ("gst_videoflip_src_link");
videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad));
-
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
- gst_caps_debug(caps,"ack");
+
+ structure = gst_caps_get_structure (caps, 0);
videoflip->format = videoflip_find_by_caps (caps);
g_return_val_if_fail(videoflip->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videoflip->to_width);
- gst_caps_get_int (caps, "height", &videoflip->to_height);
-
- GST_DEBUG ("width %d height %d",videoflip->to_width,videoflip->to_height);
+ ret = gst_structure_get_int (structure, "width", &videoflip->to_width);
+ ret &= gst_structure_get_int (structure, "height", &videoflip->to_height);
- peercaps = gst_caps_copy(caps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- gst_caps_set(peercaps, "width", GST_PROPS_INT_RANGE (0, G_MAXINT));
- gst_caps_set(peercaps, "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
-
- ret = gst_pad_try_set_caps (videoflip->srcpad, peercaps);
-
- gst_caps_unref(peercaps);
-
- if(ret==GST_PAD_LINK_OK){
- caps = gst_pad_get_caps (videoflip->srcpad);
-
- gst_caps_get_int (caps, "width", &videoflip->from_width);
- gst_caps_get_int (caps, "height", &videoflip->from_height);
- gst_videoflip_setup(videoflip);
- }
-
- return ret;
+ return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
-gst_videoflip_sink_link (GstPad *pad, GstCaps *caps)
+gst_videoflip_sink_link (GstPad *pad, const GstCaps *caps)
{
GstVideoflip *videoflip;
- GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
+ gboolean ret;
- GST_DEBUG ("gst_videoflip_src_link");
+ GST_DEBUG ("gst_videoflip_sink_link");
videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad));
-
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+
+ structure = gst_caps_get_structure (caps, 0);
videoflip->format = videoflip_find_by_caps (caps);
- gst_caps_debug(caps,"ack");
g_return_val_if_fail(videoflip->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videoflip->from_width);
- gst_caps_get_int (caps, "height", &videoflip->from_height);
-
- gst_videoflip_setup(videoflip);
-
- peercaps = gst_caps_copy(caps);
-
- gst_caps_set(peercaps, "width", GST_PROPS_INT (videoflip->to_width));
- gst_caps_set(peercaps, "height", GST_PROPS_INT (videoflip->to_height));
+ ret = gst_structure_get_int (structure, "width", &videoflip->from_width);
+ ret &= gst_structure_get_int (structure, "height", &videoflip->from_height);
- ret = gst_pad_try_set_caps (videoflip->srcpad, peercaps);
-
- gst_caps_unref(peercaps);
-
- if(ret==GST_PAD_LINK_OK){
- caps = gst_pad_get_caps (videoflip->srcpad);
-
- gst_caps_get_int (caps, "width", &videoflip->to_width);
- gst_caps_get_int (caps, "height", &videoflip->to_height);
- gst_videoflip_setup(videoflip);
- }
+ if (!ret) return GST_PAD_LINK_REFUSED;
- return ret;
+ return GST_PAD_LINK_OK;
}
static void
{
GST_DEBUG ("gst_videoflip_init");
videoflip->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory),
+ gst_videoflip_sink_template_factory(),
"sink");
gst_element_add_pad(GST_ELEMENT(videoflip),videoflip->sinkpad);
gst_pad_set_chain_function(videoflip->sinkpad,gst_videoflip_chain);
gst_pad_set_getcaps_function(videoflip->sinkpad,gst_videoflip_sink_getcaps);
videoflip->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory),
+ gst_videoflip_src_template_factory(),
"src");
gst_element_add_pad(GST_ELEMENT(videoflip),videoflip->srcpad);
gst_pad_set_link_function(videoflip->srcpad,gst_videoflip_src_link);
int videoflip_n_formats = sizeof(videoflip_formats)/sizeof(videoflip_formats[0]);
-GstCaps *
-videoflip_get_caps(struct videoflip_format_struct *format)
+GstStructure *
+videoflip_get_cap(struct videoflip_format_struct *format)
{
unsigned int fourcc;
- GstCaps *caps;
+ GstStructure *structure;
if(format->scale==NULL)
return NULL;
fourcc = GST_MAKE_FOURCC(format->fourcc[0],format->fourcc[1],format->fourcc[2],format->fourcc[3]);
if(format->bpp){
- caps = GST_CAPS_NEW ("videoflip", "video/x-raw-rgb",
- "depth", GST_PROPS_INT(format->bpp),
- "bpp", GST_PROPS_INT(format->depth),
- "endianness", GST_PROPS_INT(format->endianness),
- "red_mask", GST_PROPS_INT(format->red_mask),
- "green_mask", GST_PROPS_INT(format->green_mask),
- "blue_mask", GST_PROPS_INT(format->blue_mask));
+ structure = gst_structure_new("video/x-raw-rgb",
+ "depth", G_TYPE_INT, format->bpp,
+ "bpp", G_TYPE_INT, format->depth,
+ "endianness", G_TYPE_INT, format->endianness,
+ "red_mask", G_TYPE_INT, format->red_mask,
+ "green_mask", G_TYPE_INT, format->green_mask,
+ "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
}else{
- caps = GST_CAPS_NEW ("videoflip", "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (fourcc));
+ structure = gst_structure_new("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
}
- return caps;
+ return structure;
}
struct videoflip_format_struct *
-videoflip_find_by_caps(GstCaps *caps)
+videoflip_find_by_caps(const GstCaps *caps)
{
int i;
- GST_DEBUG ("finding %p",caps);
+ GST_DEBUG ("finding %p", caps);
g_return_val_if_fail(caps != NULL, NULL);
for (i = 0; i < videoflip_n_formats; i++){
GstCaps *c;
- c = videoflip_get_caps(videoflip_formats + i);
+ c = gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL);
if(c){
if(gst_caps_is_always_compatible(caps, c)){
- gst_caps_unref(c);
+ gst_caps_free(c);
return videoflip_formats + i;
}
- gst_caps_unref(c);
+ gst_caps_free(c);
}
}
extern struct videoflip_format_struct videoflip_formats[];
extern int videoflip_n_formats;
-GstCaps *videoflip_get_caps(struct videoflip_format_struct *format);
+GstStructure *videoflip_get_cap(struct videoflip_format_struct *format);
-struct videoflip_format_struct *videoflip_find_by_caps(GstCaps *caps);
+struct videoflip_format_struct *videoflip_find_by_caps(const GstCaps *caps);
#endif
static GstPadTemplate *srctemplate, *sinktemplate;
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "wavenc_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, MAX ], "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) true"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (src_factory,
+static GstStaticPadTemplate src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "wavenc_wav",
- "audio/x-wav",
- NULL
- )
-)
+ GST_STATIC_CAPS ("audio/x-wav")
+);
enum {
PROP_0,
- PROP_METADATA
};
static GstElementClass *parent_class = NULL;
enc = GST_WAVENC (object);
switch (prop_id) {
- case PROP_METADATA:
- enc->metadata = g_value_get_boxed (value);
- break;
-
default:
break;
}
gst_element_class_set_details (element_class, &gst_wavenc_details);
- srctemplate = src_factory ();
- gst_element_class_add_pad_template (element_class, srctemplate);
-
- sinktemplate = sink_factory ();
- gst_element_class_add_pad_template (element_class, sinktemplate);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
}
static void
gst_wavenc_class_init (GstWavEncClass *klass)
{
GstElementClass *element_class;
- GObjectClass *object_class;
+ GObjectClass *object_class;
element_class = (GstElementClass *) klass;
- object_class = (GObjectClass *) klass;
-
- object_class->set_property = set_property;
+ object_class = (GObjectClass *) klass;
+ object_class->set_property = set_property;
element_class->change_state = gst_wavenc_change_state;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
- g_object_class_install_property (object_class,
- PROP_METADATA,
- g_param_spec_boxed ("metadata", "", "",
- GST_TYPE_CAPS,
- G_PARAM_WRITABLE));
}
static gboolean
}
static GstPadLinkReturn
-gst_wavenc_sinkconnect (GstPad *pad,
- GstCaps *caps)
+gst_wavenc_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstWavEnc *wavenc;
+ GstStructure *structure;
wavenc = GST_WAVENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "channels", &wavenc->channels);
- gst_caps_get_int (caps, "rate", &wavenc->rate);
- gst_caps_get_int (caps, "depth", &wavenc->bits);
+ gst_structure_get_int (structure, "channels", &wavenc->channels);
+ gst_structure_get_int (structure, "rate", &wavenc->rate);
+ gst_structure_get_int (structure, "depth", &wavenc->bits);
gst_wavenc_setup (wavenc);
wavenc->setup = FALSE;
wavenc->flush_header = TRUE;
- wavenc->metadata = NULL;
- GST_FLAG_SET (wavenc, GST_ELEMENT_EVENT_AWARE);
+ GST_FLAG_SET (wavenc, GST_ELEMENT_EVENT_AWARE);
}
struct _maps {
{ 0, NULL }
};
+#if 0
static guint32
get_id_from_name (const char *name)
{
gst_pad_push (wavenc->srcpad, GST_DATA (buf));
g_string_free (info_str, FALSE);
}
+#endif
static void
gst_wavenc_chain (GstPad *pad,
if (GST_EVENT_TYPE (buf) == GST_EVENT_EOS) {
wavenc->pad_eos = TRUE;
+#if 0
/* Write our metadata if we have any */
if (wavenc->metadata) {
write_metadata (wavenc);
write_cues (wavenc);
write_labels (wavenc);
}
+#endif
gst_wavenc_stop_file (wavenc);
gst_pad_push (wavenc->srcpad,
gboolean setup, flush_header, pad_eos;
guchar header[WAV_HEADER_LEN];
-
- /* Metadata */
- GstCaps *metadata;
};
struct _GstWavEncClass {
"Erik Walthinsen <omega@cse.ogi.edu>"
);
-GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"wavparse_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "wavparse_wav",
- "audio/x-wav",
- NULL
- )
-)
+ GST_STATIC_CAPS ("audio/x-wav")
+);
-GST_PAD_TEMPLATE_FACTORY (src_template_factory,
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"wavparse_src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
+ GST_STATIC_CAPS_ANY
+);
+#if 0
+ GST_STATIC_CAPS (
"wavparse_raw",
"audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
+ "endianness", G_TYPE_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (FALSE),
- GST_PROPS_BOOLEAN (TRUE)
+ G_TYPE_BOOLEAN (FALSE),
+ G_TYPE_BOOLEAN (TRUE)
),
"width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
+ G_TYPE_INT (8),
+ G_TYPE_INT (16)
),
"depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
+ G_TYPE_INT (8),
+ G_TYPE_INT (16)
),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2)
),
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"wavparse_mpeg",
"audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- "layer", GST_PROPS_INT_RANGE (1, 3)
+ "mpegversion", G_TYPE_INT, 1,
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2),
+ "layer", G_TYPE_INT_RANGE (1, 3)
),
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"parsewav_law",
"audio/x-alaw",
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2)
),
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"parsewav_law",
"audio/x-mulaw",
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2)
)
-)
+#endif
/* WavParse signals and args */
enum {
enum {
PROP_0,
- PROP_METADATA
};
static GstElementClass *parent_class = NULL;
gst_element_class_set_details (element_class, &gst_wavparse_details);
/* register src pads */
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (sink_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (src_template_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_template_factory));
}
static void
gst_wavparse_class_init (GstWavParseClass *klass)
object_class->get_property = gst_wavparse_get_property;
gstelement_class->change_state = gst_wavparse_change_state;
-
- g_object_class_install_property (object_class, PROP_METADATA,
- g_param_spec_boxed ("metadata",
- "Metadata", "Metadata",
- GST_TYPE_CAPS,
- G_PARAM_READABLE));
}
static void
gst_wavparse_init (GstWavParse *wavparse)
{
- GstProps *props;
-
/* sink */
- wavparse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_template_factory), "sink");
+ wavparse->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&sink_template_factory), "sink");
gst_element_add_pad (GST_ELEMENT (wavparse), wavparse->sinkpad);
gst_pad_set_formats_function (wavparse->sinkpad, gst_wavparse_get_formats);
gst_pad_set_query_function (wavparse->sinkpad, gst_wavparse_pad_query);
/* source */
- wavparse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_template_factory), "src");
+ wavparse->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&src_template_factory), "src");
gst_element_add_pad (GST_ELEMENT (wavparse), wavparse->srcpad);
gst_pad_set_formats_function (wavparse->srcpad, gst_wavparse_get_formats);
gst_pad_set_convert_function (wavparse->srcpad, gst_wavparse_pad_convert);
wavparse->bps = 0;
wavparse->seek_pending = FALSE;
wavparse->seek_offset = 0;
-
- props = gst_props_empty_new ();
-
- /* Metadata is added later when we find it */
- gst_caps_replace_sink (&wavparse->metadata,
- gst_caps_new ("wav_metadata",
- "application/x-gst-metadata",
- props));
}
static void
wavparse = GST_WAVPARSE (object);
switch (prop_id) {
- case PROP_METADATA:
- g_value_set_boxed (value, wavparse->metadata);
- break;
-
default:
break;
}
}
+#if 0
static void
gst_wavparse_parse_adtl (GstWavParse *wavparse,
int len)
new_caps = gst_caps_new ("label",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (labl.identifier),
- "name", GST_PROPS_STRING (label_name),
+ "identifier", G_TYPE_INT (labl.identifier),
+ "name", G_TYPE_STRING (label_name),
NULL));
if (gst_props_get (props, "labels", &caps, NULL)) {
new_caps = gst_caps_new ("ltxt",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (ltxt.identifier),
- "name", GST_PROPS_STRING (label_name),
- "length", GST_PROPS_INT (ltxt.length),
+ "identifier", G_TYPE_INT (ltxt.identifier),
+ "name", G_TYPE_STRING (label_name),
+ "length", G_TYPE_INT (ltxt.length),
NULL));
if (gst_props_get (props, "ltxts", &caps, NULL)) {
new_caps = gst_caps_new ("note",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (note.identifier),
- "name", GST_PROPS_STRING (label_name),
+ "identifier", G_TYPE_INT (note.identifier),
+ "name", G_TYPE_STRING (label_name),
NULL));
if (gst_props_get (props, "notes", &caps, NULL)) {
if (type) {
GstPropsEntry *entry;
- entry = gst_props_entry_new (type, GST_PROPS_STRING (name));
+ entry = gst_props_entry_new (type, G_TYPE_STRING (name));
gst_props_add_entry (wavparse->metadata->properties, entry);
}
}
caps = gst_caps_new ("cues",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (points[i].identifier),
- "position", GST_PROPS_INT (points[i].offset),
+ "identifier", G_TYPE_INT (points[i].identifier),
+ "position", G_TYPE_INT (points[i].offset),
NULL));
cues = g_list_append (cues, caps);
}
return;
}
- caps = GST_CAPS_NEW ("parsewav_src",
- mime,
- "rate", GST_PROPS_INT (wavparse->rate),
- "channels", GST_PROPS_INT (wavparse->channels)
- );
+ caps = gst_caps_new_simple (mime,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels,
+ NULL);
}
case GST_RIFF_WAVE_FORMAT_PCM:
- caps = GST_CAPS_NEW ("parsewav_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "signed", GST_PROPS_BOOLEAN ((wavparse->width > 8) ? TRUE : FALSE),
- "width", GST_PROPS_INT (wavparse->width),
- "depth", GST_PROPS_INT (wavparse->width),
- "rate", GST_PROPS_INT (wavparse->rate),
- "channels", GST_PROPS_INT (wavparse->channels)
- );
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "signed", G_TYPE_BOOLEAN, (wavparse->width > 8) ? TRUE : FALSE,
+ "width", G_TYPE_INT, wavparse->width,
+ "depth", G_TYPE_INT, wavparse->width,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels,
+ NULL);
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12:
case GST_RIFF_WAVE_FORMAT_MPEGL3: {
int layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3;
- caps = GST_CAPS_NEW ("parsewav_src",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (layer),
- "rate", GST_PROPS_INT (wavparse->rate),
- "channels", GST_PROPS_INT (wavparse->channels)
- );
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, layer,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels,
+ NULL);
}
break;
wavparse->rate, wavparse->channels);
}
}
+#endif
static gboolean
gst_wavparse_handle_sink_event (GstWavParse *wavparse)
switch (chunk.id) {
case GST_RIFF_TAG_data:
+#if 0
wavparse->state = GST_WAVPARSE_DATA;
wavparse->dataleft = chunk.size;
wavparse->byteoffset = 0;
flush = 0;
+#endif
break;
case GST_RIFF_TAG_fmt:
- gst_wavparse_parse_fmt (wavparse);
+ //gst_wavparse_parse_fmt (wavparse);
break;
case GST_RIFF_TAG_cue:
- gst_wavparse_parse_cues (wavparse, chunk.size);
+ //gst_wavparse_parse_cues (wavparse, chunk.size);
break;
case GST_RIFF_TAG_LIST:
GST_DEBUG ("list type: %4.4s", (char *) &chunk.type);
switch (chunk.type) {
case GST_RIFF_LIST_INFO:
- gst_wavparse_parse_info (wavparse, chunk.size - 4);
+ //gst_wavparse_parse_info (wavparse, chunk.size - 4);
flush = 0;
break;
case GST_RIFF_LIST_adtl:
- gst_wavparse_parse_adtl (wavparse, chunk.size - 4);
+ //gst_wavparse_parse_adtl (wavparse, chunk.size - 4);
flush = 0;
break;
wavparse->bps = 0;
wavparse->seek_pending = FALSE;
wavparse->seek_offset = 0;
- gst_caps_replace (&wavparse->metadata, NULL);
break;
case GST_STATE_READY_TO_NULL:
guint64 seek_offset;
GstBuffer *buf;
-
- GstCaps *metadata;
};
struct _GstWavParseClass {
}
gboolean
-gst_osselement_parse_caps (GstOssElement *oss, GstCaps *caps)
+gst_osselement_parse_caps (GstOssElement *oss, const GstCaps *caps)
{
gint bps, format;
+ GstStructure *structure;
- gst_caps_get_int (caps, "width", &oss->width);
- gst_caps_get_int (caps, "depth", &oss->depth);
+ structure = gst_caps_get_structure (caps, 0);
+
+ gst_structure_get_int (structure, "width", &oss->width);
+ gst_structure_get_int (structure, "depth", &oss->depth);
if (oss->width != oss->depth)
return FALSE;
- gst_caps_get_int (caps, "law", &oss->law);
- gst_caps_get_int (caps, "endianness", &oss->endianness);
- gst_caps_get_boolean (caps, "signed", &oss->sign);
+ gst_structure_get_int (structure, "law", &oss->law);
+ gst_structure_get_int (structure, "endianness", &oss->endianness);
+ gst_structure_get_boolean (structure, "signed", &oss->sign);
if (!gst_ossformat_get (oss->law, oss->endianness, oss->sign,
oss->width, oss->depth, &format, &bps))
return FALSE;
}
- gst_caps_get_int (caps, "channels", &oss->channels);
- gst_caps_get_int (caps, "rate", &oss->rate);
+ gst_structure_get_int (structure, "channels", &oss->channels);
+ gst_structure_get_int (structure, "rate", &oss->rate);
oss->bps = bps * oss->channels * oss->rate;
oss->format = format;
#define GET_FIXED_INT(caps, name, dest) \
G_STMT_START { \
if (gst_caps_has_fixed_property (caps, name)) \
- gst_caps_get_int (caps, name, dest); \
+ gst_structure_get_int (structure, name, dest); \
} G_STMT_END
#define GET_FIXED_BOOLEAN(caps, name, dest) \
G_STMT_START { \
if (gst_caps_has_fixed_property (caps, name)) \
- gst_caps_get_boolean (caps, name, dest); \
+ gst_structure_get_boolean (structure, name, dest); \
} G_STMT_END
gboolean
gst_osselement_merge_fixed_caps (GstOssElement *oss, GstCaps *caps)
{
gint bps, format;
+ GstStructure *structure;
+ structure = gst_caps_get_structure (caps, 0);
+
/* peel off fixed stuff from the caps */
- GET_FIXED_INT (caps, "law", &oss->law);
- GET_FIXED_INT (caps, "endianness", &oss->endianness);
- GET_FIXED_BOOLEAN (caps, "signed", &oss->sign);
- GET_FIXED_INT (caps, "width", &oss->width);
- GET_FIXED_INT (caps, "depth", &oss->depth);
+ gst_structure_get_int (structure, "law", &oss->law);
+ gst_structure_get_int (structure, "endianness", &oss->endianness);
+ gst_structure_get_boolean (structure, "signed", &oss->sign);
+ gst_structure_get_int (structure, "width", &oss->width);
+ gst_structure_get_int (structure, "depth", &oss->depth);
if (!gst_ossformat_get (oss->law, oss->endianness, oss->sign,
oss->width, oss->depth, &format, &bps))
return FALSE;
}
- GET_FIXED_INT (caps, "rate", &oss->rate);
- GET_FIXED_INT (caps, "channels", &oss->channels);
+ gst_structure_get_int (structure, "rate", &oss->rate);
+ gst_structure_get_int (structure, "channels", &oss->channels);
oss->bps = bps * oss->channels * oss->rate;
oss->format = format;
/* some useful functions */
gboolean gst_osselement_parse_caps (GstOssElement *oss,
- GstCaps *caps);
+ const GstCaps *caps);
gboolean gst_osselement_merge_fixed_caps (GstOssElement *oss,
- GstCaps *caps);
+ GstCaps *caps);
gboolean gst_osselement_sync_parms (GstOssElement *oss);
void gst_osselement_reset (GstOssElement *oss);
static gboolean gst_osssink_sink_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
-static GstPadLinkReturn gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_osssink_sinkconnect (GstPad *pad, const GstCaps *caps);
static void gst_osssink_set_property (GObject *object, guint prop_id, const GValue *value,
GParamSpec *pspec);
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (osssink_sink_factory,
+static GstStaticPadTemplate osssink_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "osssink_sink",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (FALSE),
- GST_PROPS_BOOLEAN (TRUE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
)
);
return osssink_type;
}
-static GstBufferPool*
-gst_osssink_get_bufferpool (GstPad *pad)
-{
- GstOssSink *oss;
-
- oss = GST_OSSSINK (gst_pad_get_parent(pad));
-
- /* 6 buffers per chunk by default */
- if (!oss->sinkpool)
- oss->sinkpool = gst_buffer_pool_get_default (oss->bufsize, 6);
-
- return oss->sinkpool;
-}
-
static void
gst_osssink_dispose (GObject *object)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_osssink_details);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (osssink_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&osssink_sink_factory));
}
static void
gst_osssink_class_init (GstOssSinkClass *klass)
gst_osssink_init (GstOssSink *osssink)
{
osssink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (osssink_sink_factory), "sink");
+ gst_static_pad_template_get (&osssink_sink_factory), "sink");
gst_element_add_pad (GST_ELEMENT (osssink), osssink->sinkpad);
gst_pad_set_link_function (osssink->sinkpad, gst_osssink_sinkconnect);
- gst_pad_set_bufferpool_function (osssink->sinkpad, gst_osssink_get_bufferpool);
gst_pad_set_convert_function (osssink->sinkpad, gst_osssink_convert);
gst_pad_set_query_function (osssink->sinkpad, gst_osssink_sink_query);
gst_pad_set_query_type_function (osssink->sinkpad, gst_osssink_get_query_types);
osssink->resync = FALSE;
osssink->mute = FALSE;
osssink->sync = TRUE;
- osssink->sinkpool = NULL;
osssink->provided_clock = gst_audio_clock_new ("ossclock", gst_osssink_get_time, osssink);
gst_object_set_parent (GST_OBJECT (osssink->provided_clock), GST_OBJECT (osssink));
osssink->handled = 0;
static GstPadLinkReturn
-gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_osssink_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstOssSink *osssink = GST_OSSSINK (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
if (!gst_osselement_parse_caps (GST_OSSELEMENT (osssink), caps))
return GST_PAD_LINK_REFUSED;
break;
case ARG_BUFFER_SIZE:
osssink->bufsize = g_value_get_uint (value);
- osssink->sinkpool = gst_buffer_pool_get_default (osssink->bufsize, 6);
g_object_notify (object, "buffer_size");
break;
case ARG_SYNC:
GstOssElement element;
GstPad *sinkpad;
- GstBufferPool *sinkpool;
GstClock *provided_clock;
GstClock *clock;
ARG_FRAGMENT,
};
-GST_PAD_TEMPLATE_FACTORY (osssrc_src_factory,
+static GstStaticPadTemplate osssrc_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "osssrc_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
)
-)
+);
static void gst_osssrc_base_init (gpointer g_class);
static void gst_osssrc_class_init (GstOssSrcClass *klass);
static void gst_osssrc_init (GstOssSrc *osssrc);
static void gst_osssrc_dispose (GObject *object);
-static GstPadLinkReturn gst_osssrc_srcconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_osssrc_srcconnect (GstPad *pad, const GstCaps *caps);
static const GstFormat* gst_osssrc_get_formats (GstPad *pad);
static gboolean gst_osssrc_convert (GstPad *pad,
GstFormat src_format, gint64 src_value,
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_osssrc_details);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (osssrc_src_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&osssrc_src_factory));
}
static void
gst_osssrc_class_init (GstOssSrcClass *klass)
gst_osssrc_init (GstOssSrc *osssrc)
{
osssrc->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (osssrc_src_factory), "src");
+ gst_static_pad_template_get (&osssrc_src_factory), "src");
gst_pad_set_get_function (osssrc->srcpad, gst_osssrc_get);
gst_pad_set_link_function (osssrc->srcpad, gst_osssrc_srcconnect);
gst_pad_set_convert_function (osssrc->srcpad, gst_osssrc_convert);
}
static GstPadLinkReturn
-gst_osssrc_srcconnect (GstPad *pad, GstCaps *caps)
+gst_osssrc_srcconnect (GstPad *pad, const GstCaps *caps)
{
GstOssSrc *src;
src = GST_OSSSRC(gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
if (!gst_osselement_parse_caps (GST_OSSELEMENT (src), caps))
return GST_PAD_LINK_REFUSED;
/* set caps on src pad */
if (gst_pad_try_set_caps (src->srcpad,
- GST_CAPS_NEW (
- "oss_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (GST_OSSELEMENT (src)->endianness),
- "signed", GST_PROPS_BOOLEAN (GST_OSSELEMENT (src)->sign),
- "width", GST_PROPS_INT (GST_OSSELEMENT (src)->width),
- "depth", GST_PROPS_INT (GST_OSSELEMENT (src)->depth),
- "rate", GST_PROPS_INT (GST_OSSELEMENT (src)->rate),
- "channels", GST_PROPS_INT (GST_OSSELEMENT (src)->channels)
- )) <= 0)
- {
+ gst_caps_new_simple("audio/x-raw-int",
+ "endianness", G_TYPE_INT, GST_OSSELEMENT (src)->endianness,
+ "signed", G_TYPE_BOOLEAN, GST_OSSELEMENT (src)->sign,
+ "width", G_TYPE_INT, GST_OSSELEMENT (src)->width,
+ "depth", G_TYPE_INT, GST_OSSELEMENT (src)->depth,
+ "rate", G_TYPE_INT, GST_OSSELEMENT (src)->rate,
+ "channels", G_TYPE_INT, GST_OSSELEMENT (src)->channels,
+ NULL)) <= 0) {
return FALSE;
}
return TRUE;
static void gst_v4l2src_init (GstV4l2Src *v4l2src);
/* signal functions */
-static void gst_v4l2src_open (GstElement *element,
- const gchar *device);
-static void gst_v4l2src_close (GstElement *element,
- const gchar *device);
-
-/* pad/info functions */
-static gboolean gst_v4l2src_src_convert (GstPad *pad,
- GstFormat src_format,
- gint64 src_value,
- GstFormat *dest_format,
- gint64 *dest_value);
-static gboolean gst_v4l2src_src_query (GstPad *pad,
- GstQueryType type,
- GstFormat *format,
- gint64 *value);
-
-/* buffer functions */
-static GstPadLinkReturn
- gst_v4l2src_srcconnect (GstPad *pad,
- GstCaps *caps);
-static GstCaps *gst_v4l2src_getcaps (GstPad *pad,
- GstCaps *caps);
-static GstData *gst_v4l2src_get (GstPad *pad);
+static void gst_v4l2src_open (GstElement *element,
+ const gchar *device);
+static void gst_v4l2src_close (GstElement *element,
+ const gchar *device);
+
+/* pad/buffer functions */
+static GstPadLinkReturn gst_v4l2src_srcconnect (GstPad *pad,
+ const GstCaps *caps);
+static GstCaps * gst_v4l2src_getcaps (GstPad *pad);
+static GstData * gst_v4l2src_get (GstPad *pad);
+static gboolean gst_v4l2src_src_convert (GstPad *pad,
+ GstFormat src_format,
+ gint64 src_value,
+ GstFormat *dest_format,
+ gint64 *dest_value);
+static gboolean gst_v4l2src_src_query (GstPad *pad,
+ GstQueryType type,
+ GstFormat *format,
+ gint64 *value);
/* get/set params */
static void gst_v4l2src_set_property (GObject *object,
static void gst_v4l2src_set_clock (GstElement *element,
GstClock *clock);
-/* bufferpool functions */
-static GstBuffer *gst_v4l2src_buffer_new (GstBufferPool *pool,
- guint64 offset,
- guint size,
- gpointer user_data);
-static void gst_v4l2src_buffer_free (GstBufferPool *pool,
- GstBuffer *buf,
- gpointer user_data);
-
-
static GstPadTemplate *src_template;
static GstElementClass *parent_class = NULL;
gst_pad_set_query_type_function (v4l2src->srcpad,
gst_v4l2src_get_query_types);
- v4l2src->bufferpool = gst_buffer_pool_new(NULL, NULL,
- gst_v4l2src_buffer_new,
- NULL,
- gst_v4l2src_buffer_free,
- v4l2src);
-
v4l2src->breq.count = 0;
v4l2src->formats = NULL;
}
-static GstCaps *
+static GstStructure *
gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
- GstPropsEntry *width,
- GstPropsEntry *height,
- GstPropsEntry *fps,
gboolean compressed)
{
- GstCaps *caps = NULL;
+ GstStructure *structure;
switch (fourcc) {
case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */
case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */
- caps = GST_CAPS_NEW("v4l2src_caps",
- "video/x-jpeg",
- NULL);
+ structure = gst_structure_new ("video/x-jpeg", NULL);
break;
case V4L2_PIX_FMT_RGB332:
case V4L2_PIX_FMT_RGB555:
break;
}
- caps = GST_CAPS_NEW("v4l2src_caps",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT(bpp),
- "depth", GST_PROPS_INT(depth),
- "red_mask", GST_PROPS_INT(r_mask),
- "green_mask", GST_PROPS_INT(g_mask),
- "blue_mask", GST_PROPS_INT(b_mask),
- "endianness", GST_PROPS_INT(endianness),
- NULL);
+ structure = gst_structure_new ("video/x-raw-rgb",
+ "bpp", G_TYPE_INT, bpp,
+ "depth", G_TYPE_INT, depth,
+ "red_mask", G_TYPE_INT, r_mask,
+ "green_mask", G_TYPE_INT, g_mask,
+ "blue_mask", G_TYPE_INT, b_mask,
+ "endianness", G_TYPE_INT, endianness,
+ NULL);
break;
}
case V4L2_PIX_FMT_YUV420: /* I420/IYUV */
break;
}
- caps = GST_CAPS_NEW("v4l2src_caps",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC(fcc),
- NULL);
+ structure = gst_structure_new ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fcc,
+ NULL);
break;
}
default:
}
string_format = g_strdup_printf("video/%4.4s",
print_format_str);
- caps = GST_CAPS_NEW("v4l2src_caps",
- string_format,
- NULL);
+ structure = gst_structure_new (string_format, NULL);
g_free(string_format);
} else {
- caps = GST_CAPS_NEW("v4l2src_caps",
- "video/x-raw-yuv",
- "format",GST_PROPS_FOURCC(fourcc),
- NULL);
+ structure = gst_structure_new ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
}
break;
}
- if (!caps->properties)
- caps->properties = gst_props_empty_new();
- gst_props_add_entry(caps->properties, width);
- gst_props_add_entry(caps->properties, height);
- gst_props_add_entry(caps->properties, fps);
+#if 0
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", G_TYPE_DOUBLE, fps,
+ NULL);
+#endif
- return caps;
+ return structure;
}
#define gst_v4l2src_v4l2fourcc_to_caps_fixed(f, width, height, fps, c) \
static struct v4l2_fmtdesc *
gst_v4l2_caps_to_v4l2fourcc (GstV4l2Src *v4l2src,
- GstCaps *caps)
+ GstStructure *structure)
{
gint i;
guint32 fourcc = 0;
struct v4l2_fmtdesc *end_fmt = NULL;
- const gchar *format = gst_caps_get_mime(caps);
+ const gchar *format = gst_structure_get_name (structure);
if (!strcmp(format, "video/x-raw-yuv") ||
!strcmp(format, "video/x-raw-rgb")) {
if (!strcmp(format, "video/x-raw-rgb"))
fourcc = GST_MAKE_FOURCC('R','G','B',' ');
else
- gst_caps_get_fourcc_int(caps, "format", &fourcc);
+ gst_structure_get_fourcc (structure, "format", &fourcc);
switch (fourcc) {
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('R','G','B',' '): {
gint depth, endianness;
- gst_caps_get_int(caps, "depth", &depth);
- gst_caps_get_int(caps, "endianness", &endianness);
+ gst_structure_get_int (structure, "depth", &depth);
+ gst_structure_get_int (structure, "endianness", &endianness);
switch (depth) {
case 8:
static GstPadLinkReturn
gst_v4l2src_srcconnect (GstPad *pad,
- GstCaps *vscapslist)
+ const GstCaps *vscapslist)
{
GstV4l2Src *v4l2src;
GstV4l2Element *v4l2element;
- GstCaps *caps;
struct v4l2_fmtdesc *format;
int w, h;
+ GstStructure *structure;
v4l2src = GST_V4L2SRC(gst_pad_get_parent (pad));
v4l2element = GST_V4L2ELEMENT(v4l2src);
+ structure = gst_caps_get_structure (vscapslist, 0);
+
/* clean up if we still haven't cleaned up our previous
* capture session */
if (GST_V4L2_IS_ACTIVE(v4l2element)) {
return GST_PAD_LINK_DELAYED;
}
- for (caps = vscapslist; caps != NULL; caps = caps->next) {
- /* we want our own v4l2 type of fourcc codes */
- if (!(format = gst_v4l2_caps_to_v4l2fourcc(v4l2src, caps))) {
- continue;
- }
- if (gst_caps_has_property(caps, "width")) {
- if (gst_caps_has_fixed_property(caps, "width")) {
- gst_caps_get_int(caps, "width", &w);
- } else {
- int max;
- gst_caps_get_int_range(caps, "width", &max, &w);
- }
- }
- if (gst_caps_has_property(caps, "height")) {
- if (gst_caps_has_fixed_property(caps, "height")) {
- gst_caps_get_int(caps, "height", &h);
- } else {
- int max;
- gst_caps_get_int_range(caps, "height", &max, &h);
- }
- }
+ /* we want our own v4l2 type of fourcc codes */
+ if (!(format = gst_v4l2_caps_to_v4l2fourcc(v4l2src, structure))) {
+ return GST_PAD_LINK_REFUSED;
+ }
- /* we found the pixelformat! - try it out */
- if (gst_v4l2src_set_capture(v4l2src, format, w, h)) {
- /* it fits! Now, get the proper counterpart and retry
- * it on the other side (again...) - if it works, we're
- * done -> GST_PAD_LINK_OK */
- GstCaps *lastcaps;
- GstPadLinkReturn ret_val;
-
- lastcaps = gst_v4l2src_v4l2fourcc_to_caps_fixed(format->pixelformat,
- v4l2src->format.fmt.pix.width,
- v4l2src->format.fmt.pix.height,
- gst_v4l2src_get_fps(v4l2src),
- format->flags & V4L2_FMT_FLAG_COMPRESSED);
-
- ret_val = gst_pad_try_set_caps(v4l2src->srcpad,
- lastcaps);
-
- if (ret_val > 0) {
- if (gst_v4l2src_capture_init(v4l2src)) {
- return GST_PAD_LINK_DONE;
- }
- } else if (ret_val == GST_PAD_LINK_DELAYED) {
- return GST_PAD_LINK_DELAYED;
- }
+ gst_structure_get_int (structure, "width", &w);
+ gst_structure_get_int (structure, "height", &h);
+
+ /* we found the pixelformat! - try it out */
+ if (gst_v4l2src_set_capture(v4l2src, format, w, h)) {
+ if (gst_v4l2src_capture_init(v4l2src)) {
+ return GST_PAD_LINK_OK;
}
}
static GstCaps *
-gst_v4l2src_getcaps (GstPad *pad,
- GstCaps *caps)
+gst_v4l2src_getcaps (GstPad *pad)
{
GstV4l2Src *v4l2src = GST_V4L2SRC(gst_pad_get_parent (pad));
- GstCaps *list = NULL;
+ GstCaps *caps;
gint i;
struct v4l2_fmtdesc *format;
int min_w, max_w, min_h, max_h;
}
/* build our own capslist */
+ caps = gst_caps_new_empty();
for (i=0;i<g_list_length(v4l2src->formats);i++) {
+ GstStructure *structure;
+
format = g_list_nth_data(v4l2src->formats, i);
/* get size delimiters */
}
/* add to list */
- caps = gst_v4l2src_v4l2fourcc_to_caps_range(format->pixelformat,
- min_w, max_w,
- min_h, max_h,
- format->flags & V4L2_FMT_FLAG_COMPRESSED);
+ structure = gst_v4l2src_v4l2fourcc_to_caps (format->pixelformat,
+ format->flags & V4L2_FMT_FLAG_COMPRESSED);
- list = gst_caps_append(list, caps);
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, min_w, max_w,
+ "height", GST_TYPE_INT_RANGE, min_h, max_h,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0, G_MAXDOUBLE,
+ NULL);
+
+ gst_caps_append_structure (caps, structure);
}
- return list;
+ return caps;
}
(fps = gst_v4l2src_get_fps(v4l2src)) == 0)
return NULL;
- buf = gst_buffer_new_from_pool(v4l2src->bufferpool, 0, 0);
- if (!buf) {
- gst_element_error(GST_ELEMENT(v4l2src),
- "Failed to create a new GstBuffer");
- return NULL;
- }
-
if (v4l2src->need_writes > 0) {
/* use last frame */
num = v4l2src->last_frame;
v4l2src->use_num_times[num] = 1;
}
+ buf = gst_buffer_new ();
GST_BUFFER_DATA(buf) = gst_v4l2src_get_buffer(v4l2src, num);
GST_BUFFER_SIZE(buf) = v4l2src->bufsettings.bytesused;
+ GST_BUFFER_FLAG_SET(buf, GST_BUFFER_READONLY);
if (v4l2src->use_fixed_fps)
GST_BUFFER_TIMESTAMP(buf) = v4l2src->handled * GST_SECOND / fps;
else /* calculate time based on our own clock */
}
+#if 0
static GstBuffer*
gst_v4l2src_buffer_new (GstBufferPool *pool,
guint64 offset,
return buffer;
}
+#endif
-
+#if 0
static void
gst_v4l2src_buffer_free (GstBufferPool *pool,
GstBuffer *buf,
/* free the buffer itself */
gst_buffer_default_free(buf);
}
+#endif
+
/* how are we going to push buffers? */
gboolean use_fixed_fps;
-
- /* bufferpool for the buffers we're gonna use */
- GstBufferPool *bufferpool;
};
struct _GstV4l2SrcClass {