mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
Merge CAPS branch
Original commit message from CVS: Merge CAPS branch
This commit is contained in:
parent
f43f0a9fd7
commit
ce51f6173c
84 changed files with 2652 additions and 3554 deletions
|
@ -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);
|
||||
|
|
|
@ -29,8 +29,11 @@
|
|||
|
||||
#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.
|
||||
|
@ -68,91 +71,88 @@ enum {
|
|||
* 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)
|
||||
" }; "
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY ( audio_src_temp,
|
||||
"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)
|
||||
" }"
|
||||
)
|
||||
);
|
||||
|
||||
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
|
||||
|
@ -247,9 +247,9 @@ gst_dvdec_base_init (gpointer g_class)
|
|||
* 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);
|
||||
}
|
||||
|
@ -303,13 +303,13 @@ gst_dvdec_init(GstDVDec *dvdec)
|
|||
{
|
||||
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));
|
||||
|
@ -318,7 +318,7 @@ gst_dvdec_init(GstDVDec *dvdec)
|
|||
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));
|
||||
|
@ -329,7 +329,6 @@ gst_dvdec_init(GstDVDec *dvdec)
|
|||
|
||||
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;
|
||||
|
@ -706,7 +705,7 @@ gst_dvdec_loop (GstElement *element)
|
|||
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);
|
||||
|
||||
|
@ -724,43 +723,51 @@ gst_dvdec_loop (GstElement *element)
|
|||
|
||||
/* 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));
|
||||
|
||||
while (trylist) {
|
||||
GstCaps *to_try = gst_caps_copy_1 (trylist);
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -774,12 +781,7 @@ gst_dvdec_loop (GstElement *element)
|
|||
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;
|
||||
}
|
||||
|
@ -799,15 +801,14 @@ gst_dvdec_loop (GstElement *element)
|
|||
/* 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
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -831,23 +832,7 @@ gst_dvdec_loop (GstElement *element)
|
|||
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);
|
||||
|
||||
|
@ -898,9 +883,6 @@ gst_dvdec_change_state (GstElement *element)
|
|||
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);
|
||||
|
|
|
@ -54,7 +54,6 @@ struct _GstDVDec {
|
|||
gint quality;
|
||||
|
||||
GstByteStream *bs;
|
||||
GstBufferPool *pool;
|
||||
dv_color_space_t space;
|
||||
gint bpp;
|
||||
gboolean PAL;
|
||||
|
|
105
ext/esd/esdmon.c
105
ext/esd/esdmon.c
|
@ -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 =
|
||||
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_STATIC_CAPS ("audio/x-flac; application/x-gst-tags")
|
||||
);
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (flac_tag_sink_template_factory,
|
||||
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);
|
||||
|
@ -181,9 +170,9 @@ 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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,25 +196,20 @@ caps_nego (GstFlacTag *tag)
|
|||
{
|
||||
/* 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;
|
||||
|
@ -251,12 +235,12 @@ gst_flac_tag_init (GstFlacTag *tag)
|
|||
{
|
||||
/* 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;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#endif
|
||||
#include <gst/gst.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gstgdkpixbuf.h"
|
||||
|
@ -47,50 +48,39 @@ enum {
|
|||
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);
|
||||
|
@ -110,7 +100,7 @@ static void gst_gdk_pixbuf_type_find (GstTypeFind *tf, gpointer ignore);
|
|||
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;
|
||||
|
||||
|
@ -119,11 +109,6 @@ gst_gdk_pixbuf_sink_link (GstPad *pad, GstCaps *caps)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -134,31 +119,8 @@ gst_gdk_pixbuf_sink_link (GstPad *pad, GstCaps *caps)
|
|||
* 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)
|
||||
|
@ -168,31 +130,27 @@ static GstCaps *gst_gdk_pixbuf_get_capslist(void)
|
|||
GdkPixbufFormat *pixbuf_format;
|
||||
char **mimetypes;
|
||||
char **mimetype;
|
||||
static GstCaps *capslist = NULL;
|
||||
GstCaps *capslist = NULL;
|
||||
|
||||
if(capslist==NULL){
|
||||
slist0 = gdk_pixbuf_get_formats();
|
||||
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++){
|
||||
capslist = gst_caps_append(capslist, gst_caps_new("ack",*mimetype,NULL));
|
||||
}
|
||||
g_free(mimetypes);
|
||||
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));
|
||||
}
|
||||
gst_caps_ref(capslist);
|
||||
gst_caps_sink(capslist);
|
||||
g_slist_free(slist0);
|
||||
|
||||
g_print("%s\n",gst_caps_to_string(capslist));
|
||||
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;
|
||||
|
||||
|
@ -234,8 +192,10 @@ gst_gdk_pixbuf_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -262,12 +222,12 @@ gst_gdk_pixbuf_class_init (GstGdkPixbufClass *klass)
|
|||
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);
|
||||
|
@ -285,7 +245,7 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstData *_data)
|
|||
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);
|
||||
|
@ -313,9 +273,10 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstData *_data)
|
|||
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);
|
||||
}
|
||||
|
@ -399,7 +360,7 @@ gst_gdk_pixbuf_type_find (GstTypeFind *tf, gpointer ignore)
|
|||
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);
|
||||
|
@ -418,7 +379,8 @@ plugin_init (GstPlugin *plugin)
|
|||
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;
|
||||
|
|
|
@ -54,7 +54,7 @@ static void gst_jpegdec_init (GstJpegDec *jpegdec);
|
|||
|
||||
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 }; */
|
||||
|
@ -83,26 +83,17 @@ gst_jpegdec_get_type(void) {
|
|||
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
|
||||
|
@ -116,10 +107,10 @@ gst_jpegdec_base_init (gpointer g_class)
|
|||
|
||||
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);
|
||||
|
@ -206,26 +197,23 @@ gst_jpegdec_init (GstJpegDec *jpegdec)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -416,16 +404,13 @@ gst_jpegdec_chain (GstPad *pad, GstData *_data)
|
|||
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 */
|
||||
|
|
|
@ -64,7 +64,7 @@ struct _GstJpegDec {
|
|||
gint format;
|
||||
gint width;
|
||||
gint height;
|
||||
gfloat fps;
|
||||
gdouble fps;
|
||||
/* the size of the output buffer */
|
||||
gint outsize;
|
||||
/* the jpeg line buffer */
|
||||
|
|
|
@ -50,8 +50,8 @@ static void gst_jpegenc_base_init (gpointer g_class);
|
|||
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);
|
||||
|
||||
|
@ -86,26 +86,17 @@ gst_jpegenc_get_type (void)
|
|||
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
|
||||
|
@ -119,10 +110,10 @@ gst_jpegenc_base_init (gpointer g_class)
|
|||
|
||||
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);
|
||||
|
@ -202,24 +193,21 @@ gst_jpegenc_init (GstJpegEnc *jpegenc)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ struct _GstJpegEnc {
|
|||
gint format;
|
||||
gint width;
|
||||
gint height;
|
||||
gfloat fps;
|
||||
gdouble fps;
|
||||
/* the video buffer */
|
||||
gint bufsize;
|
||||
GstBuffer *buffer;
|
||||
|
|
|
@ -37,45 +37,15 @@
|
|||
#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);
|
||||
|
@ -141,10 +111,12 @@ gst_ladspa_base_init (GstLADSPAClass *klass)
|
|||
|
||||
/* 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++;
|
||||
}
|
||||
|
||||
|
@ -456,7 +428,6 @@ gst_ladspa_init (GstLADSPA *ladspa)
|
|||
|
||||
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) {
|
||||
|
@ -492,52 +463,43 @@ gst_ladspa_update_int(const GValue *value, gpointer data)
|
|||
}
|
||||
|
||||
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",
|
||||
|
@ -548,13 +510,14 @@ gst_ladspa_force_src_caps(GstLADSPA *ladspa, GstPad *pad)
|
|||
"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)
|
||||
|
@ -759,11 +722,6 @@ gst_ladspa_loop (GstElement *element)
|
|||
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++) {
|
||||
|
@ -773,8 +731,7 @@ gst_ladspa_loop (GstElement *element)
|
|||
}
|
||||
}
|
||||
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]);
|
||||
}
|
||||
|
@ -850,11 +807,6 @@ gst_ladspa_chain (GstPad *pad, GstData *_data)
|
|||
/* 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);
|
||||
|
@ -870,11 +822,7 @@ gst_ladspa_chain (GstPad *pad, GstData *_data)
|
|||
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]);
|
||||
|
@ -932,12 +880,8 @@ gst_ladspa_get(GstPad *pad)
|
|||
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);
|
||||
|
||||
|
|
|
@ -59,8 +59,6 @@ struct _GstLADSPA {
|
|||
GstPad **sinkpads,
|
||||
**srcpads;
|
||||
|
||||
GstBufferPool *bufpool;
|
||||
|
||||
gboolean activated;
|
||||
|
||||
gint samplerate, buffer_frames;
|
||||
|
|
|
@ -93,23 +93,18 @@ GType gst_pngenc_get_type (void)
|
|||
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
|
||||
|
@ -123,11 +118,11 @@ gst_pngenc_base_init (gpointer g_class)
|
|||
|
||||
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);
|
||||
|
@ -148,26 +143,24 @@ gst_pngenc_class_init (GstPngEncClass *klass)
|
|||
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -58,51 +58,28 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static GstPadTemplate*
|
||||
mikmod_src_factory (void)
|
||||
{
|
||||
static GstPadTemplate *template = NULL;
|
||||
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)
|
||||
);
|
||||
|
||||
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_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);
|
||||
|
@ -137,8 +114,10 @@ gst_mikmod_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -205,8 +184,10 @@ gst_mikmod_class_init (GstMikModClass *klass)
|
|||
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);
|
||||
|
@ -245,39 +226,35 @@ gst_mikmod_negotiate (GstMikMod *mikmod)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -28,46 +28,35 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
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)
|
||||
)
|
||||
)
|
||||
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 ]")
|
||||
);
|
||||
|
||||
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)
|
||||
)
|
||||
)
|
||||
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 ]")
|
||||
);
|
||||
|
||||
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 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);
|
||||
|
@ -116,9 +105,12 @@ gst_textoverlay_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 (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);
|
||||
}
|
||||
|
@ -228,18 +220,17 @@ render_text(GstTextOverlay *overlay)
|
|||
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -514,20 +505,20 @@ gst_textoverlay_init(GstTextOverlay *overlay)
|
|||
{
|
||||
/* 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);
|
||||
|
|
|
@ -62,14 +62,14 @@ gst_dv1394src_factory (void)
|
|||
"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)
|
||||
),
|
||||
|
@ -167,7 +167,6 @@ gst_dv1394src_init (GstDV1394Src *dv1394src)
|
|||
|
||||
/* initialized when first header received */
|
||||
dv1394src->frameSize=0;
|
||||
dv1394src->pool = NULL;
|
||||
|
||||
dv1394src->buf = NULL;
|
||||
dv1394src->frame = NULL;
|
||||
|
@ -237,22 +236,20 @@ int gst_dv1394src_iso_receive(raw1394handle_t handle,int channel,size_t len,quad
|
|||
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;
|
||||
}
|
||||
|
@ -261,19 +258,13 @@ int gst_dv1394src_iso_receive(raw1394handle_t handle,int channel,size_t len,quad
|
|||
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
|
||||
|
@ -287,9 +278,9 @@ int gst_dv1394src_iso_receive(raw1394handle_t handle,int channel,size_t len,quad
|
|||
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) {
|
||||
|
@ -390,10 +381,6 @@ gst_dv1394src_change_state (GstElement *element)
|
|||
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:
|
||||
|
|
|
@ -68,7 +68,8 @@ struct _GstDV1394Src {
|
|||
guint frameSize;
|
||||
guint bytesInFrame;
|
||||
guint frameSequence;
|
||||
GstBufferPool *pool;
|
||||
|
||||
gboolean negotiated;
|
||||
};
|
||||
|
||||
struct _GstDV1394SrcClass {
|
||||
|
|
|
@ -51,7 +51,7 @@ static void gst_speexdec_class_init (GstSpeexDec *klass);
|
|||
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 }; */
|
||||
|
@ -77,45 +77,41 @@ gst_speexdec_get_type(void) {
|
|||
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);
|
||||
}
|
||||
|
@ -147,29 +143,26 @@ gst_speexdec_init (GstSpeexDec *speexdec)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ static void gst_speexenc_class_init (GstSpeexEnc *klass);
|
|||
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 };
|
||||
|
@ -79,45 +79,41 @@ gst_speexenc_get_type (void)
|
|||
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);
|
||||
}
|
||||
|
@ -160,22 +156,20 @@ gst_speexenc_init (GstSpeexEnc *speexenc)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -211,12 +205,10 @@ gst_speexenc_chain (GstPad *pad, GstData *_data)
|
|||
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;
|
||||
|
|
|
@ -105,7 +105,7 @@ static void gst_bpwsinc_get_property (GObject * object, guint prop_id,
|
|||
|
||||
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 }; */
|
||||
|
@ -136,8 +136,10 @@ gst_bpwsinc_base_init (gpointer g_class)
|
|||
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);
|
||||
}
|
||||
|
@ -176,12 +178,14 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
|
|||
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;
|
||||
|
@ -191,7 +195,7 @@ gst_bpwsinc_init (GstBPWSinc * filter)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -204,10 +208,7 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ static void gst_lpwsinc_get_property (GObject * object, guint prop_id,
|
|||
|
||||
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 }; */
|
||||
|
@ -133,8 +133,10 @@ gst_lpwsinc_base_init (gpointer g_class)
|
|||
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);
|
||||
}
|
||||
|
@ -168,12 +170,14 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
|
|||
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;
|
||||
|
@ -182,7 +186,7 @@ gst_lpwsinc_init (GstLPWSinc * filter)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -193,10 +197,7 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <gstauparse.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_auparse_details = GST_ELEMENT_DETAILS (
|
||||
|
@ -37,47 +38,26 @@ 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 {
|
||||
|
@ -127,9 +107,9 @@ gst_auparse_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_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);
|
||||
|
||||
}
|
||||
|
@ -148,12 +128,12 @@ static void
|
|||
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;
|
||||
|
@ -170,7 +150,7 @@ gst_auparse_chain (GstPad *pad, GstData *_data)
|
|||
GstAuParse *auparse;
|
||||
gchar *data;
|
||||
glong size;
|
||||
GstCaps* tempcaps;
|
||||
GstCaps *tempcaps;
|
||||
gint law, depth;
|
||||
gboolean sign;
|
||||
|
||||
|
@ -258,19 +238,17 @@ gst_auparse_chain (GstPad *pad, GstData *_data)
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -42,15 +42,12 @@ enum {
|
|||
/* 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);
|
||||
|
@ -138,20 +135,19 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -185,7 +181,7 @@ gst_avi_demux_init (GstAviDemux *avi)
|
|||
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;
|
||||
|
||||
|
@ -232,16 +228,10 @@ gst_avi_demux_reset (GstAviDemux *avi)
|
|||
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");*/
|
||||
}
|
||||
|
|
|
@ -54,139 +54,85 @@ enum {
|
|||
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);
|
||||
|
@ -246,11 +192,11 @@ 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);
|
||||
}
|
||||
|
@ -334,113 +280,101 @@ gst_avimux_init (GstAviMux *avimux)
|
|||
}
|
||||
|
||||
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.;
|
||||
structure = gst_caps_get_structure (vscaps, 0);
|
||||
mimetype = gst_structure_get_name (structure);
|
||||
|
||||
/* 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;
|
||||
/* 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 (!strcmp (mimetype, "video/x-raw-yuv"))
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
goto done;
|
||||
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;
|
||||
} 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_caps_get_int (caps, "divxversion", &divxversion);
|
||||
switch (divxversion) {
|
||||
case 3:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','3');
|
||||
/* 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;
|
||||
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');
|
||||
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;
|
||||
|
@ -450,80 +384,70 @@ done:
|
|||
}
|
||||
|
||||
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;
|
||||
!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;
|
||||
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;
|
||||
avimux->auds.blockalign = 1;
|
||||
avimux->auds.av_bps = 0;
|
||||
avimux->auds.size = 16;
|
||||
|
||||
if (!avimux->auds.format) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -51,35 +51,25 @@ enum {
|
|||
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
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -129,13 +119,13 @@ gst_cutter_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 (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;
|
||||
|
@ -145,9 +135,7 @@ gst_cutter_link (GstPad *pad, GstCaps *caps)
|
|||
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
|
||||
|
@ -200,8 +188,10 @@ gst_cutter_class_init (GstCutterClass *klass)
|
|||
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;
|
||||
|
@ -461,13 +451,16 @@ void
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,18 +56,20 @@ enum {
|
|||
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);
|
||||
|
@ -100,7 +102,7 @@ void *gst_fenced_buffer_alloc(GstBuffer *buffer, unsigned int length,
|
|||
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;
|
||||
|
@ -111,19 +113,7 @@ gst_efence_link (GstPad *pad, GstCaps *caps)
|
|||
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
|
||||
|
@ -157,8 +147,10 @@ gst_efence_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -190,11 +182,11 @@ gst_efence_class_init (GstEFenceClass *klass)
|
|||
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);
|
||||
|
|
|
@ -142,8 +142,10 @@ gst_agingtv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -164,34 +166,36 @@ gst_agingtv_class_init (GstAgingTVClass * klass)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -132,8 +132,10 @@ gst_dicetv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -169,34 +171,36 @@ gst_dicetv_class_init (GstDiceTVClass * klass)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -121,8 +121,10 @@ gst_edgetv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -143,17 +145,17 @@ gst_edgetv_class_init (GstEdgeTVClass * klass)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -163,18 +165,20 @@ gst_edgetv_sinkconnect (GstPad * pad, GstCaps * caps)
|
|||
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;
|
||||
|
|
|
@ -49,43 +49,21 @@ static struct _elements_entry _elements[] = {
|
|||
};
|
||||
|
||||
|
||||
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)
|
||||
|
@ -94,7 +72,7 @@ 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++;
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ GType gst_vertigotv_get_type (void);
|
|||
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;
|
||||
|
|
|
@ -138,8 +138,10 @@ gst_quarktv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -166,18 +168,18 @@ gst_quarktv_class_init (GstQuarkTVClass * klass)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -188,18 +190,20 @@ gst_quarktv_sinkconnect (GstPad * pad, GstCaps * caps)
|
|||
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;
|
||||
|
|
|
@ -149,8 +149,10 @@ gst_revtv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -181,30 +183,32 @@ gst_revtv_class_init (GstRevTVClass * klass)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -130,8 +130,10 @@ gst_shagadelictv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -152,18 +154,18 @@ gst_shagadelictv_class_init (GstShagadelicTVClass * klass)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -175,18 +177,20 @@ gst_shagadelictv_sinkconnect (GstPad * pad, GstCaps * caps)
|
|||
|
||||
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;
|
||||
|
|
|
@ -135,8 +135,10 @@ gst_vertigotv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -186,18 +188,18 @@ gst_vertigotv_reset_handler (GstElement *element)
|
|||
|
||||
|
||||
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;
|
||||
|
||||
|
@ -209,18 +211,20 @@ gst_vertigotv_sinkconnect (GstPad * pad, GstCaps * caps)
|
|||
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;
|
||||
|
|
|
@ -136,8 +136,10 @@ gst_warptv_base_init (gpointer g_class)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
@ -158,32 +160,33 @@ gst_warptv_class_init (GstWarpTVClass * klass)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -47,36 +47,22 @@ enum {
|
|||
};
|
||||
|
||||
/* 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);
|
||||
|
@ -130,9 +116,9 @@ gst_flxdec_base_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
|
||||
|
@ -158,12 +144,12 @@ 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;
|
||||
|
@ -444,6 +430,7 @@ gst_flxdec_loop (GstElement *element)
|
|||
GstBuffer *buf;
|
||||
GstBuffer *databuf;
|
||||
guchar *data, *chunk;
|
||||
GstCaps *caps;
|
||||
|
||||
GstFlxDec *flxdec;
|
||||
FlxHeader *flxh;
|
||||
|
@ -497,19 +484,11 @@ gst_flxdec_loop (GstElement *element)
|
|||
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);
|
||||
|
@ -521,7 +500,6 @@ gst_flxdec_loop (GstElement *element)
|
|||
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);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ struct _GstGOOM {
|
|||
gint16 datain[2][512];
|
||||
|
||||
/* video state */
|
||||
gfloat fps;
|
||||
gdouble fps;
|
||||
gint width;
|
||||
gint height;
|
||||
gint channels;
|
||||
|
@ -78,33 +78,28 @@ enum {
|
|||
/* 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);
|
||||
|
@ -117,8 +112,8 @@ static GstElementStateReturn
|
|||
|
||||
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;
|
||||
|
||||
|
@ -151,9 +146,9 @@ gst_goom_base_init (GstGOOMClass *klass)
|
|||
|
||||
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
|
||||
|
@ -177,9 +172,9 @@ gst_goom_init (GstGOOM *goom)
|
|||
{
|
||||
/* 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);
|
||||
|
||||
|
@ -207,39 +202,33 @@ gst_goom_dispose (GObject *object)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -247,36 +236,6 @@ gst_goom_srcconnect (GstPad *pad, GstCaps *caps)
|
|||
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)
|
||||
{
|
||||
|
@ -318,13 +277,6 @@ 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);
|
||||
|
|
|
@ -80,31 +80,29 @@ static gint alaw_to_s16(guint8 a_val)
|
|||
}
|
||||
|
||||
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;
|
||||
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 (
|
||||
"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);
|
||||
}
|
||||
|
|
|
@ -120,30 +120,29 @@ static GstElementClass *parent_class = NULL;
|
|||
/*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;
|
||||
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 (
|
||||
"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);
|
||||
}
|
||||
|
|
|
@ -7,31 +7,23 @@
|
|||
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;
|
||||
|
@ -45,11 +37,11 @@ plugin_init (GstPlugin *plugin)
|
|||
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) ||
|
||||
|
|
|
@ -59,32 +59,29 @@ static GstElementClass *parent_class = NULL;
|
|||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,33 +58,30 @@ static GstElementClass *parent_class = NULL;
|
|||
/*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) {
|
||||
|
|
|
@ -7,34 +7,23 @@
|
|||
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;
|
||||
|
@ -49,14 +38,14 @@ plugin_init (GstPlugin *plugin)
|
|||
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) ||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
#include <gst/gst.h>
|
||||
#include <gst/audio/audio.h>
|
||||
#include "gstlevel.h"
|
||||
#include "math.h"
|
||||
|
||||
|
@ -38,47 +39,21 @@ static GstElementDetails level_details = {
|
|||
|
||||
/* 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 {
|
||||
|
@ -130,22 +105,20 @@ gst_level_get_type (void)
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -154,12 +127,12 @@ gst_level_link (GstPad *pad, GstCaps *caps)
|
|||
|
||||
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);
|
||||
|
@ -393,9 +366,9 @@ gst_level_base_init (GstLevelClass *klass)
|
|||
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;
|
||||
|
@ -443,9 +416,9 @@ gst_level_class_init (GstLevelClass *klass)
|
|||
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);
|
||||
|
|
|
@ -45,16 +45,13 @@ enum {
|
|||
/* 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);
|
||||
|
@ -163,7 +160,7 @@ 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);
|
||||
}
|
||||
|
@ -179,10 +176,10 @@ gst_matroska_demux_class_init (GstMatroskaDemuxClass *klass)
|
|||
|
||||
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);
|
||||
|
||||
|
@ -251,6 +248,7 @@ gst_matroska_demux_reset (GstElement *element)
|
|||
demux->num_v_streams = 0;
|
||||
|
||||
/* reset media info */
|
||||
|
||||
gst_caps_replace (&demux->metadata, NULL);
|
||||
gst_caps_replace (&demux->streaminfo, NULL);
|
||||
|
||||
|
@ -2157,6 +2155,114 @@ gst_matroska_demux_loop (GstElement *element)
|
|||
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,
|
||||
|
@ -2169,7 +2275,6 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
|
|||
|
||||
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;
|
||||
|
@ -2200,12 +2305,6 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
|
|||
} 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) {
|
||||
|
@ -2223,45 +2322,32 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
|
|||
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;
|
||||
|
@ -2273,36 +2359,37 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
|
|||
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 &&
|
||||
|
@ -2310,53 +2397,31 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
|
|||
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));
|
||||
}
|
||||
|
||||
if (one->properties == NULL) {
|
||||
one->properties = gst_props_empty_new ();
|
||||
}
|
||||
|
||||
if (width != NULL && height != NULL) {
|
||||
gst_props_add_entry (one->properties, width);
|
||||
gst_props_add_entry (one->properties, height);
|
||||
}
|
||||
|
||||
if (pixel_width != NULL && pixel_height != NULL) {
|
||||
gst_props_add_entry (one->properties, pixel_width);
|
||||
gst_props_add_entry (one->properties, pixel_height);
|
||||
}
|
||||
|
||||
if (fps != NULL) {
|
||||
gst_props_add_entry (one->properties, fps);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2364,6 +2429,86 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
|
|||
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;
|
||||
|
||||
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 }");
|
||||
}
|
||||
|
||||
}
|
||||
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;
|
||||
|
||||
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,
|
||||
const gchar *codec_id,
|
||||
|
@ -2388,14 +2533,12 @@ 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;
|
||||
|
@ -2405,60 +2548,35 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
|
|||
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;
|
||||
|
@ -2475,11 +2593,6 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
|
|||
} 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,
|
||||
|
@ -2495,41 +2608,33 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2610,8 +2715,7 @@ gboolean
|
|||
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,
|
||||
|
@ -2653,38 +2757,41 @@ gst_matroska_demux_plugin_init (GstPlugin *plugin)
|
|||
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",
|
||||
|
|
|
@ -66,8 +66,8 @@ typedef struct _GstMatroskaDemux {
|
|||
GstClock *clock;
|
||||
|
||||
/* metadata */
|
||||
GstCaps *metadata,
|
||||
*streaminfo;
|
||||
GstCaps *metadata;
|
||||
GstCaps *streaminfo;
|
||||
gchar *muxing_app, *writing_app;
|
||||
gint64 created;
|
||||
|
||||
|
|
|
@ -40,114 +40,82 @@ enum {
|
|||
/* 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)
|
||||
)
|
||||
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_PROPERTIES \
|
||||
"channels", GST_PROPS_INT_RANGE (1, 8), \
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 96000)
|
||||
#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_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
|
||||
)
|
||||
);
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (subtitlesink_templ,
|
||||
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);
|
||||
|
@ -221,13 +189,13 @@ 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);
|
||||
}
|
||||
|
@ -315,10 +283,9 @@ gst_matroska_mux_reset (GstElement *element)
|
|||
|
||||
/* 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;
|
||||
|
@ -331,18 +298,16 @@ gst_matroska_mux_reset (GstElement *element)
|
|||
}
|
||||
|
||||
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++) {
|
||||
|
@ -357,97 +322,93 @@ gst_matroska_mux_video_pad_link (GstPad *pad,
|
|||
videocontext = (GstMatroskaTrackVideoContext *) context;
|
||||
|
||||
/* gst -> matroska ID'ing */
|
||||
for (; caps != NULL; caps = caps->next) {
|
||||
mimetype = gst_caps_get_mime (caps);
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
/* 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;
|
||||
mimetype = gst_structure_get_name (structure);
|
||||
|
||||
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;
|
||||
}
|
||||
/* 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;
|
||||
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);
|
||||
/* 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-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;
|
||||
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;
|
||||
}
|
||||
|
||||
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-msmpeg")) {
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
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_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;
|
||||
}
|
||||
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
@ -455,16 +416,14 @@ gst_matroska_mux_video_pad_link (GstPad *pad,
|
|||
|
||||
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++) {
|
||||
|
@ -478,81 +437,77 @@ gst_matroska_mux_audio_pad_link (GstPad *pad,
|
|||
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_AUDIO);
|
||||
audiocontext = (GstMatroskaTrackAudioContext *) context;
|
||||
|
||||
for (; caps != NULL; caps = caps->next) {
|
||||
mimetype = gst_caps_get_mime (caps);
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
mimetype = gst_structure_get_name (structure);
|
||||
|
||||
/* general setup */
|
||||
gst_caps_get (caps,
|
||||
"rate", &samplerate,
|
||||
"channels", &channels,
|
||||
NULL);
|
||||
audiocontext->samplerate = samplerate;
|
||||
audiocontext->channels = channels;
|
||||
audiocontext->bitdepth = 0;
|
||||
/* general setup */
|
||||
gst_structure_get_int (structure, "rate", &samplerate);
|
||||
gst_structure_get_int (structure, "channels", &channels);
|
||||
|
||||
if (!strcmp (mimetype, "audio/mpeg")) {
|
||||
gint mpegversion = 0;
|
||||
audiocontext->samplerate = samplerate;
|
||||
audiocontext->channels = channels;
|
||||
audiocontext->bitdepth = 0;
|
||||
|
||||
gst_caps_get_int (caps, "mpegversion", &mpegversion);
|
||||
switch (mpegversion) {
|
||||
case 1: {
|
||||
gint layer;
|
||||
if (!strcmp (mimetype, "audio/mpeg")) {
|
||||
gint mpegversion = 0;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
@ -560,7 +515,7 @@ gst_matroska_mux_audio_pad_link (GstPad *pad,
|
|||
|
||||
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,
|
||||
|
@ -749,10 +704,12 @@ gst_matroska_mux_start (GstMatroskaMux *mux)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ typedef struct _GstMatroskaMux {
|
|||
num_v_streams, num_a_streams, num_t_streams;
|
||||
|
||||
/* metadata - includes writing_app and creation_time */
|
||||
GstCaps *metadata;
|
||||
GstCaps *metadata;
|
||||
|
||||
/* state */
|
||||
GstMatroskaMuxState state;
|
||||
|
|
|
@ -32,31 +32,21 @@ static GstElementDetails median_details = {
|
|||
"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 */
|
||||
|
@ -115,9 +105,9 @@ gst_median_base_init (GstMedianClass *klass)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -147,32 +137,32 @@ gst_median_class_init (GstMedianClass *klass)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#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())
|
||||
|
@ -39,14 +40,13 @@ struct _GstMonoscope {
|
|||
|
||||
/* 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;
|
||||
|
@ -81,41 +81,21 @@ enum {
|
|||
/* 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);
|
||||
|
@ -125,9 +105,9 @@ static void gst_monoscope_init (GstMonoscope *monoscope);
|
|||
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;
|
||||
|
||||
|
@ -159,9 +139,9 @@ gst_monoscope_base_init (GstMonoscopeClass *klass)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -182,9 +162,9 @@ gst_monoscope_init (GstMonoscope *monoscope)
|
|||
{
|
||||
/* 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);
|
||||
|
||||
|
@ -193,7 +173,6 @@ gst_monoscope_init (GstMonoscope *monoscope)
|
|||
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;
|
||||
|
@ -203,15 +182,11 @@ gst_monoscope_init (GstMonoscope *monoscope)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -220,38 +195,32 @@ gst_monoscope_negotiate (GstMonoscope *monoscope)
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -111,23 +111,30 @@ enum {
|
|||
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);
|
||||
|
@ -167,10 +174,13 @@ static void gst_qtdemux_base_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)
|
||||
|
@ -189,14 +199,17 @@ 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 */
|
||||
|
@ -227,6 +240,7 @@ plugin_init (GstPlugin *plugin)
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_SOMETIMES,
|
||||
videocaps, NULL);
|
||||
#endif
|
||||
|
||||
return gst_element_register (plugin, "qtdemux",
|
||||
GST_RANK_PRIMARY, GST_TYPE_QTDEMUX);
|
||||
|
@ -484,9 +498,8 @@ static void gst_qtdemux_loop_header (GstElement *element)
|
|||
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);
|
||||
}
|
||||
|
@ -506,11 +519,10 @@ static void gst_qtdemux_loop_header (GstElement *element)
|
|||
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
|
@ -518,20 +530,12 @@ static GstCaps *gst_qtdemux_src_getcaps(GstPad *pad, GstCaps *caps)
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -559,42 +563,40 @@ 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);
|
||||
|
@ -604,7 +606,7 @@ void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
|
|||
|
||||
/* 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);
|
||||
}
|
||||
|
@ -1358,11 +1360,6 @@ static void qtdemux_parse_trak(GstQTDemux *qtdemux, GNode *trak)
|
|||
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);
|
||||
|
@ -1528,87 +1525,51 @@ static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc)
|
|||
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 */
|
||||
|
@ -1617,7 +1578,7 @@ static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc)
|
|||
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;
|
||||
}
|
||||
|
@ -1627,130 +1588,89 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
|
|||
{
|
||||
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'):
|
||||
|
@ -1764,7 +1684,7 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -41,29 +41,27 @@ enum
|
|||
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);
|
||||
|
@ -108,9 +106,9 @@ gst_rtpL16parse_base_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);
|
||||
}
|
||||
|
||||
|
@ -141,8 +139,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
|
|||
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);
|
||||
|
@ -172,15 +172,11 @@ gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -44,30 +44,27 @@ enum
|
|||
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);
|
||||
|
@ -78,7 +75,7 @@ static void gst_rtpL16enc_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
|
@ -111,9 +108,9 @@ gst_rtpL16enc_base_init (GstRtpL16EncClass * klass)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -137,8 +134,10 @@ gst_rtpL16enc_class_init (GstRtpL16EncClass * klass)
|
|||
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);
|
||||
|
@ -155,14 +154,20 @@ gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -41,29 +41,27 @@ enum
|
|||
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);
|
||||
|
@ -108,9 +106,9 @@ gst_rtpL16parse_base_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);
|
||||
}
|
||||
|
||||
|
@ -141,8 +139,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
|
|||
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);
|
||||
|
@ -172,15 +172,11 @@ gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -44,30 +44,27 @@ enum
|
|||
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);
|
||||
|
@ -78,7 +75,7 @@ static void gst_rtpL16enc_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
|
@ -111,9 +108,9 @@ gst_rtpL16enc_base_init (GstRtpL16EncClass * klass)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -137,8 +134,10 @@ gst_rtpL16enc_class_init (GstRtpL16EncClass * klass)
|
|||
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);
|
||||
|
@ -155,14 +154,20 @@ gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -41,26 +41,25 @@ enum
|
|||
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);
|
||||
|
@ -103,9 +102,9 @@ gst_rtpgsmparse_base_init (GstRtpGSMParseClass * 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_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);
|
||||
}
|
||||
|
||||
|
@ -133,8 +132,10 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass)
|
|||
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);
|
||||
|
@ -161,10 +162,8 @@ gst_rtpgsm_caps_nego (GstRtpGSMParse *rtpgsmparse)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -45,26 +45,24 @@ enum
|
|||
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)
|
||||
)
|
||||
)
|
||||
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")
|
||||
);
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (src_factory,
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW (
|
||||
"rtp",
|
||||
"application/x-rtp",
|
||||
NULL)
|
||||
)
|
||||
|
||||
static void gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass);
|
||||
static void gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass);
|
||||
|
@ -74,7 +72,7 @@ static void gst_rtpgsmenc_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
|
@ -107,9 +105,9 @@ gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -133,8 +131,10 @@ gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass)
|
|||
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);
|
||||
|
@ -150,13 +150,18 @@ gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -41,26 +41,25 @@ enum
|
|||
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);
|
||||
|
@ -103,9 +102,9 @@ gst_rtpgsmparse_base_init (GstRtpGSMParseClass * 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_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);
|
||||
}
|
||||
|
||||
|
@ -133,8 +132,10 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass)
|
|||
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);
|
||||
|
@ -161,10 +162,8 @@ gst_rtpgsm_caps_nego (GstRtpGSMParse *rtpgsmparse)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -45,26 +45,24 @@ enum
|
|||
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)
|
||||
)
|
||||
)
|
||||
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")
|
||||
);
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (src_factory,
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW (
|
||||
"rtp",
|
||||
"application/x-rtp",
|
||||
NULL)
|
||||
)
|
||||
|
||||
static void gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass);
|
||||
static void gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass);
|
||||
|
@ -74,7 +72,7 @@ static void gst_rtpgsmenc_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
|
@ -107,9 +105,9 @@ gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -133,8 +131,10 @@ gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass)
|
|||
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);
|
||||
|
@ -150,13 +150,18 @@ gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -33,41 +33,35 @@ static GstElementDetails smpte_details = {
|
|||
"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 */
|
||||
|
@ -158,11 +152,11 @@ gst_smpte_base_init (GstSMPTEClass *klass)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -236,40 +230,42 @@ gst_smpte_update_mask (GstSMPTE *smpte, gint type, gint depth, gint width, gint
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -366,16 +362,15 @@ gst_smpte_loop (GstElement *element)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ struct _GstSMPTE {
|
|||
gint format;
|
||||
gint width;
|
||||
gint height;
|
||||
gfloat fps;
|
||||
gdouble fps;
|
||||
|
||||
gint duration;
|
||||
gint position;
|
||||
|
|
|
@ -150,7 +150,7 @@ gst_udpsink_class_init (GstUDPSink *klass)
|
|||
|
||||
|
||||
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;
|
||||
|
@ -251,7 +251,7 @@ gst_udpsink_init (GstUDPSink *udpsink)
|
|||
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;
|
||||
|
|
|
@ -48,7 +48,7 @@ struct _GstVideoCrop {
|
|||
|
||||
/* caps */
|
||||
gint width, height;
|
||||
gfloat fps;
|
||||
gdouble fps;
|
||||
gint crop_left, crop_right, crop_top, crop_bottom;
|
||||
};
|
||||
|
||||
|
@ -80,29 +80,21 @@ enum {
|
|||
/* 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);
|
||||
|
@ -115,7 +107,7 @@ static void gst_video_crop_get_property (GObject *object, guint prop_id,
|
|||
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
|
||||
|
@ -155,9 +147,9 @@ gst_video_crop_base_init (gpointer g_class)
|
|||
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)
|
||||
|
@ -194,13 +186,13 @@ gst_video_crop_init (GstVideoCrop *video_crop)
|
|||
{
|
||||
/* 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;
|
||||
|
@ -270,19 +262,18 @@ gst_video_crop_get_property (GObject *object, guint prop_id, GValue *value, GPar
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -380,22 +371,6 @@ gst_video_crop_chain (GstPad *pad, GstData *_data)
|
|||
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);
|
||||
|
||||
|
|
|
@ -107,10 +107,10 @@ static void gst_videofilter_class_init (gpointer g_class, gpointer class_data)
|
|||
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;
|
||||
|
@ -118,79 +118,48 @@ static GstCaps *gst_videofilter_format_get_caps(GstVideofilterFormat *format)
|
|||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
GstCaps *caps;
|
||||
GstStructure *structure;
|
||||
int i;
|
||||
|
||||
caps = gst_caps_new_empty();
|
||||
for(i=0;i<klass->formats->len;i++){
|
||||
structure = gst_videofilter_format_get_structure(g_ptr_array_index(klass->formats,i));
|
||||
gst_caps_append_structure (caps, structure);
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
GstCaps * gst_videofilter_class_get_capslist(GstVideofilterClass *klass)
|
||||
{
|
||||
static GstCaps *capslist = NULL;
|
||||
GstCaps *caps;
|
||||
int i;
|
||||
|
||||
if (capslist){
|
||||
gst_caps_ref(capslist);
|
||||
return capslist;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -207,115 +176,81 @@ gst_videofilter_sink_getcaps (GstPad *pad, GstCaps *caps)
|
|||
/* 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);
|
||||
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);
|
||||
|
||||
if (!ret) return GST_PAD_LINK_REFUSED;
|
||||
|
||||
GST_DEBUG("width %d height %d",videofilter->to_width,videofilter->to_height);
|
||||
|
||||
peercaps = gst_caps_copy(caps);
|
||||
gst_videofilter_setup(videofilter);
|
||||
|
||||
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);
|
||||
|
||||
gst_caps_unref(peercaps);
|
||||
|
||||
if(ret==GST_PAD_LINK_OK){
|
||||
caps = gst_pad_get_caps (videofilter->srcpad);
|
||||
|
||||
gst_caps_get_int (caps, "width", &videofilter->from_width);
|
||||
gst_caps_get_int (caps, "height", &videofilter->from_height);
|
||||
//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);
|
||||
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);
|
||||
|
||||
if (!ret) return GST_PAD_LINK_REFUSED;
|
||||
|
||||
GST_DEBUG("width %d height %d",videofilter->from_width,videofilter->from_height);
|
||||
|
||||
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));
|
||||
|
||||
GST_DEBUG("setting %s\n",gst_caps_to_string(peercaps));
|
||||
|
||||
ret = gst_pad_try_set_caps (videofilter->srcpad, peercaps);
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -457,6 +392,7 @@ void gst_videofilter_set_output_size(GstVideofilter *videofilter,
|
|||
{
|
||||
int ret;
|
||||
GstCaps *srccaps;
|
||||
GstStructure *structure;
|
||||
|
||||
g_return_if_fail(GST_IS_VIDEOFILTER(videofilter));
|
||||
|
||||
|
@ -467,18 +403,16 @@ void gst_videofilter_set_output_size(GstVideofilter *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)
|
||||
|
@ -513,12 +447,13 @@ 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));
|
||||
|
||||
|
@ -526,15 +461,16 @@ GstVideofilterFormat *gst_videofilter_find_format_by_caps(GstVideofilter *videof
|
|||
|
||||
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(c){
|
||||
if(gst_caps_is_always_compatible(caps, c)){
|
||||
gst_caps_unref(c);
|
||||
return 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 (ret) return format;
|
||||
}
|
||||
gst_caps_unref(c);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -548,17 +484,15 @@ void gst_videofilter_class_add_format(GstVideofilterClass *videofilterclass,
|
|||
|
||||
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
|
||||
|
|
|
@ -75,7 +75,7 @@ struct _GstVideofilter {
|
|||
/* private */
|
||||
gint from_buf_size;
|
||||
gint to_buf_size;
|
||||
gfloat framerate;
|
||||
gdouble framerate;
|
||||
|
||||
GstBuffer *in_buf;
|
||||
GstBuffer *out_buf;
|
||||
|
@ -95,7 +95,7 @@ int gst_videofilter_get_input_height(GstVideofilter *videofilter);
|
|||
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,
|
||||
|
|
|
@ -57,6 +57,7 @@ static void gst_videoflip_get_property (GObject *object, guint prop_id, GValue
|
|||
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())
|
||||
|
@ -86,38 +87,28 @@ gst_videoflip_method_get_type(void)
|
|||
static GstPadTemplate *
|
||||
gst_videoflip_src_template_factory(void)
|
||||
{
|
||||
static GstPadTemplate *templ = NULL;
|
||||
/* 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 ]");
|
||||
|
||||
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));
|
||||
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;
|
||||
GstCaps *caps = gst_caps_from_string ("video/x-raw-yuv, "
|
||||
"width = (int) [ 0, MAX ], "
|
||||
"height = (int) [ 0, MAX ], "
|
||||
"framerate = (double) [ 0, MAX ]");
|
||||
|
||||
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));
|
||||
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
|
||||
|
@ -149,8 +140,10 @@ gst_videoflip_base_init (gpointer g_class)
|
|||
|
||||
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)
|
||||
|
@ -176,34 +169,30 @@ 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 */
|
||||
|
@ -218,111 +207,70 @@ gst_videoflip_sink_getcaps (GstPad *pad, GstCaps *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);
|
||||
ret = gst_structure_get_int (structure, "width", &videoflip->to_width);
|
||||
ret &= gst_structure_get_int (structure, "height", &videoflip->to_height);
|
||||
|
||||
GST_DEBUG ("width %d height %d",videoflip->to_width,videoflip->to_height);
|
||||
if (!ret) return GST_PAD_LINK_REFUSED;
|
||||
|
||||
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 (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);
|
||||
ret = gst_structure_get_int (structure, "width", &videoflip->from_width);
|
||||
ret &= gst_structure_get_int (structure, "height", &videoflip->from_height);
|
||||
|
||||
gst_videoflip_setup(videoflip);
|
||||
if (!ret) return GST_PAD_LINK_REFUSED;
|
||||
|
||||
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_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);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -330,7 +278,7 @@ gst_videoflip_init (GstVideoflip *videoflip)
|
|||
{
|
||||
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);
|
||||
|
@ -338,7 +286,7 @@ gst_videoflip_init (GstVideoflip *videoflip)
|
|||
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);
|
||||
|
|
|
@ -43,11 +43,11 @@ struct videoflip_format_struct videoflip_formats[] = {
|
|||
|
||||
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;
|
||||
|
@ -55,40 +55,40 @@ videoflip_get_caps(struct videoflip_format_struct *format)
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ struct videoflip_format_struct {
|
|||
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
|
||||
|
|
|
@ -78,42 +78,31 @@ static GstElementDetails gst_wavenc_details = GST_ELEMENT_DETAILS (
|
|||
|
||||
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;
|
||||
|
@ -174,10 +163,6 @@ set_property (GObject *object,
|
|||
enc = GST_WAVENC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_METADATA:
|
||||
enc->metadata = g_value_get_boxed (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -190,32 +175,24 @@ gst_wavenc_base_init (gpointer g_class)
|
|||
|
||||
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
|
||||
|
@ -264,20 +241,18 @@ gst_wavenc_setup (GstWavEnc *wavenc)
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -318,9 +293,8 @@ gst_wavenc_init (GstWavEnc *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 {
|
||||
|
@ -344,6 +318,7 @@ struct _maps {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#if 0
|
||||
static guint32
|
||||
get_id_from_name (const char *name)
|
||||
{
|
||||
|
@ -598,6 +573,7 @@ write_labels (GstWavEnc *wavenc)
|
|||
gst_pad_push (wavenc->srcpad, GST_DATA (buf));
|
||||
g_string_free (info_str, FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gst_wavenc_chain (GstPad *pad,
|
||||
|
@ -618,12 +594,14 @@ 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,
|
||||
|
|
|
@ -57,9 +57,6 @@ struct _GstWavEnc {
|
|||
|
||||
gboolean setup, flush_header, pad_eos;
|
||||
guchar header[WAV_HEADER_LEN];
|
||||
|
||||
/* Metadata */
|
||||
GstCaps *metadata;
|
||||
};
|
||||
|
||||
struct _GstWavEncClass {
|
||||
|
|
|
@ -60,61 +60,62 @@ static GstElementDetails gst_wavparse_details = GST_ELEMENT_DETAILS (
|
|||
"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 {
|
||||
|
@ -124,7 +125,6 @@ enum {
|
|||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_METADATA
|
||||
};
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
@ -161,8 +161,8 @@ gst_wavparse_base_init (gpointer g_class)
|
|||
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)
|
||||
|
@ -177,21 +177,13 @@ 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);
|
||||
|
@ -201,7 +193,7 @@ gst_wavparse_init (GstWavParse *wavparse)
|
|||
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);
|
||||
|
@ -217,14 +209,6 @@ gst_wavparse_init (GstWavParse *wavparse)
|
|||
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
|
||||
|
@ -238,15 +222,12 @@ gst_wavparse_get_property (GObject *object,
|
|||
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)
|
||||
|
@ -310,8 +291,8 @@ gst_wavparse_parse_adtl (GstWavParse *wavparse,
|
|||
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)) {
|
||||
|
@ -362,9 +343,9 @@ gst_wavparse_parse_adtl (GstWavParse *wavparse,
|
|||
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)) {
|
||||
|
@ -405,8 +386,8 @@ gst_wavparse_parse_adtl (GstWavParse *wavparse,
|
|||
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)) {
|
||||
|
@ -536,7 +517,7 @@ gst_wavparse_parse_info (GstWavParse *wavparse,
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
@ -595,8 +576,8 @@ gst_wavparse_parse_cues (GstWavParse *wavparse,
|
|||
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);
|
||||
}
|
||||
|
@ -640,36 +621,33 @@ gst_wavparse_parse_fmt (GstWavParse *wavparse)
|
|||
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;
|
||||
|
||||
|
@ -687,6 +665,7 @@ gst_wavparse_parse_fmt (GstWavParse *wavparse)
|
|||
wavparse->rate, wavparse->channels);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
gst_wavparse_handle_sink_event (GstWavParse *wavparse)
|
||||
|
@ -853,32 +832,34 @@ gst_wavparse_loop (GstElement *element)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1108,7 +1089,6 @@ gst_wavparse_change_state (GstElement *element)
|
|||
wavparse->bps = 0;
|
||||
wavparse->seek_pending = FALSE;
|
||||
wavparse->seek_offset = 0;
|
||||
gst_caps_replace (&wavparse->metadata, NULL);
|
||||
|
||||
break;
|
||||
case GST_STATE_READY_TO_NULL:
|
||||
|
|
|
@ -77,8 +77,6 @@ struct _GstWavParse {
|
|||
guint64 seek_offset;
|
||||
|
||||
GstBuffer *buf;
|
||||
|
||||
GstCaps *metadata;
|
||||
};
|
||||
|
||||
struct _GstWavParseClass {
|
||||
|
|
|
@ -486,19 +486,22 @@ gst_ossformat_get (gint law, gint endianness, gboolean sign, gint width, gint de
|
|||
}
|
||||
|
||||
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))
|
||||
|
@ -507,8 +510,8 @@ gst_osselement_parse_caps (GstOssElement *oss, GstCaps *caps)
|
|||
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;
|
||||
|
@ -519,25 +522,28 @@ gst_osselement_parse_caps (GstOssElement *oss, GstCaps *caps)
|
|||
#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))
|
||||
|
@ -545,8 +551,8 @@ gst_osselement_merge_fixed_caps (GstOssElement *oss, GstCaps *caps)
|
|||
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;
|
||||
|
|
|
@ -101,9 +101,9 @@ GType gst_osselement_get_type (void);
|
|||
|
||||
/* 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);
|
||||
|
|
|
@ -58,7 +58,7 @@ static gboolean gst_osssink_query (GstElement *element, GstQueryType type,
|
|||
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);
|
||||
|
@ -83,28 +83,18 @@ enum {
|
|||
/* 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 ]"
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -134,20 +124,6 @@ gst_osssink_get_type (void)
|
|||
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)
|
||||
{
|
||||
|
@ -164,7 +140,7 @@ gst_osssink_base_init (gpointer g_class)
|
|||
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)
|
||||
|
@ -214,10 +190,9 @@ static void
|
|||
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);
|
||||
|
@ -230,7 +205,6 @@ gst_osssink_init (GstOssSink *osssink)
|
|||
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;
|
||||
|
@ -241,13 +215,10 @@ gst_osssink_init (GstOssSink *osssink)
|
|||
|
||||
|
||||
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;
|
||||
|
||||
|
@ -529,7 +500,6 @@ gst_osssink_set_property (GObject *object, guint prop_id, const GValue *value, G
|
|||
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:
|
||||
|
|
|
@ -56,7 +56,6 @@ struct _GstOssSink {
|
|||
GstOssElement element;
|
||||
|
||||
GstPad *sinkpad;
|
||||
GstBufferPool *sinkpool;
|
||||
|
||||
GstClock *provided_clock;
|
||||
GstClock *clock;
|
||||
|
|
|
@ -57,37 +57,27 @@ enum {
|
|||
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,
|
||||
|
@ -143,7 +133,7 @@ gst_osssrc_base_init (gpointer g_class)
|
|||
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)
|
||||
|
@ -179,7 +169,7 @@ static void
|
|||
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);
|
||||
|
@ -212,15 +202,12 @@ gst_osssrc_dispose (GObject *object)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -248,17 +235,14 @@ gst_osssrc_negotiate (GstPad *pad)
|
|||
|
||||
/* 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;
|
||||
|
|
|
@ -62,29 +62,25 @@ static void gst_v4l2src_base_init (GstV4l2SrcClass *klass);
|
|||
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);
|
||||
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);
|
||||
/* 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,
|
||||
|
@ -104,16 +100,6 @@ static GstElementStateReturn
|
|||
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;
|
||||
|
@ -240,12 +226,6 @@ gst_v4l2src_init (GstV4l2Src *v4l2src)
|
|||
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;
|
||||
|
@ -386,21 +366,16 @@ gst_v4l2src_src_query (GstPad *pad,
|
|||
}
|
||||
|
||||
|
||||
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:
|
||||
|
@ -488,15 +463,14 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
|
|||
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 */
|
||||
|
@ -527,10 +501,9 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
|
|||
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:
|
||||
|
@ -550,26 +523,24 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
|
|||
}
|
||||
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) \
|
||||
|
@ -594,19 +565,19 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
|
|||
|
||||
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'):
|
||||
|
@ -628,8 +599,8 @@ gst_v4l2_caps_to_v4l2fourcc (GstV4l2Src *v4l2src,
|
|||
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:
|
||||
|
@ -721,17 +692,19 @@ gst_v4l2_caps_to_v4l2fourcc (GstV4l2Src *v4l2src,
|
|||
|
||||
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)) {
|
||||
|
@ -741,52 +714,18 @@ gst_v4l2src_srcconnect (GstPad *pad,
|
|||
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;
|
||||
gst_structure_get_int (structure, "width", &w);
|
||||
gst_structure_get_int (structure, "height", &h);
|
||||
|
||||
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;
|
||||
}
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -795,11 +734,10 @@ gst_v4l2src_srcconnect (GstPad *pad,
|
|||
|
||||
|
||||
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;
|
||||
|
@ -809,7 +747,10 @@ gst_v4l2src_getcaps (GstPad *pad,
|
|||
}
|
||||
|
||||
/* 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 */
|
||||
|
@ -820,15 +761,19 @@ gst_v4l2src_getcaps (GstPad *pad,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -848,13 +793,6 @@ gst_v4l2src_get (GstPad *pad)
|
|||
(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;
|
||||
|
@ -929,8 +867,10 @@ gst_v4l2src_get (GstPad *pad)
|
|||
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 */
|
||||
|
@ -1074,6 +1014,7 @@ gst_v4l2src_set_clock (GstElement *element,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static GstBuffer*
|
||||
gst_v4l2src_buffer_new (GstBufferPool *pool,
|
||||
guint64 offset,
|
||||
|
@ -1097,8 +1038,9 @@ gst_v4l2src_buffer_new (GstBufferPool *pool,
|
|||
|
||||
return buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
static void
|
||||
gst_v4l2src_buffer_free (GstBufferPool *pool,
|
||||
GstBuffer *buf,
|
||||
|
@ -1126,3 +1068,5 @@ gst_v4l2src_buffer_free (GstBufferPool *pool,
|
|||
/* free the buffer itself */
|
||||
gst_buffer_default_free(buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -80,9 +80,6 @@ struct _GstV4l2Src {
|
|||
|
||||
/* how are we going to push buffers? */
|
||||
gboolean use_fixed_fps;
|
||||
|
||||
/* bufferpool for the buffers we're gonna use */
|
||||
GstBufferPool *bufferpool;
|
||||
};
|
||||
|
||||
struct _GstV4l2SrcClass {
|
||||
|
|
Loading…
Reference in a new issue