Commit c2f41a89 authored by Wim Taymans's avatar Wim Taymans

Next big merge.

Original commit message from CVS:
Next big merge.
Added GstBus for mainloop integration.
Added GstMessage for sending notifications on the bus.
Added GstTask as an abstraction for pipeline entry points.
Removed GstThread.
Removed Schedulers.
Simplified GstQueue for multithreaded core.
Made _link threadsafe, removed old capsnego.
Added STREAM_LOCK and PREROLL_LOCK in GstPad.
Added pad blocking functions.
Reworked scheduling functions in GstPad to prepare for
scheduling updates soon.
Moved events out of data stream.
Simplified GstEvent types.
Added return values to push/pull.
Removed clocking from GstElement.
Added prototypes for state change function for next merge.
Removed iterate from bins and state change management.
Fixed some elements, disabled others for now.
Fixed -inspect and -launch.
Added check for GstBus.
parent 007cff6d
2005-03-21 Wim Taymans <wim@fluendo.com>
* check/Makefile.am:
* gst/Makefile.am:
* gst/elements/Makefile.am:
* gst/elements/gstelements.c:
* gst/elements/gstfakesink.c: (gst_fakesink_init),
(gst_fakesink_event), (gst_fakesink_chain):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_init), (gst_fakesrc_get_event_mask),
(gst_fakesrc_event_handler), (gst_fakesrc_set_pad_functions),
(gst_fakesrc_set_all_pad_functions), (gst_fakesrc_request_new_pad),
(gst_fakesrc_set_property), (gst_fakesrc_get_property),
(gst_fakesrc_get_range_unlocked), (gst_fakesrc_get_range),
(gst_fakesrc_loop), (gst_fakesrc_activate),
(gst_fakesrc_change_state):
* gst/elements/gstfakesrc.h:
* gst/elements/gstfilesrc.c: (gst_filesrc_init),
(gst_filesrc_get_read), (gst_filesrc_getrange), (gst_filesrc_get),
(gst_filesrc_open_file), (gst_filesrc_loop),
(gst_filesrc_activate), (gst_filesrc_change_state),
(filesrc_find_peek), (filesrc_find_suggest),
(gst_filesrc_type_find):
* gst/elements/gstidentity.c: (gst_identity_finalize),
(gst_identity_class_init), (gst_identity_init),
(gst_identity_proxy_getcaps), (identity_queue_push),
(identity_queue_pop), (identity_queue_flush), (gst_identity_event),
(gst_identity_getrange), (gst_identity_chain),
(gst_identity_sink_loop), (gst_identity_src_loop),
(gst_identity_handle_buffer), (gst_identity_set_dataflow_funcs),
(gst_identity_set_property), (gst_identity_get_property),
(gst_identity_change_state):
* gst/elements/gstidentity.h:
* gst/elements/gsttee.c: (gst_tee_class_init), (gst_tee_init),
(gst_tee_update_pad_functions), (gst_tee_request_new_pad),
(gst_tee_set_property), (gst_tee_get_property), (gst_tee_do_push),
(gst_tee_handle_buffer), (gst_tee_chain), (gst_tee_loop),
(gst_tee_sink_activate):
* gst/elements/gsttee.h:
* gst/gst.c: (gst_register_core_elements), (init_post):
* gst/gst.h:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_bus),
(gst_bin_set_scheduler), (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_get_state),
(gst_bin_change_state):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_get_type), (gst_bus_class_init),
(gst_bus_init), (gst_bus_dispose), (gst_bus_set_property),
(gst_bus_get_property), (gst_bus_new), (gst_bus_post),
(gst_bus_have_pending), (gst_bus_pop), (gst_bus_peek),
(gst_bus_set_sync_handler), (gst_bus_create_watch),
(bus_watch_callback), (bus_watch_destroy),
(gst_bus_add_watch_full), (gst_bus_add_watch), (poll_handler),
(poll_timeout), (gst_bus_poll):
* gst/gstbus.h:
* gst/gstcaps.h:
* gst/gstdata.h:
* gst/gstelement.c: (gst_element_class_init), (gst_element_init),
(gst_element_post_message), (gst_element_message_full),
(gst_element_get_state_func), (gst_element_get_state),
(gst_element_abort_state), (gst_element_commit_state),
(gst_element_lost_state), (gst_element_set_state),
(gst_element_pads_activate), (gst_element_change_state),
(gst_element_dispose), (gst_element_set_manager_func),
(gst_element_set_bus_func), (gst_element_set_scheduler_func),
(gst_element_set_manager), (gst_element_get_manager),
(gst_element_set_bus), (gst_element_get_bus),
(gst_element_set_scheduler), (gst_element_get_scheduler):
* gst/gstelement.h:
* gst/gstevent.c: (gst_event_new_segment_seek),
(gst_event_new_flush):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize), (_gst_message_copy),
(_gst_message_free), (gst_message_get_type), (gst_message_new),
(gst_message_new_eos), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application),
(gst_message_get_structure), (gst_message_parse_tag),
(gst_message_parse_state_changed), (gst_message_parse_error),
(gst_message_parse_warning):
* gst/gstmessage.h:
* gst/gstpad.c: (gst_real_pad_class_init), (gst_real_pad_init),
(gst_real_pad_set_property), (gst_pad_set_active),
(gst_pad_is_active), (gst_pad_set_blocked_async),
(gst_pad_set_blocked), (gst_pad_is_blocked),
(gst_pad_set_activate_function), (gst_pad_set_loop_function),
(gst_pad_set_getrange_function), (gst_pad_set_acceptcaps_function),
(gst_pad_set_fixatecaps_function), (gst_pad_set_setcaps_function),
(gst_pad_unlink), (gst_pad_link_prepare_filtered),
(gst_pad_link_filtered), (gst_pad_relink_filtered),
(gst_real_pad_get_caps_unlocked), (gst_pad_get_caps),
(gst_pad_peer_get_caps), (gst_pad_fixate_caps),
(gst_pad_accept_caps), (gst_pad_peer_accept_caps),
(gst_pad_set_caps), (gst_pad_configure_sink),
(gst_pad_configure_src), (gst_pad_get_negotiated_caps),
(gst_pad_get_filter_caps), (gst_pad_alloc_buffer),
(gst_real_pad_dispose), (gst_real_pad_finalize),
(handle_pad_block), (gst_pad_push), (gst_pad_pull_range),
(gst_pad_event_default_dispatch), (gst_pad_event_default),
(gst_pad_push_event), (gst_pad_send_event), (gst_pad_get_formats):
* gst/gstpad.h:
* gst/gstpipeline.c: (gst_pipeline_init), (is_eos),
(pipeline_bus_handler), (gst_pipeline_change_state),
(gst_pipeline_get_scheduler), (gst_pipeline_get_bus):
* gst/gstpipeline.h:
* gst/gstprobe.h:
* gst/gstqueue.c: (gst_queue_class_init), (gst_queue_init),
(gst_queue_finalize), (gst_queue_getcaps), (gst_queue_link_sink),
(gst_queue_link_src), (gst_queue_bufferalloc),
(gst_queue_locked_flush), (gst_queue_handle_sink_event),
(gst_queue_is_empty), (gst_queue_is_filled), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_src_activate),
(gst_queue_change_state):
* gst/gstqueue.h:
* gst/gstscheduler.c: (gst_scheduler_init),
(gst_scheduler_dispose), (gst_scheduler_create_task),
(gst_scheduler_factory_create):
* gst/gstscheduler.h:
* gst/gststructure.c: (gst_structure_get_type),
(gst_structure_copy_conditional):
* gst/gststructure.h:
* gst/gsttaginterface.h:
* gst/gsttask.c: (gst_task_get_type), (gst_task_class_init),
(gst_task_init), (gst_task_dispose), (gst_task_create),
(gst_task_get_state), (gst_task_start), (gst_task_stop),
(gst_task_pause):
* gst/gsttask.h:
* gst/gstthread.c:
* gst/gstthread.h:
* gst/gsttypes.h:
* gst/schedulers/Makefile.am:
* gst/schedulers/cothreads_compat.h:
* gst/schedulers/entryscheduler.c:
* gst/schedulers/faircothreads.c:
* gst/schedulers/faircothreads.h:
* gst/schedulers/fairscheduler.c:
* gst/schedulers/gstbasicscheduler.c:
* gst/schedulers/gstoptimalscheduler.c:
* gst/schedulers/gthread-cothreads.h:
* gst/schedulers/threadscheduler.c:
(gst_thread_scheduler_task_get_type),
(gst_thread_scheduler_task_class_init),
(gst_thread_scheduler_task_init),
(gst_thread_scheduler_task_start),
(gst_thread_scheduler_task_stop),
(gst_thread_scheduler_task_pause), (gst_thread_scheduler_get_type),
(gst_thread_scheduler_class_init), (gst_thread_scheduler_func),
(gst_thread_scheduler_init), (gst_thread_scheduler_create_task),
(gst_thread_scheduler_setup), (gst_thread_scheduler_reset),
(plugin_init):
* libs/gst/Makefile.am:
* libs/gst/bytestream/bytestream.c: (gst_bytestream_get_next_buf):
* libs/gst/bytestream/filepad.c: (gst_file_pad_init),
(gst_file_pad_parent_set):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
* tests/complexity.c: (main):
* tests/mass_elements.c: (main):
* testsuite/states/locked.c: (message_received), (main):
* testsuite/states/parent.c: (main):
* tools/gst-inspect.c: (print_element_flag_info),
(print_implementation_info), (print_pad_info):
* tools/gst-launch.c: (check_intr), (play_handler), (event_loop),
(main):
* tools/gst-md5sum.c: (event_loop), (main):
* tools/gst-typefind.c: (main):
* tools/gst-xmlinspect.c: (print_element_info):
Next big merge.
Added GstBus for mainloop integration.
Added GstMessage for sending notifications on the bus.
Added GstTask as an abstraction for pipeline entry points.
Removed GstThread.
Removed Schedulers.
Simplified GstQueue for multithreaded core.
Made _link threadsafe, removed old capsnego.
Added STREAM_LOCK and PREROLL_LOCK in GstPad.
Added pad blocking functions.
Reworked scheduling functions in GstPad to prepare for
scheduling updates soon.
Moved events out of data stream.
Simplified GstEvent types.
Added return values to push/pull.
Removed clocking from GstElement.
Added prototypes for state change function for next merge.
Removed iterate from bins and state change management.
Fixed some elements, disabled others for now.
Fixed -inspect and -launch.
Added check for GstBus.
2005-03-10 Wim Taymans <wim@fluendo.com>
* docs/design/part-MT-refcounting.txt:
......
......@@ -20,6 +20,7 @@ CLEANFILES = core.*
TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
gst/gstbin \
gst/gstbus \
gst/gstcaps \
gst/gstdata \
gst/gstiterator \
......
common @ 131c2632
Subproject commit b2638c100721f67b280c3b43b21f1ce1c9b5e316
Subproject commit 131c2632127e6f061b5270d8f80651782a4fdd13
lib_LTLIBRARIES = libgstreamer-@GST_MAJORMINOR@.la
AS_LIBTOOL_LIB = libgstreamer-@GST_MAJORMINOR@
if GST_DISABLE_OMEGA_COTHREADS
noinst_LTLIBRARIES =
else
noinst_LTLIBRARIES = libcothreads.la
endif
#GST_INSTRUMENT_FLAGS = -finstrument-functions -DGST_ENABLE_FUNC_INSTRUMENTATION
......@@ -67,7 +63,7 @@ GST_URI_SRC = gsturi.c
endif
SUBDIRS = $(GST_PARSE_DIRS) $(GST_REGISTRY_DIRS) . elements schedulers $(GST_INDEX_DIRS)
DIST_SUBDIRS = autoplug elements parse registries schedulers indexers
DIST_SUBDIRS = elements parse registries schedulers indexers
# make variables for all generated source and header files to make the
# distinction clear
......@@ -85,6 +81,7 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
gstatomic.c \
gstbin.c \
gstbuffer.c \
gstbus.c \
gstcaps.c \
gstclock.c \
gstcpu.c \
......@@ -100,19 +97,20 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \
gstinterface.c \
gstiterator.c \
gstmemchunk.c \
gstmessage.c \
gstpad.c \
gstpipeline.c \
gstplugin.c \
gstpluginfeature.c \
gstprobe.c \
gstqueue.c \
gstquery.c \
gstqueue.c \
gstscheduler.c \
gststructure.c \
gstsystemclock.c \
gsttag.c \
gsttaginterface.c \
gstthread.c \
gsttask.c \
$(GST_TRACE_SRC) \
gsttrashstack.c \
gsttypefind.c \
......@@ -159,6 +157,7 @@ gst_headers = \
gstobject.h \
gstbin.h \
gstbuffer.h \
gstbus.h \
gstcaps.h \
gstclock.h \
gstcompat.h \
......@@ -175,19 +174,20 @@ gst_headers = \
gstiterator.h \
gstmacros.h \
gstmemchunk.h \
gstmessage.h \
gstpad.h \
gstpipeline.h \
gstplugin.h \
gstpluginfeature.h \
gstprobe.h \
gstqueue.h \
gstquery.h \
gstqueue.h \
gstscheduler.h \
gststructure.h \
gstsystemclock.h \
gsttag.h \
gsttaginterface.h \
gstthread.h \
gsttask.h \
gsttrace.h \
gsttrashstack.h \
gsttypefind.h \
......@@ -215,15 +215,6 @@ noinst_HEADERS = \
gstarch.h \
cothreads.h
if GST_DISABLE_OMEGA_COTHREADS
#libcothreads_la_SOURCES =
#libcothreads_la_CFLAGS =
else
libcothreads_la_SOURCES = cothreads.c
libcothreads_la_CFLAGS = $(libgstreamer_@GST_MAJORMINOR@_la_CFLAGS)
endif
gstmarshal.h: gstmarshal.list
glib-genmarshal --header --prefix=gst_marshal $(srcdir)/gstmarshal.list > gstmarshal.h.tmp
mv gstmarshal.h.tmp gstmarshal.h
......
......@@ -24,23 +24,24 @@ endif
libgstelements_la_DEPENDENCIES = ../libgstreamer-@GST_MAJORMINOR@.la
libgstelements_la_SOURCES = \
gstaggregator.c \
gstbufferstore.c \
gstelements.c \
gstfakesink.c \
gstfakesrc.c \
gstfilesink.c \
gstfakesink.c \
gstfilesrc.c \
gstfdsink.c \
gstfdsrc.c \
gstidentity.c \
gstmd5sink.c \
$(multifilesrc) \
$(pipefilter) \
gstshaper.c \
gststatistics.c \
gsttee.c \
gsttypefindelement.c
gstelements.c \
gsttee.c
# gstaggregator.c \
# gstbufferstore.c \
# gstfilesink.c \
# gstfdsink.c \
# gstfdsrc.c \
# gstmd5sink.c \
# $(multifilesrc) \
# $(pipefilter) \
# gstshaper.c \
# gststatistics.c \
# gsttypefindelement.c
libgstelements_la_CFLAGS = $(GST_OBJ_CFLAGS)
libgstelements_la_LIBADD = $(GST_OBJ_LIBS)
......
......@@ -55,24 +55,24 @@ extern GType gst_filesrc_get_type (void);
extern GstElementDetails gst_filesrc_details;
static struct _elements_entry _elements[] = {
{"aggregator", GST_RANK_NONE, gst_aggregator_get_type},
// {"aggregator", GST_RANK_NONE, gst_aggregator_get_type},
{"fakesrc", GST_RANK_NONE, gst_fakesrc_get_type},
{"fakesink", GST_RANK_NONE, gst_fakesink_get_type},
{"fdsink", GST_RANK_NONE, gst_fdsink_get_type},
{"fdsrc", GST_RANK_NONE, gst_fdsrc_get_type},
{"filesrc", GST_RANK_NONE, gst_filesrc_get_type},
{"filesink", GST_RANK_NONE, gst_filesink_get_type},
{"identity", GST_RANK_NONE, gst_identity_get_type},
{"md5sink", GST_RANK_NONE, gst_md5sink_get_type},
// {"fdsink", GST_RANK_NONE, gst_fdsink_get_type},
// {"fdsrc", GST_RANK_NONE, gst_fdsrc_get_type},
// {"filesink", GST_RANK_NONE, gst_filesink_get_type},
// {"md5sink", GST_RANK_NONE, gst_md5sink_get_type},
#ifndef HAVE_WIN32
{"multifilesrc", GST_RANK_NONE, gst_multifilesrc_get_type},
{"pipefilter", GST_RANK_NONE, gst_pipefilter_get_type},
// {"multifilesrc", GST_RANK_NONE, gst_multifilesrc_get_type},
// {"pipefilter", GST_RANK_NONE, gst_pipefilter_get_type},
#endif
{"shaper", GST_RANK_NONE, gst_shaper_get_type},
{"statistics", GST_RANK_NONE, gst_statistics_get_type},
// {"shaper", GST_RANK_NONE, gst_shaper_get_type},
// {"statistics", GST_RANK_NONE, gst_statistics_get_type},
{"tee", GST_RANK_NONE, gst_tee_get_type},
{"typefind", GST_RANK_NONE, gst_type_find_element_get_type},
{NULL, 0},
// {"typefind", GST_RANK_NONE, gst_type_find_element_get_type},
// {NULL, 0},
};
static gboolean
......
......@@ -113,7 +113,8 @@ static void gst_fakesink_get_property (GObject * object, guint prop_id,
static GstElementStateReturn gst_fakesink_change_state (GstElement * element);
static void gst_fakesink_chain (GstPad * pad, GstData * _data);
static GstFlowReturn gst_fakesink_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_fakesink_event (GstPad * pad, GstEvent * event);
static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
......@@ -188,6 +189,7 @@ gst_fakesink_init (GstFakeSink * fakesink)
"sink");
gst_element_add_pad (GST_ELEMENT (fakesink), pad);
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain));
gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_event));
fakesink->silent = FALSE;
fakesink->dump = FALSE;
......@@ -195,8 +197,6 @@ gst_fakesink_init (GstFakeSink * fakesink)
fakesink->last_message = NULL;
fakesink->state_error = FAKESINK_STATE_ERROR_NONE;
fakesink->signal_handoffs = FALSE;
GST_FLAG_SET (fakesink, GST_ELEMENT_EVENT_AWARE);
}
static void
......@@ -307,47 +307,43 @@ gst_fakesink_get_property (GObject * object, guint prop_id, GValue * value,
}
}
static void
gst_fakesink_chain (GstPad * pad, GstData * _data)
static gboolean
gst_fakesink_event (GstPad * pad, GstEvent * event)
{
GstBuffer *buf = GST_BUFFER (_data);
GstFakeSink *fakesink;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
fakesink = GST_FAKESINK (GST_OBJECT_PARENT (pad));
if (GST_IS_EVENT (buf)) {
GstEvent *event = GST_EVENT (buf);
if (!fakesink->silent) {
g_free (fakesink->last_message);
fakesink->last_message =
g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p",
GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
if (!fakesink->silent) {
g_free (fakesink->last_message);
g_object_notify (G_OBJECT (fakesink), "last_message");
}
fakesink->last_message =
g_strdup_printf ("chain ******* (%s:%s)E (type: %d) %p",
GST_DEBUG_PAD_NAME (pad), GST_EVENT_TYPE (event), event);
g_object_notify (G_OBJECT (fakesink), "last_message");
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
if (fakesink->sync && fakesink->clock) {
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
gst_element_set_time (GST_ELEMENT (fakesink), value);
}
default:
gst_pad_event_default (pad, event);
break;
}
return;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
default:
gst_pad_event_default (pad, event);
break;
}
return TRUE;
}
static GstFlowReturn
gst_fakesink_chain (GstPad * pad, GstBuffer * buffer)
{
GstBuffer *buf = GST_BUFFER (buffer);
GstFakeSink *fakesink;
fakesink = GST_FAKESINK (GST_OBJECT_PARENT (pad));
if (fakesink->sync && fakesink->clock) {
gst_element_wait (GST_ELEMENT (fakesink), GST_BUFFER_TIMESTAMP (buf));
//gst_element_wait (GST_ELEMENT (fakesink), GST_BUFFER_TIMESTAMP (buf));
}
if (!fakesink->silent) {
......@@ -374,6 +370,8 @@ gst_fakesink_chain (GstPad * pad, GstData * _data)
}
gst_buffer_unref (buf);
return GST_FLOW_OK;
}
static GstElementStateReturn
......
......@@ -64,7 +64,8 @@ enum
{
ARG_0,
ARG_NUM_SOURCES,
ARG_LOOP_BASED,
ARG_HAS_LOOP,
ARG_HAS_GETRANGE,
ARG_OUTPUT,
ARG_DATA,
ARG_SIZETYPE,
......@@ -179,7 +180,7 @@ GST_BOILERPLATE_FULL (GstFakeSrc, gst_fakesrc, GstElement, GST_TYPE_ELEMENT,
static GstPad *gst_fakesrc_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * unused);
static void gst_fakesrc_update_functions (GstFakeSrc * src);
static gboolean gst_fakesrc_activate (GstPad * pad, GstActivateMode mode);
static void gst_fakesrc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_fakesrc_get_property (GObject * object, guint prop_id,
......@@ -188,8 +189,9 @@ static void gst_fakesrc_set_clock (GstElement * element, GstClock * clock);
static GstElementStateReturn gst_fakesrc_change_state (GstElement * element);
static GstData *gst_fakesrc_get (GstPad * pad);
static void gst_fakesrc_loop (GstElement * element);
static void gst_fakesrc_loop (GstPad * pad);
static GstFlowReturn gst_fakesrc_get_range (GstPad * pad, guint64 offset,
guint length, GstBuffer ** buf);
static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
......@@ -220,9 +222,14 @@ gst_fakesrc_class_init (GstFakeSrcClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
g_param_spec_int ("num-sources", "num-sources", "Number of sources",
1, G_MAXINT, 1, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
g_param_spec_boolean ("loop-based", "loop-based",
"Enable loop-based operation", FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HAS_LOOP,
g_param_spec_boolean ("has-loop", "has-loop",
"Enable loop-based operation", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HAS_GETRANGE,
g_param_spec_boolean ("has-getrange", "has-getrange",
"Enable getrange-based operation", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT,
g_param_spec_enum ("output", "output", "Output method (currently unused)",
GST_TYPE_FAKESRC_OUTPUT, FAKESRC_FIRST_LAST_LOOP, G_PARAM_READWRITE));
......@@ -300,9 +307,6 @@ gst_fakesrc_init (GstFakeSrc * fakesrc)
"src");
gst_element_add_pad (GST_ELEMENT (fakesrc), pad);
fakesrc->loop_based = FALSE;
gst_fakesrc_update_functions (fakesrc);
fakesrc->output = FAKESRC_FIRST_LAST_LOOP;
fakesrc->segment_start = -1;
fakesrc->segment_end = -1;
......@@ -324,6 +328,7 @@ gst_fakesrc_init (GstFakeSrc * fakesrc)
fakesrc->last_message = NULL;
fakesrc->datarate = DEFAULT_DATARATE;
fakesrc->sync = DEFAULT_SYNC;
fakesrc->pad_mode = GST_ACTIVATE_NONE;
}
static void
......@@ -336,35 +341,6 @@ gst_fakesrc_set_clock (GstElement * element, GstClock * clock)
src->clock = clock;
}
static GstPad *
gst_fakesrc_request_new_pad (GstElement * element, GstPadTemplate * templ,
const gchar * unused)
{
gchar *name;
GstPad *srcpad;
GstFakeSrc *fakesrc;
g_return_val_if_fail (GST_IS_FAKESRC (element), NULL);
if (templ->direction != GST_PAD_SRC) {
g_warning ("gstfakesrc: request new pad that is not a SRC pad\n");
return NULL;
}
fakesrc = GST_FAKESRC (element);
name = g_strdup_printf ("src%d", GST_ELEMENT (fakesrc)->numsrcpads);
srcpad = gst_pad_new_from_template (templ, name);
gst_element_add_pad (GST_ELEMENT (fakesrc), srcpad);
gst_fakesrc_update_functions (fakesrc);
g_free (name);
return srcpad;
}
static const GstFormat *
gst_fakesrc_get_formats (GstPad * pad)
{
......@@ -419,8 +395,7 @@ static const GstEventMask *
gst_fakesrc_get_event_mask (GstPad * pad)
{
static const GstEventMask masks[] = {
{GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH},
{GST_EVENT_SEEK_SEGMENT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP},
{GST_EVENT_SEEK, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT_LOOP},
{GST_EVENT_FLUSH, 0},
{0, 0},
};
......@@ -433,22 +408,16 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event)
{
GstFakeSrc *src;
src = GST_FAKESRC (gst_pad_get_parent (pad));
src = GST_FAKESRC (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
src->buffer_count = GST_EVENT_SEEK_OFFSET (event);
if (!GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
break;
}
/* else we do a flush too */
case GST_EVENT_SEEK_SEGMENT:
src->segment_start = GST_EVENT_SEEK_OFFSET (event);
src->segment_end = GST_EVENT_SEEK_ENDOFFSET (event);
src->buffer_count = src->segment_start;
src->segment_loop =
GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
src->need_flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH;
break;
case GST_EVENT_FLUSH:
src->need_flush = TRUE;
......@@ -462,34 +431,61 @@ gst_fakesrc_event_handler (GstPad * pad, GstEvent * event)
}
static void
gst_fakesrc_update_functions (GstFakeSrc * src)
gst_fakesrc_set_pad_functions (GstFakeSrc * src, GstPad * pad)
{
GList *pads;
gst_pad_set_activate_function (pad, gst_fakesrc_activate);
gst_pad_set_event_function (pad, gst_fakesrc_event_handler);
gst_pad_set_event_mask_function (pad, gst_fakesrc_get_event_mask);
gst_pad_set_query_function (pad, gst_fakesrc_query);
gst_pad_set_query_type_function (pad, gst_fakesrc_get_query_types);
gst_pad_set_formats_function (pad, gst_fakesrc_get_formats);