diff options
author | David Schleef <ds@schleef.org> | 2003-12-18 08:38:33 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-12-18 08:38:33 +0000 |
commit | c81f7168ebb8726b84724b4f4a78c25257f8f4eb (patch) | |
tree | 2d99d3e52f894a000f364b31b87973668318bc7d | |
parent | 2c881e47e58db20895b652b141582561f69bf0e2 (diff) |
Merge HEAD from CAPS-ROOT to CAPS-MERGE-3
Original commit message from CVS:
Merge HEAD from CAPS-ROOT to CAPS-MERGE-3
-rw-r--r-- | gst-libs/gst/video/gstvideofilter.c | 1 | ||||
-rw-r--r-- | gst/adder/gstadder.c | 37 | ||||
-rw-r--r-- | gst/audioconvert/gstaudioconvert.c | 1 | ||||
-rw-r--r-- | gst/audioscale/gstaudioscale.c | 1 | ||||
-rw-r--r-- | gst/sine/gstsinesrc.c | 144 | ||||
-rw-r--r-- | gst/sine/gstsinesrc.h | 17 | ||||
-rw-r--r-- | gst/tags/Makefile.am | 5 | ||||
-rw-r--r-- | gst/tags/gstid3tag.c | 9 | ||||
-rw-r--r-- | gst/tags/gsttagediting.c | 1 | ||||
-rw-r--r-- | gst/tags/gsttagediting.h | 62 | ||||
-rw-r--r-- | gst/tags/gsttageditingprivate.h | 2 | ||||
-rw-r--r-- | gst/tags/gstvorbistag.c | 2 | ||||
-rw-r--r-- | gst/tcp/gsttcp.c | 1 | ||||
-rw-r--r-- | gst/tcp/gsttcpplugin.c | 1 | ||||
-rw-r--r-- | gst/typefind/gsttypefindfunctions.c | 1 | ||||
-rw-r--r-- | gst/videoscale/gstvideoscale.c | 1 | ||||
-rw-r--r-- | gst/videotestsrc/gstvideotestsrc.c | 64 | ||||
-rw-r--r-- | gst/volume/gstvolume.c | 1 | ||||
-rw-r--r-- | sys/v4l/gstv4l.c | 1 | ||||
-rw-r--r-- | sys/v4l/gstv4lelement.c | 8 | ||||
-rw-r--r-- | sys/ximage/ximagesink.c | 36 | ||||
-rw-r--r-- | sys/xvimage/xvimagesink.c | 40 | ||||
-rw-r--r-- | sys/xvimage/xvimagesink.h | 2 |
23 files changed, 247 insertions, 191 deletions
diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c index 64d2fd50e..4597f5ed5 100644 --- a/gst-libs/gst/video/gstvideofilter.c +++ b/gst-libs/gst/video/gstvideofilter.c @@ -509,7 +509,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index b41bca993..72dce369c 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -236,24 +236,24 @@ gst_adder_link (GstPad *pad, const GstCaps2 *caps) remove = g_list_prepend (remove, p); } } - sinkpads = g_list_next (sinkpads); - } - while (remove) { - gst_element_remove_pad (GST_ELEMENT (adder), - GST_PAD_CAST (remove->data)); - restart: - channels = adder->input_channels; - while (channels) { - GstAdderInputChannel *channel; - channel = (GstAdderInputChannel*) channels->data; - if (channel->sinkpad == GST_PAD_CAST (remove->data)) { - gst_bytestream_destroy (channel->bytestream); - adder->input_channels = - g_slist_remove_link (adder->input_channels, channels); - adder->numsinkpads--; - goto restart; - } - channels = g_slist_next (channels); + while (remove) { + gst_element_remove_pad (GST_ELEMENT (adder), + GST_PAD (remove->data)); + restart: + channels = adder->input_channels; + while (channels) { + GstAdderInputChannel *channel; + channel = (GstAdderInputChannel*) channels->data; + if (channel->sinkpad == GST_PAD (remove->data)) { + gst_bytestream_destroy (channel->bytestream); + adder->input_channels = + g_slist_remove_link (adder->input_channels, channels); + adder->numsinkpads--; + goto restart; + } + channels = g_slist_next (channels); + } + remove = g_list_next (remove); } remove = g_list_next (remove); } @@ -617,7 +617,6 @@ GST_PLUGIN_DEFINE( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index 073f79e91..22ca3bf15 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -741,6 +741,5 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN) diff --git a/gst/audioscale/gstaudioscale.c b/gst/audioscale/gstaudioscale.c index 69a5b633d..9f6626e52 100644 --- a/gst/audioscale/gstaudioscale.c +++ b/gst/audioscale/gstaudioscale.c @@ -403,7 +403,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/sine/gstsinesrc.c b/gst/sine/gstsinesrc.c index bd61fad02..abbcffc96 100644 --- a/gst/sine/gstsinesrc.c +++ b/gst/sine/gstsinesrc.c @@ -80,20 +80,26 @@ static void gst_sinesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -/*static gboolean gst_sinesrc_change_state(GstElement *element, */ -/* GstElementState state); */ -/*static void gst_sinesrc_close_audio(GstSineSrc *src); */ -/*static gboolean gst_sinesrc_open_audio(GstSineSrc *src); */ +static GstPadLinkReturn + gst_sinesrc_link (GstPad *pad, + const GstCaps2 *caps); +static GstElementStateReturn + gst_sinesrc_change_state (GstElement *element); static void gst_sinesrc_update_freq (const GValue *value, gpointer data); static void gst_sinesrc_populate_sinetable (GstSineSrc *src); static inline void gst_sinesrc_update_table_inc (GstSineSrc *src); -static gboolean gst_sinesrc_force_caps (GstSineSrc *src); + +static const GstQueryType * + gst_sinesrc_get_query_types (GstPad *pad); +static gboolean gst_sinesrc_src_query (GstPad *pad, + GstQueryType type, + GstFormat *format, + gint64 *value); static GstData* gst_sinesrc_get (GstPad *pad); static GstCaps2 * gst_sinesrc_src_fixate (GstPad *pad, const GstCaps2 *caps, gpointer user_data); -static GstPadLinkReturn gst_sinesrc_src_link (GstPad *pad, const GstCaps2 *caps); static GstElementClass *parent_class = NULL; /*static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 }; */ @@ -156,7 +162,7 @@ gst_sinesrc_class_init (GstSineSrcClass *klass) gobject_class->set_property = gst_sinesrc_set_property; gobject_class->get_property = gst_sinesrc_get_property; -/* gstelement_class->change_state = gst_sinesrc_change_state; */ + gstelement_class->change_state = gst_sinesrc_change_state; } static void @@ -164,22 +170,24 @@ gst_sinesrc_init (GstSineSrc *src) { src->srcpad = gst_pad_new_from_template ( gst_static_pad_template_get (&gst_sinesrc_src_template), "src"); - gst_pad_set_link_function (src->srcpad, gst_sinesrc_src_link); + gst_pad_set_link_function (src->srcpad, gst_sinesrc_link); gst_pad_set_fixate_function (src->srcpad, gst_sinesrc_src_fixate); gst_element_add_pad (GST_ELEMENT(src), src->srcpad); gst_pad_set_get_function (src->srcpad, gst_sinesrc_get); + gst_pad_set_link_function (src->srcpad, gst_sinesrc_link); + gst_pad_set_query_function (src->srcpad, gst_sinesrc_src_query); + gst_pad_set_query_type_function (src->srcpad, gst_sinesrc_get_query_types); - src->rate = 44100; + src->samplerate = 44100; src->volume = 1.0; src->freq = 440.0; - src->newcaps = TRUE; - src->table_pos = 0.0; src->table_size = 1024; src->samples_per_buffer=1024; - src->timestamp=0LL; + src->timestamp=0LLU; + src->offset=0LLU; src->bufpool=NULL; src->seq = 0; @@ -203,7 +211,7 @@ gst_sinesrc_init (GstSineSrc *src) &(src->volume) ); - gst_dpman_set_rate(src->dpman, src->rate); + gst_dpman_set_rate(src->dpman, src->samplerate); gst_sinesrc_populate_sinetable(src); gst_sinesrc_update_table_inc(src); @@ -229,7 +237,7 @@ gst_sinesrc_src_fixate (GstPad *pad, const GstCaps2 *caps, } static GstPadLinkReturn -gst_sinesrc_src_link (GstPad *pad, const GstCaps2 *caps) +gst_sinesrc_link (GstPad *pad, const GstCaps2 *caps) { GstSineSrc *sinesrc; const GstStructure *structure; @@ -240,38 +248,91 @@ gst_sinesrc_src_link (GstPad *pad, const GstCaps2 *caps) structure = gst_caps2_get_nth_cap (caps, 0); - ret = gst_structure_get_int (structure, "rate", &sinesrc->rate); + ret = gst_structure_get_int (structure, "rate", &sinesrc->samplerate); if (!ret) return GST_PAD_LINK_REFUSED; return GST_PAD_LINK_OK; } +static const GstQueryType * +gst_sinesrc_get_query_types (GstPad *pad) +{ + static const GstQueryType query_types[] = { + GST_QUERY_POSITION, + 0, + }; + + return query_types; +} + +static gboolean +gst_sinesrc_src_query (GstPad *pad, + GstQueryType type, + GstFormat *format, + gint64 *value) +{ + gboolean res = FALSE; + GstSineSrc *src; + + src = GST_SINESRC (gst_pad_get_parent (pad)); + + switch (type) { + case GST_QUERY_POSITION: + switch (*format) { + case GST_FORMAT_TIME: + *value = src->timestamp; + res = TRUE; + break; + case GST_FORMAT_DEFAULT: /* samples */ + *value = src->offset / 2; /* 16bpp audio */ + res = TRUE; + break; + case GST_FORMAT_BYTES: + *value = src->offset; + res = TRUE; + break; + default: + break; + } + break; + default: + break; + } + + return res; +} + static GstData * gst_sinesrc_get (GstPad *pad) { GstSineSrc *src; GstBuffer *buf; + guint tdiff; gint16 *samples; gint i=0; g_return_val_if_fail (pad != NULL, NULL); - src = GST_SINESRC(gst_pad_get_parent (pad)); + src = GST_SINESRC (gst_pad_get_parent (pad)); if (src->bufpool == NULL) { src->bufpool = gst_buffer_pool_get_default (2 * src->samples_per_buffer, 8); } - + + tdiff = src->samples_per_buffer * GST_SECOND / src->samplerate; + buf = (GstBuffer *) gst_buffer_new_from_pool (src->bufpool, 0, 0); GST_BUFFER_TIMESTAMP(buf) = src->timestamp; + GST_BUFFER_OFFSET (buf) = src->offset; + GST_BUFFER_DURATION (buf) = tdiff; - samples = (gint16*)GST_BUFFER_DATA(buf); - GST_BUFFER_DATA(buf) = (gpointer) samples; + samples = (gint16 *) GST_BUFFER_DATA(buf); GST_DPMAN_PREPROCESS(src->dpman, src->samples_per_buffer, src->timestamp); - src->timestamp += (gint64)src->samples_per_buffer * GST_SECOND / (gint64)src->rate; + src->timestamp += tdiff; + src->offset += GST_BUFFER_SIZE (buf); while(GST_DPMAN_PROCESS(src->dpman, i)) { #if 0 @@ -302,7 +363,7 @@ gst_sinesrc_get (GstPad *pad) )+src->table_data[src->table_lookup] )* src->volume * 32767.0; #endif - src->accumulator += 2*M_PI*src->freq / src->rate; + src->accumulator += 2*M_PI*src->freq / src->samplerate; if(src->accumulator >= 2*M_PI){ src->accumulator -= 2*M_PI; } @@ -311,13 +372,14 @@ gst_sinesrc_get (GstPad *pad) i++; } - - if (src->newcaps) { - if (!gst_sinesrc_force_caps(src)) { + if (!GST_PAD_CAPS (src->srcpad)) { + if (gst_sinesrc_link (src->srcpad, + gst_pad_get_allowed_caps (src->srcpad)) <= 0) { gst_element_error (GST_ELEMENT (src), "Could not set caps"); return NULL; } } + return GST_DATA (buf); } @@ -381,28 +443,25 @@ gst_sinesrc_get_property (GObject *object, guint prop_id, } } -/* -static gboolean gst_sinesrc_change_state(GstElement *element, - GstElementState state) { - g_return_if_fail(GST_IS_SINESRC(element)); +static GstElementStateReturn +gst_sinesrc_change_state (GstElement *element) +{ + GstSineSrc *src = GST_SINESRC (element); - switch (state) { - case GST_STATE_RUNNING: - if (!gst_sinesrc_open_audio(GST_SINESRC(element))) - return FALSE; - break; - case ~GST_STATE_RUNNING: - gst_sinesrc_close_audio(GST_SINESRC(element)); + switch (GST_STATE_TRANSITION (element)) { + case GST_STATE_PAUSED_TO_READY: + src->timestamp = 0LLU; + src->offset = 0LLU; break; default: break; } if (GST_ELEMENT_CLASS(parent_class)->change_state) - return GST_ELEMENT_CLASS(parent_class)->change_state(element,state); - return TRUE; + return GST_ELEMENT_CLASS(parent_class)->change_state (element); + + return GST_STATE_SUCCESS; } -*/ static void gst_sinesrc_populate_sinetable (GstSineSrc *src) @@ -426,7 +485,7 @@ gst_sinesrc_update_freq (const GValue *value, gpointer data) g_return_if_fail (GST_IS_SINESRC (src)); src->freq = g_value_get_double (value); - src->table_inc = src->table_size * src->freq / src->rate; + src->table_inc = src->table_size * src->freq / src->samplerate; /*GST_DEBUG ("freq %f", src->freq); */ } @@ -434,9 +493,10 @@ gst_sinesrc_update_freq (const GValue *value, gpointer data) static inline void gst_sinesrc_update_table_inc (GstSineSrc *src) { - src->table_inc = src->table_size * src->freq / src->rate; + src->table_inc = src->table_size * src->freq / src->samplerate; } +#if 0 static gboolean gst_sinesrc_force_caps (GstSineSrc *src) { @@ -458,12 +518,13 @@ gst_sinesrc_force_caps (GstSineSrc *src) structure = gst_caps2_get_nth_cap (caps, 0); - gst_structure_set (structure, "rate", G_TYPE_INT, src->rate, NULL); + gst_structure_set (structure, "rate", G_TYPE_INT, src->samplerate, NULL); src->newcaps = gst_pad_try_set_caps (src->srcpad, caps) < GST_PAD_LINK_OK; return !src->newcaps; } +#endif static gboolean plugin_init (GstPlugin *plugin) @@ -483,7 +544,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, "LGPL", - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/sine/gstsinesrc.h b/gst/sine/gstsinesrc.h index 92c76aa4f..03735ee0b 100644 --- a/gst/sine/gstsinesrc.h +++ b/gst/sine/gstsinesrc.h @@ -27,9 +27,7 @@ #include <gst/gst.h> -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS GstElementDetails gst_sinesrc_details; @@ -70,17 +68,16 @@ struct _GstSineSrc { gint table_lookup_next; /* audio parameters */ - gint rate; + gint samplerate; gint samples_per_buffer; gulong seq; - gint64 timestamp; + guint64 timestamp; + guint64 offset; GstBufferPool *bufpool; - gboolean newcaps; - - double accumulator; + gdouble accumulator; }; struct _GstSineSrcClass { @@ -90,9 +87,7 @@ struct _GstSineSrcClass { GType gst_sinesrc_get_type(void); gboolean gst_sinesrc_factory_init (GstElementFactory *factory); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* __GST_SINESRC_H__ */ diff --git a/gst/tags/Makefile.am b/gst/tags/Makefile.am index 3d78fb4ff..718d75551 100644 --- a/gst/tags/Makefile.am +++ b/gst/tags/Makefile.am @@ -2,12 +2,9 @@ plugin_LTLIBRARIES = libgsttagediting.la libgsttagediting_la_SOURCES = gstvorbistag.c gsttagediting.c gstid3tag.c -libgsttagediting_la_CFLAGS = $(GST_CFLAGS) +libgsttagediting_la_CFLAGS = $(GST_CFLAGS) -I$(top_srcdir)/gst/tags libgsttagediting_la_LIBADD = $(GST_LIBS) libgsttagediting_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgsttageditingincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/tags -libgsttageditinginclude_HEADERS = gsttagediting.h - noinst_HEADERS = gsttageditingprivate.h diff --git a/gst/tags/gstid3tag.c b/gst/tags/gstid3tag.c index 0c410fabc..e2c466191 100644 --- a/gst/tags/gstid3tag.c +++ b/gst/tags/gstid3tag.c @@ -1,7 +1,7 @@ /* GStreamer * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> * - * gstvorbistagsetter.c: plugin for reading / modifying vorbis tags + * gstid3tag.c: plugin for reading / modifying id3 tags * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -253,8 +253,11 @@ gst_tag_extract (GstTagList *list, const gchar *tag, const gchar *start, const g return; } } + conv = g_strchomp (conv); + } + if (conv[0] != '\0') { + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, tag, conv, NULL); } - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, tag, conv, NULL); g_free (conv); } /** @@ -275,7 +278,7 @@ gst_tag_list_new_from_id3v1 (const guint8 *data) g_return_val_if_fail (data != NULL, NULL); - if (data[0] == 'T' && data[1] == 'A' && data[2] == 'G') return NULL; + if (data[0] != 'T' || data[1] != 'A' || data[2] != 'G') return NULL; list = gst_tag_list_new (); gst_tag_extract (list, GST_TAG_TITLE, &data[3], 30); gst_tag_extract (list, GST_TAG_ARTIST, &data[33], 30); diff --git a/gst/tags/gsttagediting.c b/gst/tags/gsttagediting.c index 4f1b5891b..2511fcb6c 100644 --- a/gst/tags/gsttagediting.c +++ b/gst/tags/gsttagediting.c @@ -45,7 +45,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/tags/gsttagediting.h b/gst/tags/gsttagediting.h deleted file mode 100644 index 7bf968eb2..000000000 --- a/gst/tags/gsttagediting.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_TAG_EDITING_H__ -#define __GST_TAG_EDITING_H__ - -#include <gst/gst.h> - -G_BEGIN_DECLS - - -/* functions for vorbis comment manipulation */ - -G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag); -G_CONST_RETURN gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag); -void gst_vorbis_tag_add (GstTagList * list, - const gchar * tag, - const gchar * value); - -GList * gst_tag_to_vorbis_comments (const GstTagList * list, - const gchar * tag); - -/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */ -GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer, - const guint8 * id_data, - const guint id_data_length, - gchar ** vendor_string); -GstBuffer * gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list, - const guint8 * id_data, - const guint id_data_length, - const gchar * vendor_string); - -/* functions for ID3 tag manipulation */ - -guint gst_tag_id3_genre_count (void); -G_CONST_RETURN gchar * gst_tag_id3_genre_get (const guint id); -GstTagList * gst_tag_list_new_from_id3v1 (const guint8 * data); - -G_CONST_RETURN gchar * gst_tag_from_id3_tag (const gchar * vorbis_tag); -G_CONST_RETURN gchar * gst_tag_to_id3_tag (const gchar * gst_tag); - - -G_END_DECLS - -#endif /* __GST_TAG_EDITING_H__ */ diff --git a/gst/tags/gsttageditingprivate.h b/gst/tags/gsttageditingprivate.h index a3ffcaf51..f7d9e95c3 100644 --- a/gst/tags/gsttageditingprivate.h +++ b/gst/tags/gsttageditingprivate.h @@ -21,7 +21,7 @@ #ifndef __GST_OGG_PLUGINS_H__ #define __GST_OGG_PLUGINS_H__ -#include <gst/tags/gsttagediting.h> +#include <gst/tag/tag.h> G_BEGIN_DECLS diff --git a/gst/tags/gstvorbistag.c b/gst/tags/gstvorbistag.c index ddfa00cba..d7301a709 100644 --- a/gst/tags/gstvorbistag.c +++ b/gst/tags/gstvorbistag.c @@ -317,7 +317,7 @@ gst_tag_list_from_vorbiscomment_buffer (const GstBuffer *buffer, const guint8 *i cur_size = GUINT32_FROM_LE (*((guint32 *) data)); \ data += 4; \ size -= 4; \ - if (cur_size >= size) goto error; \ + if (cur_size > size) goto error; \ cur = data; \ }G_STMT_END gchar *cur, *value; diff --git a/gst/tcp/gsttcp.c b/gst/tcp/gsttcp.c index b22976a55..c7f487aa3 100644 --- a/gst/tcp/gsttcp.c +++ b/gst/tcp/gsttcp.c @@ -44,7 +44,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/tcp/gsttcpplugin.c b/gst/tcp/gsttcpplugin.c index b22976a55..c7f487aa3 100644 --- a/gst/tcp/gsttcpplugin.c +++ b/gst/tcp/gsttcpplugin.c @@ -44,7 +44,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 86a791ebc..e28032027 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -1132,7 +1132,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 8af7a3dd1..cddf2b155 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -386,7 +386,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index ed36221a6..dff83f584 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -71,6 +71,13 @@ static void gst_videotestsrc_get_property (GObject * object, guint prop_id, GVal static GstData *gst_videotestsrc_get (GstPad * pad); +static const GstQueryType * + gst_videotestsrc_get_query_types (GstPad *pad); +static gboolean gst_videotestsrc_src_query (GstPad *pad, + GstQueryType type, + GstFormat *format, + gint64 *value); + static GstElementClass *parent_class = NULL; static GstCaps2 * gst_videotestsrc_get_capslist (void); @@ -356,6 +363,9 @@ gst_videotestsrc_init (GstVideotestsrc * videotestsrc) gst_pad_set_get_function (videotestsrc->srcpad, gst_videotestsrc_get); gst_pad_set_link_function (videotestsrc->srcpad, gst_videotestsrc_src_link); gst_pad_set_unlink_function (videotestsrc->srcpad, gst_videotestsrc_src_unlink); + gst_pad_set_query_function (videotestsrc->srcpad, gst_videotestsrc_src_query); + gst_pad_set_query_type_function (videotestsrc->srcpad, + gst_videotestsrc_get_query_types); videotestsrc->pool = NULL; gst_videotestsrc_set_pattern(videotestsrc, GST_VIDEOTESTSRC_SMPTE); @@ -367,6 +377,49 @@ gst_videotestsrc_init (GstVideotestsrc * videotestsrc) } +static const GstQueryType * +gst_videotestsrc_get_query_types (GstPad *pad) +{ + static const GstQueryType query_types[] = { + GST_QUERY_POSITION, + 0, + }; + + return query_types; +} + +static gboolean +gst_videotestsrc_src_query (GstPad *pad, + GstQueryType type, + GstFormat *format, + gint64 *value) +{ + gboolean res = FALSE; + GstVideotestsrc *videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad)); + + switch (type) { + case GST_QUERY_POSITION: + switch (*format) { + case GST_FORMAT_TIME: + *value = videotestsrc->n_frames * GST_SECOND / (double) videotestsrc->rate; + res = TRUE; + break; + case GST_FORMAT_DEFAULT: /* frames */ + *value = videotestsrc->n_frames; + res = TRUE; + break; + default: + break; + } + break; + default: + break; + } + + return res; +} + + static GstData * gst_videotestsrc_get (GstPad * pad) { @@ -382,7 +435,11 @@ gst_videotestsrc_get (GstPad * pad) videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad)); - g_return_val_if_fail (videotestsrc->fourcc != NULL, NULL); + if (videotestsrc->fourcc != NULL) { + gst_element_error (GST_ELEMENT (videotestsrc), + "No color format set - aborting"); + return NULL; + } newsize = (videotestsrc->width * videotestsrc->height * videotestsrc->bpp) >> 3; g_return_val_if_fail (newsize > 0, NULL); @@ -427,6 +484,7 @@ gst_videotestsrc_get (GstPad * pad) (videotestsrc->n_frames * GST_SECOND)/(double)videotestsrc->rate; videotestsrc->n_frames++; } + GST_BUFFER_DURATION (buf) = GST_SECOND / (double) videotestsrc->rate; return GST_DATA (buf); } @@ -543,10 +601,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) - - - diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 732e5a8fc..cac956b18 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -438,7 +438,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/sys/v4l/gstv4l.c b/sys/v4l/gstv4l.c index 3f8d2bcaa..d26d5b77c 100644 --- a/sys/v4l/gstv4l.c +++ b/sys/v4l/gstv4l.c @@ -57,7 +57,6 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN ) diff --git a/sys/v4l/gstv4lelement.c b/sys/v4l/gstv4lelement.c index 4287bfbf5..b2d406d40 100644 --- a/sys/v4l/gstv4lelement.c +++ b/sys/v4l/gstv4lelement.c @@ -78,8 +78,8 @@ static GstElementClass *parent_class = NULL; static guint gst_v4lelement_signals[LAST_SIGNAL] = { 0 }; static gboolean -gst_v4l_iface_supported (GstInterface *iface, - GType iface_type) +gst_v4l_iface_supported (GstImplementsInterface *iface, + GType iface_type) { GstV4lElement *v4lelement = GST_V4LELEMENT (iface); @@ -98,7 +98,7 @@ gst_v4l_iface_supported (GstInterface *iface, } static void -gst_v4l_interface_init (GstInterfaceClass *klass) +gst_v4l_interface_init (GstImplementsInterfaceClass *klass) { /* default virtual functions */ klass->supported = gst_v4l_iface_supported; @@ -333,7 +333,7 @@ gst_v4lelement_get_type (void) &v4lelement_info, 0); g_type_add_interface_static (v4lelement_type, - GST_TYPE_INTERFACE, + GST_TYPE_IMPLEMENTS_INTERFACE, &v4liface_info); g_type_add_interface_static (v4lelement_type, GST_TYPE_TUNER, diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index e53479c77..e191cd742 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -306,10 +306,10 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad) gst_caps2_new_simple ("video/x-raw-rgb", "bpp", G_TYPE_INT, ximagesink->xcontext->bpp, "depth", G_TYPE_INT, ximagesink->xcontext->depth, - "endianness", G_TYPE_INT, G_BIG_ENDIAN, - "red_mask", G_TYPE_INT, GINT_FROM_BE (ximagesink->xcontext->visual->red_mask), - "green_mask", G_TYPE_INT, GINT_FROM_BE (ximagesink->xcontext->visual->green_mask), - "blue_mask", G_TYPE_INT, GINT_FROM_BE (ximagesink->xcontext->visual->blue_mask), + "endianness", G_TYPE_INT, ximagesink->xcontext->endianness, + "red_mask", G_TYPE_INT, ximagesink->xcontext->visual->red_mask, + "green_mask", G_TYPE_INT, ximagesink->xcontext->visual->green_mask, + "blue_mask", G_TYPE_INT, ximagesink->xcontext->visual->blue_mask, "width", G_TYPE_INT, e.xconfigure.width, "height", G_TYPE_INT, e.xconfigure.height, "framerate", G_TYPE_DOUBLE, ximagesink->framerate, @@ -367,7 +367,7 @@ gst_ximagesink_handle_xevents (GstXImageSink *ximagesink, GstPad *pad) e.xkey.keycode, 0); gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), XKeysymToString (keysym)); - /* What's that ? */ + /* FIXME : What's that ? */ gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), "unknown"); break; @@ -435,7 +435,7 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink) XFree (px_formats); - xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_BIG_ENDIAN:G_BIG_ENDIAN; + xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_LITTLE_ENDIAN:G_BIG_ENDIAN; #ifdef HAVE_XSHM /* Search for XShm extension support */ @@ -450,14 +450,23 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink) GST_DEBUG ("ximagesink is not using XShm extension"); } #endif /* HAVE_XSHM */ + + /* our caps system handles 24/32bpp RGB as big-endian. */ + if ((xcontext->bpp == 24 || xcontext->bpp == 32) && + xcontext->endianness == G_LITTLE_ENDIAN) { + xcontext->endianness = G_BIG_ENDIAN; + xcontext->visual->red_mask = GULONG_TO_BE (xcontext->visual->red_mask); + xcontext->visual->green_mask = GULONG_TO_BE (xcontext->visual->green_mask); + xcontext->visual->blue_mask = GULONG_TO_BE (xcontext->visual->blue_mask); + } xcontext->caps = gst_caps2_new_simple ("video/x-raw-rgb", "bpp", G_TYPE_INT, xcontext->bpp, "depth", G_TYPE_INT, xcontext->depth, - "endianness", G_TYPE_INT, G_BIG_ENDIAN, - "red_mask", G_TYPE_INT, GINT_FROM_BE (xcontext->visual->red_mask), - "green_mask", G_TYPE_INT, GINT_FROM_BE (xcontext->visual->green_mask), - "blue_mask", G_TYPE_INT, GINT_FROM_BE (xcontext->visual->blue_mask), + "endianness", G_TYPE_INT, xcontext->endianness, + "red_mask", G_TYPE_INT, xcontext->visual->red_mask, + "green_mask", G_TYPE_INT, xcontext->visual->green_mask, + "blue_mask", G_TYPE_INT, xcontext->visual->blue_mask, "width", GST_TYPE_INT_RANGE, 0, G_MAXINT, "height", GST_TYPE_INT_RANGE, 0, G_MAXINT, "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, @@ -796,14 +805,14 @@ gst_ximagesink_get_bufferpool (GstPad *pad) /* Interfaces stuff */ static gboolean -gst_ximagesink_interface_supported (GstInterface *iface, GType type) +gst_ximagesink_interface_supported (GstImplementsInterface *iface, GType type) { g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY); return TRUE; } static void -gst_ximagesink_interface_init (GstInterfaceClass *klass) +gst_ximagesink_interface_init (GstImplementsInterfaceClass *klass) { klass->supported = gst_ximagesink_interface_supported; } @@ -1052,7 +1061,7 @@ gst_ximagesink_get_type (void) "GstXImageSink", &ximagesink_info, 0); - g_type_add_interface_static (ximagesink_type, GST_TYPE_INTERFACE, + g_type_add_interface_static (ximagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); g_type_add_interface_static (ximagesink_type, GST_TYPE_NAVIGATION, &navigation_info); @@ -1085,6 +1094,5 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN) diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 08e1a2d33..a32e008be 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -464,6 +464,7 @@ gst_xvimagesink_get_xv_support (GstXContext *xcontext) XFree (formats); GST_DEBUG_CAPS ("Generated the following caps", caps); + return caps; } @@ -732,12 +733,14 @@ gst_xvimagesink_change_state (GstElement *element) return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: + xvimagesink->time = 0; break; case GST_STATE_PAUSED_TO_PLAYING: break; case GST_STATE_PLAYING_TO_PAUSED: break; case GST_STATE_PAUSED_TO_READY: + xvimagesink->framerate = 0; break; case GST_STATE_READY_TO_NULL: break; @@ -745,26 +748,25 @@ gst_xvimagesink_change_state (GstElement *element) if (GST_ELEMENT_CLASS (parent_class)->change_state) return GST_ELEMENT_CLASS (parent_class)->change_state (element); - + return GST_STATE_SUCCESS; } static void -gst_xvimagesink_chain (GstPad *pad, GstData *_data) +gst_xvimagesink_chain (GstPad *pad, GstData *data) { - GstBuffer *buf = GST_BUFFER (_data); - GstClockTime time = GST_BUFFER_TIMESTAMP (buf); + GstBuffer *buf = NULL; GstXvImageSink *xvimagesink; - + g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); + g_return_if_fail (data != NULL); xvimagesink = GST_XVIMAGESINK (gst_pad_get_parent (pad)); - if (GST_IS_EVENT (buf)) + if (GST_IS_EVENT (data)) { - GstEvent *event = GST_EVENT (buf); + GstEvent *event = GST_EVENT (data); gint64 offset; switch (GST_EVENT_TYPE (event)) @@ -781,11 +783,16 @@ gst_xvimagesink_chain (GstPad *pad, GstData *_data) return; } - GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, time); + buf = GST_BUFFER (data); + /* update time */ + if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { + xvimagesink->time = GST_BUFFER_TIMESTAMP (buf); + } + GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, xvimagesink->time); if (GST_VIDEOSINK_CLOCK (xvimagesink)) { GstClockID id; - id = gst_clock_new_single_shot_id (GST_VIDEOSINK_CLOCK (xvimagesink), time); + id = gst_clock_new_single_shot_id (GST_VIDEOSINK_CLOCK (xvimagesink), xvimagesink->time); gst_element_clock_wait (GST_ELEMENT (xvimagesink), id, NULL); gst_clock_id_free (id); } @@ -810,7 +817,11 @@ gst_xvimagesink_chain (GstPad *pad, GstData *_data) return; } } - + /* set correct time for next buffer */ + if (!GST_BUFFER_TIMESTAMP_IS_VALID (buf) && xvimagesink->framerate > 0) { + xvimagesink->time += GST_SECOND / xvimagesink->framerate; + } + gst_buffer_unref (buf); gst_xvimagesink_handle_xevents (xvimagesink, pad); @@ -942,14 +953,14 @@ gst_xvimagesink_get_bufferpool (GstPad *pad) /* Interfaces stuff */ static gboolean -gst_xvimagesink_interface_supported (GstInterface *iface, GType type) +gst_xvimagesink_interface_supported (GstImplementsInterface *iface, GType type) { g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_X_OVERLAY); return TRUE; } static void -gst_xvimagesink_interface_init (GstInterfaceClass *klass) +gst_xvimagesink_interface_init (GstImplementsInterfaceClass *klass) { klass->supported = gst_xvimagesink_interface_supported; } @@ -1191,7 +1202,7 @@ gst_xvimagesink_get_type (void) "GstXvImageSink", &xvimagesink_info, 0); - g_type_add_interface_static (xvimagesink_type, GST_TYPE_INTERFACE, + g_type_add_interface_static (xvimagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); g_type_add_interface_static (xvimagesink_type, GST_TYPE_NAVIGATION, &navigation_info); @@ -1224,6 +1235,5 @@ GST_PLUGIN_DEFINE ( plugin_init, VERSION, GST_LICENSE, - GST_COPYRIGHT, GST_PACKAGE, GST_ORIGIN) diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h index 852464578..70fdadde3 100644 --- a/sys/xvimage/xvimagesink.h +++ b/sys/xvimage/xvimagesink.h @@ -127,6 +127,8 @@ struct _GstXvImageSink { /* Unused */ gint pixel_width, pixel_height; + + GstClockTime time; GstBufferPool *bufferpool; GMutex *pool_lock; |