This is a rather large patch. Switched on -Wall compiler flag and fixed the warnings.

Original commit message from CVS:
This is a rather large patch. Switched on -Wall compiler flag and fixed
the warnings.
Made the Video for Linux more like it should be.
This commit is contained in:
Wim Taymans 2000-02-27 23:18:38 +00:00
parent c144819530
commit ef63c32778
43 changed files with 178 additions and 140 deletions

View file

@ -55,6 +55,8 @@ libgstinclude_HEADERS = \
gstxml.h \ gstxml.h \
cothreads.h cothreads.h
CFLAGS += -O2 -Wall
libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS) libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS)
libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)

View file

@ -56,7 +56,7 @@ cothread_context *cothread_init() {
if (_cothread_key == -1) { if (_cothread_key == -1) {
if (pthread_key_create(&_cothread_key,NULL) != 0) { if (pthread_key_create(&_cothread_key,NULL) != 0) {
perror("pthread_key_create"); perror("pthread_key_create");
return; return NULL;
} }
} }
pthread_setspecific(_cothread_key,ctx); pthread_setspecific(_cothread_key,ctx);

View file

@ -38,7 +38,7 @@ noinst_HEADERS = \
gstqueue.h \ gstqueue.h \
gstsinesrc.h gstsinesrc.h
CFLAGS += -g CFLAGS += -O2 -Wall
libgstelements_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(GHTTP_LIBS) libgstelements_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(GHTTP_LIBS)
libgstelements_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) libgstelements_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)

View file

