diff options
Diffstat (limited to 'gst')
-rw-r--r-- | gst/chart/gstchart.c | 88 | ||||
-rw-r--r-- | gst/deinterlace/gstdeinterlace.c | 51 | ||||
-rw-r--r-- | gst/flx/gstflxdec.c | 177 | ||||
-rw-r--r-- | gst/flx/gstflxdec.h | 19 | ||||
-rw-r--r-- | gst/mpeg1videoparse/gstmp1videoparse.c | 2 | ||||
-rw-r--r-- | gst/mpegaudioparse/gstmpegaudioparse.c | 1 | ||||
-rw-r--r-- | gst/passthrough/gstpassthrough.c | 6 | ||||
-rw-r--r-- | gst/playondemand/gstplayondemand.c | 6 | ||||
-rw-r--r-- | gst/smooth/gstsmooth.c | 35 | ||||
-rw-r--r-- | gst/speed/gstspeed.c | 6 | ||||
-rw-r--r-- | gst/y4m/gsty4mencode.c | 11 |
11 files changed, 212 insertions, 190 deletions
diff --git a/gst/chart/gstchart.c b/gst/chart/gstchart.c index 1ec25970..a08c475d 100644 --- a/gst/chart/gstchart.c +++ b/gst/chart/gstchart.c @@ -44,6 +44,7 @@ struct _GstChart { gint depth; gint width; gint height; + gboolean first_buffer; gint samplerate; gint framerate; // desired frame rate @@ -162,10 +163,10 @@ static void gst_chart_get_property (GObject *object, guint prop_id, GValue *valu static void gst_chart_chain (GstPad *pad, GstBuffer *buf); -static GstElementClass *parent_class = NULL; +static GstPadConnectReturn + gst_chart_sinkconnect (GstPad *pad, GstCaps *caps); -static void gst_chart_newsinkcaps (GstPad *pad, GstCaps *caps); -static void gst_chart_newsrccaps (GstPad *pad, GstCaps *caps); +static GstElementClass *parent_class = NULL; GType gst_chart_get_type (void) @@ -211,9 +212,7 @@ gst_chart_init (GstChart *chart) gst_element_add_pad (GST_ELEMENT (chart), chart->srcpad); gst_pad_set_chain_function (chart->sinkpad, gst_chart_chain); - gst_pad_set_newcaps_function (chart->sinkpad, gst_chart_newsinkcaps); - gst_pad_set_newcaps_function (chart->srcpad, gst_chart_newsrccaps); - + gst_pad_set_connect_function (chart->sinkpad, gst_chart_sinkconnect); chart->next_time = 0; chart->peerpool = NULL; @@ -221,8 +220,9 @@ gst_chart_init (GstChart *chart) // reset the initial video state chart->bpp = 16; chart->depth = 16; - chart->width = -1; - chart->height = -1; + chart->first_buffer = TRUE; + chart->width = 256; + chart->height = 128; chart->samplerate = -1; chart->framerate = 25; // desired frame rate @@ -230,8 +230,8 @@ gst_chart_init (GstChart *chart) chart->samples_since_last_frame = 0; } -static void -gst_chart_newsinkcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_chart_sinkconnect (GstPad *pad, GstCaps *caps) { GstChart *chart; chart = GST_CHART (gst_pad_get_parent (pad)); @@ -242,22 +242,8 @@ gst_chart_newsinkcaps (GstPad *pad, GstCaps *caps) GST_DEBUG (0, "CHART: new sink caps: rate %d\n", chart->samplerate); //gst_chart_sync_parms (chart); -} - -static void -gst_chart_newsrccaps (GstPad *pad, GstCaps *caps) -{ - GstChart *chart; - chart = GST_CHART (gst_pad_get_parent (pad)); - - chart->bpp = gst_caps_get_int (caps, "bpp"); - chart->depth = gst_caps_get_int (caps, "depth"); - chart->width = gst_caps_get_int (caps, "width"); - chart->height = gst_caps_get_int (caps, "height"); - - GST_DEBUG (0, "CHART: new src caps: bpp %d, depth %d, width %d, height %d\n", - chart->bpp, chart->depth, chart->width, chart->height); - //gst_chart_sync_parms (chart); + // + return GST_PAD_CONNECT_OK; } static void @@ -347,28 +333,6 @@ gst_chart_chain (GstPad *pad, GstBuffer *bufin) if (chart->samples_between_frames <= chart->samples_since_last_frame) { chart->samples_since_last_frame = 0; - // Check if we need to renegotiate size. - if (chart->width == -1 || chart->height == -1) { - chart->width = 256; - chart->height = 128; - GST_DEBUG (0, "making new pad\n"); - gst_pad_set_caps (chart->srcpad, - gst_caps_new ( - "chartsrc", - "video/raw", - gst_props_new ( - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R','G','B',' ')), - "bpp", GST_PROPS_INT (chart->bpp), - "depth", GST_PROPS_INT (chart->depth), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "red_mask", GST_PROPS_INT (0xf800), - "green_mask", GST_PROPS_INT (0x07e0), - "blue_mask", GST_PROPS_INT (0x001f), - "width", GST_PROPS_INT (chart->width), - "height", GST_PROPS_INT (chart->height), - NULL))); - } - // get data to draw into buffer if (samples_in >= chart->width) { // make a new buffer for the output @@ -384,9 +348,35 @@ gst_chart_chain (GstPad *pad, GstBuffer *bufin) // FIXME: call different routines for different properties draw_chart_16bpp(dataout, chart->width, chart->height, (gint16 *)datain, samples_in); + gst_buffer_unref(bufin); + // set timestamp GST_BUFFER_TIMESTAMP (bufout) = chart->next_time; + // Check if we need to renegotiate size. + if (chart->first_buffer) { + GST_DEBUG (0, "making new pad\n"); + if (!gst_pad_try_set_caps (chart->srcpad, + GST_CAPS_NEW ( + "chartsrc", + "video/raw", + "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R','G','B',' ')), + "bpp", GST_PROPS_INT (chart->bpp), + "depth", GST_PROPS_INT (chart->depth), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "red_mask", GST_PROPS_INT (0xf800), + "green_mask", GST_PROPS_INT (0x07e0), + "blue_mask", GST_PROPS_INT (0x001f), + "width", GST_PROPS_INT (chart->width), + "height", GST_PROPS_INT (chart->height) + ))) + { + gst_element_error (GST_ELEMENT (chart), "could not set caps"); + return; + } + chart->first_buffer = FALSE; + } + GST_DEBUG (0, "CHART: outputting buffer\n"); // output buffer GST_BUFFER_FLAG_SET (bufout, GST_BUFFER_READONLY); @@ -394,9 +384,9 @@ gst_chart_chain (GstPad *pad, GstBuffer *bufin) } } else { GST_DEBUG (0, "CHART: skipping buffer\n"); + gst_buffer_unref(bufin); } - gst_buffer_unref(bufin); GST_DEBUG (0, "CHART: exiting chainfunc\n"); } diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 99a70c84..0ad6ea8e 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -54,7 +54,9 @@ GST_PADTEMPLATE_FACTORY (deinterlace_src_factory, GST_CAPS_NEW ( "deinterlace_src", "video/raw", - "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")) + "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")), + "width", GST_PROPS_INT_POSITIVE, + "height", GST_PROPS_INT_POSITIVE ) ) @@ -65,7 +67,9 @@ GST_PADTEMPLATE_FACTORY (deinterlace_sink_factory, GST_CAPS_NEW ( "deinterlace_src", "video/raw", - "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")) + "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")), + "width", GST_PROPS_INT_POSITIVE, + "height", GST_PROPS_INT_POSITIVE ) ) @@ -74,36 +78,16 @@ static GType gst_deinterlace_get_type (void); static void gst_deinterlace_class_init (GstDeInterlaceClass *klass); static void gst_deinterlace_init (GstDeInterlace *filter); -static void gst_deinterlace_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_deinterlace_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_deinterlace_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec); +static void gst_deinterlace_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec); static void gst_deinterlace_chain (GstPad *pad, GstBuffer *buf); static GstElementClass *parent_class = NULL; //static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; -static GstPadNegotiateReturn -deinterlace_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstDeInterlace* filter = GST_DEINTERLACE (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->sinkpad,caps); -} - -static GstPadNegotiateReturn -deinterlace_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstDeInterlace* filter = GST_DEINTERLACE (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->srcpad,caps); -} - static GType gst_deinterlace_get_type(void) { static GType deinterlace_type = 0; @@ -152,12 +136,15 @@ gst_deinterlace_class_init (GstDeInterlaceClass *klass) gobject_class->get_property = gst_deinterlace_get_property; } -static void -gst_deinterlace_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_deinterlace_sinkconnect (GstPad *pad, GstCaps *caps) { GstDeInterlace *filter; filter = GST_DEINTERLACE(gst_pad_get_parent (pad)); + + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; filter->width = gst_caps_get_int (caps, "width"); filter->height = gst_caps_get_int (caps, "height"); @@ -168,19 +155,21 @@ gst_deinterlace_newcaps (GstPad *pad, GstCaps *caps) filter->picsize = filter->width*filter->height; filter->src = g_malloc(filter->picsize); } + if (gst_pad_try_set_caps (filter->srcpad, caps)) { + return GST_PAD_CONNECT_OK; + } + return GST_PAD_CONNECT_REFUSED; } static void gst_deinterlace_init (GstDeInterlace *filter) { filter->sinkpad = gst_pad_new_from_template(deinterlace_sink_factory (),"sink"); - gst_pad_set_negotiate_function(filter->sinkpad,deinterlace_negotiate_sink); gst_pad_set_chain_function(filter->sinkpad,gst_deinterlace_chain); - gst_pad_set_newcaps_function(filter->sinkpad,gst_deinterlace_newcaps); + gst_pad_set_connect_function(filter->sinkpad,gst_deinterlace_sinkconnect); gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); filter->srcpad = gst_pad_new_from_template(deinterlace_src_factory (),"src"); - gst_pad_set_negotiate_function(filter->srcpad,deinterlace_negotiate_src); gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); filter->show_deinterlaced_area_only = FALSE; diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index 5fd5eb23..95e55cc6 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -22,6 +22,8 @@ #include "flx_fmt.h" #include "gstflxdec.h" +#define JIFFIE (1000000/70) + static GstCaps* flxdec_typefind(GstBuffer *buf, gpointer private); /* flx element information */ @@ -89,6 +91,9 @@ static void gst_flxdec_init (GstFlxDec *flxdec); static void gst_flxdec_loop (GstElement *element); +static GstElementStateReturn + gst_flxdec_change_state (GstElement *element); + static void gst_flxdec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_flxdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); @@ -108,10 +113,10 @@ flxdec_typefind (GstBuffer *buf, gpointer private) guchar *data = GST_BUFFER_DATA(buf); GstCaps *new; - // check magic + /* check magic */ if ((data[4] == 0x11 || data[4] == 0x12 || data[4] == 0x30 || data[4] == 0x44) && data[5] == 0xaf) { - // check the frame type of the first frame + /* check the frame type of the first frame */ if ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1) { g_print("GstFlxDec: found supported flx format\n"); new = gst_caps_new("flxdec_typefind","video/fli", NULL); @@ -158,6 +163,7 @@ gst_flxdec_class_init (GstFlxDecClass *klass) gobject_class->set_property = NULL; gobject_class->get_property = NULL; + gstelement_class->change_state = gst_flxdec_change_state; } @@ -175,9 +181,9 @@ gst_flxdec_init(GstFlxDec *flxdec) gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad); flxdec->buf = NULL; - flxdec->offset = 0; - flxdec->new_buf = TRUE; - + flxdec->bs = NULL; + flxdec->frame = NULL; + flxdec->delta = NULL; } static void @@ -428,15 +434,13 @@ flx_get_data(GstFlxDec *flxdec, gulong size) g_return_val_if_fail (flxdec != NULL, NULL); - if (flxdec->new_buf) { - retbuf = gst_pad_pullregion(flxdec->sinkpad, - GST_REGION_OFFSET_LEN, 0, size); - flxdec->new_buf = FALSE; - flxdec->offset = size; - } else { - retbuf = gst_pad_pullregion(flxdec->sinkpad, GST_REGION_OFFSET_LEN, - flxdec->offset, size); - flxdec->offset += size; + retbuf = gst_bytestream_read (flxdec->bs, size); + if (!retbuf) { + GstEvent *event; + guint32 remaining; + + gst_bytestream_get_status (flxdec->bs, &remaining, &event); + gst_pad_event_default (flxdec->sinkpad, event); } return retbuf; @@ -461,33 +465,41 @@ gst_flxdec_loop (GstElement *element) flxdec = GST_FLXDEC(element); - databuf = flx_get_data(flxdec, FlxHeaderSize); - - g_return_if_fail (databuf != NULL); + if (flxdec->state == GST_FLXDEC_READ_HEADER) { + databuf = flx_get_data(flxdec, FlxHeaderSize); - data = GST_BUFFER_DATA(databuf); + data = GST_BUFFER_DATA(databuf); - memcpy((char *) &flxdec->hdr, data, sizeof(FlxHeader)); + memcpy((char *) &flxdec->hdr, data, sizeof(FlxHeader)); - gst_buffer_unref (databuf); + gst_buffer_unref (databuf); - flxh = &flxdec->hdr; + flxh = &flxdec->hdr; - // check header - if (flxh->type != FLX_MAGICHDR_FLI && + /* check header */ + if (flxh->type != FLX_MAGICHDR_FLI && flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) return; - g_print("GstFlxDec: size : %d\n", flxh->size); - g_print("GstFlxDec: frames : %d\n", flxh->frames); - g_print("GstFlxDec: width : %d\n", flxh->width); - g_print("GstFlxDec: height : %d\n", flxh->height); - g_print("GstFlxDec: depth : %d\n", flxh->depth); - g_print("GstFlxDec: speed : %d\n", flxh->speed); - - gst_pad_set_caps (flxdec->srcpad, + g_print("GstFlxDec: size : %d\n", flxh->size); + g_print("GstFlxDec: frames : %d\n", flxh->frames); + g_print("GstFlxDec: width : %d\n", flxh->width); + g_print("GstFlxDec: height : %d\n", flxh->height); + g_print("GstFlxDec: depth : %d\n", flxh->depth); + g_print("GstFlxDec: speed : %d\n", flxh->speed); + + flxdec->next_time = 0; + + if (flxh->type == FLX_MAGICHDR_FLI) { + flxdec->frame_time = JIFFIE * flxh->speed; + } + else { + flxdec->frame_time = flxh->speed * 1000; + } + + gst_pad_try_set_caps (flxdec->srcpad, gst_caps_new ( "src_video", "video/raw", @@ -503,41 +515,37 @@ gst_flxdec_loop (GstElement *element) "height", GST_PROPS_INT (flxh->height), NULL))); - if (flxh->depth <= 8) - flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height); - - if (flxh->type == FLX_MAGICHDR_FLC || - flxh->type == FLX_MAGICHDR_FLX) { - g_print("GstFlxDec: (FLC) aspect_dx : %d\n", - flxh->aspect_dx); - g_print("GstFlxDec: (FLC) aspect_dy : %d\n", - flxh->aspect_dy); - g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", - flxh->oframe1); - g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", - flxh->oframe2); - } + if (flxh->depth <= 8) + flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height); + + if (flxh->type == FLX_MAGICHDR_FLC || + flxh->type == FLX_MAGICHDR_FLX) { + g_print("GstFlxDec: (FLC) aspect_dx : %d\n", flxh->aspect_dx); + g_print("GstFlxDec: (FLC) aspect_dy : %d\n", flxh->aspect_dy); + 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); + flxdec->size = (flxh->width * flxh->height); - // create delta and output frame - flxdec->frame = gst_buffer_new(); - flxdec->delta = gst_buffer_new(); - GST_BUFFER_DATA(flxdec->frame) = g_malloc(flxdec->size); - GST_BUFFER_SIZE(flxdec->frame) = flxdec->size; - GST_BUFFER_DATA(flxdec->delta) = g_malloc(flxdec->size); - GST_BUFFER_SIZE(flxdec->delta) = flxdec->size; - - do - { + /* create delta and output frame */ + flxdec->frame = gst_buffer_new(); + flxdec->delta = gst_buffer_new(); + GST_BUFFER_DATA(flxdec->frame) = g_malloc(flxdec->size); + GST_BUFFER_SIZE(flxdec->frame) = flxdec->size; + GST_BUFFER_DATA(flxdec->delta) = g_malloc(flxdec->size); + GST_BUFFER_SIZE(flxdec->delta) = flxdec->size; + + flxdec->state = GST_FLXDEC_PLAYING; + } + else if (flxdec->state == GST_FLXDEC_PLAYING) { databuf = flx_get_data(flxdec, FlxFrameChunkSize); flxfh = (FlxFrameChunk *) GST_BUFFER_DATA(databuf); - switch(flxfh->id) - { + switch(flxfh->id) { case FLX_FRAME_TYPE: buf = flx_get_data(flxdec, flxfh->size-FlxFrameChunkSize); @@ -546,43 +554,74 @@ gst_flxdec_loop (GstElement *element) if (((FlxFrameType *)chunk)->chunks == 0) break; - // create 32 bits output frame + /* create 32 bits output frame */ flxdec->out = gst_buffer_new(); GST_BUFFER_DATA(flxdec->out) = g_malloc(flxdec->size * 4); GST_BUFFER_SIZE(flxdec->out) = flxdec->size * 4; - // decode chunks + /* decode chunks */ flx_decode_chunks(flxdec, ((FlxFrameType *)chunk)->chunks, GST_BUFFER_DATA(buf) + FlxFrameTypeSize, GST_BUFFER_DATA(flxdec->frame)); - // destroy input buffer + /* destroy input buffer*/ gst_buffer_unref(buf); - // save copy of the current frame for possible delta. + /* save copy of the current frame for possible delta. */ memcpy(GST_BUFFER_DATA(flxdec->delta), GST_BUFFER_DATA(flxdec->frame), GST_BUFFER_SIZE(flxdec->delta)); - // convert current frame. + /* convert current frame. */ flx_colorspace_convert(flxdec->converter, GST_BUFFER_DATA(flxdec->frame), GST_BUFFER_DATA(flxdec->out)); + GST_BUFFER_TIMESTAMP (flxdec->out) = flxdec->next_time; + flxdec->next_time += flxdec->frame_time; + gst_pad_push(flxdec->srcpad, flxdec->out); break; } - // destroy header buffer + /* destroy header buffer */ gst_buffer_unref(databuf); + } +} + +static GstElementStateReturn +gst_flxdec_change_state (GstElement *element) +{ + GstFlxDec *flxdec; + + flxdec = GST_FLXDEC(element); - gst_element_yield (element); + switch (GST_STATE_TRANSITION (element)) { + case GST_STATE_NULL_TO_READY: + flxdec->bs = gst_bytestream_new (flxdec->sinkpad); + break; + case GST_STATE_READY_TO_PAUSED: + flxdec->state = GST_FLXDEC_READ_HEADER; + break; + case GST_STATE_PAUSED_TO_PLAYING: + break; + case GST_STATE_PLAYING_TO_PAUSED: + break; + case GST_STATE_PAUSED_TO_READY: + gst_buffer_unref (flxdec->frame); + gst_buffer_unref (flxdec->delta); + break; + case GST_STATE_READY_TO_NULL: + gst_bytestream_destroy (flxdec->bs); + break; } - while (TRUE); + + parent_class->change_state (element); + return GST_STATE_SUCCESS; } static void @@ -622,6 +661,12 @@ plugin_init (GModule *module, GstPlugin *plugin) GstElementFactory *factory; GstTypeFactory *type; + /* this filter needs the bytestream package */ + if (!gst_library_load("gstbytestream")) { + gst_info("flxdec:: could not load support library: 'gstbytestream'\n"); + return FALSE; + } + factory = gst_elementfactory_new("flxdec", GST_TYPE_FLXDEC, &flxdec_details); g_return_val_if_fail(factory != NULL, FALSE); diff --git a/gst/flx/gstflxdec.h b/gst/flx/gstflxdec.h index cc4c94db..5b06252d 100644 --- a/gst/flx/gstflxdec.h +++ b/gst/flx/gstflxdec.h @@ -23,23 +23,35 @@ #include <gst/gst.h> #include "flx_color.h" +#include <gst/bytestream/bytestream.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +typedef enum { + GST_FLXDEC_READ_HEADER, + GST_FLXDEC_PLAYING, +} GstFlxDecState; + /* Definition of structure storing data for this element. */ typedef struct _GstFlxDec GstFlxDec; + struct _GstFlxDec { GstElement element; GstPad *sinkpad,*srcpad; - gboolean active, new_meta, new_buf; + gboolean active, new_meta; GstBuffer *buf, *out, *delta, *frame; - gulong offset, size; + GstByteStream *bs; + gulong size; + GstFlxDecState state; + glong frame_time; + gint64 next_time; FlxColorSpaceConverter *converter; @@ -64,9 +76,6 @@ struct _GstFlxDecClass { #define GST_IS_FLXDEC_CLASS(obj) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLXDEC)) -#define FLXDEC_BUFSIZE(buf, offset) \ - ((GST_BUFFER_OFFSET(buf) + GST_BUFFER_SIZE(buf)) - offset) - /* Standard function returning type information. */ GType gst_flxdec_get_type(void); diff --git a/gst/mpeg1videoparse/gstmp1videoparse.c b/gst/mpeg1videoparse/gstmp1videoparse.c index 39fdfa29..0d54d27e 100644 --- a/gst/mpeg1videoparse/gstmp1videoparse.c +++ b/gst/mpeg1videoparse/gstmp1videoparse.c @@ -138,12 +138,10 @@ static void gst_mp1videoparse_init (Mp1VideoParse *mp1videoparse) { mp1videoparse->sinkpad = gst_pad_new_from_template (sink_template, "sink"); - gst_pad_set_caps (mp1videoparse->sinkpad, gst_pad_get_padtemplate_caps (mp1videoparse->sinkpad)); gst_element_add_pad(GST_ELEMENT(mp1videoparse),mp1videoparse->sinkpad); gst_pad_set_chain_function(mp1videoparse->sinkpad,gst_mp1videoparse_chain); mp1videoparse->srcpad = gst_pad_new_from_template (src_template, "src"); - gst_pad_set_caps (mp1videoparse->srcpad, gst_pad_get_padtemplate_caps (mp1videoparse->srcpad)); gst_element_add_pad(GST_ELEMENT(mp1videoparse),mp1videoparse->srcpad); mp1videoparse->partialbuf = NULL; diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index 220d6dd2..9e19b319 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -142,7 +142,6 @@ static void gst_mp3parse_init (GstMPEGAudioParse *mp3parse) { mp3parse->sinkpad = gst_pad_new_from_template(sink_temp, "sink"); - //gst_pad_set_caps(mp3parse->sinkpad, gst_pad_get_padtemplate_caps (mp3parse->sinkpad)); gst_element_add_pad(GST_ELEMENT(mp3parse),mp3parse->sinkpad); #if 1 // set this to one to use the old chaining code diff --git a/gst/passthrough/gstpassthrough.c b/gst/passthrough/gstpassthrough.c index 0faa878b..d9f0bac1 100644 --- a/gst/passthrough/gstpassthrough.c +++ b/gst/passthrough/gstpassthrough.c @@ -107,6 +107,7 @@ passthrough_get_bufferpool (GstPad *pad) return gst_pad_get_bufferpool (filter->srcpad); } +/* static GstPadNegotiateReturn passthrough_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { @@ -134,6 +135,7 @@ passthrough_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) return gst_pad_negotiate_proxy(pad,filter->srcpad,caps); } +*/ static gint passthrough_parse_caps (GstPassthrough *filter, GstCaps *caps) @@ -222,10 +224,10 @@ static void passthrough_init (GstPassthrough *filter) { filter->sinkpad = gst_pad_new_from_template(passthrough_sink_factory (),"sink"); - gst_pad_set_negotiate_function(filter->sinkpad,passthrough_negotiate_sink); + //gst_pad_set_negotiate_function(filter->sinkpad,passthrough_negotiate_sink); gst_pad_set_bufferpool_function(filter->sinkpad,passthrough_get_bufferpool); filter->srcpad = gst_pad_new_from_template(passthrough_src_factory (),"src"); - gst_pad_set_negotiate_function(filter->srcpad,passthrough_negotiate_src); + //gst_pad_set_negotiate_function(filter->srcpad,passthrough_negotiate_src); gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); diff --git a/gst/playondemand/gstplayondemand.c b/gst/playondemand/gstplayondemand.c index 2f7ebb08..b3d99846 100644 --- a/gst/playondemand/gstplayondemand.c +++ b/gst/playondemand/gstplayondemand.c @@ -117,6 +117,7 @@ play_on_demand_get_bufferpool (GstPad *pad) return gst_pad_get_bufferpool(filter->srcpad); } +/* static GstPadNegotiateReturn play_on_demand_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { @@ -144,6 +145,7 @@ play_on_demand_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) return gst_pad_negotiate_proxy(pad, filter->srcpad, caps); } +*/ static gint play_on_demand_parse_caps (GstPlayOnDemand *filter, GstCaps *caps) @@ -264,11 +266,11 @@ play_on_demand_init (GstPlayOnDemand *filter) guint i; filter->sinkpad = gst_pad_new_from_template(play_on_demand_sink_factory(), "sink"); - gst_pad_set_negotiate_function(filter->sinkpad, play_on_demand_negotiate_sink); + //gst_pad_set_negotiate_function(filter->sinkpad, play_on_demand_negotiate_sink); gst_pad_set_bufferpool_function(filter->sinkpad, play_on_demand_get_bufferpool); filter->srcpad = gst_pad_new_from_template(play_on_demand_src_factory(), "src"); - gst_pad_set_negotiate_function(filter->srcpad, play_on_demand_negotiate_src); + //gst_pad_set_negotiate_function(filter->srcpad, play_on_demand_negotiate_src); gst_element_add_pad(GST_ELEMENT(filter), filter->sinkpad); gst_element_add_pad(GST_ELEMENT(filter), filter->srcpad); diff --git a/gst/smooth/gstsmooth.c b/gst/smooth/gstsmooth.c index 5f1f507c..ea321940 100644 --- a/gst/smooth/gstsmooth.c +++ b/gst/smooth/gstsmooth.c @@ -80,28 +80,6 @@ static void gst_smooth_get_property (GObject *object, guint prop_id, GValue *val static GstElementClass *parent_class = NULL; //static guint gst_smooth_signals[LAST_SIGNAL] = { 0 }; -static GstPadNegotiateReturn -smooth_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstSmooth* filter = GST_SMOOTH (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy (pad, filter->sinkpad, caps); -} - -static GstPadNegotiateReturn -smooth_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstSmooth* filter = GST_SMOOTH (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy (pad, filter->srcpad, caps); -} - GType gst_smooth_get_type (void) { @@ -149,15 +127,20 @@ gst_smooth_class_init (GstSmoothClass *klass) } -static void -gst_smooth_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_smooth_sinkconnect (GstPad *pad, GstCaps *caps) { GstSmooth *filter; filter = GST_SMOOTH (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + filter->width = gst_caps_get_int (caps, "width"); filter->height = gst_caps_get_int (caps, "height"); + + return GST_PAD_CONNECT_OK; } static void @@ -165,14 +148,12 @@ gst_smooth_init (GstSmooth *smooth) { smooth->sinkpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (smooth_sink_factory), "sink"); - gst_pad_set_negotiate_function (smooth->sinkpad, smooth_negotiate_sink); - gst_pad_set_newcaps_function (smooth->sinkpad, gst_smooth_newcaps); + gst_pad_set_connect_function (smooth->sinkpad, gst_smooth_sinkconnect); gst_pad_set_chain_function (smooth->sinkpad, gst_smooth_chain); gst_element_add_pad (GST_ELEMENT (smooth), smooth->sinkpad); smooth->srcpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (smooth_src_factory), "src"); - gst_pad_set_negotiate_function (smooth->srcpad, smooth_negotiate_src); gst_element_add_pad (GST_ELEMENT (smooth), smooth->srcpad); smooth->active = TRUE; diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c index feca2533..8cf90191 100644 --- a/gst/speed/gstspeed.c +++ b/gst/speed/gstspeed.c @@ -109,6 +109,7 @@ static void speed_loop (GstElement *element); static GstElementClass *parent_class = NULL; //static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; +/* static GstPadNegotiateReturn speed_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { @@ -136,6 +137,7 @@ speed_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) return gst_pad_negotiate_proxy(pad,filter->srcpad,caps); } +*/ static gint speed_parse_caps (GstSpeed *filter, GstCaps *caps) @@ -228,10 +230,10 @@ static void speed_init (GstSpeed *filter) { filter->sinkpad = gst_pad_new_from_template(speed_sink_factory (),"sink"); - gst_pad_set_negotiate_function(filter->sinkpad,speed_negotiate_sink); + //gst_pad_set_negotiate_function(filter->sinkpad,speed_negotiate_sink); gst_pad_set_bufferpool_function (filter->sinkpad, speed_sink_get_bufferpool); filter->srcpad = gst_pad_new_from_template(speed_src_factory (),"src"); - gst_pad_set_negotiate_function(filter->srcpad,speed_negotiate_src); + //gst_pad_set_negotiate_function(filter->srcpad,speed_negotiate_src); gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); diff --git a/gst/y4m/gsty4mencode.c b/gst/y4m/gsty4mencode.c index 69fc58dc..ac82d65a 100644 --- a/gst/y4m/gsty4mencode.c +++ b/gst/y4m/gsty4mencode.c @@ -115,15 +115,20 @@ gst_lavencode_class_init (GstLavEncodeClass *klass) gobject_class->get_property = gst_lavencode_get_property; } -static void -gst_lavencode_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_lavencode_sinkconnect (GstPad *pad, GstCaps *caps) { GstLavEncode *filter; filter = GST_LAVENCODE (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + filter->width = gst_caps_get_int (caps, "width"); filter->height = gst_caps_get_int (caps, "height"); + + return GST_PAD_CONNECT_OK; } static void @@ -133,7 +138,7 @@ gst_lavencode_init (GstLavEncode *filter) GST_PADTEMPLATE_GET (lavencode_sink_factory), "sink"); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); gst_pad_set_chain_function (filter->sinkpad, gst_lavencode_chain); - gst_pad_set_newcaps_function (filter->sinkpad, gst_lavencode_newcaps); + gst_pad_set_connect_function (filter->sinkpad, gst_lavencode_sinkconnect); filter->srcpad = gst_pad_new_from_template( GST_PADTEMPLATE_GET (lavencode_src_factory), "src"); |