Commit ce51f617 authored by David Schleef's avatar David Schleef

Merge CAPS branch

Original commit message from CVS:
Merge CAPS branch
parent f43f0a9f
......@@ -12,78 +12,27 @@ struct probe_context {
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
......
......@@ -58,17 +58,13 @@ enum {
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);
......@@ -177,7 +173,7 @@ gst_aasink_base_init (gpointer g_class)
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);
}
......@@ -244,17 +240,16 @@ gst_aasink_class_init (GstAASinkClass *klass)
}
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 */
......@@ -279,7 +274,7 @@ static void
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);
......
This diff is collapsed.
......@@ -54,7 +54,6 @@ struct _GstDVDec {
gint quality;
GstByteStream *bs;
GstBufferPool *pool;
dv_color_space_t space;
gint bpp;
gboolean PAL;
......
......@@ -52,38 +52,31 @@ enum {
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);
......@@ -143,12 +136,12 @@ gst_esdmon_get_type (void)
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);
}
......@@ -160,37 +153,35 @@ gst_esdmon_base_init (gpointer g_class)
{
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 */
......@@ -201,10 +192,13 @@ gst_esdmon_class_init (GstEsdmonClass *klass)
}
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);
......@@ -262,17 +256,16 @@ gst_esdmon_get (GstPad *pad)
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;
......
......@@ -50,43 +50,36 @@ enum {
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);
......@@ -111,12 +104,12 @@ gst_esdsink_get_type (void)
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);
}
......@@ -128,31 +121,29 @@ gst_esdsink_base_init (gpointer g_class)
{
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));
......@@ -165,13 +156,16 @@ gst_esdsink_class_init (GstEsdsinkClass *klass)
}
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);
......@@ -191,34 +185,27 @@ gst_esdsink_init(GstEsdsink *esdsink)
}
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;
}
......
......@@ -124,31 +124,22 @@ flacdec_get_type(void) {
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
......@@ -160,12 +151,10 @@ gst_flacdec_base_init (gpointer g_class)
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);
......@@ -485,16 +474,14 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder *decoder,
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;
......
......@@ -68,7 +68,7 @@ static void gst_flacenc_class_init (FlacEncClass *klass);
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);
......@@ -179,31 +179,22 @@ gst_flacenc_quality_get_type (void)
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
......@@ -217,10 +208,10 @@ gst_flacenc_base_init (gpointer g_class)
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);
......@@ -354,24 +345,23 @@ gst_flacenc_dispose (GObject *object)
}
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;
......
......@@ -100,32 +100,21 @@ enum {
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (flac_tag_src_template_factory,
static GstStaticPadTemplate flac_tag_src_template =