mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-19 20:46:22 +00:00
Code Cleanups
Original commit message from CVS: Code Cleanups Added use cases for the source elements.
This commit is contained in:
parent
a075cbda18
commit
26a69ef7f8
44 changed files with 1490 additions and 1201 deletions
66
docs/random/sources
Normal file
66
docs/random/sources
Normal file
|
@ -0,0 +1,66 @@
|
|||
There are a number of different ways of coding a GstSrc. I'll try to
|
||||
outline them and how the function here:
|
||||
|
||||
1a) Simple push-function based with single output
|
||||
|
||||
This is the style that all the existing sources use. There is a single
|
||||
output pad, and a _push function that's global to the whole element. The
|
||||
_push function simple constructs buffer and pushes them out the pad.
|
||||
|
||||
Chained:
|
||||
|
||||
Typically this will be the/an entry into the Bin. The Bin's iterate
|
||||
function simply calls the Src's _push function. When the _push function
|
||||
pushes a buffer out it's pad, the chain function of the peer pad is
|
||||
called, presumably causing a push out the other side of that element, and
|
||||
eventually data gets to the other end. The stack unrolls, and the
|
||||
iteration ends for that Src.
|
||||
|
||||
Cothreaded:
|
||||
|
||||
Again, the source would generally be an entry into the Bin. A loopfunc
|
||||
will be constructed around it, which will simply loop calling the Src's
|
||||
_push function as in the non-cothreaded case. When the _push function
|
||||
pushes a buffer, it finds a pushfunc attached to the pad, drops the buffer
|
||||
in the pen, and calls the pushfunc provided by the Bin. This causes a
|
||||
switch to the next element, then the next, to the end, at which point a
|
||||
buffer pull will travel back down the chain. The _push function gets
|
||||
context and finishes, at which point the loopfunc wrapper simply calls it
|
||||
again in the next iteration.
|
||||
|
||||
|
||||
1b) Simple push-function based with multiple output
|
||||
|
||||
Chained:
|
||||
|
||||
Similar to the single output variant, except several chains are spawned
|
||||
off, one per push, hanging off whichever pad the buffer is pushed off of.
|
||||
The stack will grow and unwind as many times as buffers are pushed out.
|
||||
|
||||
Cothreaded:
|
||||
|
||||
Also similar to the single output variant. When the pull winds its way
|
||||
back from the first push, execution returns to the Src's _push function,
|
||||
which simply goes off and pushes out another buffer, causing another
|
||||
series of context switches. Eventually the loopfunc wrapper starts over,
|
||||
round and round we go.
|
||||
|
||||
|
||||
|
||||
2) Pull-function based with single output
|
||||
|
||||
Similar to a regular filter with a chain function associated with each
|
||||
pad, this kind of source doesn't provide a src-wide push function, but
|
||||
does provide pullfuncs for its pad. A pullfunc puts a buffer in the pen
|
||||
and exits.
|
||||
|
||||
Chained:
|
||||
|
||||
As usual, is likely to be an entry into a Bin. The Bin iterate code must
|
||||
explicitely pull a buffer and pass it on to the peer.
|
||||
|
||||
Cothreaded:
|
||||
|
||||
|
||||
---- ok, I'll finish this tomorrow when my brain's working again.... ----
|
||||
|
|
@ -33,7 +33,6 @@ extern "C" {
|
|||
|
||||
GstElementDetails gst_asyncdisksrc_details;
|
||||
|
||||
|
||||
#define GST_TYPE_ASYNCDISKSRC \
|
||||
(gst_asyncdisksrc_get_type())
|
||||
#define GST_ASYNCDISKSRC(obj) \
|
||||
|
|
|
@ -40,6 +40,8 @@ GstElementDetails gst_audiosink_details = {
|
|||
"(C) 1999",
|
||||
};
|
||||
|
||||
static void gst_audiosink_class_init (GstAudioSinkClass *klass);
|
||||
static void gst_audiosink_init (GstAudioSink *audiosink);
|
||||
|
||||
static gboolean gst_audiosink_open_audio (GstAudioSink *sink);
|
||||
static void gst_audiosink_close_audio (GstAudioSink *sink);
|
||||
|
@ -48,7 +50,7 @@ static GstElementStateReturn gst_audiosink_change_state(GstElement *element);
|
|||
static void gst_audiosink_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_audiosink_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
void gst_audiosink_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_audiosink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
/* AudioSink signals and args */
|
||||
enum {
|
||||
|
@ -67,7 +69,7 @@ enum {
|
|||
|
||||
#define GST_TYPE_AUDIOSINK_FORMATS (gst_audiosink_formats_get_type())
|
||||
|
||||
GtkType
|
||||
static GtkType
|
||||
gst_audiosink_formats_get_type(void) {
|
||||
static GtkType audiosink_formats_type = 0;
|
||||
static GtkEnumValue audiosink_formats[] = {
|
||||
|
@ -83,7 +85,7 @@ gst_audiosink_formats_get_type(void) {
|
|||
|
||||
#define GST_TYPE_AUDIOSINK_CHANNELS (gst_audiosink_channels_get_type())
|
||||
|
||||
GtkType
|
||||
static GtkType
|
||||
gst_audiosink_channels_get_type(void) {
|
||||
static GtkType audiosink_channels_type = 0;
|
||||
static GtkEnumValue audiosink_channels[] = {
|
||||
|
@ -97,9 +99,6 @@ gst_audiosink_channels_get_type(void) {
|
|||
return audiosink_channels_type;
|
||||
}
|
||||
|
||||
static void gst_audiosink_class_init(GstAudioSinkClass *klass);
|
||||
static void gst_audiosink_init(GstAudioSink *audiosink);
|
||||
|
||||
|
||||
static GstSinkClass *parent_class = NULL;
|
||||
static guint gst_audiosink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -107,7 +106,8 @@ static guint gst_audiosink_signals[LAST_SIGNAL] = { 0 };
|
|||
static guint16 gst_audiosink_type_audio = 0;
|
||||
|
||||
GtkType
|
||||
gst_audiosink_get_type(void) {
|
||||
gst_audiosink_get_type (void)
|
||||
{
|
||||
static GtkType audiosink_type = 0;
|
||||
|
||||
if (!audiosink_type) {
|
||||
|
@ -131,7 +131,8 @@ gst_audiosink_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiosink_class_init(GstAudioSinkClass *klass) {
|
||||
gst_audiosink_class_init (GstAudioSinkClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
|
@ -156,29 +157,33 @@ gst_audiosink_class_init(GstAudioSinkClass *klass) {
|
|||
gtk_signal_new("handoff",GTK_RUN_LAST,gtkobject_class->type,
|
||||
GTK_SIGNAL_OFFSET(GstAudioSinkClass,handoff),
|
||||
gtk_marshal_NONE__NONE,GTK_TYPE_NONE,0);
|
||||
|
||||
gtk_object_class_add_signals(gtkobject_class,gst_audiosink_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
gstelement_class->change_state = gst_audiosink_change_state;
|
||||
}
|
||||
|
||||
static void gst_audiosink_init(GstAudioSink *audiosink) {
|
||||
static void
|
||||
gst_audiosink_init (GstAudioSink *audiosink)
|
||||
{
|
||||
audiosink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (audiosink), audiosink->sinkpad);
|
||||
|
||||
gst_pad_set_type_id (audiosink->sinkpad, gst_audiosink_type_audio);
|
||||
|
||||
gst_pad_set_chain_function (audiosink->sinkpad, gst_audiosink_chain);
|
||||
|
||||
audiosink->fd = -1;
|
||||
audiosink->clock = gst_clock_get_system();
|
||||
|
||||
gst_clock_register (audiosink->clock, GST_OBJECT (audiosink));
|
||||
//audiosink->clocktime = 0LL;
|
||||
|
||||
GST_FLAG_SET (audiosink, GST_ELEMENT_THREAD_SUGGESTED);
|
||||
}
|
||||
|
||||
void gst_audiosink_sync_parms(GstAudioSink *audiosink) {
|
||||
static void
|
||||
gst_audiosink_sync_parms (GstAudioSink *audiosink)
|
||||
{
|
||||
audio_buf_info ospace;
|
||||
int frag;
|
||||
|
||||
|
@ -202,13 +207,9 @@ void gst_audiosink_sync_parms(GstAudioSink *audiosink) {
|
|||
|
||||
}
|
||||
|
||||
GstElement *gst_audiosink_new(gchar *name) {
|
||||
GstElement *audiosink = GST_ELEMENT(gtk_type_new(GST_TYPE_AUDIOSINK));
|
||||
gst_element_set_name(GST_ELEMENT(audiosink),name);
|
||||
return audiosink;
|
||||
}
|
||||
|
||||
void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstAudioSink *audiosink;
|
||||
MetaAudioRaw *meta;
|
||||
gboolean in_flush;
|
||||
|
@ -235,7 +236,8 @@ void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
if (meta != NULL) {
|
||||
if ((meta->format != audiosink->format) ||
|
||||
(meta->channels != audiosink->channels) ||
|
||||
(meta->frequency != audiosink->frequency)) {
|
||||
(meta->frequency != audiosink->frequency))
|
||||
{
|
||||
audiosink->format = meta->format;
|
||||
audiosink->channels = meta->channels;
|
||||
audiosink->frequency = meta->frequency;
|
||||
|
@ -255,7 +257,8 @@ void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
if (!audiosink->mute) {
|
||||
gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
|
||||
ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
|
||||
DEBUG("audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes, audiosink->fd, GST_BUFFER_DATA(buf), GST_BUFFER_SIZE(buf));
|
||||
DEBUG ("audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes,
|
||||
audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
//write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));
|
||||
}
|
||||
|
@ -264,11 +267,14 @@ void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
static void gst_audiosink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosink_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSink *audiosink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSINK (object));
|
||||
|
||||
audiosink = GST_AUDIOSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -292,11 +298,14 @@ static void gst_audiosink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_audiosink_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosink_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSink *audiosink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSINK (object));
|
||||
|
||||
audiosink = GST_AUDIOSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -317,7 +326,9 @@ static void gst_audiosink_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean gst_audiosink_open_audio(GstAudioSink *sink) {
|
||||
static gboolean
|
||||
gst_audiosink_open_audio (GstAudioSink *sink)
|
||||
{
|
||||
g_return_val_if_fail (sink->fd == -1, FALSE);
|
||||
|
||||
g_print ("audiosink: attempting to open sound device\n");
|
||||
|
@ -335,30 +346,39 @@ static gboolean gst_audiosink_open_audio(GstAudioSink *sink) {
|
|||
ioctl(sink->fd, SNDCTL_DSP_GETCAPS, &sink->caps);
|
||||
|
||||
g_print("audiosink: Capabilities\n");
|
||||
|
||||
if (sink->caps & DSP_CAP_DUPLEX) g_print("audiosink: Full duplex\n");
|
||||
if (sink->caps & DSP_CAP_REALTIME) g_print("audiosink: Realtime\n");
|
||||
if (sink->caps & DSP_CAP_BATCH) g_print("audiosink: Batch\n");
|
||||
if (sink->caps & DSP_CAP_COPROC) g_print("audiosink: Has coprocessor\n");
|
||||
if (sink->caps & DSP_CAP_TRIGGER) g_print("audiosink: Trigger\n");
|
||||
if (sink->caps & DSP_CAP_MMAP) g_print("audiosink: Direct access\n");
|
||||
|
||||
g_print("audiosink: opened audio with fd=%d\n", sink->fd);
|
||||
GST_FLAG_SET (sink, GST_AUDIOSINK_OPEN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void gst_audiosink_close_audio(GstAudioSink *sink) {
|
||||
static void
|
||||
gst_audiosink_close_audio (GstAudioSink *sink)
|
||||
{
|
||||
if (sink->fd < 0) return;
|
||||
|
||||
close(sink->fd);
|
||||
sink->fd = -1;
|
||||
|
||||
GST_FLAG_UNSET (sink, GST_AUDIOSINK_OPEN);
|
||||
|
||||
g_print("audiosink: closed sound device\n");
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_audiosink_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_audiosink_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_AUDIOSINK (element), FALSE);
|
||||
|
||||
/* if going down into NULL state, close the file if it's open */
|
||||
|
@ -378,8 +398,9 @@ static GstElementStateReturn gst_audiosink_change_state(GstElement *element) {
|
|||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
gboolean gst_audiosink_factory_init(GstElementFactory *factory) {
|
||||
|
||||
gboolean
|
||||
gst_audiosink_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
if (!gst_audiosink_type_audio)
|
||||
gst_audiosink_type_audio = gst_type_find_by_mime ("audio/raw");
|
||||
|
||||
|
|
|
@ -55,21 +55,23 @@ enum {
|
|||
|
||||
static void gst_audiosrc_class_init (GstAudioSrcClass *klass);
|
||||
static void gst_audiosrc_init (GstAudioSrc *audiosrc);
|
||||
|
||||
static void gst_audiosrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_audiosrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static GstElementStateReturn gst_audiosrc_change_state (GstElement *element);
|
||||
|
||||
static void gst_audiosrc_close_audio (GstAudioSrc *src);
|
||||
static gboolean gst_audiosrc_open_audio (GstAudioSrc *src);
|
||||
void gst_audiosrc_sync_parms(GstAudioSrc *audiosrc);
|
||||
static void gst_audiosrc_sync_parms (GstAudioSrc *audiosrc);
|
||||
|
||||
void gst_audiosrc_push(GstSrc *src);
|
||||
static void gst_audiosrc_push (GstSrc *src);
|
||||
|
||||
static GstSrcClass *parent_class = NULL;
|
||||
//static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_audiosrc_get_type(void) {
|
||||
gst_audiosrc_get_type (void)
|
||||
{
|
||||
static GtkType audiosrc_type = 0;
|
||||
|
||||
if (!audiosrc_type) {
|
||||
|
@ -89,7 +91,8 @@ gst_audiosrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiosrc_class_init(GstAudioSrcClass *klass) {
|
||||
gst_audiosrc_class_init (GstAudioSrcClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
@ -119,7 +122,9 @@ gst_audiosrc_class_init(GstAudioSrcClass *klass) {
|
|||
gstsrc_class->push = gst_audiosrc_push;
|
||||
}
|
||||
|
||||
static void gst_audiosrc_init(GstAudioSrc *audiosrc) {
|
||||
static void
|
||||
gst_audiosrc_init (GstAudioSrc *audiosrc)
|
||||
{
|
||||
audiosrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (audiosrc), audiosrc->srcpad);
|
||||
|
||||
|
@ -136,13 +141,9 @@ static void gst_audiosrc_init(GstAudioSrc *audiosrc) {
|
|||
audiosrc->seq = 0;
|
||||
}
|
||||
|
||||
GstElement *gst_audiosrc_new(gchar *name) {
|
||||
GstElement *audiosrc = GST_ELEMENT(gtk_type_new(GST_TYPE_AUDIOSRC));
|
||||
gst_element_set_name(GST_ELEMENT(audiosrc),name);
|
||||
return audiosrc;
|
||||
}
|
||||
|
||||
void gst_audiosrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_audiosrc_push (GstSrc *src)
|
||||
{
|
||||
GstAudioSrc *audiosrc;
|
||||
GstBuffer *buf;
|
||||
glong readbytes;
|
||||
|
@ -155,9 +156,12 @@ void gst_audiosrc_push(GstSrc *src) {
|
|||
|
||||
buf = gst_buffer_new ();
|
||||
g_return_if_fail (buf);
|
||||
|
||||
GST_BUFFER_DATA (buf) = (gpointer)g_malloc (audiosrc->bytes_per_read);
|
||||
|
||||
readbytes = read (audiosrc->fd,GST_BUFFER_DATA (buf),
|
||||
audiosrc->bytes_per_read);
|
||||
|
||||
if (readbytes == 0) {
|
||||
gst_src_signal_eos (GST_SRC (audiosrc));
|
||||
return;
|
||||
|
@ -165,6 +169,7 @@ void gst_audiosrc_push(GstSrc *src) {
|
|||
|
||||
GST_BUFFER_SIZE (buf) = readbytes;
|
||||
GST_BUFFER_OFFSET (buf) = audiosrc->curoffset;
|
||||
|
||||
audiosrc->curoffset += readbytes;
|
||||
|
||||
// gst_buffer_add_meta(buf,GST_META(newmeta));
|
||||
|
@ -173,11 +178,14 @@ void gst_audiosrc_push(GstSrc *src) {
|
|||
// g_print("pushed buffer from soundcard of %d bytes\n",readbytes);
|
||||
}
|
||||
|
||||
static void gst_audiosrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSRC (object));
|
||||
|
||||
src = GST_AUDIOSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -198,11 +206,14 @@ static void gst_audiosrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_audiosrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSRC (object));
|
||||
|
||||
src = GST_AUDIOSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -224,7 +235,9 @@ static void gst_audiosrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_audiosrc_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_audiosrc_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_AUDIOSRC (element), FALSE);
|
||||
|
||||
/* if going down into NULL state, close the file if it's open */
|
||||
|
@ -241,10 +254,13 @@ static GstElementStateReturn gst_audiosrc_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 gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
|
||||
static gboolean
|
||||
gst_audiosrc_open_audio (GstAudioSrc *src)
|
||||
{
|
||||
g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN), FALSE);
|
||||
|
||||
/* first try to open the sound card */
|
||||
|
@ -259,6 +275,7 @@ static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
|
|||
/* set card state */
|
||||
gst_audiosrc_sync_parms (src);
|
||||
DEBUG("opened audio\n");
|
||||
|
||||
GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -266,7 +283,9 @@ static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void gst_audiosrc_close_audio(GstAudioSrc *src) {
|
||||
static void
|
||||
gst_audiosrc_close_audio (GstAudioSrc *src)
|
||||
{
|
||||
g_return_if_fail (GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN));
|
||||
|
||||
close(src->fd);
|
||||
|
@ -275,7 +294,9 @@ static void gst_audiosrc_close_audio(GstAudioSrc *src) {
|
|||
GST_FLAG_UNSET (src, GST_AUDIOSRC_OPEN);
|
||||
}
|
||||
|
||||
void gst_audiosrc_sync_parms(GstAudioSrc *audiosrc) {
|
||||
static void
|
||||
gst_audiosrc_sync_parms (GstAudioSrc *audiosrc)
|
||||
{
|
||||
audio_buf_info ospace;
|
||||
|
||||
g_return_if_fail (audiosrc != NULL);
|
||||
|
|
|
@ -44,7 +44,7 @@ GstElementDetails gst_audiosrc_details;
|
|||
#define GST_IS_AUDIOSRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_AUDIOSRC))
|
||||
#define GST_IS_AUDIOSRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSRC))
|
||||
|
||||
// NOTE: per-element flags start with 16 for now
|
||||
typedef enum {
|
||||
|
|
|
@ -45,7 +45,7 @@ struct _elements_entry {
|
|||
gboolean (*factoryinit) (GstElementFactory *factory);
|
||||
};
|
||||
|
||||
struct _elements_entry _elements[] = {
|
||||
static struct _elements_entry _elements[] = {
|
||||
{ "fakesrc", gst_fakesrc_get_type, &gst_fakesrc_details, NULL },
|
||||
{ "fakesink", gst_fakesink_get_type, &gst_fakesink_details, NULL },
|
||||
{ "asyncdisksrc", gst_asyncdisksrc_get_type, &gst_asyncdisksrc_details, NULL },
|
||||
|
@ -62,13 +62,15 @@ struct _elements_entry _elements[] = {
|
|||
{ "queue", gst_queue_get_type, &gst_queue_details, NULL },
|
||||
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, NULL },
|
||||
{ "typefind", gst_typefind_get_type, &gst_typefind_details, NULL },
|
||||
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
GstPlugin *plugin_init(GModule *module) {
|
||||
GstPlugin *plugin_init (GModule *module)
|
||||
{
|
||||
GstPlugin *plugin;
|
||||
GstElementFactory *factory;
|
||||
int i = 0;
|
||||
gint i = 0;
|
||||
|
||||
/* we depend on having the usual types loaded first */
|
||||
gst_plugin_load("gsttypes");
|
||||
|
|
|
@ -38,7 +38,7 @@ extern "C" {
|
|||
#define GST_IS_ESDSINK(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_ESDSINK))
|
||||
#define GST_IS_ESDSINK_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ESDSINK)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ESDSINK))
|
||||
|
||||
typedef struct _GstEsdSink GstEsdSink;
|
||||
typedef struct _GstEsdSinkClass GstEsdSinkClass;
|
||||
|
|
|
@ -46,14 +46,14 @@ enum {
|
|||
static void gst_fakesink_class_init(GstFakeSinkClass *klass);
|
||||
static void gst_fakesink_init(GstFakeSink *fakesink);
|
||||
|
||||
GstElement *gst_fakesink_new(gchar *name);
|
||||
void gst_fakesink_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fakesink_chain(GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstSinkClass *parent_class = NULL;
|
||||
//static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fakesink_get_type(void) {
|
||||
gst_fakesink_get_type (void)
|
||||
{
|
||||
static GtkType fakesink_type = 0;
|
||||
|
||||
if (!fakesink_type) {
|
||||
|
@ -73,7 +73,8 @@ gst_fakesink_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fakesink_class_init(GstFakeSinkClass *klass) {
|
||||
gst_fakesink_class_init (GstFakeSinkClass *klass)
|
||||
{
|
||||
GstSinkClass *gstsink_class;
|
||||
|
||||
gstsink_class = (GstSinkClass*)klass;
|
||||
|
@ -81,7 +82,9 @@ gst_fakesink_class_init(GstFakeSinkClass *klass) {
|
|||
parent_class = gtk_type_class (GST_TYPE_SINK);
|
||||
}
|
||||
|
||||
static void gst_fakesink_init(GstFakeSink *fakesink) {
|
||||
static void
|
||||
gst_fakesink_init (GstFakeSink *fakesink)
|
||||
{
|
||||
fakesink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesink), fakesink->sinkpad);
|
||||
gst_pad_set_chain_function (fakesink->sinkpad, gst_fakesink_chain);
|
||||
|
@ -90,20 +93,6 @@ static void gst_fakesink_init(GstFakeSink *fakesink) {
|
|||
// gst_element_set_state(GST_ELEMENT(fakesink),GST_STATE_READY);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesink_new:
|
||||
* @name: the name of the new fakesrc
|
||||
*
|
||||
* create a new fakesink
|
||||
*
|
||||
* Returns: the new fakesink
|
||||
*/
|
||||
GstElement *gst_fakesink_new(gchar *name) {
|
||||
GstElement *fakesink = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESINK));
|
||||
gst_element_set_name(GST_ELEMENT(fakesink),name);
|
||||
return fakesink;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesink_chain:
|
||||
* @pad: the pad this faksink is connected to
|
||||
|
@ -112,7 +101,9 @@ GstElement *gst_fakesink_new(gchar *name) {
|
|||
* take the buffer from the pad and unref it without doing
|
||||
* anything with it.
|
||||
*/
|
||||
void gst_fakesink_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstFakeSink *fakesink;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
|
@ -123,5 +114,6 @@ void gst_fakesink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
// g_print("gst_fakesink_chain: got buffer in '%s'\n",
|
||||
// gst_element_get_name(GST_ELEMENT(fakesink)));
|
||||
g_print("<");
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fakesink_details;
|
|||
#define GST_IS_FAKESINK(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FAKESINK))
|
||||
#define GST_IS_FAKESINK_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESINK)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESINK))
|
||||
|
||||
typedef struct _GstFakeSink GstFakeSink;
|
||||
typedef struct _GstFakeSinkClass GstFakeSinkClass;
|
||||
|
|
|
@ -46,13 +46,14 @@ enum {
|
|||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
|
||||
void gst_fakesrc_push(GstSrc *src);
|
||||
static void gst_fakesrc_push (GstSrc *src);
|
||||
|
||||
static GstSrcClass *parent_class = NULL;
|
||||
//static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fakesrc_get_type(void) {
|
||||
gst_fakesrc_get_type (void)
|
||||
{
|
||||
static GtkType fakesrc_type = 0;
|
||||
|
||||
if (!fakesrc_type) {
|
||||
|
@ -72,7 +73,8 @@ gst_fakesrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fakesrc_class_init(GstFakeSrcClass *klass) {
|
||||
gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
||||
{
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
||||
gstsrc_class = (GstSrcClass*)klass;
|
||||
|
@ -83,7 +85,9 @@ gst_fakesrc_class_init(GstFakeSrcClass *klass) {
|
|||
gstsrc_class->push_region = NULL;
|
||||
}
|
||||
|
||||
static void gst_fakesrc_init(GstFakeSrc *fakesrc) {
|
||||
static void
|
||||
gst_fakesrc_init (GstFakeSrc *fakesrc)
|
||||
{
|
||||
fakesrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesrc), fakesrc->srcpad);
|
||||
|
||||
|
@ -91,37 +95,27 @@ static void gst_fakesrc_init(GstFakeSrc *fakesrc) {
|
|||
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesrc_new:
|
||||
* @name: then name of the fakse source
|
||||
*
|
||||
* create a new fakesrc
|
||||
*
|
||||
* Returns: The new element.
|
||||
*/
|
||||
GstElement *gst_fakesrc_new(gchar *name) {
|
||||
GstElement *fakesrc = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESRC));
|
||||
gst_element_set_name(GST_ELEMENT(fakesrc),name);
|
||||
return fakesrc;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesrc_push:
|
||||
* @src: the faksesrc to push
|
||||
*
|
||||
* generate an empty buffer and push it to the next element.
|
||||
*/
|
||||
void gst_fakesrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_fakesrc_push (GstSrc *src)
|
||||
{
|
||||
GstFakeSrc *fakesrc;
|
||||
GstBuffer *buf;
|
||||
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (GST_IS_FAKESRC (src));
|
||||
|
||||
fakesrc = GST_FAKESRC (src);
|
||||
|
||||
// g_print("gst_fakesrc_push(): pushing fake buffer from '%s'\n",
|
||||
// gst_element_get_name(GST_ELEMENT(fakesrc)));
|
||||
g_print(">");
|
||||
buf = gst_buffer_new ();
|
||||
|
||||
gst_pad_push (fakesrc->srcpad, buf);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fakesrc_details;
|
|||
#define GST_IS_FAKESRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FAKESRC))
|
||||
#define GST_IS_FAKESRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESRC))
|
||||
|
||||
typedef struct _GstFakeSrc GstFakeSrc;
|
||||
typedef struct _GstFakeSrcClass GstFakeSrcClass;
|
||||
|
|
|
@ -45,16 +45,18 @@ enum {
|
|||
|
||||
static void gst_fdsink_class_init (GstFdSinkClass *klass);
|
||||
static void gst_fdsink_init (GstFdSink *fdsink);
|
||||
|
||||
static void gst_fdsink_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_fdsink_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
void gst_fdsink_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fdsink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstSinkClass *parent_class = NULL;
|
||||
//static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fdsink_get_type(void) {
|
||||
gst_fdsink_get_type (void)
|
||||
{
|
||||
static GtkType fdsink_type = 0;
|
||||
|
||||
if (!fdsink_type) {
|
||||
|
@ -74,7 +76,8 @@ gst_fdsink_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fdsink_class_init(GstFdSinkClass *klass) {
|
||||
gst_fdsink_class_init (GstFdSinkClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstSinkClass *gstsink_class;
|
||||
|
||||
|
@ -90,7 +93,9 @@ gst_fdsink_class_init(GstFdSinkClass *klass) {
|
|||
gtkobject_class->get_arg = gst_fdsink_get_arg;
|
||||
}
|
||||
|
||||
static void gst_fdsink_init(GstFdSink *fdsink) {
|
||||
static void
|
||||
gst_fdsink_init (GstFdSink *fdsink)
|
||||
{
|
||||
fdsink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (fdsink), fdsink->sinkpad);
|
||||
gst_pad_set_chain_function (fdsink->sinkpad, gst_fdsink_chain);
|
||||
|
@ -98,19 +103,9 @@ static void gst_fdsink_init(GstFdSink *fdsink) {
|
|||
fdsink->fd = 1;
|
||||
}
|
||||
|
||||
GstElement *gst_fdsink_new(gchar *name) {
|
||||
GstElement *fdsink = GST_ELEMENT(gtk_type_new(GST_TYPE_FDSINK));
|
||||
gst_element_set_name(GST_ELEMENT(fdsink),name);
|
||||
return fdsink;
|
||||
}
|
||||
|
||||
GstElement *gst_fdsink_new_with_fd(gchar *name,gint fd) {
|
||||
GstElement *fdsink = gst_fdsink_new(name);
|
||||
gtk_object_set(GTK_OBJECT(fdsink),"fd",fd,NULL);
|
||||
return fdsink;
|
||||
}
|
||||
|
||||
void gst_fdsink_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstFdSink *fdsink;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
|
@ -118,17 +113,23 @@ void gst_fdsink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
g_return_if_fail (buf != NULL);
|
||||
|
||||
fdsink = GST_FDSINK (pad->parent);
|
||||
|
||||
g_return_if_fail (fdsink->fd >= 0);
|
||||
|
||||
if (GST_BUFFER_DATA (buf))
|
||||
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
static void gst_fdsink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_fdsink_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstFdSink *fdsink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSINK (object));
|
||||
|
||||
fdsink = GST_FDSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -140,11 +141,14 @@ static void gst_fdsink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_fdsink_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_fdsink_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstFdSink *fdsink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSINK (object));
|
||||
|
||||
fdsink = GST_FDSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fdsink_details;
|
|||
#define GST_IS_FDSINK(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FDSINK))
|
||||
#define GST_IS_FDSINK_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSINK)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSINK))
|
||||
|
||||
typedef struct _GstFdSink GstFdSink;
|
||||
typedef struct _GstFdSinkClass GstFdSinkClass;
|
||||
|
|
|
@ -53,6 +53,7 @@ enum {
|
|||
|
||||
static void gst_fdsrc_class_init (GstFdSrcClass *klass);
|
||||
static void gst_fdsrc_init (GstFdSrc *fdsrc);
|
||||
|
||||
static void gst_fdsrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_fdsrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
|
@ -64,7 +65,8 @@ static GstSrcClass *parent_class = NULL;
|
|||
//static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fdsrc_get_type(void) {
|
||||
gst_fdsrc_get_type (void)
|
||||
{
|
||||
static GtkType fdsrc_type = 0;
|
||||
|
||||
if (!fdsrc_type) {
|
||||
|
@ -84,7 +86,8 @@ gst_fdsrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fdsrc_class_init(GstFdSrcClass *klass) {
|
||||
gst_fdsrc_class_init (GstFdSrcClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
||||
|
@ -104,11 +107,14 @@ gst_fdsrc_class_init(GstFdSrcClass *klass) {
|
|||
gtkobject_class->get_arg = gst_fdsrc_get_arg;
|
||||
|
||||
gstsrc_class->push = gst_fdsrc_push;
|
||||
|
||||
/* we nominally can't (won't) do async */
|
||||
gstsrc_class->push_region = NULL;
|
||||
}
|
||||
|
||||
static void gst_fdsrc_init(GstFdSrc *fdsrc) {
|
||||
static void
|
||||
gst_fdsrc_init (GstFdSrc *fdsrc)
|
||||
{
|
||||
fdsrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (fdsrc), fdsrc->srcpad);
|
||||
|
||||
|
@ -119,12 +125,15 @@ static void gst_fdsrc_init(GstFdSrc *fdsrc) {
|
|||
}
|
||||
|
||||
|
||||
static void gst_fdsrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_fdsrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstFdSrc *src;
|
||||
int fd;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSRC (object));
|
||||
|
||||
src = GST_FDSRC (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -150,11 +159,14 @@ 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)
|
||||
{
|
||||
GstFdSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSRC (object));
|
||||
|
||||
src = GST_FDSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -170,13 +182,16 @@ static void gst_fdsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
void gst_fdsrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_fdsrc_push (GstSrc *src)
|
||||
{
|
||||
GstFdSrc *fdsrc;
|
||||
GstBuffer *buf;
|
||||
glong readbytes;
|
||||
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (GST_IS_FDSRC (src));
|
||||
|
||||
fdsrc = GST_FDSRC (src);
|
||||
|
||||
/* create the buffer */
|
||||
|
@ -202,6 +217,7 @@ void gst_fdsrc_push(GstSrc *src) {
|
|||
}
|
||||
GST_BUFFER_OFFSET (buf) = fdsrc->curoffset;
|
||||
GST_BUFFER_SIZE (buf) = readbytes;
|
||||
|
||||
fdsrc->curoffset += readbytes;
|
||||
|
||||
/* we're done, push the buffer off now */
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fdsrc_details;
|
|||
#define GST_IS_FDSRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FDSRC))
|
||||
#define GST_IS_FDSRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSRC))
|
||||
|
||||
|
||||
typedef struct _GstFdSrc GstFdSrc;
|
||||
|
|
|
@ -35,13 +35,6 @@ GstElementDetails gst_httpsrc_details = {
|
|||
"(C) 1999",
|
||||
};
|
||||
|
||||
|
||||
static void gst_httpsrc_push(GstSrc *src);
|
||||
static gboolean gst_httpsrc_open_url(GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url(GstHttpSrc *src);
|
||||
static GstElementStateReturn gst_httpsrc_change_state(GstElement *element);
|
||||
|
||||
|
||||
/* HttpSrc signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
|
@ -58,15 +51,23 @@ enum {
|
|||
|
||||
static void gst_httpsrc_class_init (GstHttpSrcClass *klass);
|
||||
static void gst_httpsrc_init (GstHttpSrc *httpsrc);
|
||||
|
||||
static void gst_httpsrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_httpsrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
static void gst_httpsrc_push (GstSrc *src);
|
||||
|
||||
static gboolean gst_httpsrc_open_url (GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url (GstHttpSrc *src);
|
||||
|
||||
static GstElementStateReturn gst_httpsrc_change_state(GstElement *element);
|
||||
|
||||
static GstSrcClass *parent_class = NULL;
|
||||
//static guint gst_httpsrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_httpsrc_get_type(void) {
|
||||
gst_httpsrc_get_type (void)
|
||||
{
|
||||
static GtkType httpsrc_type = 0;
|
||||
|
||||
if (!httpsrc_type) {
|
||||
|
@ -86,7 +87,8 @@ gst_httpsrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_httpsrc_class_init(GstHttpSrcClass *klass) {
|
||||
gst_httpsrc_class_init (GstHttpSrcClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
@ -112,7 +114,9 @@ gst_httpsrc_class_init(GstHttpSrcClass *klass) {
|
|||
gstsrc_class->push_region = NULL;
|
||||
}
|
||||
|
||||
static void gst_httpsrc_init(GstHttpSrc *httpsrc) {
|
||||
static void
|
||||
gst_httpsrc_init (GstHttpSrc *httpsrc)
|
||||
{
|
||||
httpsrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (httpsrc), httpsrc->srcpad);
|
||||
|
||||
|
@ -123,7 +127,9 @@ static void gst_httpsrc_init(GstHttpSrc *httpsrc) {
|
|||
httpsrc->bytes_per_read = 4096;
|
||||
}
|
||||
|
||||
static void gst_httpsrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_httpsrc_push (GstSrc *src)
|
||||
{
|
||||
GstHttpSrc *httpsrc;
|
||||
GstBuffer *buf;
|
||||
glong readbytes;
|
||||
|
@ -135,7 +141,9 @@ static void gst_httpsrc_push(GstSrc *src) {
|
|||
|
||||
buf = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (buf) = (gpointer)malloc (httpsrc->bytes_per_read);
|
||||
|
||||
readbytes = read (httpsrc->fd, GST_BUFFER_DATA (buf), httpsrc->bytes_per_read);
|
||||
|
||||
if (readbytes == 0) {
|
||||
gst_src_signal_eos (GST_SRC (httpsrc));
|
||||
return;
|
||||
|
@ -146,18 +154,22 @@ static void gst_httpsrc_push(GstSrc *src) {
|
|||
}
|
||||
GST_BUFFER_OFFSET (buf) = httpsrc->curoffset;
|
||||
GST_BUFFER_SIZE (buf) = readbytes;
|
||||
|
||||
httpsrc->curoffset += readbytes;
|
||||
|
||||
gst_pad_push (httpsrc->srcpad, buf);
|
||||
}
|
||||
|
||||
static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) {
|
||||
static gboolean
|
||||
gst_httpsrc_open_url (GstHttpSrc *httpsrc)
|
||||
{
|
||||
gint status;
|
||||
|
||||
g_return_val_if_fail (!GST_FLAG_IS_SET (httpsrc, GST_HTTPSRC_OPEN), FALSE);
|
||||
g_return_val_if_fail (httpsrc->url != NULL, FALSE);
|
||||
|
||||
httpsrc->request = ghttp_request_new ();
|
||||
|
||||
ghttp_set_uri (httpsrc->request, httpsrc->url);
|
||||
ghttp_set_sync (httpsrc->request, ghttp_async);
|
||||
ghttp_set_header (httpsrc->request, "User-Agent", "GstHttpSrc");
|
||||
|
@ -173,14 +185,17 @@ static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) {
|
|||
|
||||
/* get the fd so we can read data ourselves */
|
||||
httpsrc->fd = ghttp_get_socket (httpsrc->request);
|
||||
|
||||
GST_FLAG_SET (httpsrc, GST_HTTPSRC_OPEN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* unmap and close the file */
|
||||
static void gst_httpsrc_close_url(GstHttpSrc *src) {
|
||||
static void
|
||||
gst_httpsrc_close_url (GstHttpSrc *src)
|
||||
{
|
||||
g_return_if_fail (GST_FLAG_IS_SET (src, GST_HTTPSRC_OPEN));
|
||||
|
||||
g_return_if_fail (src->fd > 0);
|
||||
|
||||
close(src->fd);
|
||||
|
@ -189,11 +204,14 @@ static void gst_httpsrc_close_url(GstHttpSrc *src) {
|
|||
GST_FLAG_UNSET (src, GST_HTTPSRC_OPEN);
|
||||
}
|
||||
|
||||
static void gst_httpsrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_httpsrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstHttpSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_HTTPSRC (object));
|
||||
|
||||
src = GST_HTTPSRC (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -219,11 +237,14 @@ static void gst_httpsrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_httpsrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstHttpSrc *httpsrc;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_HTTPSRC (object));
|
||||
|
||||
httpsrc = GST_HTTPSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -239,7 +260,9 @@ static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_httpsrc_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_httpsrc_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_HTTPSRC (element), GST_STATE_FAILURE);
|
||||
|
||||
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
||||
|
@ -254,5 +277,6 @@ static GstElementStateReturn gst_httpsrc_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;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ GstElementDetails gst_httpsrc_details;
|
|||
#define GST_IS_HTTPSRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_HTTPSRC))
|
||||
#define GST_IS_HTTPSRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_HTTPSRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_HTTPSRC))
|
||||
|
||||
// NOTE: per-element flags start with 16 for now
|
||||
typedef enum {
|
||||
|
|
|
@ -45,16 +45,18 @@ enum {
|
|||
|
||||
static void gst_identity_class_init (GstIdentityClass *klass);
|
||||
static void gst_identity_init (GstIdentity *identity);
|
||||
|
||||
static void gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_identity_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
void gst_identity_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_identity_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstFilterClass *parent_class = NULL;
|
||||
//static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_identity_get_type(void) {
|
||||
gst_identity_get_type (void)
|
||||
{
|
||||
static GtkType identity_type = 0;
|
||||
|
||||
if (!identity_type) {
|
||||
|
@ -73,7 +75,9 @@ gst_identity_get_type(void) {
|
|||
return identity_type;
|
||||
}
|
||||
|
||||
static void gst_identity_class_init(GstIdentityClass *klass) {
|
||||
static void
|
||||
gst_identity_class_init (GstIdentityClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstFilterClass *gstfilter_class;
|
||||
|
||||
|
@ -89,23 +93,22 @@ static void gst_identity_class_init(GstIdentityClass *klass) {
|
|||
//gtkobject_class->get_arg = gst_identity_get_arg;
|
||||
}
|
||||
|
||||
static void gst_identity_init(GstIdentity *identity) {
|
||||
static void
|
||||
gst_identity_init (GstIdentity *identity)
|
||||
{
|
||||
identity->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad);
|
||||
gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
|
||||
|
||||
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
|
||||
|
||||
identity->control = 0;
|
||||
}
|
||||
|
||||
GstElement *gst_identity_new(gchar *name) {
|
||||
GstElement *identity = GST_ELEMENT(gtk_type_new(GST_TYPE_IDENTITY));
|
||||
gst_element_set_name(GST_ELEMENT(identity),name);
|
||||
return identity;
|
||||
}
|
||||
|
||||
void gst_identity_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstIdentity *identity;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
|
@ -116,14 +119,18 @@ void gst_identity_chain(GstPad *pad,GstBuffer *buf) {
|
|||
// g_print("gst_identity_chain: got buffer in '%s'\n",
|
||||
// gst_element_get_name(GST_ELEMENT(identity)));
|
||||
g_print("i");
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
}
|
||||
|
||||
static void gst_identity_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstIdentity *identity;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_IDENTITY (object));
|
||||
|
||||
identity = GST_IDENTITY (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -140,6 +147,7 @@ static void gst_identity_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_IDENTITY (object));
|
||||
|
||||
identity = GST_IDENTITY (object);
|
||||
|
||||
switch (id) {
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_identity_details;
|
|||
#define GST_IS_IDENTITY(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_IDENTITY))
|
||||
#define GST_IS_IDENTITY_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_IDENTITY)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_IDENTITY))
|
||||
|
||||
typedef struct _GstIdentity GstIdentity;
|
||||
typedef struct _GstIdentityClass GstIdentityClass;
|
||||
|
|
|
@ -54,6 +54,7 @@ enum {
|
|||
|
||||
static void gst_queue_class_init (GstQueueClass *klass);
|
||||
static void gst_queue_init (GstQueue *queue);
|
||||
|
||||
static void gst_queue_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_queue_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
|
@ -64,6 +65,7 @@ static void gst_queue_flush(GstQueue *queue);
|
|||
|
||||
static GstElementStateReturn gst_queue_change_state (GstElement *element);
|
||||
|
||||
|
||||
static GstConnectionClass *parent_class = NULL;
|
||||
//static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
@ -87,7 +89,9 @@ gst_queue_get_type(void) {
|
|||
return queue_type;
|
||||
}
|
||||
|
||||
static void gst_queue_class_init(GstQueueClass *klass) {
|
||||
static void
|
||||
gst_queue_class_init (GstQueueClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstConnectionClass *gstconnection_class;
|
||||
|
@ -111,7 +115,9 @@ static void gst_queue_class_init(GstQueueClass *klass) {
|
|||
gstelement_class->change_state = gst_queue_change_state;
|
||||
}
|
||||
|
||||
static void gst_queue_init(GstQueue *queue) {
|
||||
static void
|
||||
gst_queue_init (GstQueue *queue)
|
||||
{
|
||||
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
|
||||
gst_pad_set_chain_function (queue->sinkpad, gst_queue_chain);
|
||||
|
@ -133,27 +139,28 @@ static void gst_queue_init(GstQueue *queue) {
|
|||
queue->fullcond = g_cond_new ();
|
||||
}
|
||||
|
||||
GstElement *gst_queue_new(gchar *name) {
|
||||
GstElement *queue = GST_ELEMENT(gtk_type_new(GST_TYPE_QUEUE));
|
||||
gst_element_set_name(GST_ELEMENT(queue),name);
|
||||
return queue;
|
||||
}
|
||||
|
||||
static void gst_queue_cleanup_buffers(gpointer data, const gpointer user_data)
|
||||
static void
|
||||
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
|
||||
{
|
||||
DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
|
||||
|
||||
gst_buffer_unref (GST_BUFFER (data));
|
||||
}
|
||||
|
||||
static void gst_queue_flush(GstQueue *queue) {
|
||||
g_slist_foreach(queue->queue, gst_queue_cleanup_buffers, (char *)gst_element_get_name(GST_ELEMENT(queue)));
|
||||
static void
|
||||
gst_queue_flush (GstQueue *queue)
|
||||
{
|
||||
g_slist_foreach (queue->queue, gst_queue_cleanup_buffers,
|
||||
(char *)gst_element_get_name (GST_ELEMENT (queue)));
|
||||
g_slist_free (queue->queue);
|
||||
|
||||
queue->queue = NULL;
|
||||
queue->level_buffers = 0;
|
||||
}
|
||||
|
||||
static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstQueue *queue;
|
||||
gboolean tosignal = FALSE;
|
||||
const guchar *name;
|
||||
|
@ -211,7 +218,9 @@ static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_queue_push(GstConnection *connection) {
|
||||
static void
|
||||
gst_queue_push (GstConnection *connection)
|
||||
{
|
||||
GstQueue *queue = GST_QUEUE (connection);
|
||||
GstBuffer *buf = NULL;
|
||||
GSList *front;
|
||||
|
@ -240,6 +249,7 @@ static void gst_queue_push(GstConnection *connection) {
|
|||
buf = (GstBuffer *)(front->data);
|
||||
queue->queue = g_slist_remove_link (queue->queue, front);
|
||||
g_slist_free (front);
|
||||
|
||||
queue->level_buffers--;
|
||||
STATUS("%s: -\n");
|
||||
tosignal = queue->level_buffers < queue->max_buffers;
|
||||
|
@ -260,7 +270,9 @@ static void gst_queue_push(GstConnection *connection) {
|
|||
/* unlock now */
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_queue_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_queue_change_state (GstElement *element)
|
||||
{
|
||||
GstQueue *queue;
|
||||
g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE);
|
||||
|
||||
|
@ -281,11 +293,14 @@ static GstElementStateReturn gst_queue_change_state(GstElement *element) {
|
|||
}
|
||||
|
||||
|
||||
static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_queue_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstQueue *queue;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_QUEUE (object));
|
||||
|
||||
queue = GST_QUEUE (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -297,11 +312,14 @@ static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_queue_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_queue_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstQueue *queue;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_QUEUE (object));
|
||||
|
||||
queue = GST_QUEUE (object);
|
||||
|
||||
switch (id) {
|
||||
|
|
|
@ -44,7 +44,7 @@ GstElementDetails gst_sinesrc_details;
|
|||
#define GST_IS_SINESRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_SINESRC))
|
||||
#define GST_IS_SINESRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_SINESRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_SINESRC))
|
||||
|
||||
typedef struct _GstSineSrc GstSineSrc;
|
||||
typedef struct _GstSineSrcClass GstSineSrcClass;
|
||||
|
|
|
@ -81,7 +81,8 @@ gst_pipeline_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_pipeline_class_init(GstPipelineClass *klass) {
|
||||
gst_pipeline_class_init (GstPipelineClass *klass)
|
||||
{
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gstelement_class = (GstElementClass*)klass;
|
||||
|
@ -92,7 +93,9 @@ gst_pipeline_class_init(GstPipelineClass *klass) {
|
|||
gstelement_class->elementfactory = gst_elementfactory_find ("pipeline");
|
||||
}
|
||||
|
||||
static void gst_pipeline_init(GstPipeline *pipeline) {
|
||||
static void
|
||||
gst_pipeline_init (GstPipeline *pipeline)
|
||||
{
|
||||
pipeline->src = NULL;
|
||||
pipeline->sinks = NULL;
|
||||
}
|
||||
|
@ -106,26 +109,35 @@ static void gst_pipeline_init(GstPipeline *pipeline) {
|
|||
*
|
||||
* Returns: newly created GstPipeline
|
||||
*/
|
||||
GstElement *gst_pipeline_new(guchar *name) {
|
||||
GstElement*
|
||||
gst_pipeline_new (guchar *name)
|
||||
{
|
||||
GstPipeline *pipeline;
|
||||
|
||||
pipeline = gtk_type_new (gst_pipeline_get_type ());
|
||||
gst_element_set_name (GST_ELEMENT (pipeline), name);
|
||||
|
||||
return GST_ELEMENT (pipeline);
|
||||
}
|
||||
|
||||
static void gst_pipeline_prepare(GstPipeline *pipeline) {
|
||||
static void
|
||||
gst_pipeline_prepare (GstPipeline *pipeline)
|
||||
{
|
||||
g_print("GstPipeline: preparing pipeline \"%s\" for playing\n",
|
||||
gst_element_get_name(GST_ELEMENT(pipeline)));
|
||||
}
|
||||
|
||||
static void gst_pipeline_have_type(GstSink *sink, GstSink *sink2, gpointer data) {
|
||||
static void
|
||||
gst_pipeline_have_type (GstSink *sink, GstSink *sink2, gpointer data)
|
||||
{
|
||||
g_print("GstPipeline: pipeline have type %p\n", (gboolean *)data);
|
||||
|
||||
*(gboolean *)data = TRUE;
|
||||
}
|
||||
|
||||
static guint16 gst_pipeline_typefind(GstPipeline *pipeline, GstElement *element) {
|
||||
static guint16
|
||||
gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
|
||||
{
|
||||
gboolean found = FALSE;
|
||||
GstElement *typefind;
|
||||
guint16 type_id = 0;
|
||||
|
@ -168,7 +180,9 @@ static guint16 gst_pipeline_typefind(GstPipeline *pipeline, GstElement *element)
|
|||
return type_id;
|
||||
}
|
||||
|
||||
static void gst_pipeline_pads_autoplug_func(GstElement *src, GstPad *pad, GstElement *sink) {
|
||||
static void
|
||||
gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
||||
{
|
||||
GList *sinkpads;
|
||||
GstPad *sinkpad;
|
||||
gboolean connected = FALSE;
|
||||
|
@ -201,7 +215,9 @@ static void gst_pipeline_pads_autoplug_func(GstElement *src, GstPad *pad, GstEle
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_pipeline_pads_autoplug(GstElement *src, GstElement *sink) {
|
||||
static void
|
||||
gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink)
|
||||
{
|
||||
GList *srcpads, *sinkpads;
|
||||
gboolean connected = FALSE;
|
||||
|
||||
|
@ -255,7 +271,8 @@ end:
|
|||
* than one src element, the previously added element will
|
||||
* be removed.
|
||||
*/
|
||||
void gst_pipeline_add_src(GstPipeline *pipeline, GstElement *src)
|
||||
void
|
||||
gst_pipeline_add_src (GstPipeline *pipeline, GstElement *src)
|
||||
{
|
||||
g_return_if_fail (pipeline != NULL);
|
||||
g_return_if_fail (GST_IS_PIPELINE (pipeline));
|
||||
|
@ -279,7 +296,8 @@ void gst_pipeline_add_src(GstPipeline *pipeline, GstElement *src)
|
|||
* Adds a sink element to the pipeline. This element
|
||||
* will be used as a sink for autoplugging
|
||||
*/
|
||||
void gst_pipeline_add_sink(GstPipeline *pipeline, GstElement *sink)
|
||||
void
|
||||
gst_pipeline_add_sink (GstPipeline *pipeline, GstElement *sink)
|
||||
{
|
||||
g_return_if_fail (pipeline != NULL);
|
||||
g_return_if_fail (GST_IS_PIPELINE (pipeline));
|
||||
|
@ -299,7 +317,9 @@ void gst_pipeline_add_sink(GstPipeline *pipeline, GstElement *sink)
|
|||
*
|
||||
* Returns: a gboolean indicating success or failure.
|
||||
*/
|
||||
gboolean gst_pipeline_autoplug(GstPipeline *pipeline) {
|
||||
gboolean
|
||||
gst_pipeline_autoplug (GstPipeline *pipeline)
|
||||
{
|
||||
GList *elements;
|
||||
GstElement *element, *srcelement = NULL, *sinkelement= NULL;
|
||||
GList **factories;
|
||||
|
@ -500,12 +520,14 @@ next:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_pipeline_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_pipeline_change_state (GstElement *element)
|
||||
{
|
||||
GstPipeline *pipeline;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PIPELINE (element), FALSE);
|
||||
pipeline = GST_PIPELINE(element);
|
||||
|
||||
pipeline = GST_PIPELINE (element);
|
||||
|
||||
switch (GST_STATE_PENDING (pipeline)) {
|
||||
case GST_STATE_READY:
|
||||
|
@ -518,6 +540,7 @@ static GstElementStateReturn gst_pipeline_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;
|
||||
}
|
||||
|
||||
|
@ -528,7 +551,9 @@ static GstElementStateReturn gst_pipeline_change_state(GstElement *element) {
|
|||
*
|
||||
* Cause the pipeline's contents to be run through one full 'iteration'.
|
||||
*/
|
||||
void gst_pipeline_iterate(GstPipeline *pipeline) {
|
||||
void
|
||||
gst_pipeline_iterate (GstPipeline *pipeline)
|
||||
{
|
||||
g_return_if_fail (pipeline != NULL);
|
||||
g_return_if_fail (GST_IS_PIPELINE(pipeline));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ extern "C" {
|
|||
|
||||
GstElementDetails gst_asyncdisksrc_details;
|
||||
|
||||
|
||||
#define GST_TYPE_ASYNCDISKSRC \
|
||||
(gst_asyncdisksrc_get_type())
|
||||
#define GST_ASYNCDISKSRC(obj) \
|
||||
|
|
|
@ -40,6 +40,8 @@ GstElementDetails gst_audiosink_details = {
|
|||
"(C) 1999",
|
||||
};
|
||||
|
||||
static void gst_audiosink_class_init (GstAudioSinkClass *klass);
|
||||
static void gst_audiosink_init (GstAudioSink *audiosink);
|
||||
|
||||
static gboolean gst_audiosink_open_audio (GstAudioSink *sink);
|
||||
static void gst_audiosink_close_audio (GstAudioSink *sink);
|
||||
|
@ -48,7 +50,7 @@ static GstElementStateReturn gst_audiosink_change_state(GstElement *element);
|
|||
static void gst_audiosink_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_audiosink_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
void gst_audiosink_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_audiosink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
/* AudioSink signals and args */
|
||||
enum {
|
||||
|
@ -67,7 +69,7 @@ enum {
|
|||
|
||||
#define GST_TYPE_AUDIOSINK_FORMATS (gst_audiosink_formats_get_type())
|
||||
|
||||
GtkType
|
||||
static GtkType
|
||||
gst_audiosink_formats_get_type(void) {
|
||||
static GtkType audiosink_formats_type = 0;
|
||||
static GtkEnumValue audiosink_formats[] = {
|
||||
|
@ -83,7 +85,7 @@ gst_audiosink_formats_get_type(void) {
|
|||
|
||||
#define GST_TYPE_AUDIOSINK_CHANNELS (gst_audiosink_channels_get_type())
|
||||
|
||||
GtkType
|
||||
static GtkType
|
||||
gst_audiosink_channels_get_type(void) {
|
||||
static GtkType audiosink_channels_type = 0;
|
||||
static GtkEnumValue audiosink_channels[] = {
|
||||
|
@ -97,9 +99,6 @@ gst_audiosink_channels_get_type(void) {
|
|||
return audiosink_channels_type;
|
||||
}
|
||||
|
||||
static void gst_audiosink_class_init(GstAudioSinkClass *klass);
|
||||
static void gst_audiosink_init(GstAudioSink *audiosink);
|
||||
|
||||
|
||||
static GstSinkClass *parent_class = NULL;
|
||||
static guint gst_audiosink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -107,7 +106,8 @@ static guint gst_audiosink_signals[LAST_SIGNAL] = { 0 };
|
|||
static guint16 gst_audiosink_type_audio = 0;
|
||||
|
||||
GtkType
|
||||
gst_audiosink_get_type(void) {
|
||||
gst_audiosink_get_type (void)
|
||||
{
|
||||
static GtkType audiosink_type = 0;
|
||||
|
||||
if (!audiosink_type) {
|
||||
|
@ -131,7 +131,8 @@ gst_audiosink_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiosink_class_init(GstAudioSinkClass *klass) {
|
||||
gst_audiosink_class_init (GstAudioSinkClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
|
@ -156,29 +157,33 @@ gst_audiosink_class_init(GstAudioSinkClass *klass) {
|
|||
gtk_signal_new("handoff",GTK_RUN_LAST,gtkobject_class->type,
|
||||
GTK_SIGNAL_OFFSET(GstAudioSinkClass,handoff),
|
||||
gtk_marshal_NONE__NONE,GTK_TYPE_NONE,0);
|
||||
|
||||
gtk_object_class_add_signals(gtkobject_class,gst_audiosink_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
gstelement_class->change_state = gst_audiosink_change_state;
|
||||
}
|
||||
|
||||
static void gst_audiosink_init(GstAudioSink *audiosink) {
|
||||
static void
|
||||
gst_audiosink_init (GstAudioSink *audiosink)
|
||||
{
|
||||
audiosink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (audiosink), audiosink->sinkpad);
|
||||
|
||||
gst_pad_set_type_id (audiosink->sinkpad, gst_audiosink_type_audio);
|
||||
|
||||
gst_pad_set_chain_function (audiosink->sinkpad, gst_audiosink_chain);
|
||||
|
||||
audiosink->fd = -1;
|
||||
audiosink->clock = gst_clock_get_system();
|
||||
|
||||
gst_clock_register (audiosink->clock, GST_OBJECT (audiosink));
|
||||
//audiosink->clocktime = 0LL;
|
||||
|
||||
GST_FLAG_SET (audiosink, GST_ELEMENT_THREAD_SUGGESTED);
|
||||
}
|
||||
|
||||
void gst_audiosink_sync_parms(GstAudioSink *audiosink) {
|
||||
static void
|
||||
gst_audiosink_sync_parms (GstAudioSink *audiosink)
|
||||
{
|
||||
audio_buf_info ospace;
|
||||
int frag;
|
||||
|
||||
|
@ -202,13 +207,9 @@ void gst_audiosink_sync_parms(GstAudioSink *audiosink) {
|
|||
|
||||
}
|
||||
|
||||
GstElement *gst_audiosink_new(gchar *name) {
|
||||
GstElement *audiosink = GST_ELEMENT(gtk_type_new(GST_TYPE_AUDIOSINK));
|
||||
gst_element_set_name(GST_ELEMENT(audiosink),name);
|
||||
return audiosink;
|
||||
}
|
||||
|
||||
void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstAudioSink *audiosink;
|
||||
MetaAudioRaw *meta;
|
||||
gboolean in_flush;
|
||||
|
@ -235,7 +236,8 @@ void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
if (meta != NULL) {
|
||||
if ((meta->format != audiosink->format) ||
|
||||
(meta->channels != audiosink->channels) ||
|
||||
(meta->frequency != audiosink->frequency)) {
|
||||
(meta->frequency != audiosink->frequency))
|
||||
{
|
||||
audiosink->format = meta->format;
|
||||
audiosink->channels = meta->channels;
|
||||
audiosink->frequency = meta->frequency;
|
||||
|
@ -255,7 +257,8 @@ void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
if (!audiosink->mute) {
|
||||
gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
|
||||
ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
|
||||
DEBUG("audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes, audiosink->fd, GST_BUFFER_DATA(buf), GST_BUFFER_SIZE(buf));
|
||||
DEBUG ("audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes,
|
||||
audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
//write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));
|
||||
}
|
||||
|
@ -264,11 +267,14 @@ void gst_audiosink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
static void gst_audiosink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosink_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSink *audiosink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSINK (object));
|
||||
|
||||
audiosink = GST_AUDIOSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -292,11 +298,14 @@ static void gst_audiosink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_audiosink_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosink_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSink *audiosink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSINK (object));
|
||||
|
||||
audiosink = GST_AUDIOSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -317,7 +326,9 @@ static void gst_audiosink_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean gst_audiosink_open_audio(GstAudioSink *sink) {
|
||||
static gboolean
|
||||
gst_audiosink_open_audio (GstAudioSink *sink)
|
||||
{
|
||||
g_return_val_if_fail (sink->fd == -1, FALSE);
|
||||
|
||||
g_print ("audiosink: attempting to open sound device\n");
|
||||
|
@ -335,30 +346,39 @@ static gboolean gst_audiosink_open_audio(GstAudioSink *sink) {
|
|||
ioctl(sink->fd, SNDCTL_DSP_GETCAPS, &sink->caps);
|
||||
|
||||
g_print("audiosink: Capabilities\n");
|
||||
|
||||
if (sink->caps & DSP_CAP_DUPLEX) g_print("audiosink: Full duplex\n");
|
||||
if (sink->caps & DSP_CAP_REALTIME) g_print("audiosink: Realtime\n");
|
||||
if (sink->caps & DSP_CAP_BATCH) g_print("audiosink: Batch\n");
|
||||
if (sink->caps & DSP_CAP_COPROC) g_print("audiosink: Has coprocessor\n");
|
||||
if (sink->caps & DSP_CAP_TRIGGER) g_print("audiosink: Trigger\n");
|
||||
if (sink->caps & DSP_CAP_MMAP) g_print("audiosink: Direct access\n");
|
||||
|
||||
g_print("audiosink: opened audio with fd=%d\n", sink->fd);
|
||||
GST_FLAG_SET (sink, GST_AUDIOSINK_OPEN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void gst_audiosink_close_audio(GstAudioSink *sink) {
|
||||
static void
|
||||
gst_audiosink_close_audio (GstAudioSink *sink)
|
||||
{
|
||||
if (sink->fd < 0) return;
|
||||
|
||||
close(sink->fd);
|
||||
sink->fd = -1;
|
||||
|
||||
GST_FLAG_UNSET (sink, GST_AUDIOSINK_OPEN);
|
||||
|
||||
g_print("audiosink: closed sound device\n");
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_audiosink_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_audiosink_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_AUDIOSINK (element), FALSE);
|
||||
|
||||
/* if going down into NULL state, close the file if it's open */
|
||||
|
@ -378,8 +398,9 @@ static GstElementStateReturn gst_audiosink_change_state(GstElement *element) {
|
|||
return GST_STATE_SUCCESS;
|
||||
}
|
||||
|
||||
gboolean gst_audiosink_factory_init(GstElementFactory *factory) {
|
||||
|
||||
gboolean
|
||||
gst_audiosink_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
if (!gst_audiosink_type_audio)
|
||||
gst_audiosink_type_audio = gst_type_find_by_mime ("audio/raw");
|
||||
|
||||
|
|
|
@ -55,21 +55,23 @@ enum {
|
|||
|
||||
static void gst_audiosrc_class_init (GstAudioSrcClass *klass);
|
||||
static void gst_audiosrc_init (GstAudioSrc *audiosrc);
|
||||
|
||||
static void gst_audiosrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_audiosrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static GstElementStateReturn gst_audiosrc_change_state (GstElement *element);
|
||||
|
||||
static void gst_audiosrc_close_audio (GstAudioSrc *src);
|
||||
static gboolean gst_audiosrc_open_audio (GstAudioSrc *src);
|
||||
void gst_audiosrc_sync_parms(GstAudioSrc *audiosrc);
|
||||
static void gst_audiosrc_sync_parms (GstAudioSrc *audiosrc);
|
||||
|
||||
void gst_audiosrc_push(GstSrc *src);
|
||||
static void gst_audiosrc_push (GstSrc *src);
|
||||
|
||||
static GstSrcClass *parent_class = NULL;
|
||||
//static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_audiosrc_get_type(void) {
|
||||
gst_audiosrc_get_type (void)
|
||||
{
|
||||
static GtkType audiosrc_type = 0;
|
||||
|
||||
if (!audiosrc_type) {
|
||||
|
@ -89,7 +91,8 @@ gst_audiosrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiosrc_class_init(GstAudioSrcClass *klass) {
|
||||
gst_audiosrc_class_init (GstAudioSrcClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
@ -119,7 +122,9 @@ gst_audiosrc_class_init(GstAudioSrcClass *klass) {
|
|||
gstsrc_class->push = gst_audiosrc_push;
|
||||
}
|
||||
|
||||
static void gst_audiosrc_init(GstAudioSrc *audiosrc) {
|
||||
static void
|
||||
gst_audiosrc_init (GstAudioSrc *audiosrc)
|
||||
{
|
||||
audiosrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (audiosrc), audiosrc->srcpad);
|
||||
|
||||
|
@ -136,13 +141,9 @@ static void gst_audiosrc_init(GstAudioSrc *audiosrc) {
|
|||
audiosrc->seq = 0;
|
||||
}
|
||||
|
||||
GstElement *gst_audiosrc_new(gchar *name) {
|
||||
GstElement *audiosrc = GST_ELEMENT(gtk_type_new(GST_TYPE_AUDIOSRC));
|
||||
gst_element_set_name(GST_ELEMENT(audiosrc),name);
|
||||
return audiosrc;
|
||||
}
|
||||
|
||||
void gst_audiosrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_audiosrc_push (GstSrc *src)
|
||||
{
|
||||
GstAudioSrc *audiosrc;
|
||||
GstBuffer *buf;
|
||||
glong readbytes;
|
||||
|
@ -155,9 +156,12 @@ void gst_audiosrc_push(GstSrc *src) {
|
|||
|
||||
buf = gst_buffer_new ();
|
||||
g_return_if_fail (buf);
|
||||
|
||||
GST_BUFFER_DATA (buf) = (gpointer)g_malloc (audiosrc->bytes_per_read);
|
||||
|
||||
readbytes = read (audiosrc->fd,GST_BUFFER_DATA (buf),
|
||||
audiosrc->bytes_per_read);
|
||||
|
||||
if (readbytes == 0) {
|
||||
gst_src_signal_eos (GST_SRC (audiosrc));
|
||||
return;
|
||||
|
@ -165,6 +169,7 @@ void gst_audiosrc_push(GstSrc *src) {
|
|||
|
||||
GST_BUFFER_SIZE (buf) = readbytes;
|
||||
GST_BUFFER_OFFSET (buf) = audiosrc->curoffset;
|
||||
|
||||
audiosrc->curoffset += readbytes;
|
||||
|
||||
// gst_buffer_add_meta(buf,GST_META(newmeta));
|
||||
|
@ -173,11 +178,14 @@ void gst_audiosrc_push(GstSrc *src) {
|
|||
// g_print("pushed buffer from soundcard of %d bytes\n",readbytes);
|
||||
}
|
||||
|
||||
static void gst_audiosrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSRC (object));
|
||||
|
||||
src = GST_AUDIOSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -198,11 +206,14 @@ static void gst_audiosrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_audiosrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_audiosrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstAudioSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AUDIOSRC (object));
|
||||
|
||||
src = GST_AUDIOSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -224,7 +235,9 @@ static void gst_audiosrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_audiosrc_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_audiosrc_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_AUDIOSRC (element), FALSE);
|
||||
|
||||
/* if going down into NULL state, close the file if it's open */
|
||||
|
@ -241,10 +254,13 @@ static GstElementStateReturn gst_audiosrc_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 gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
|
||||
static gboolean
|
||||
gst_audiosrc_open_audio (GstAudioSrc *src)
|
||||
{
|
||||
g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN), FALSE);
|
||||
|
||||
/* first try to open the sound card */
|
||||
|
@ -259,6 +275,7 @@ static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
|
|||
/* set card state */
|
||||
gst_audiosrc_sync_parms (src);
|
||||
DEBUG("opened audio\n");
|
||||
|
||||
GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -266,7 +283,9 @@ static gboolean gst_audiosrc_open_audio(GstAudioSrc *src) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void gst_audiosrc_close_audio(GstAudioSrc *src) {
|
||||
static void
|
||||
gst_audiosrc_close_audio (GstAudioSrc *src)
|
||||
{
|
||||
g_return_if_fail (GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN));
|
||||
|
||||
close(src->fd);
|
||||
|
@ -275,7 +294,9 @@ static void gst_audiosrc_close_audio(GstAudioSrc *src) {
|
|||
GST_FLAG_UNSET (src, GST_AUDIOSRC_OPEN);
|
||||
}
|
||||
|
||||
void gst_audiosrc_sync_parms(GstAudioSrc *audiosrc) {
|
||||
static void
|
||||
gst_audiosrc_sync_parms (GstAudioSrc *audiosrc)
|
||||
{
|
||||
audio_buf_info ospace;
|
||||
|
||||
g_return_if_fail (audiosrc != NULL);
|
||||
|
|
|
@ -44,7 +44,7 @@ GstElementDetails gst_audiosrc_details;
|
|||
#define GST_IS_AUDIOSRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_AUDIOSRC))
|
||||
#define GST_IS_AUDIOSRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSRC))
|
||||
|
||||
// NOTE: per-element flags start with 16 for now
|
||||
typedef enum {
|
||||
|
|
|
@ -45,7 +45,7 @@ struct _elements_entry {
|
|||
gboolean (*factoryinit) (GstElementFactory *factory);
|
||||
};
|
||||
|
||||
struct _elements_entry _elements[] = {
|
||||
static struct _elements_entry _elements[] = {
|
||||
{ "fakesrc", gst_fakesrc_get_type, &gst_fakesrc_details, NULL },
|
||||
{ "fakesink", gst_fakesink_get_type, &gst_fakesink_details, NULL },
|
||||
{ "asyncdisksrc", gst_asyncdisksrc_get_type, &gst_asyncdisksrc_details, NULL },
|
||||
|
@ -62,13 +62,15 @@ struct _elements_entry _elements[] = {
|
|||
{ "queue", gst_queue_get_type, &gst_queue_details, NULL },
|
||||
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, NULL },
|
||||
{ "typefind", gst_typefind_get_type, &gst_typefind_details, NULL },
|
||||
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
GstPlugin *plugin_init(GModule *module) {
|
||||
GstPlugin *plugin_init (GModule *module)
|
||||
{
|
||||
GstPlugin *plugin;
|
||||
GstElementFactory *factory;
|
||||
int i = 0;
|
||||
gint i = 0;
|
||||
|
||||
/* we depend on having the usual types loaded first */
|
||||
gst_plugin_load("gsttypes");
|
||||
|
|
|
@ -38,7 +38,7 @@ extern "C" {
|
|||
#define GST_IS_ESDSINK(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_ESDSINK))
|
||||
#define GST_IS_ESDSINK_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ESDSINK)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ESDSINK))
|
||||
|
||||
typedef struct _GstEsdSink GstEsdSink;
|
||||
typedef struct _GstEsdSinkClass GstEsdSinkClass;
|
||||
|
|
|
@ -46,14 +46,14 @@ enum {
|
|||
static void gst_fakesink_class_init(GstFakeSinkClass *klass);
|
||||
static void gst_fakesink_init(GstFakeSink *fakesink);
|
||||
|
||||
GstElement *gst_fakesink_new(gchar *name);
|
||||
void gst_fakesink_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fakesink_chain(GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstSinkClass *parent_class = NULL;
|
||||
//static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fakesink_get_type(void) {
|
||||
gst_fakesink_get_type (void)
|
||||
{
|
||||
static GtkType fakesink_type = 0;
|
||||
|
||||
if (!fakesink_type) {
|
||||
|
@ -73,7 +73,8 @@ gst_fakesink_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fakesink_class_init(GstFakeSinkClass *klass) {
|
||||
gst_fakesink_class_init (GstFakeSinkClass *klass)
|
||||
{
|
||||
GstSinkClass *gstsink_class;
|
||||
|
||||
gstsink_class = (GstSinkClass*)klass;
|
||||
|
@ -81,7 +82,9 @@ gst_fakesink_class_init(GstFakeSinkClass *klass) {
|
|||
parent_class = gtk_type_class (GST_TYPE_SINK);
|
||||
}
|
||||
|
||||
static void gst_fakesink_init(GstFakeSink *fakesink) {
|
||||
static void
|
||||
gst_fakesink_init (GstFakeSink *fakesink)
|
||||
{
|
||||
fakesink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesink), fakesink->sinkpad);
|
||||
gst_pad_set_chain_function (fakesink->sinkpad, gst_fakesink_chain);
|
||||
|
@ -90,20 +93,6 @@ static void gst_fakesink_init(GstFakeSink *fakesink) {
|
|||
// gst_element_set_state(GST_ELEMENT(fakesink),GST_STATE_READY);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesink_new:
|
||||
* @name: the name of the new fakesrc
|
||||
*
|
||||
* create a new fakesink
|
||||
*
|
||||
* Returns: the new fakesink
|
||||
*/
|
||||
GstElement *gst_fakesink_new(gchar *name) {
|
||||
GstElement *fakesink = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESINK));
|
||||
gst_element_set_name(GST_ELEMENT(fakesink),name);
|
||||
return fakesink;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesink_chain:
|
||||
* @pad: the pad this faksink is connected to
|
||||
|
@ -112,7 +101,9 @@ GstElement *gst_fakesink_new(gchar *name) {
|
|||
* take the buffer from the pad and unref it without doing
|
||||
* anything with it.
|
||||
*/
|
||||
void gst_fakesink_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstFakeSink *fakesink;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
|
@ -123,5 +114,6 @@ void gst_fakesink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
// g_print("gst_fakesink_chain: got buffer in '%s'\n",
|
||||
// gst_element_get_name(GST_ELEMENT(fakesink)));
|
||||
g_print("<");
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fakesink_details;
|
|||
#define GST_IS_FAKESINK(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FAKESINK))
|
||||
#define GST_IS_FAKESINK_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESINK)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESINK))
|
||||
|
||||
typedef struct _GstFakeSink GstFakeSink;
|
||||
typedef struct _GstFakeSinkClass GstFakeSinkClass;
|
||||
|
|
|
@ -46,13 +46,14 @@ enum {
|
|||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
|
||||
void gst_fakesrc_push(GstSrc *src);
|
||||
static void gst_fakesrc_push (GstSrc *src);
|
||||
|
||||
static GstSrcClass *parent_class = NULL;
|
||||
//static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fakesrc_get_type(void) {
|
||||
gst_fakesrc_get_type (void)
|
||||
{
|
||||
static GtkType fakesrc_type = 0;
|
||||
|
||||
if (!fakesrc_type) {
|
||||
|
@ -72,7 +73,8 @@ gst_fakesrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fakesrc_class_init(GstFakeSrcClass *klass) {
|
||||
gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
||||
{
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
||||
gstsrc_class = (GstSrcClass*)klass;
|
||||
|
@ -83,7 +85,9 @@ gst_fakesrc_class_init(GstFakeSrcClass *klass) {
|
|||
gstsrc_class->push_region = NULL;
|
||||
}
|
||||
|
||||
static void gst_fakesrc_init(GstFakeSrc *fakesrc) {
|
||||
static void
|
||||
gst_fakesrc_init (GstFakeSrc *fakesrc)
|
||||
{
|
||||
fakesrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesrc), fakesrc->srcpad);
|
||||
|
||||
|
@ -91,37 +95,27 @@ static void gst_fakesrc_init(GstFakeSrc *fakesrc) {
|
|||
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesrc_new:
|
||||
* @name: then name of the fakse source
|
||||
*
|
||||
* create a new fakesrc
|
||||
*
|
||||
* Returns: The new element.
|
||||
*/
|
||||
GstElement *gst_fakesrc_new(gchar *name) {
|
||||
GstElement *fakesrc = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESRC));
|
||||
gst_element_set_name(GST_ELEMENT(fakesrc),name);
|
||||
return fakesrc;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_fakesrc_push:
|
||||
* @src: the faksesrc to push
|
||||
*
|
||||
* generate an empty buffer and push it to the next element.
|
||||
*/
|
||||
void gst_fakesrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_fakesrc_push (GstSrc *src)
|
||||
{
|
||||
GstFakeSrc *fakesrc;
|
||||
GstBuffer *buf;
|
||||
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (GST_IS_FAKESRC (src));
|
||||
|
||||
fakesrc = GST_FAKESRC (src);
|
||||
|
||||
// g_print("gst_fakesrc_push(): pushing fake buffer from '%s'\n",
|
||||
// gst_element_get_name(GST_ELEMENT(fakesrc)));
|
||||
g_print(">");
|
||||
buf = gst_buffer_new ();
|
||||
|
||||
gst_pad_push (fakesrc->srcpad, buf);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fakesrc_details;
|
|||
#define GST_IS_FAKESRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FAKESRC))
|
||||
#define GST_IS_FAKESRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FAKESRC))
|
||||
|
||||
typedef struct _GstFakeSrc GstFakeSrc;
|
||||
typedef struct _GstFakeSrcClass GstFakeSrcClass;
|
||||
|
|
|
@ -45,16 +45,18 @@ enum {
|
|||
|
||||
static void gst_fdsink_class_init (GstFdSinkClass *klass);
|
||||
static void gst_fdsink_init (GstFdSink *fdsink);
|
||||
|
||||
static void gst_fdsink_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_fdsink_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
void gst_fdsink_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fdsink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstSinkClass *parent_class = NULL;
|
||||
//static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fdsink_get_type(void) {
|
||||
gst_fdsink_get_type (void)
|
||||
{
|
||||
static GtkType fdsink_type = 0;
|
||||
|
||||
if (!fdsink_type) {
|
||||
|
@ -74,7 +76,8 @@ gst_fdsink_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fdsink_class_init(GstFdSinkClass *klass) {
|
||||
gst_fdsink_class_init (GstFdSinkClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstSinkClass *gstsink_class;
|
||||
|
||||
|
@ -90,7 +93,9 @@ gst_fdsink_class_init(GstFdSinkClass *klass) {
|
|||
gtkobject_class->get_arg = gst_fdsink_get_arg;
|
||||
}
|
||||
|
||||
static void gst_fdsink_init(GstFdSink *fdsink) {
|
||||
static void
|
||||
gst_fdsink_init (GstFdSink *fdsink)
|
||||
{
|
||||
fdsink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (fdsink), fdsink->sinkpad);
|
||||
gst_pad_set_chain_function (fdsink->sinkpad, gst_fdsink_chain);
|
||||
|
@ -98,19 +103,9 @@ static void gst_fdsink_init(GstFdSink *fdsink) {
|
|||
fdsink->fd = 1;
|
||||
}
|
||||
|
||||
GstElement *gst_fdsink_new(gchar *name) {
|
||||
GstElement *fdsink = GST_ELEMENT(gtk_type_new(GST_TYPE_FDSINK));
|
||||
gst_element_set_name(GST_ELEMENT(fdsink),name);
|
||||
return fdsink;
|
||||
}
|
||||
|
||||
GstElement *gst_fdsink_new_with_fd(gchar *name,gint fd) {
|
||||
GstElement *fdsink = gst_fdsink_new(name);
|
||||
gtk_object_set(GTK_OBJECT(fdsink),"fd",fd,NULL);
|
||||
return fdsink;
|
||||
}
|
||||
|
||||
void gst_fdsink_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstFdSink *fdsink;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
|
@ -118,17 +113,23 @@ void gst_fdsink_chain(GstPad *pad,GstBuffer *buf) {
|
|||
g_return_if_fail (buf != NULL);
|
||||
|
||||
fdsink = GST_FDSINK (pad->parent);
|
||||
|
||||
g_return_if_fail (fdsink->fd >= 0);
|
||||
|
||||
if (GST_BUFFER_DATA (buf))
|
||||
write (fdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
static void gst_fdsink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_fdsink_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstFdSink *fdsink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSINK (object));
|
||||
|
||||
fdsink = GST_FDSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -140,11 +141,14 @@ static void gst_fdsink_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_fdsink_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_fdsink_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstFdSink *fdsink;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSINK (object));
|
||||
|
||||
fdsink = GST_FDSINK (object);
|
||||
|
||||
switch(id) {
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fdsink_details;
|
|||
#define GST_IS_FDSINK(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FDSINK))
|
||||
#define GST_IS_FDSINK_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSINK)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSINK))
|
||||
|
||||
typedef struct _GstFdSink GstFdSink;
|
||||
typedef struct _GstFdSinkClass GstFdSinkClass;
|
||||
|
|
|
@ -53,6 +53,7 @@ enum {
|
|||
|
||||
static void gst_fdsrc_class_init (GstFdSrcClass *klass);
|
||||
static void gst_fdsrc_init (GstFdSrc *fdsrc);
|
||||
|
||||
static void gst_fdsrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_fdsrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
|
@ -64,7 +65,8 @@ static GstSrcClass *parent_class = NULL;
|
|||
//static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_fdsrc_get_type(void) {
|
||||
gst_fdsrc_get_type (void)
|
||||
{
|
||||
static GtkType fdsrc_type = 0;
|
||||
|
||||
if (!fdsrc_type) {
|
||||
|
@ -84,7 +86,8 @@ gst_fdsrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_fdsrc_class_init(GstFdSrcClass *klass) {
|
||||
gst_fdsrc_class_init (GstFdSrcClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
||||
|
@ -104,11 +107,14 @@ gst_fdsrc_class_init(GstFdSrcClass *klass) {
|
|||
gtkobject_class->get_arg = gst_fdsrc_get_arg;
|
||||
|
||||
gstsrc_class->push = gst_fdsrc_push;
|
||||
|
||||
/* we nominally can't (won't) do async */
|
||||
gstsrc_class->push_region = NULL;
|
||||
}
|
||||
|
||||
static void gst_fdsrc_init(GstFdSrc *fdsrc) {
|
||||
static void
|
||||
gst_fdsrc_init (GstFdSrc *fdsrc)
|
||||
{
|
||||
fdsrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (fdsrc), fdsrc->srcpad);
|
||||
|
||||
|
@ -119,12 +125,15 @@ static void gst_fdsrc_init(GstFdSrc *fdsrc) {
|
|||
}
|
||||
|
||||
|
||||
static void gst_fdsrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_fdsrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstFdSrc *src;
|
||||
int fd;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSRC (object));
|
||||
|
||||
src = GST_FDSRC (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -150,11 +159,14 @@ 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)
|
||||
{
|
||||
GstFdSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_FDSRC (object));
|
||||
|
||||
src = GST_FDSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -170,13 +182,16 @@ static void gst_fdsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
void gst_fdsrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_fdsrc_push (GstSrc *src)
|
||||
{
|
||||
GstFdSrc *fdsrc;
|
||||
GstBuffer *buf;
|
||||
glong readbytes;
|
||||
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (GST_IS_FDSRC (src));
|
||||
|
||||
fdsrc = GST_FDSRC (src);
|
||||
|
||||
/* create the buffer */
|
||||
|
@ -202,6 +217,7 @@ void gst_fdsrc_push(GstSrc *src) {
|
|||
}
|
||||
GST_BUFFER_OFFSET (buf) = fdsrc->curoffset;
|
||||
GST_BUFFER_SIZE (buf) = readbytes;
|
||||
|
||||
fdsrc->curoffset += readbytes;
|
||||
|
||||
/* we're done, push the buffer off now */
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_fdsrc_details;
|
|||
#define GST_IS_FDSRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_FDSRC))
|
||||
#define GST_IS_FDSRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FDSRC))
|
||||
|
||||
|
||||
typedef struct _GstFdSrc GstFdSrc;
|
||||
|
|
|
@ -35,13 +35,6 @@ GstElementDetails gst_httpsrc_details = {
|
|||
"(C) 1999",
|
||||
};
|
||||
|
||||
|
||||
static void gst_httpsrc_push(GstSrc *src);
|
||||
static gboolean gst_httpsrc_open_url(GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url(GstHttpSrc *src);
|
||||
static GstElementStateReturn gst_httpsrc_change_state(GstElement *element);
|
||||
|
||||
|
||||
/* HttpSrc signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
|
@ -58,15 +51,23 @@ enum {
|
|||
|
||||
static void gst_httpsrc_class_init (GstHttpSrcClass *klass);
|
||||
static void gst_httpsrc_init (GstHttpSrc *httpsrc);
|
||||
|
||||
static void gst_httpsrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_httpsrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
static void gst_httpsrc_push (GstSrc *src);
|
||||
|
||||
static gboolean gst_httpsrc_open_url (GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url (GstHttpSrc *src);
|
||||
|
||||
static GstElementStateReturn gst_httpsrc_change_state(GstElement *element);
|
||||
|
||||
static GstSrcClass *parent_class = NULL;
|
||||
//static guint gst_httpsrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_httpsrc_get_type(void) {
|
||||
gst_httpsrc_get_type (void)
|
||||
{
|
||||
static GtkType httpsrc_type = 0;
|
||||
|
||||
if (!httpsrc_type) {
|
||||
|
@ -86,7 +87,8 @@ gst_httpsrc_get_type(void) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_httpsrc_class_init(GstHttpSrcClass *klass) {
|
||||
gst_httpsrc_class_init (GstHttpSrcClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstSrcClass *gstsrc_class;
|
||||
|
@ -112,7 +114,9 @@ gst_httpsrc_class_init(GstHttpSrcClass *klass) {
|
|||
gstsrc_class->push_region = NULL;
|
||||
}
|
||||
|
||||
static void gst_httpsrc_init(GstHttpSrc *httpsrc) {
|
||||
static void
|
||||
gst_httpsrc_init (GstHttpSrc *httpsrc)
|
||||
{
|
||||
httpsrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (httpsrc), httpsrc->srcpad);
|
||||
|
||||
|
@ -123,7 +127,9 @@ static void gst_httpsrc_init(GstHttpSrc *httpsrc) {
|
|||
httpsrc->bytes_per_read = 4096;
|
||||
}
|
||||
|
||||
static void gst_httpsrc_push(GstSrc *src) {
|
||||
static void
|
||||
gst_httpsrc_push (GstSrc *src)
|
||||
{
|
||||
GstHttpSrc *httpsrc;
|
||||
GstBuffer *buf;
|
||||
glong readbytes;
|
||||
|
@ -135,7 +141,9 @@ static void gst_httpsrc_push(GstSrc *src) {
|
|||
|
||||
buf = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (buf) = (gpointer)malloc (httpsrc->bytes_per_read);
|
||||
|
||||
readbytes = read (httpsrc->fd, GST_BUFFER_DATA (buf), httpsrc->bytes_per_read);
|
||||
|
||||
if (readbytes == 0) {
|
||||
gst_src_signal_eos (GST_SRC (httpsrc));
|
||||
return;
|
||||
|
@ -146,18 +154,22 @@ static void gst_httpsrc_push(GstSrc *src) {
|
|||
}
|
||||
GST_BUFFER_OFFSET (buf) = httpsrc->curoffset;
|
||||
GST_BUFFER_SIZE (buf) = readbytes;
|
||||
|
||||
httpsrc->curoffset += readbytes;
|
||||
|
||||
gst_pad_push (httpsrc->srcpad, buf);
|
||||
}
|
||||
|
||||
static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) {
|
||||
static gboolean
|
||||
gst_httpsrc_open_url (GstHttpSrc *httpsrc)
|
||||
{
|
||||
gint status;
|
||||
|
||||
g_return_val_if_fail (!GST_FLAG_IS_SET (httpsrc, GST_HTTPSRC_OPEN), FALSE);
|
||||
g_return_val_if_fail (httpsrc->url != NULL, FALSE);
|
||||
|
||||
httpsrc->request = ghttp_request_new ();
|
||||
|
||||
ghttp_set_uri (httpsrc->request, httpsrc->url);
|
||||
ghttp_set_sync (httpsrc->request, ghttp_async);
|
||||
ghttp_set_header (httpsrc->request, "User-Agent", "GstHttpSrc");
|
||||
|
@ -173,14 +185,17 @@ static gboolean gst_httpsrc_open_url(GstHttpSrc *httpsrc) {
|
|||
|
||||
/* get the fd so we can read data ourselves */
|
||||
httpsrc->fd = ghttp_get_socket (httpsrc->request);
|
||||
|
||||
GST_FLAG_SET (httpsrc, GST_HTTPSRC_OPEN);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* unmap and close the file */
|
||||
static void gst_httpsrc_close_url(GstHttpSrc *src) {
|
||||
static void
|
||||
gst_httpsrc_close_url (GstHttpSrc *src)
|
||||
{
|
||||
g_return_if_fail (GST_FLAG_IS_SET (src, GST_HTTPSRC_OPEN));
|
||||
|
||||
g_return_if_fail (src->fd > 0);
|
||||
|
||||
close(src->fd);
|
||||
|
@ -189,11 +204,14 @@ static void gst_httpsrc_close_url(GstHttpSrc *src) {
|
|||
GST_FLAG_UNSET (src, GST_HTTPSRC_OPEN);
|
||||
}
|
||||
|
||||
static void gst_httpsrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_httpsrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstHttpSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_HTTPSRC (object));
|
||||
|
||||
src = GST_HTTPSRC (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -219,11 +237,14 @@ static void gst_httpsrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_httpsrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstHttpSrc *httpsrc;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_HTTPSRC (object));
|
||||
|
||||
httpsrc = GST_HTTPSRC (object);
|
||||
|
||||
switch (id) {
|
||||
|
@ -239,7 +260,9 @@ static void gst_httpsrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_httpsrc_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_httpsrc_change_state (GstElement *element)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_HTTPSRC (element), GST_STATE_FAILURE);
|
||||
|
||||
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
||||
|
@ -254,5 +277,6 @@ static GstElementStateReturn gst_httpsrc_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;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ GstElementDetails gst_httpsrc_details;
|
|||
#define GST_IS_HTTPSRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_HTTPSRC))
|
||||
#define GST_IS_HTTPSRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_HTTPSRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_HTTPSRC))
|
||||
|
||||
// NOTE: per-element flags start with 16 for now
|
||||
typedef enum {
|
||||
|
|
|
@ -45,16 +45,18 @@ enum {
|
|||
|
||||
static void gst_identity_class_init (GstIdentityClass *klass);
|
||||
static void gst_identity_init (GstIdentity *identity);
|
||||
|
||||
static void gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_identity_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
void gst_identity_chain(GstPad *pad,GstBuffer *buf);
|
||||
static void gst_identity_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstFilterClass *parent_class = NULL;
|
||||
//static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_identity_get_type(void) {
|
||||
gst_identity_get_type (void)
|
||||
{
|
||||
static GtkType identity_type = 0;
|
||||
|
||||
if (!identity_type) {
|
||||
|
@ -73,7 +75,9 @@ gst_identity_get_type(void) {
|
|||
return identity_type;
|
||||
}
|
||||
|
||||
static void gst_identity_class_init(GstIdentityClass *klass) {
|
||||
static void
|
||||
gst_identity_class_init (GstIdentityClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstFilterClass *gstfilter_class;
|
||||
|
||||
|
@ -89,23 +93,22 @@ static void gst_identity_class_init(GstIdentityClass *klass) {
|
|||
//gtkobject_class->get_arg = gst_identity_get_arg;
|
||||
}
|
||||
|
||||
static void gst_identity_init(GstIdentity *identity) {
|
||||
static void
|
||||
gst_identity_init (GstIdentity *identity)
|
||||
{
|
||||
identity->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad);
|
||||
gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
|
||||
|
||||
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
|
||||
|
||||
identity->control = 0;
|
||||
}
|
||||
|
||||
GstElement *gst_identity_new(gchar *name) {
|
||||
GstElement *identity = GST_ELEMENT(gtk_type_new(GST_TYPE_IDENTITY));
|
||||
gst_element_set_name(GST_ELEMENT(identity),name);
|
||||
return identity;
|
||||
}
|
||||
|
||||
void gst_identity_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstIdentity *identity;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
|
@ -116,14 +119,18 @@ void gst_identity_chain(GstPad *pad,GstBuffer *buf) {
|
|||
// g_print("gst_identity_chain: got buffer in '%s'\n",
|
||||
// gst_element_get_name(GST_ELEMENT(identity)));
|
||||
g_print("i");
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
}
|
||||
|
||||
static void gst_identity_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstIdentity *identity;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_IDENTITY (object));
|
||||
|
||||
identity = GST_IDENTITY (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -140,6 +147,7 @@ static void gst_identity_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_IDENTITY (object));
|
||||
|
||||
identity = GST_IDENTITY (object);
|
||||
|
||||
switch (id) {
|
||||
|
|
|
@ -43,7 +43,7 @@ GstElementDetails gst_identity_details;
|
|||
#define GST_IS_IDENTITY(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_IDENTITY))
|
||||
#define GST_IS_IDENTITY_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_IDENTITY)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_IDENTITY))
|
||||
|
||||
typedef struct _GstIdentity GstIdentity;
|
||||
typedef struct _GstIdentityClass GstIdentityClass;
|
||||
|
|
|
@ -54,6 +54,7 @@ enum {
|
|||
|
||||
static void gst_queue_class_init (GstQueueClass *klass);
|
||||
static void gst_queue_init (GstQueue *queue);
|
||||
|
||||
static void gst_queue_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_queue_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
|
@ -64,6 +65,7 @@ static void gst_queue_flush(GstQueue *queue);
|
|||
|
||||
static GstElementStateReturn gst_queue_change_state (GstElement *element);
|
||||
|
||||
|
||||
static GstConnectionClass *parent_class = NULL;
|
||||
//static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
@ -87,7 +89,9 @@ gst_queue_get_type(void) {
|
|||
return queue_type;
|
||||
}
|
||||
|
||||
static void gst_queue_class_init(GstQueueClass *klass) {
|
||||
static void
|
||||
gst_queue_class_init (GstQueueClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstConnectionClass *gstconnection_class;
|
||||
|
@ -111,7 +115,9 @@ static void gst_queue_class_init(GstQueueClass *klass) {
|
|||
gstelement_class->change_state = gst_queue_change_state;
|
||||
}
|
||||
|
||||
static void gst_queue_init(GstQueue *queue) {
|
||||
static void
|
||||
gst_queue_init (GstQueue *queue)
|
||||
{
|
||||
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
|
||||
gst_pad_set_chain_function (queue->sinkpad, gst_queue_chain);
|
||||
|
@ -133,27 +139,28 @@ static void gst_queue_init(GstQueue *queue) {
|
|||
queue->fullcond = g_cond_new ();
|
||||
}
|
||||
|
||||
GstElement *gst_queue_new(gchar *name) {
|
||||
GstElement *queue = GST_ELEMENT(gtk_type_new(GST_TYPE_QUEUE));
|
||||
gst_element_set_name(GST_ELEMENT(queue),name);
|
||||
return queue;
|
||||
}
|
||||
|
||||
static void gst_queue_cleanup_buffers(gpointer data, const gpointer user_data)
|
||||
static void
|
||||
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
|
||||
{
|
||||
DEBUG("queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
|
||||
|
||||
gst_buffer_unref (GST_BUFFER (data));
|
||||
}
|
||||
|
||||
static void gst_queue_flush(GstQueue *queue) {
|
||||
g_slist_foreach(queue->queue, gst_queue_cleanup_buffers, (char *)gst_element_get_name(GST_ELEMENT(queue)));
|
||||
static void
|
||||
gst_queue_flush (GstQueue *queue)
|
||||
{
|
||||
g_slist_foreach (queue->queue, gst_queue_cleanup_buffers,
|
||||
(char *)gst_element_get_name (GST_ELEMENT (queue)));
|
||||
g_slist_free (queue->queue);
|
||||
|
||||
queue->queue = NULL;
|
||||
queue->level_buffers = 0;
|
||||
}
|
||||
|
||||
static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
||||
static void
|
||||
gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstQueue *queue;
|
||||
gboolean tosignal = FALSE;
|
||||
const guchar *name;
|
||||
|
@ -211,7 +218,9 @@ static void gst_queue_chain(GstPad *pad,GstBuffer *buf) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_queue_push(GstConnection *connection) {
|
||||
static void
|
||||
gst_queue_push (GstConnection *connection)
|
||||
{
|
||||
GstQueue *queue = GST_QUEUE (connection);
|
||||
GstBuffer *buf = NULL;
|
||||
GSList *front;
|
||||
|
@ -240,6 +249,7 @@ static void gst_queue_push(GstConnection *connection) {
|
|||
buf = (GstBuffer *)(front->data);
|
||||
queue->queue = g_slist_remove_link (queue->queue, front);
|
||||
g_slist_free (front);
|
||||
|
||||
queue->level_buffers--;
|
||||
STATUS("%s: -\n");
|
||||
tosignal = queue->level_buffers < queue->max_buffers;
|
||||
|
@ -260,7 +270,9 @@ static void gst_queue_push(GstConnection *connection) {
|
|||
/* unlock now */
|
||||
}
|
||||
|
||||
static GstElementStateReturn gst_queue_change_state(GstElement *element) {
|
||||
static GstElementStateReturn
|
||||
gst_queue_change_state (GstElement *element)
|
||||
{
|
||||
GstQueue *queue;
|
||||
g_return_val_if_fail (GST_IS_QUEUE (element), GST_STATE_FAILURE);
|
||||
|
||||
|
@ -281,11 +293,14 @@ static GstElementStateReturn gst_queue_change_state(GstElement *element) {
|
|||
}
|
||||
|
||||
|
||||
static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_queue_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstQueue *queue;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_QUEUE (object));
|
||||
|
||||
queue = GST_QUEUE (object);
|
||||
|
||||
switch(id) {
|
||||
|
@ -297,11 +312,14 @@ static void gst_queue_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gst_queue_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
||||
static void
|
||||
gst_queue_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstQueue *queue;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_QUEUE (object));
|
||||
|
||||
queue = GST_QUEUE (object);
|
||||
|
||||
switch (id) {
|
||||
|
|
|
@ -44,7 +44,7 @@ GstElementDetails gst_sinesrc_details;
|
|||
#define GST_IS_SINESRC(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_SINESRC))
|
||||
#define GST_IS_SINESRC_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_SINESRC)))
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_SINESRC))
|
||||
|
||||
typedef struct _GstSineSrc GstSineSrc;
|
||||
typedef struct _GstSineSrcClass GstSineSrcClass;
|
||||
|
|
Loading…
Reference in a new issue