mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
gst/elements/gstfdsrc.c gst/elements/gstfdsrc.h gst/elements/gstelements.c gst/elements/Makefile.am
Original commit message from CVS: 2005-07-16 Philippe Khalaf <burger@speedy.org> * gst/elements/gstfdsrc.c * gst/elements/gstfdsrc.h * gst/elements/gstelements.c * gst/elements/Makefile.am Ported fdsrc to 0.9.
This commit is contained in:
parent
11bc479656
commit
4b888578a0
8 changed files with 62 additions and 50 deletions
|
@ -14,6 +14,7 @@ libgstelements_la_SOURCES = \
|
||||||
gstfakesink.c \
|
gstfakesink.c \
|
||||||
gstfilesink.c \
|
gstfilesink.c \
|
||||||
gstfilesrc.c \
|
gstfilesrc.c \
|
||||||
|
gstfdsrc.c \
|
||||||
gstidentity.c \
|
gstidentity.c \
|
||||||
gstelements.c \
|
gstelements.c \
|
||||||
gsttee.c \
|
gsttee.c \
|
||||||
|
@ -31,6 +32,7 @@ noinst_HEADERS = \
|
||||||
gstfakesrc.h \
|
gstfakesrc.h \
|
||||||
gstfilesink.h \
|
gstfilesink.h \
|
||||||
gstfilesrc.h \
|
gstfilesrc.h \
|
||||||
|
gstfdsrc.h \
|
||||||
gstidentity.h \
|
gstidentity.h \
|
||||||
gsttee.h \
|
gsttee.h \
|
||||||
gsttypefindelement.h
|
gsttypefindelement.h
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "gstfakesrc.h"
|
#include "gstfakesrc.h"
|
||||||
#include "gstfilesink.h"
|
#include "gstfilesink.h"
|
||||||
#include "gstfilesrc.h"
|
#include "gstfilesrc.h"
|
||||||
|
#include "gstfdsrc.h"
|
||||||
#include "gstidentity.h"
|
#include "gstidentity.h"
|
||||||
#include "gsttee.h"
|
#include "gsttee.h"
|
||||||
#include "gsttypefindelement.h"
|
#include "gsttypefindelement.h"
|
||||||
|
@ -51,6 +52,7 @@ static struct _elements_entry _elements[] = {
|
||||||
{"fakesrc", GST_RANK_NONE, gst_fake_src_get_type},
|
{"fakesrc", GST_RANK_NONE, gst_fake_src_get_type},
|
||||||
{"fakesink", GST_RANK_NONE, gst_fake_sink_get_type},
|
{"fakesink", GST_RANK_NONE, gst_fake_sink_get_type},
|
||||||
{"filesrc", GST_RANK_NONE, gst_file_src_get_type},
|
{"filesrc", GST_RANK_NONE, gst_file_src_get_type},
|
||||||
|
{"fdsrc", GST_RANK_NONE, gst_fdsrc_get_type},
|
||||||
{"identity", GST_RANK_NONE, gst_identity_get_type},
|
{"identity", GST_RANK_NONE, gst_identity_get_type},
|
||||||
{"filesink", GST_RANK_NONE, gst_file_sink_get_type},
|
{"filesink", GST_RANK_NONE, gst_file_sink_get_type},
|
||||||
{"tee", GST_RANK_NONE, gst_tee_get_type},
|
{"tee", GST_RANK_NONE, gst_tee_get_type},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
|
* 2005 Philippe Khalaf <burger@speedy.org>
|
||||||
*
|
*
|
||||||
* gstfdsrc.c:
|
* gstfdsrc.c:
|
||||||
*
|
*
|
||||||
|
@ -73,7 +74,7 @@ static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };
|
||||||
#define _do_init(bla) \
|
#define _do_init(bla) \
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
|
GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstFdSrc, gst_fdsrc, GstElement, GST_TYPE_ELEMENT,
|
GST_BOILERPLATE_FULL (GstFdSrc, gst_fdsrc, GstElement, GST_TYPE_PUSH_SRC,
|
||||||
_do_init);
|
_do_init);
|
||||||
|
|
||||||
static void gst_fdsrc_set_property (GObject * object, guint prop_id,
|
static void gst_fdsrc_set_property (GObject * object, guint prop_id,
|
||||||
|
@ -83,8 +84,7 @@ static void gst_fdsrc_get_property (GObject * object, guint prop_id,
|
||||||
|
|
||||||
static GstElementStateReturn gst_fdsrc_change_state (GstElement * element);
|
static GstElementStateReturn gst_fdsrc_change_state (GstElement * element);
|
||||||
|
|
||||||
static GstData *gst_fdsrc_get (GstPad * pad);
|
static GstFlowReturn gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_fdsrc_base_init (gpointer g_class)
|
gst_fdsrc_base_init (gpointer g_class)
|
||||||
|
@ -99,9 +99,15 @@ static void
|
||||||
gst_fdsrc_class_init (GstFdSrcClass * klass)
|
gst_fdsrc_class_init (GstFdSrcClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
GstBaseSrcClass *gstbasesrc_class;
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
GstPushSrcClass *gstpush_src_class;
|
||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
||||||
|
gstpush_src_class = (GstPushSrcClass *) klass;
|
||||||
|
|
||||||
|
parent_class = g_type_class_ref (GST_TYPE_PUSH_SRC);
|
||||||
|
|
||||||
gobject_class->set_property = gst_fdsrc_set_property;
|
gobject_class->set_property = gst_fdsrc_set_property;
|
||||||
gobject_class->get_property = gst_fdsrc_get_property;
|
gobject_class->get_property = gst_fdsrc_get_property;
|
||||||
|
@ -123,17 +129,16 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
|
||||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||||
|
|
||||||
gstelement_class->change_state = gst_fdsrc_change_state;
|
gstelement_class->change_state = gst_fdsrc_change_state;
|
||||||
|
|
||||||
|
gstpush_src_class->create = gst_fdsrc_create;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_fdsrc_init (GstFdSrc * fdsrc)
|
gst_fdsrc_init (GstFdSrc * fdsrc)
|
||||||
{
|
{
|
||||||
fdsrc->srcpad =
|
// TODO set live only if it's actually a live source
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
|
gst_base_src_set_live (GST_BASE_SRC (fdsrc), TRUE);
|
||||||
"src");
|
|
||||||
|
|
||||||
gst_pad_set_get_function (fdsrc->srcpad, gst_fdsrc_get);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (fdsrc), fdsrc->srcpad);
|
|
||||||
|
|
||||||
fdsrc->fd = 0;
|
fdsrc->fd = 0;
|
||||||
fdsrc->curoffset = 0;
|
fdsrc->curoffset = 0;
|
||||||
|
@ -220,8 +225,8 @@ gst_fdsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstData *
|
static GstFlowReturn
|
||||||
gst_fdsrc_get (GstPad * pad)
|
gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf)
|
||||||
{
|
{
|
||||||
GstFdSrc *src;
|
GstFdSrc *src;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
@ -233,7 +238,7 @@ gst_fdsrc_get (GstPad * pad)
|
||||||
gint retval;
|
gint retval;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
src = GST_FDSRC (gst_pad_get_parent (pad));
|
src = GST_FDSRC (psrc);
|
||||||
|
|
||||||
/* create the buffer */
|
/* create the buffer */
|
||||||
buf = gst_buffer_new_and_alloc (src->blocksize);
|
buf = gst_buffer_new_and_alloc (src->blocksize);
|
||||||
|
@ -254,12 +259,10 @@ gst_fdsrc_get (GstPad * pad)
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||||
("select on file descriptor: %s.", g_strerror (errno)));
|
("select on file descriptor: %s.", g_strerror (errno)));
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
} else if (retval == 0) {
|
} else if (retval == 0) {
|
||||||
g_signal_emit (G_OBJECT (src), gst_fdsrc_signals[SIGNAL_TIMEOUT], 0);
|
g_signal_emit (G_OBJECT (src), gst_fdsrc_signals[SIGNAL_TIMEOUT], 0);
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -274,14 +277,13 @@ gst_fdsrc_get (GstPad * pad)
|
||||||
src->curoffset += readbytes;
|
src->curoffset += readbytes;
|
||||||
|
|
||||||
/* we're done, return the buffer */
|
/* we're done, return the buffer */
|
||||||
return GST_DATA (buf);
|
*outbuf = buf;
|
||||||
|
return GST_FLOW_OK;
|
||||||
} else if (readbytes == 0) {
|
} else if (readbytes == 0) {
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
} else {
|
} else {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||||
("read on file descriptor: %s.", g_strerror (errno)));
|
("read on file descriptor: %s.", g_strerror (errno)));
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
|
* 2005 Philippe Khalaf <burger@speedy.org>
|
||||||
*
|
*
|
||||||
* gstfdsrc.h:
|
* gstfdsrc.h:
|
||||||
*
|
*
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
#define __GST_FDSRC_H__
|
#define __GST_FDSRC_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/base/gstpushsrc.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -45,9 +47,7 @@ typedef struct _GstFdSrc GstFdSrc;
|
||||||
typedef struct _GstFdSrcClass GstFdSrcClass;
|
typedef struct _GstFdSrcClass GstFdSrcClass;
|
||||||
|
|
||||||
struct _GstFdSrc {
|
struct _GstFdSrc {
|
||||||
GstElement element;
|
GstPushSrc element;
|
||||||
/* pads */
|
|
||||||
GstPad *srcpad;
|
|
||||||
|
|
||||||
/* fd */
|
/* fd */
|
||||||
gint fd;
|
gint fd;
|
||||||
|
@ -60,7 +60,7 @@ struct _GstFdSrc {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstFdSrcClass {
|
struct _GstFdSrcClass {
|
||||||
GstElementClass parent_class;
|
GstPushSrcClass parent_class;
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (*timeout) (GstElement *element);
|
void (*timeout) (GstElement *element);
|
||||||
|
|
|
@ -14,6 +14,7 @@ libgstelements_la_SOURCES = \
|
||||||
gstfakesink.c \
|
gstfakesink.c \
|
||||||
gstfilesink.c \
|
gstfilesink.c \
|
||||||
gstfilesrc.c \
|
gstfilesrc.c \
|
||||||
|
gstfdsrc.c \
|
||||||
gstidentity.c \
|
gstidentity.c \
|
||||||
gstelements.c \
|
gstelements.c \
|
||||||
gsttee.c \
|
gsttee.c \
|
||||||
|
@ -31,6 +32,7 @@ noinst_HEADERS = \
|
||||||
gstfakesrc.h \
|
gstfakesrc.h \
|
||||||
gstfilesink.h \
|
gstfilesink.h \
|
||||||
gstfilesrc.h \
|
gstfilesrc.h \
|
||||||
|
gstfdsrc.h \
|
||||||
gstidentity.h \
|
gstidentity.h \
|
||||||
gsttee.h \
|
gsttee.h \
|
||||||
gsttypefindelement.h
|
gsttypefindelement.h
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "gstfakesrc.h"
|
#include "gstfakesrc.h"
|
||||||
#include "gstfilesink.h"
|
#include "gstfilesink.h"
|
||||||
#include "gstfilesrc.h"
|
#include "gstfilesrc.h"
|
||||||
|
#include "gstfdsrc.h"
|
||||||
#include "gstidentity.h"
|
#include "gstidentity.h"
|
||||||
#include "gsttee.h"
|
#include "gsttee.h"
|
||||||
#include "gsttypefindelement.h"
|
#include "gsttypefindelement.h"
|
||||||
|
@ -51,6 +52,7 @@ static struct _elements_entry _elements[] = {
|
||||||
{"fakesrc", GST_RANK_NONE, gst_fake_src_get_type},
|
{"fakesrc", GST_RANK_NONE, gst_fake_src_get_type},
|
||||||
{"fakesink", GST_RANK_NONE, gst_fake_sink_get_type},
|
{"fakesink", GST_RANK_NONE, gst_fake_sink_get_type},
|
||||||
{"filesrc", GST_RANK_NONE, gst_file_src_get_type},
|
{"filesrc", GST_RANK_NONE, gst_file_src_get_type},
|
||||||
|
{"fdsrc", GST_RANK_NONE, gst_fdsrc_get_type},
|
||||||
{"identity", GST_RANK_NONE, gst_identity_get_type},
|
{"identity", GST_RANK_NONE, gst_identity_get_type},
|
||||||
{"filesink", GST_RANK_NONE, gst_file_sink_get_type},
|
{"filesink", GST_RANK_NONE, gst_file_sink_get_type},
|
||||||
{"tee", GST_RANK_NONE, gst_tee_get_type},
|
{"tee", GST_RANK_NONE, gst_tee_get_type},
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
|
* 2005 Philippe Khalaf <burger@speedy.org>
|
||||||
*
|
*
|
||||||
* gstfdsrc.c:
|
* gstfdsrc.c:
|
||||||
*
|
*
|
||||||
|
@ -73,7 +74,7 @@ static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };
|
||||||
#define _do_init(bla) \
|
#define _do_init(bla) \
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
|
GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstFdSrc, gst_fdsrc, GstElement, GST_TYPE_ELEMENT,
|
GST_BOILERPLATE_FULL (GstFdSrc, gst_fdsrc, GstElement, GST_TYPE_PUSH_SRC,
|
||||||
_do_init);
|
_do_init);
|
||||||
|
|
||||||
static void gst_fdsrc_set_property (GObject * object, guint prop_id,
|
static void gst_fdsrc_set_property (GObject * object, guint prop_id,
|
||||||
|
@ -83,8 +84,7 @@ static void gst_fdsrc_get_property (GObject * object, guint prop_id,
|
||||||
|
|
||||||
static GstElementStateReturn gst_fdsrc_change_state (GstElement * element);
|
static GstElementStateReturn gst_fdsrc_change_state (GstElement * element);
|
||||||
|
|
||||||
static GstData *gst_fdsrc_get (GstPad * pad);
|
static GstFlowReturn gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_fdsrc_base_init (gpointer g_class)
|
gst_fdsrc_base_init (gpointer g_class)
|
||||||
|
@ -99,9 +99,15 @@ static void
|
||||||
gst_fdsrc_class_init (GstFdSrcClass * klass)
|
gst_fdsrc_class_init (GstFdSrcClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
GstBaseSrcClass *gstbasesrc_class;
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
GstPushSrcClass *gstpush_src_class;
|
||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
||||||
|
gstpush_src_class = (GstPushSrcClass *) klass;
|
||||||
|
|
||||||
|
parent_class = g_type_class_ref (GST_TYPE_PUSH_SRC);
|
||||||
|
|
||||||
gobject_class->set_property = gst_fdsrc_set_property;
|
gobject_class->set_property = gst_fdsrc_set_property;
|
||||||
gobject_class->get_property = gst_fdsrc_get_property;
|
gobject_class->get_property = gst_fdsrc_get_property;
|
||||||
|
@ -123,17 +129,16 @@ gst_fdsrc_class_init (GstFdSrcClass * klass)
|
||||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||||
|
|
||||||
gstelement_class->change_state = gst_fdsrc_change_state;
|
gstelement_class->change_state = gst_fdsrc_change_state;
|
||||||
|
|
||||||
|
gstpush_src_class->create = gst_fdsrc_create;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_fdsrc_init (GstFdSrc * fdsrc)
|
gst_fdsrc_init (GstFdSrc * fdsrc)
|
||||||
{
|
{
|
||||||
fdsrc->srcpad =
|
// TODO set live only if it's actually a live source
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
|
gst_base_src_set_live (GST_BASE_SRC (fdsrc), TRUE);
|
||||||
"src");
|
|
||||||
|
|
||||||
gst_pad_set_get_function (fdsrc->srcpad, gst_fdsrc_get);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (fdsrc), fdsrc->srcpad);
|
|
||||||
|
|
||||||
fdsrc->fd = 0;
|
fdsrc->fd = 0;
|
||||||
fdsrc->curoffset = 0;
|
fdsrc->curoffset = 0;
|
||||||
|
@ -220,8 +225,8 @@ gst_fdsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstData *
|
static GstFlowReturn
|
||||||
gst_fdsrc_get (GstPad * pad)
|
gst_fdsrc_create (GstPushSrc * psrc, GstBuffer ** outbuf)
|
||||||
{
|
{
|
||||||
GstFdSrc *src;
|
GstFdSrc *src;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
@ -233,7 +238,7 @@ gst_fdsrc_get (GstPad * pad)
|
||||||
gint retval;
|
gint retval;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
src = GST_FDSRC (gst_pad_get_parent (pad));
|
src = GST_FDSRC (psrc);
|
||||||
|
|
||||||
/* create the buffer */
|
/* create the buffer */
|
||||||
buf = gst_buffer_new_and_alloc (src->blocksize);
|
buf = gst_buffer_new_and_alloc (src->blocksize);
|
||||||
|
@ -254,12 +259,10 @@ gst_fdsrc_get (GstPad * pad)
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||||
("select on file descriptor: %s.", g_strerror (errno)));
|
("select on file descriptor: %s.", g_strerror (errno)));
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
} else if (retval == 0) {
|
} else if (retval == 0) {
|
||||||
g_signal_emit (G_OBJECT (src), gst_fdsrc_signals[SIGNAL_TIMEOUT], 0);
|
g_signal_emit (G_OBJECT (src), gst_fdsrc_signals[SIGNAL_TIMEOUT], 0);
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -274,14 +277,13 @@ gst_fdsrc_get (GstPad * pad)
|
||||||
src->curoffset += readbytes;
|
src->curoffset += readbytes;
|
||||||
|
|
||||||
/* we're done, return the buffer */
|
/* we're done, return the buffer */
|
||||||
return GST_DATA (buf);
|
*outbuf = buf;
|
||||||
|
return GST_FLOW_OK;
|
||||||
} else if (readbytes == 0) {
|
} else if (readbytes == 0) {
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
} else {
|
} else {
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
|
||||||
("read on file descriptor: %s.", g_strerror (errno)));
|
("read on file descriptor: %s.", g_strerror (errno)));
|
||||||
gst_element_set_eos (GST_ELEMENT (src));
|
return GST_FLOW_ERROR;
|
||||||
return GST_DATA (gst_event_new (GST_EVENT_EOS));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
|
* 2005 Philippe Khalaf <burger@speedy.org>
|
||||||
*
|
*
|
||||||
* gstfdsrc.h:
|
* gstfdsrc.h:
|
||||||
*
|
*
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
#define __GST_FDSRC_H__
|
#define __GST_FDSRC_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/base/gstpushsrc.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -45,9 +47,7 @@ typedef struct _GstFdSrc GstFdSrc;
|
||||||
typedef struct _GstFdSrcClass GstFdSrcClass;
|
typedef struct _GstFdSrcClass GstFdSrcClass;
|
||||||
|
|
||||||
struct _GstFdSrc {
|
struct _GstFdSrc {
|
||||||
GstElement element;
|
GstPushSrc element;
|
||||||
/* pads */
|
|
||||||
GstPad *srcpad;
|
|
||||||
|
|
||||||
/* fd */
|
/* fd */
|
||||||
gint fd;
|
gint fd;
|
||||||
|
@ -60,7 +60,7 @@ struct _GstFdSrc {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstFdSrcClass {
|
struct _GstFdSrcClass {
|
||||||
GstElementClass parent_class;
|
GstPushSrcClass parent_class;
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (*timeout) (GstElement *element);
|
void (*timeout) (GstElement *element);
|
||||||
|
|
Loading…
Reference in a new issue