@ -64,7 +64,7 @@ static gboolean gst_asyncdisksrc_change_state(GstElement *element,
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_asyncdisksrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_asyncdisksrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_asyncdisksrc_get_type(void) { gst_asyncdisksrc_get_type(void) {
@ -280,7 +280,7 @@ void gst_asyncdisksrc_push_region(GstSrc *src,gulong offset,gulong size) {
/* open the file and mmap it, necessary to go to RUNNING state */ /* open the file and mmap it, necessary to go to RUNNING state */
static gboolean gst_asyncdisksrc_open_file(GstAsyncDiskSrc *src) { static gboolean gst_asyncdisksrc_open_file(GstAsyncDiskSrc *src) {
g_return_if_fail(!GST_FLAG_IS_SET(src,GST_ASYNCDISKSRC_OPEN)); g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_ASYNCDISKSRC_OPEN), FALSE);
/* open the file */ /* open the file */
src->fd = open(src->filename,O_RDONLY); src->fd = open(src->filename,O_RDONLY);
@ -326,7 +326,7 @@ static void gst_asyncdisksrc_close_file(GstAsyncDiskSrc *src) {
static gboolean gst_asyncdisksrc_change_state(GstElement *element, static gboolean gst_asyncdisksrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_ASYNCDISKSRC(element)); g_return_val_if_fail(GST_IS_ASYNCDISKSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -20,8 +20,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <unistd.h>
#include <gstaudiosink.h> #include <gstaudiosink.h>
#include <gst/meta/audioraw.h> #include <gst/meta/audioraw.h>
@ -221,7 +223,7 @@ void gst_audiosink_set_frequency(GstAudioSink *audiosink,gint frequency) {
} }
static gboolean gst_audiosink_open_audio(GstAudioSink *sink) { static gboolean gst_audiosink_open_audio(GstAudioSink *sink) {
g_return_if_fail(sink->fd == -1); g_return_val_if_fail(sink->fd == -1, FALSE);
g_print("attempting to open sound device\n"); g_print("attempting to open sound device\n");
@ -252,7 +254,7 @@ static void gst_audiosink_close_audio(GstAudioSink *sink) {
static gboolean gst_audiosink_start(GstElement *element, static gboolean gst_audiosink_start(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_AUDIOSINK(element)); g_return_val_if_fail(GST_IS_AUDIOSINK(element), FALSE);
if (gst_audiosink_open_audio(GST_AUDIOSINK(element)) == TRUE) { if (gst_audiosink_open_audio(GST_AUDIOSINK(element)) == TRUE) {
gst_element_set_state(element,GST_STATE_RUNNING | state); gst_element_set_state(element,GST_STATE_RUNNING | state);
@ -262,7 +264,7 @@ static gboolean gst_audiosink_start(GstElement *element,
} }
static gboolean gst_audiosink_stop(GstElement *element) { static gboolean gst_audiosink_stop(GstElement *element) {
g_return_if_fail(GST_IS_AUDIOSINK(element)); g_return_val_if_fail(GST_IS_AUDIOSINK(element), FALSE);
gst_audiosink_close_audio(GST_AUDIOSINK(element)); gst_audiosink_close_audio(GST_AUDIOSINK(element));
gst_element_set_state(element,~GST_STATE_RUNNING); gst_element_set_state(element,~GST_STATE_RUNNING);
@ -271,7 +273,7 @@ static gboolean gst_audiosink_stop(GstElement *element) {
static gboolean gst_audiosink_change_state(GstElement *element, static gboolean gst_audiosink_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_AUDIOSINK(element)); g_return_val_if_fail(GST_IS_AUDIOSINK(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -21,6 +21,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <gstaudiosrc.h> #include <gstaudiosrc.h>
@ -64,7 +66,7 @@ void gst_audiosrc_sync_parms(GstAudioSrc *audiosrc);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_audiosrc_get_type(void) { gst_audiosrc_get_type(void) {
@ -246,7 +248,7 @@ static void gst_audiosrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static gboolean gst_audiosrc_change_state(GstElement *element, static gboolean gst_audiosrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_AUDIOSRC(element)); g_return_val_if_fail(GST_IS_AUDIOSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:
@ -266,7 +268,7 @@ static gboolean gst_audiosrc_change_state(GstElement *element,
} }
static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) { static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
g_return_if_fail(src->fd == -1); g_return_val_if_fail(src->fd == -1, FALSE);
/* first try to open the sound card */ /* first try to open the sound card */
src->fd = open("/dev/dsp",O_RDONLY); src->fd = open("/dev/dsp",O_RDONLY);

View file

@ -20,6 +20,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h>
#include <gstdisksrc.h> #include <gstdisksrc.h>
@ -54,13 +55,13 @@ static void gst_disksrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_disksrc_get_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_disksrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_disksrc_push(GstSrc *src); static void gst_disksrc_push(GstSrc *src);
static void gst_disksrc_push_region(GstSrc *src,gulong offset,gulong size); //static void gst_disksrc_push_region(GstSrc *src,gulong offset,gulong size);
static gboolean gst_disksrc_change_state(GstElement *element, static gboolean gst_disksrc_change_state(GstElement *element,
GstElementState state); GstElementState state);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_disksrc_get_type(void) { gst_disksrc_get_type(void) {
@ -217,7 +218,7 @@ void gst_disksrc_push(GstSrc *src) {
/* open the file, necessary to go to RUNNING state */ /* open the file, necessary to go to RUNNING state */
static gboolean gst_disksrc_open_file(GstDiskSrc *src) { static gboolean gst_disksrc_open_file(GstDiskSrc *src) {
g_return_if_fail(!GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN)); g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN), FALSE);
/* open the file */ /* open the file */
src->fd = open(src->filename,O_RDONLY); src->fd = open(src->filename,O_RDONLY);
@ -247,7 +248,7 @@ static void gst_disksrc_close_file(GstDiskSrc *src) {
static gboolean gst_disksrc_change_state(GstElement *element, static gboolean gst_disksrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_DISKSRC(element)); g_return_val_if_fail(GST_IS_DISKSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -48,7 +48,7 @@ static void gst_fakesink_init(GstFakeSink *fakesink);
static GstSinkClass *parent_class = NULL; static GstSinkClass *parent_class = NULL;
static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fakesink_get_type(void) { gst_fakesink_get_type(void) {

View file

@ -48,7 +48,7 @@ static void gst_fakesrc_init(GstFakeSrc *fakesrc);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fakesrc_get_type(void) { gst_fakesrc_get_type(void) {

View file

@ -18,6 +18,7 @@
*/ */
#include <gstfdsink.h> #include <gstfdsink.h>
#include <unistd.h>
GstElementDetails gst_fdsink_details = { GstElementDetails gst_fdsink_details = {
@ -49,7 +50,7 @@ static void gst_fdsink_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstSinkClass *parent_class = NULL; static GstSinkClass *parent_class = NULL;
static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fdsink_get_type(void) { gst_fdsink_get_type(void) {

View file

@ -20,6 +20,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <gstfdsrc.h> #include <gstfdsrc.h>
@ -54,11 +57,11 @@ static void gst_fdsrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_fdsrc_get_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_fdsrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_fdsrc_push(GstSrc *src); static void gst_fdsrc_push(GstSrc *src);
static void gst_fdsrc_push_region(GstSrc *src,gulong offset,gulong size); //static void gst_fdsrc_push_region(GstSrc *src,gulong offset,gulong size);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fdsrc_get_type(void) { gst_fdsrc_get_type(void) {

View file

@ -20,6 +20,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <gsthttpsrc.h> #include <gsthttpsrc.h>
@ -62,7 +64,7 @@ static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_httpsrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_httpsrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_httpsrc_get_type(void) { gst_httpsrc_get_type(void) {
@ -153,9 +155,9 @@ static void gst_httpsrc_push(GstSrc *src) {
static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) { static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) {
gint status; gint status;
g_return_if_fail(httpsrc != NULL); g_return_val_if_fail(httpsrc != NULL, FALSE);
g_return_if_fail(GST_IS_HTTPSRC(httpsrc)); g_return_val_if_fail(GST_IS_HTTPSRC(httpsrc), FALSE);
g_return_if_fail(httpsrc->url != NULL); g_return_val_if_fail(httpsrc->url != NULL, FALSE);
httpsrc->request = ghttp_request_new(); httpsrc->request = ghttp_request_new();
ghttp_set_uri(httpsrc->request,httpsrc->url); ghttp_set_uri(httpsrc->request,httpsrc->url);
@ -237,7 +239,7 @@ static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static gboolean gst_httpsrc_change_state(GstElement *element, static gboolean gst_httpsrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_HTTPSRC(element)); g_return_val_if_fail(GST_IS_HTTPSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -50,7 +50,7 @@ static void gst_identity_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstFilterClass *parent_class = NULL; static GstFilterClass *parent_class = NULL;
static guint gst_identity_signals[LAST_SIGNAL] = { 0 }; //static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_identity_get_type(void) { gst_identity_get_type(void) {

View file

@ -51,7 +51,7 @@ static void gst_queue_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstConnectionClass *parent_class = NULL; static GstConnectionClass *parent_class = NULL;
static guint gst_queue_signals[LAST_SIGNAL] = { 0 }; //static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_queue_get_type(void) { gst_queue_get_type(void) {

View file

@ -22,6 +22,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <math.h> #include <math.h>
#include <stdlib.h>
#include <gstsinesrc.h> #include <gstsinesrc.h>
@ -58,13 +59,13 @@ static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
//static gboolean gst_sinesrc_change_state(GstElement *element, //static gboolean gst_sinesrc_change_state(GstElement *element,
// GstElementState state); // GstElementState state);
static void gst_sinesrc_close_audio(GstSineSrc *src); //static void gst_sinesrc_close_audio(GstSineSrc *src);
static gboolean gst_sinesrc_open_audio(GstSineSrc *src); //static gboolean gst_sinesrc_open_audio(GstSineSrc *src);
void gst_sinesrc_sync_parms(GstSineSrc *sinesrc); void gst_sinesrc_sync_parms(GstSineSrc *sinesrc);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_sinesrc_get_type(void) { gst_sinesrc_get_type(void) {
@ -161,7 +162,7 @@ void gst_sinesrc_push(GstSrc *src) {
g_return_if_fail(buf); g_return_if_fail(buf);
GST_BUFFER_DATA(buf) = (gpointer)malloc(4096); GST_BUFFER_DATA(buf) = (gpointer)malloc(4096);
samples = (gint16*)GST_BUFFER_DATA(buf); samples = (gint16*)GST_BUFFER_DATA(buf);
GST_BUFFER_DATA(buf) = 4096; GST_BUFFER_SIZE(buf) = 4096;
volume = 65535 * sinesrc->volume; volume = 65535 * sinesrc->volume;
for (i=0;i<1024;i++) { for (i=0;i<1024;i++) {

View file

@ -191,9 +191,9 @@ static gboolean gst_bin_change_state(GstElement *element,
// g_print("gst_bin_change_state(\"%s\",%d);\n", // g_print("gst_bin_change_state(\"%s\",%d);\n",
// gst_object_get_name(GST_OBJECT(bin)),state); // gst_object_get_name(GST_OBJECT(bin)),state);
g_return_if_fail(GST_IS_BIN(element)); g_return_val_if_fail(GST_IS_BIN(element), FALSE);
bin = GST_BIN(element); bin = GST_BIN(element);
g_return_if_fail(bin->numchildren != 0); g_return_val_if_fail(bin->numchildren != 0, FALSE);
// g_print("-->\n"); // g_print("-->\n");
children = bin->children; children = bin->children;
@ -220,9 +220,9 @@ static gboolean gst_bin_change_state_norecurse(GstElement *element,
GstElementState state) { GstElementState state) {
GstBin *bin; GstBin *bin;
g_return_if_fail(GST_IS_BIN(element)); g_return_val_if_fail(GST_IS_BIN(element), FALSE);
bin = GST_BIN(element); bin = GST_BIN(element);
g_return_if_fail(bin->numchildren != 0); g_return_val_if_fail(bin->numchildren != 0, FALSE);
if (GST_ELEMENT_CLASS(parent_class)->change_state) if (GST_ELEMENT_CLASS(parent_class)->change_state)
return GST_ELEMENT_CLASS(parent_class)->change_state(element,state); return GST_ELEMENT_CLASS(parent_class)->change_state(element,state);
@ -238,8 +238,8 @@ static gboolean gst_bin_change_state_type(GstBin *bin,
// g_print("gst_bin_change_state_type(\"%s\",%d,%d);\n", // g_print("gst_bin_change_state_type(\"%s\",%d,%d);\n",
// gst_object_get_name(GST_OBJECT(bin)),state,type); // gst_object_get_name(GST_OBJECT(bin)),state,type);
g_return_if_fail(GST_IS_BIN(bin)); g_return_val_if_fail(GST_IS_BIN(bin), FALSE);
g_return_if_fail(bin->numchildren != 0); g_return_val_if_fail(bin->numchildren != 0, FALSE);
// g_print("-->\n"); // g_print("-->\n");
children = bin->children; children = bin->children;
@ -271,13 +271,14 @@ gboolean gst_bin_set_state_type(GstBin *bin,
// g_print("gst_bin_set_state_type(\"%s\",%d,%d)\n", // g_print("gst_bin_set_state_type(\"%s\",%d,%d)\n",
// gst_object_get_name(GST_OBJECT(bin)),state,type); // gst_object_get_name(GST_OBJECT(bin)),state,type);
g_return_if_fail(bin != NULL); g_return_val_if_fail(bin != NULL, FALSE);
g_return_if_fail(GST_IS_BIN(bin)); g_return_val_if_fail(GST_IS_BIN(bin), FALSE);
oclass = GST_BIN_CLASS(GTK_OBJECT(bin)->klass); oclass = GST_BIN_CLASS(GTK_OBJECT(bin)->klass);
if (oclass->change_state_type) if (oclass->change_state_type)
(oclass->change_state_type)(bin,state,type); (oclass->change_state_type)(bin,state,type);
return TRUE;
} }
void gst_bin_real_destroy(GtkObject *object) { void gst_bin_real_destroy(GtkObject *object) {
@ -301,9 +302,9 @@ GstElement *gst_bin_get_by_name(GstBin *bin,gchar *name) {
GList *children; GList *children;
GstElement *child; GstElement *child;
g_return_if_fail(bin != NULL); g_return_val_if_fail(bin != NULL, NULL);
g_return_if_fail(GST_IS_BIN(bin)); g_return_val_if_fail(GST_IS_BIN(bin), NULL);
g_return_if_fail(name != NULL); g_return_val_if_fail(name != NULL, NULL);
children = bin->children; children = bin->children;
while (children) { while (children) {
@ -317,8 +318,8 @@ GstElement *gst_bin_get_by_name(GstBin *bin,gchar *name) {
} }
GList *gst_bin_get_list(GstBin *bin) { GList *gst_bin_get_list(GstBin *bin) {
g_return_if_fail(bin != NULL); g_return_val_if_fail(bin != NULL, NULL);
g_return_if_fail(GST_IS_BIN(bin)); g_return_val_if_fail(GST_IS_BIN(bin), NULL);
return bin->children; return bin->children;
} }
@ -340,6 +341,7 @@ static xmlNodePtr gst_bin_save_thyself(GstElement *element,xmlNodePtr parent) {
gst_element_save_thyself(child,childlist); gst_element_save_thyself(child,childlist);
children = g_list_next(children); children = g_list_next(children);
} }
return childlist;
} }
void gst_bin_iterate(GstBin *bin) { void gst_bin_iterate(GstBin *bin) {

View file

@ -80,9 +80,9 @@ GstBuffer *gst_buffer_new() {
GstBuffer *gst_buffer_create_sub(GstBuffer *parent,guint32 offset,guint32 size) { GstBuffer *gst_buffer_create_sub(GstBuffer *parent,guint32 offset,guint32 size) {
GstBuffer *buffer; GstBuffer *buffer;
g_return_if_fail(parent != NULL); g_return_val_if_fail(parent != NULL, NULL);
g_return_if_fail(size > 0); g_return_val_if_fail(size > 0, NULL);
g_return_if_fail((offset+size) <= parent->size); g_return_val_if_fail((offset+size) <= parent->size, NULL);
buffer = g_mem_chunk_alloc(_gst_buffer_chunk); buffer = g_mem_chunk_alloc(_gst_buffer_chunk);
DEBUG("BUF: allocating new subbuffer %p, parent %p\n",buffer,parent); DEBUG("BUF: allocating new subbuffer %p, parent %p\n",buffer,parent);
@ -220,13 +220,13 @@ void gst_buffer_add_meta(GstBuffer *buffer,GstMeta *meta) {
} }
GSList *gst_buffer_get_metas(GstBuffer *buffer) { GSList *gst_buffer_get_metas(GstBuffer *buffer) {
g_return_if_fail(buffer != NULL); g_return_val_if_fail(buffer != NULL, NULL);
return buffer->metas; return buffer->metas;
} }
GstMeta *gst_buffer_get_first_meta(GstBuffer *buffer) { GstMeta *gst_buffer_get_first_meta(GstBuffer *buffer) {
g_return_if_fail(buffer != NULL); g_return_val_if_fail(buffer != NULL, NULL);
if (buffer->metas == NULL) if (buffer->metas == NULL)
return NULL; return NULL;

View file

@ -37,7 +37,7 @@ static void gst_connection_init(GstConnection *connection);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static guint gst_connection_signals[LAST_SIGNAL] = { 0 }; //static guint gst_connection_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_connection_get_type(void) { gst_connection_get_type(void) {

View file

@ -181,8 +181,8 @@ void gst_element_add_ghost_pad(GstElement *element,GstPad *pad) {
GstPad *gst_element_get_pad(GstElement *element,gchar *name) { GstPad *gst_element_get_pad(GstElement *element,gchar *name) {
GList *walk; GList *walk;
g_return_if_fail(element != NULL); g_return_val_if_fail(element != NULL, NULL);
g_return_if_fail(GST_IS_ELEMENT(element)); g_return_val_if_fail(GST_IS_ELEMENT(element), NULL);
if (name == NULL) if (name == NULL)
return NULL; return NULL;
if (!element->numpads) if (!element->numpads)
@ -207,8 +207,8 @@ GstPad *gst_element_get_pad(GstElement *element,gchar *name) {
* Returns: <type>GList</type> of pads * Returns: <type>GList</type> of pads
*/ */
GList *gst_element_get_pad_list(GstElement *element) { GList *gst_element_get_pad_list(GstElement *element) {
g_return_if_fail(element != NULL); g_return_val_if_fail(element != NULL, NULL);
g_return_if_fail(GST_IS_ELEMENT(element)); g_return_val_if_fail(GST_IS_ELEMENT(element), NULL);
return element->pads; return element->pads;
} }
@ -290,8 +290,8 @@ gboolean gst_element_set_state(GstElement *element,GstElementState state) {
// g_print("gst_element_set_state(\"%s\",%08lx)\n", // g_print("gst_element_set_state(\"%s\",%08lx)\n",
// element->name,state); // element->name,state);
g_return_if_fail(element != NULL); g_return_val_if_fail(element != NULL, FALSE);
g_return_if_fail(GST_IS_ELEMENT(element)); g_return_val_if_fail(GST_IS_ELEMENT(element), FALSE);
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass); oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass);
@ -313,8 +313,8 @@ gboolean gst_element_set_state(GstElement *element,GstElementState state) {
/* class function to set the state of a simple element */ /* class function to set the state of a simple element */
gboolean gst_element_change_state(GstElement *element, gboolean gst_element_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(element != NULL); g_return_val_if_fail(element != NULL, FALSE);
g_return_if_fail(GST_IS_ELEMENT(element)); g_return_val_if_fail(GST_IS_ELEMENT(element), FALSE);
// g_print("gst_element_change_state(\"%s\",%d)\n", // g_print("gst_element_change_state(\"%s\",%d)\n",
// element->name,state); // element->name,state);
@ -328,6 +328,7 @@ gboolean gst_element_change_state(GstElement *element,
// g_print(", is now %08lx\n",GST_STATE(element)); // g_print(", is now %08lx\n",GST_STATE(element));
gtk_signal_emit(GTK_OBJECT(element),gst_element_signals[STATE_CHANGE], gtk_signal_emit(GTK_OBJECT(element),gst_element_signals[STATE_CHANGE],
state); state);
return TRUE;
} }
/** /**
@ -358,8 +359,8 @@ void gst_element_set_name(GstElement *element,gchar *name) {
* Returns: name of the element * Returns: name of the element
*/ */
gchar *gst_element_get_name(GstElement *element) { gchar *gst_element_get_name(GstElement *element) {
g_return_if_fail(element != NULL); g_return_val_if_fail(element != NULL, NULL);
g_return_if_fail(GST_IS_ELEMENT(element)); g_return_val_if_fail(GST_IS_ELEMENT(element), NULL);
return element->name; return element->name;
} }
@ -384,7 +385,7 @@ static void gst_element_real_destroy(GtkObject *object) {
g_list_free(element->pads); g_list_free(element->pads);
} }
/*
static gchar *_gst_element_type_names[] = { static gchar *_gst_element_type_names[] = {
"invalid", "invalid",
"none", "none",
@ -399,6 +400,7 @@ static gchar *_gst_element_type_names[] = {
"double", "double",
"string", "string",
}; };
*/
xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) { xmlNodePtr gst_element_save_thyself(GstElement *element,xmlNodePtr parent) {
xmlNodePtr self, arglist; xmlNodePtr self, arglist;

View file

@ -53,5 +53,6 @@ void gst_meta_unref(GstMeta *meta) {
GstMeta *gst_meta_cow(GstMeta *meta) { GstMeta *gst_meta_cow(GstMeta *meta) {
g_return_if_fail(meta != NULL); g_return_val_if_fail(meta != NULL, NULL);
return NULL;
} }

View file

@ -128,8 +128,8 @@ void gst_object_set_parent(GstObject *object,GstObject *parent) {
* Returns: parent of the object * Returns: parent of the object
*/ */
GstObject *gst_object_get_parent(GstObject *object) { GstObject *gst_object_get_parent(GstObject *object) {
g_return_if_fail(object != NULL); g_return_val_if_fail(object != NULL, NULL);
g_return_if_fail(GST_IS_OBJECT(object)); g_return_val_if_fail(GST_IS_OBJECT(object), NULL);
return object->parent; return object->parent;
} }

View file

@ -41,7 +41,7 @@ static void gst_pad_real_destroy(GtkObject *object);
static GstObject *parent_class = NULL; static GstObject *parent_class = NULL;
static guint gst_pad_signals[LAST_SIGNAL] = { 0 }; //static guint gst_pad_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_pad_get_type(void) { gst_pad_get_type(void) {
@ -96,8 +96,8 @@ static void gst_pad_init(GstPad *pad) {
GstPad *gst_pad_new(gchar *name,GstPadDirection direction) { GstPad *gst_pad_new(gchar *name,GstPadDirection direction) {
GstPad *pad; GstPad *pad;
g_return_if_fail(name != NULL); g_return_val_if_fail(name != NULL, NULL);
g_return_if_fail(direction != GST_PAD_UNKNOWN); g_return_val_if_fail(direction != GST_PAD_UNKNOWN, NULL);
pad = GST_PAD(gtk_type_new(gst_pad_get_type())); pad = GST_PAD(gtk_type_new(gst_pad_get_type()));
pad->name = g_strdup(name); pad->name = g_strdup(name);
@ -106,8 +106,8 @@ GstPad *gst_pad_new(gchar *name,GstPadDirection direction) {
} }
GstPadDirection gst_pad_get_direction(GstPad *pad) { GstPadDirection gst_pad_get_direction(GstPad *pad) {
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, GST_PAD_UNKNOWN);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), GST_PAD_UNKNOWN);
return pad->direction; return pad->direction;
} }
@ -123,8 +123,8 @@ void gst_pad_set_name(GstPad *pad,gchar *name) {
} }
gchar *gst_pad_get_name(GstPad *pad) { gchar *gst_pad_get_name(GstPad *pad) {
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), NULL);
return pad->name; return pad->name;
} }
@ -170,8 +170,8 @@ GstBuffer *gst_pad_pull(GstPad *pad) {
GstElement *peerparent; GstElement *peerparent;
cothread_state *state; cothread_state *state;
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), NULL);
// if the pull function exists for the pad, call it directly // if the pull function exists for the pad, call it directly
if (pad->pull) { if (pad->pull) {
@ -195,6 +195,7 @@ GstBuffer *gst_pad_pull(GstPad *pad) {
pad->bufpen = NULL; pad->bufpen = NULL;
return buf; return buf;
} }
return NULL;
} }
void gst_pad_chain(GstPad *pad) { void gst_pad_chain(GstPad *pad) {
@ -273,22 +274,22 @@ void gst_pad_remove_ghost_parent(GstPad *pad,GstObject *parent) {
} }
GstObject *gst_pad_get_parent(GstPad *pad) { GstObject *gst_pad_get_parent(GstPad *pad) {
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), NULL);
return pad->parent; return pad->parent;
} }
GList *gst_pad_get_ghost_parents(GstPad *pad) { GList *gst_pad_get_ghost_parents(GstPad *pad) {
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), NULL);
return pad->ghostparents; return pad->ghostparents;
} }
guint32 gst_pad_get_type_id(GstPad *pad) { guint16 gst_pad_get_type_id(GstPad *pad) {
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, 0);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), 0);
return pad->type; return pad->type;
} }
@ -302,15 +303,15 @@ void gst_pad_set_type_id(GstPad *pad,guint16 id) {
} }
GstPad *gst_pad_get_peer(GstPad *pad) { GstPad *gst_pad_get_peer(GstPad *pad) {
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), NULL);
return pad->peer; return pad->peer;
} }
GstPadDirection gst_pad_get_directory(GstPad *pad) { GstPadDirection gst_pad_get_directory(GstPad *pad) {
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, GST_PAD_UNKNOWN);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), GST_PAD_UNKNOWN);
return pad->direction; return pad->direction;
} }
@ -346,7 +347,6 @@ xmlNodePtr gst_pad_save_thyself(GstPad *pad,xmlNodePtr parent) {
xmlNodePtr gst_pad_ghost_save_thyself(GstPad *pad,GstElement *bin,xmlNodePtr parent) { xmlNodePtr gst_pad_ghost_save_thyself(GstPad *pad,GstElement *bin,xmlNodePtr parent) {
xmlNodePtr self; xmlNodePtr self;
GstPad *peer;
self = xmlNewChild(parent,NULL,"ghostpad",NULL); self = xmlNewChild(parent,NULL,"ghostpad",NULL);
xmlNewChild(self,NULL,"name",pad->name); xmlNewChild(self,NULL,"name",pad->name);

View file

@ -97,7 +97,7 @@ GstPadDirection gst_pad_get_direction(GstPad *pad);
void gst_pad_set_chain_function(GstPad *pad,GstPadChainFunction chain); void gst_pad_set_chain_function(GstPad *pad,GstPadChainFunction chain);
void gst_pad_set_pull_function(GstPad *pad, GstPadPullFunction pull); void gst_pad_set_pull_function(GstPad *pad, GstPadPullFunction pull);
guint32 gst_pad_get_type_id(GstPad *pad); guint16 gst_pad_get_type_id(GstPad *pad);
void gst_pad_set_type_id(GstPad *pad,guint16 id); void gst_pad_set_type_id(GstPad *pad,guint16 id);
void gst_pad_set_name(GstPad *pad,gchar *name); void gst_pad_set_name(GstPad *pad,gchar *name);

View file

@ -51,7 +51,7 @@ static void gst_pipeline_prepare(GstPipeline *pipeline);
static GstBin *parent_class = NULL; static GstBin *parent_class = NULL;
static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 }; //static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_pipeline_get_type(void) { gst_pipeline_get_type(void) {
@ -113,7 +113,7 @@ static gboolean gst_pipeline_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
GstPipeline *pipeline; GstPipeline *pipeline;
g_return_if_fail(GST_IS_PIPELINE(element)); g_return_val_if_fail(GST_IS_PIPELINE(element), FALSE);
pipeline = GST_PIPELINE(element); pipeline = GST_PIPELINE(element);
switch (state) { switch (state) {

View file

@ -70,7 +70,7 @@ static gboolean gst_plugin_load_recurse(gchar *directory,gchar *name) {
dir = opendir(directory); dir = opendir(directory);
if (dir) { if (dir) {
while (dirent = readdir(dir)) { while ((dirent = readdir(dir))) {
/* don't want to recurse in place or backwards */ /* don't want to recurse in place or backwards */
if (strcmp(dirent->d_name,".") && strcmp(dirent->d_name,"..")) { if (strcmp(dirent->d_name,".") && strcmp(dirent->d_name,"..")) {
gst_plugin_load_recurse(g_strjoin("/",directory,dirent->d_name, gst_plugin_load_recurse(g_strjoin("/",directory,dirent->d_name,
@ -162,13 +162,13 @@ gboolean gst_plugin_load_absolute(gchar *name) {
if (g_module_supported() == FALSE) { if (g_module_supported() == FALSE) {
g_print("wow, you built this on a platform without dynamic loading???\n"); g_print("wow, you built this on a platform without dynamic loading???\n");
return; return FALSE;
} }
module = g_module_open(name,0); module = g_module_open(name,0);
if (module != NULL) { if (module != NULL) {
if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) { if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) {
if (plugin = (initfunc)(module)) { if ((plugin = (initfunc)(module))) {
GList *factories; GList *factories;
plugin->filename = g_strdup(name); plugin->filename = g_strdup(name);
_gst_modules = g_list_append(_gst_modules,module); _gst_modules = g_list_append(_gst_modules,module);
@ -235,7 +235,7 @@ void gst_plugin_set_longname(GstPlugin *plugin,gchar *longname) {
GstPlugin *gst_plugin_find(gchar *name) { GstPlugin *gst_plugin_find(gchar *name) {
GList *plugins = _gst_plugins; GList *plugins = _gst_plugins;
g_return_if_fail(name != NULL); g_return_val_if_fail(name != NULL, NULL);
while (plugins) { while (plugins) {
GstPlugin *plugin = (GstPlugin *)plugins->data; GstPlugin *plugin = (GstPlugin *)plugins->data;
@ -261,7 +261,7 @@ GstElementFactory *gst_plugin_find_elementfactory(gchar *name) {
GList *plugins, *factories; GList *plugins, *factories;
GstElementFactory *factory; GstElementFactory *factory;
g_return_if_fail(name != NULL); g_return_val_if_fail(name != NULL, NULL);
plugins = _gst_plugins; plugins = _gst_plugins;
while (plugins) { while (plugins) {

View file

@ -44,11 +44,10 @@ enum {
static void gst_tee_class_init(GstTeeClass *klass); static void gst_tee_class_init(GstTeeClass *klass);
static void gst_tee_init(GstTee *tee); static void gst_tee_init(GstTee *tee);
static xmlNodePtr gst_tee_save_thyself(GstElement *element,xmlNodePtr parent); //static xmlNodePtr gst_tee_save_thyself(GstElement *element,xmlNodePtr parent);
static GstFilterClass *parent_class = NULL; static GstFilterClass *parent_class = NULL;
static guint gst_tee_signals[LAST_SIGNAL] = { 0 }; //static guint gst_tee_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_tee_get_type(void) { gst_tee_get_type(void) {
@ -98,8 +97,8 @@ gchar *gst_tee_new_pad(GstTee *tee) {
gchar *name; gchar *name;
GstPad *srcpad; GstPad *srcpad;
g_return_if_fail(tee != NULL); g_return_val_if_fail(tee != NULL, NULL);
g_return_if_fail(GST_IS_TEE(tee)); g_return_val_if_fail(GST_IS_TEE(tee), NULL);
name = g_strdup_printf("src%d",tee->numsrcpads); name = g_strdup_printf("src%d",tee->numsrcpads);
srcpad = gst_pad_new(name,GST_PAD_SRC); srcpad = gst_pad_new(name,GST_PAD_SRC);

View file

@ -56,7 +56,7 @@ static void gst_thread_signal_thread(GstThread *thread);
static GstBin *parent_class = NULL; static GstBin *parent_class = NULL;
static guint gst_thread_signals[LAST_SIGNAL] = { 0 }; //static guint gst_thread_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_thread_get_type(void) { gst_thread_get_type(void) {
@ -210,7 +210,7 @@ static gboolean gst_thread_change_state(GstElement *element,
GstThread *thread; GstThread *thread;
gboolean stateset = TRUE; gboolean stateset = TRUE;
g_return_if_fail(GST_IS_THREAD(element)); g_return_val_if_fail(GST_IS_THREAD(element), FALSE);
thread = GST_THREAD(element); thread = GST_THREAD(element);
if (GST_ELEMENT_CLASS(parent_class)->change_state) if (GST_ELEMENT_CLASS(parent_class)->change_state)
@ -324,9 +324,9 @@ static void gst_thread_signal_thread(GstThread *thread) {
} }
static xmlNodePtr gst_thread_save_thyself(GstElement *element,xmlNodePtr parent) { static xmlNodePtr gst_thread_save_thyself(GstElement *element,xmlNodePtr parent) {
GstThread *thread = GST_THREAD(element);
xmlNewChild(parent,NULL,"type","thread"); xmlNewChild(parent,NULL,"type","thread");
if (GST_ELEMENT_CLASS(parent_class)->save_thyself) if (GST_ELEMENT_CLASS(parent_class)->save_thyself)
GST_ELEMENT_CLASS(parent_class)->save_thyself(element,parent); GST_ELEMENT_CLASS(parent_class)->save_thyself(element,parent);
return NULL;
} }

View file

@ -26,6 +26,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <string.h>
/* global list of registered types */ /* global list of registered types */
@ -44,7 +45,7 @@ guint16 gst_type_register(GstTypeFactory *factory) {
guint16 id; guint16 id;
GstType *type; GstType *type;
g_return_if_fail(factory != NULL); g_return_val_if_fail(factory != NULL, 0);
// id = gst_type_find_by_mime(factory->mime); // id = gst_type_find_by_mime(factory->mime);
id = 0; id = 0;
@ -142,7 +143,7 @@ void gst_type_add_sink(guint16 id,GstElementFactory *sink) {
GList *gst_type_get_srcs(guint16 id) { GList *gst_type_get_srcs(guint16 id) {
GstType *type = gst_type_find_by_id(id); GstType *type = gst_type_find_by_id(id);
g_return_if_fail(type != NULL); g_return_val_if_fail(type != NULL, NULL);
return type->srcs; return type->srcs;
} }
@ -150,7 +151,7 @@ GList *gst_type_get_srcs(guint16 id) {
GList *gst_type_get_sinks(guint16 id) { GList *gst_type_get_sinks(guint16 id) {
GstType *type = gst_type_find_by_id(id); GstType *type = gst_type_find_by_id(id);
g_return_if_fail(type != 0); g_return_val_if_fail(type != 0, NULL);
return type->sinks; return type->sinks;
} }

View file

@ -8,5 +8,7 @@ libgsttypes_la_SOURCES = \
#noinst_HEADERS = #noinst_HEADERS =
CFLAGS += -O2 -Wall
libgsttypes_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) libgsttypes_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS)
libgsttypes_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) libgsttypes_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)

View file

@ -38,7 +38,7 @@ noinst_HEADERS = \
gstqueue.h \ gstqueue.h \
gstsinesrc.h gstsinesrc.h
CFLAGS += -g CFLAGS += -O2 -Wall
libgstelements_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(GHTTP_LIBS) libgstelements_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(GHTTP_LIBS)
libgstelements_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) libgstelements_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)

View file

@ -64,7 +64,7 @@ static gboolean gst_asyncdisksrc_change_state(GstElement *element,
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_asyncdisksrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_asyncdisksrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_asyncdisksrc_get_type(void) { gst_asyncdisksrc_get_type(void) {
@ -280,7 +280,7 @@ void gst_asyncdisksrc_push_region(GstSrc *src,gulong offset,gulong size) {
/* open the file and mmap it, necessary to go to RUNNING state */ /* open the file and mmap it, necessary to go to RUNNING state */
static gboolean gst_asyncdisksrc_open_file(GstAsyncDiskSrc *src) { static gboolean gst_asyncdisksrc_open_file(GstAsyncDiskSrc *src) {
g_return_if_fail(!GST_FLAG_IS_SET(src,GST_ASYNCDISKSRC_OPEN)); g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_ASYNCDISKSRC_OPEN), FALSE);
/* open the file */ /* open the file */
src->fd = open(src->filename,O_RDONLY); src->fd = open(src->filename,O_RDONLY);
@ -326,7 +326,7 @@ static void gst_asyncdisksrc_close_file(GstAsyncDiskSrc *src) {
static gboolean gst_asyncdisksrc_change_state(GstElement *element, static gboolean gst_asyncdisksrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_ASYNCDISKSRC(element)); g_return_val_if_fail(GST_IS_ASYNCDISKSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -20,8 +20,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <unistd.h>
#include <gstaudiosink.h> #include <gstaudiosink.h>
#include <gst/meta/audioraw.h> #include <gst/meta/audioraw.h>
@ -221,7 +223,7 @@ void gst_audiosink_set_frequency(GstAudioSink *audiosink,gint frequency) {
} }
static gboolean gst_audiosink_open_audio(GstAudioSink *sink) { static gboolean gst_audiosink_open_audio(GstAudioSink *sink) {
g_return_if_fail(sink->fd == -1); g_return_val_if_fail(sink->fd == -1, FALSE);
g_print("attempting to open sound device\n"); g_print("attempting to open sound device\n");
@ -252,7 +254,7 @@ static void gst_audiosink_close_audio(GstAudioSink *sink) {
static gboolean gst_audiosink_start(GstElement *element, static gboolean gst_audiosink_start(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_AUDIOSINK(element)); g_return_val_if_fail(GST_IS_AUDIOSINK(element), FALSE);
if (gst_audiosink_open_audio(GST_AUDIOSINK(element)) == TRUE) { if (gst_audiosink_open_audio(GST_AUDIOSINK(element)) == TRUE) {
gst_element_set_state(element,GST_STATE_RUNNING | state); gst_element_set_state(element,GST_STATE_RUNNING | state);
@ -262,7 +264,7 @@ static gboolean gst_audiosink_start(GstElement *element,
} }
static gboolean gst_audiosink_stop(GstElement *element) { static gboolean gst_audiosink_stop(GstElement *element) {
g_return_if_fail(GST_IS_AUDIOSINK(element)); g_return_val_if_fail(GST_IS_AUDIOSINK(element), FALSE);
gst_audiosink_close_audio(GST_AUDIOSINK(element)); gst_audiosink_close_audio(GST_AUDIOSINK(element));
gst_element_set_state(element,~GST_STATE_RUNNING); gst_element_set_state(element,~GST_STATE_RUNNING);
@ -271,7 +273,7 @@ static gboolean gst_audiosink_stop(GstElement *element) {
static gboolean gst_audiosink_change_state(GstElement *element, static gboolean gst_audiosink_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_AUDIOSINK(element)); g_return_val_if_fail(GST_IS_AUDIOSINK(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -21,6 +21,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <gstaudiosrc.h> #include <gstaudiosrc.h>
@ -64,7 +66,7 @@ void gst_audiosrc_sync_parms(GstAudioSrc *audiosrc);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_audiosrc_get_type(void) { gst_audiosrc_get_type(void) {
@ -246,7 +248,7 @@ static void gst_audiosrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static gboolean gst_audiosrc_change_state(GstElement *element, static gboolean gst_audiosrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_AUDIOSRC(element)); g_return_val_if_fail(GST_IS_AUDIOSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:
@ -266,7 +268,7 @@ static gboolean gst_audiosrc_change_state(GstElement *element,
} }
static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) { static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
g_return_if_fail(src->fd == -1); g_return_val_if_fail(src->fd == -1, FALSE);
/* first try to open the sound card */ /* first try to open the sound card */
src->fd = open("/dev/dsp",O_RDONLY); src->fd = open("/dev/dsp",O_RDONLY);

View file

@ -20,6 +20,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h>
#include <gstdisksrc.h> #include <gstdisksrc.h>
@ -54,13 +55,13 @@ static void gst_disksrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_disksrc_get_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_disksrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_disksrc_push(GstSrc *src); static void gst_disksrc_push(GstSrc *src);
static void gst_disksrc_push_region(GstSrc *src,gulong offset,gulong size); //static void gst_disksrc_push_region(GstSrc *src,gulong offset,gulong size);
static gboolean gst_disksrc_change_state(GstElement *element, static gboolean gst_disksrc_change_state(GstElement *element,
GstElementState state); GstElementState state);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_disksrc_get_type(void) { gst_disksrc_get_type(void) {
@ -217,7 +218,7 @@ void gst_disksrc_push(GstSrc *src) {
/* open the file, necessary to go to RUNNING state */ /* open the file, necessary to go to RUNNING state */
static gboolean gst_disksrc_open_file(GstDiskSrc *src) { static gboolean gst_disksrc_open_file(GstDiskSrc *src) {
g_return_if_fail(!GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN)); g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_DISKSRC_OPEN), FALSE);
/* open the file */ /* open the file */
src->fd = open(src->filename,O_RDONLY); src->fd = open(src->filename,O_RDONLY);
@ -247,7 +248,7 @@ static void gst_disksrc_close_file(GstDiskSrc *src) {
static gboolean gst_disksrc_change_state(GstElement *element, static gboolean gst_disksrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_DISKSRC(element)); g_return_val_if_fail(GST_IS_DISKSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -48,7 +48,7 @@ static void gst_fakesink_init(GstFakeSink *fakesink);
static GstSinkClass *parent_class = NULL; static GstSinkClass *parent_class = NULL;
static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fakesink_get_type(void) { gst_fakesink_get_type(void) {

View file

@ -48,7 +48,7 @@ static void gst_fakesrc_init(GstFakeSrc *fakesrc);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fakesrc_get_type(void) { gst_fakesrc_get_type(void) {

View file

@ -18,6 +18,7 @@
*/ */
#include <gstfdsink.h> #include <gstfdsink.h>
#include <unistd.h>
GstElementDetails gst_fdsink_details = { GstElementDetails gst_fdsink_details = {
@ -49,7 +50,7 @@ static void gst_fdsink_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstSinkClass *parent_class = NULL; static GstSinkClass *parent_class = NULL;
static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fdsink_get_type(void) { gst_fdsink_get_type(void) {

View file

@ -20,6 +20,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <gstfdsrc.h> #include <gstfdsrc.h>
@ -54,11 +57,11 @@ static void gst_fdsrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_fdsrc_get_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_fdsrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_fdsrc_push(GstSrc *src); static void gst_fdsrc_push(GstSrc *src);
static void gst_fdsrc_push_region(GstSrc *src,gulong offset,gulong size); //static void gst_fdsrc_push_region(GstSrc *src,gulong offset,gulong size);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_fdsrc_get_type(void) { gst_fdsrc_get_type(void) {

View file

@ -20,6 +20,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <gsthttpsrc.h> #include <gsthttpsrc.h>
@ -62,7 +64,7 @@ static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_httpsrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_httpsrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_httpsrc_get_type(void) { gst_httpsrc_get_type(void) {
@ -153,9 +155,9 @@ static void gst_httpsrc_push(GstSrc *src) {
static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) { static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) {
gint status; gint status;
g_return_if_fail(httpsrc != NULL); g_return_val_if_fail(httpsrc != NULL, FALSE);
g_return_if_fail(GST_IS_HTTPSRC(httpsrc)); g_return_val_if_fail(GST_IS_HTTPSRC(httpsrc), FALSE);
g_return_if_fail(httpsrc->url != NULL); g_return_val_if_fail(httpsrc->url != NULL, FALSE);
httpsrc->request = ghttp_request_new(); httpsrc->request = ghttp_request_new();
ghttp_set_uri(httpsrc->request,httpsrc->url); ghttp_set_uri(httpsrc->request,httpsrc->url);
@ -237,7 +239,7 @@ static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static gboolean gst_httpsrc_change_state(GstElement *element, static gboolean gst_httpsrc_change_state(GstElement *element,
GstElementState state) { GstElementState state) {
g_return_if_fail(GST_IS_HTTPSRC(element)); g_return_val_if_fail(GST_IS_HTTPSRC(element), FALSE);
switch (state) { switch (state) {
case GST_STATE_RUNNING: case GST_STATE_RUNNING:

View file

@ -50,7 +50,7 @@ static void gst_identity_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstFilterClass *parent_class = NULL; static GstFilterClass *parent_class = NULL;
static guint gst_identity_signals[LAST_SIGNAL] = { 0 }; //static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_identity_get_type(void) { gst_identity_get_type(void) {

View file

@ -51,7 +51,7 @@ static void gst_queue_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GstConnectionClass *parent_class = NULL; static GstConnectionClass *parent_class = NULL;
static guint gst_queue_signals[LAST_SIGNAL] = { 0 }; //static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_queue_get_type(void) { gst_queue_get_type(void) {

View file

@ -22,6 +22,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/soundcard.h> #include <sys/soundcard.h>
#include <math.h> #include <math.h>
#include <stdlib.h>
#include <gstsinesrc.h> #include <gstsinesrc.h>
@ -58,13 +59,13 @@ static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
//static gboolean gst_sinesrc_change_state(GstElement *element, //static gboolean gst_sinesrc_change_state(GstElement *element,
// GstElementState state); // GstElementState state);
static void gst_sinesrc_close_audio(GstSineSrc *src); //static void gst_sinesrc_close_audio(GstSineSrc *src);
static gboolean gst_sinesrc_open_audio(GstSineSrc *src); //static gboolean gst_sinesrc_open_audio(GstSineSrc *src);
void gst_sinesrc_sync_parms(GstSineSrc *sinesrc); void gst_sinesrc_sync_parms(GstSineSrc *sinesrc);
static GstSrcClass *parent_class = NULL; static GstSrcClass *parent_class = NULL;
static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 }; //static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_sinesrc_get_type(void) { gst_sinesrc_get_type(void) {
@ -161,7 +162,7 @@ void gst_sinesrc_push(GstSrc *src) {
g_return_if_fail(buf); g_return_if_fail(buf);
GST_BUFFER_DATA(buf) = (gpointer)malloc(4096); GST_BUFFER_DATA(buf) = (gpointer)malloc(4096);
samples = (gint16*)GST_BUFFER_DATA(buf); samples = (gint16*)GST_BUFFER_DATA(buf);
GST_BUFFER_DATA(buf) = 4096; GST_BUFFER_SIZE(buf) = 4096;
volume = 65535 * sinesrc->volume; volume = 65535 * sinesrc->volume;
for (i=0;i<1024;i++) { for (i=0;i<1024;i++) {

View file

@ -5,6 +5,7 @@ extern gboolean _gst_plugin_spew;
gboolean idle_func(gpointer data); gboolean idle_func(gpointer data);
GstElement *videosink;
GstElement *src; GstElement *src;
void eof(GstSrc *src) { void eof(GstSrc *src) {
@ -12,9 +13,9 @@ void eof(GstSrc *src) {
exit(0); exit(0);
} }
void resize(GstSink *sink) { void resize(GtkWidget *wid, GtkRequisition *req, gpointer sink) {
g_print("have resize\n"); g_print("have resize %d %d\n", req->width, req->height);
gtk_object_set(GTK_OBJECT(src),"width",640,"height",480,NULL); gtk_object_set(GTK_OBJECT(videosink),"width",req->width,"height",req->height,NULL);
} }
@ -22,7 +23,6 @@ int main(int argc,char *argv[]) {
GstElement *bin; GstElement *bin;
GstElementFactory *srcfactory; GstElementFactory *srcfactory;
GstElementFactory *videosinkfactory; GstElementFactory *videosinkfactory;
GstElement *videosink;
GtkWidget *appwindow; GtkWidget *appwindow;
@ -57,6 +57,11 @@ int main(int argc,char *argv[]) {
appwindow = gnome_app_new("Videotest","Videotest"); appwindow = gnome_app_new("Videotest","Videotest");
gnome_app_set_contents(GNOME_APP(appwindow), gnome_app_set_contents(GNOME_APP(appwindow),
gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget")); gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget"));
gtk_object_set(GTK_OBJECT(appwindow),"allow_grow",TRUE,NULL);
gtk_object_set(GTK_OBJECT(appwindow),"allow_shrink",TRUE,NULL);
gtk_signal_connect(GTK_OBJECT(appwindow),"size-request",
GTK_SIGNAL_FUNC(resize),videosink);
gtk_widget_show_all(appwindow); gtk_widget_show_all(appwindow);
gst_element_set_state(GST_ELEMENT(bin),GST_STATE_RUNNING); gst_element_set_state(GST_ELEMENT(bin),GST_STATE_RUNNING);