gnomemm r1354 - in gstreamermm/trunk: . gstreamer gstreamer/src tools/m4
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1354 - in gstreamermm/trunk: . gstreamer gstreamer/src tools/m4
- Date: Tue, 19 Feb 2008 04:31:08 +0000 (GMT)
Author: jaalburqu
Date: Tue Feb 19 04:31:07 2008
New Revision: 1354
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1354&view=rev
Log:
2008-02-18 Josà Alburquerque <jaalburqu svn gnome org>
* gstreamer/gstreamermm.h:
* gstreamer/src/Makefile_list_of_hg.am_fragment:
* gstreamer/src/enums.hg:
* gstreamer/src/parse.ccg:
* gstreamer/src/parse.hg:
* gstreamer/src/task.ccg:
* gstreamer/src/task.hg:
* tools/m4/convert_gst.m4: Added Parse and Task
Added:
gstreamermm/trunk/gstreamer/src/parse.ccg
gstreamermm/trunk/gstreamer/src/parse.hg
gstreamermm/trunk/gstreamer/src/task.ccg
gstreamermm/trunk/gstreamer/src/task.hg
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/gstreamer/gstreamermm.h
gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
gstreamermm/trunk/gstreamer/src/enums.hg
gstreamermm/trunk/tools/m4/convert_gst.m4
Modified: gstreamermm/trunk/gstreamer/gstreamermm.h
==============================================================================
--- gstreamermm/trunk/gstreamer/gstreamermm.h (original)
+++ gstreamermm/trunk/gstreamer/gstreamermm.h Tue Feb 19 04:31:07 2008
@@ -21,12 +21,14 @@
#include <gstreamermm/object.h>
#include <gstreamermm/pad.h>
#include <gstreamermm/padtemplate.h>
+#include <gstreamermm/parse.h>
#include <gstreamermm/pipeline.h>
#include <gstreamermm/plugin.h>
#include <gstreamermm/pluginfeature.h>
#include <gstreamermm/query.h>
#include <gstreamermm/structure.h>
#include <gstreamermm/systemclock.h>
+#include <gstreamermm/task.h>
#include <gstreamermm/value.h>
#include <gstreamermm/xml.h>
Modified: gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment (original)
+++ gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment Tue Feb 19 04:31:07 2008
@@ -7,8 +7,8 @@
files_general_hg = bin.hg buffer.hg bus.hg caps.hg childproxy.hg clock.hg \
element.hg elementfactory.hg enums.hg error.hg event.hg filter.hg \
format.hg index.hg indexfactory.hg iterator.hg message.hg pad.hg \
- padtemplate.hg pipeline.hg plugin.hg pluginfeature.hg query.hg \
- structure.hg systemclock.hg value.hg xml.hg
+ padtemplate.hg parse.hg pipeline.hg plugin.hg pluginfeature.hg \
+ query.hg structure.hg systemclock.hg task.hg value.hg xml.hg
files_general_deprecated_hg =
Modified: gstreamermm/trunk/gstreamer/src/enums.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/enums.hg (original)
+++ gstreamermm/trunk/gstreamer/src/enums.hg Tue Feb 19 04:31:07 2008
@@ -70,12 +70,14 @@
_WRAP_ENUM(PadDirection, GstPadDirection)
_WRAP_ENUM(PadLinkReturn, GstPadLinkReturn)
_WRAP_ENUM(PadPresence, GstPadPresence)
+_WRAP_ENUM(ParseError, GstParseError)
_WRAP_ENUM(PluginError, GstPluginError)
_WRAP_ENUM(QueryType, GstQueryType)
_WRAP_ENUM(Rank, GstRank)
_WRAP_ENUM(SeekFlags, GstSeekFlags)
_WRAP_ENUM(SeekType, GstSeekType)
_WRAP_ENUM(State, GstState)
+_WRAP_ENUM(TaskState, GstTaskState)
enum StateChange
{
Added: gstreamermm/trunk/gstreamer/src/parse.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/parse.ccg Tue Feb 19 04:31:07 2008
@@ -0,0 +1,89 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/gstparse.h>
+#include <gst/gstutils.h>
+#include <gstreamermm/element.h>
+
+namespace Gst
+{
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<Element> Parse::launch(const Glib::ustring& pipeline_description)
+#else
+Glib::RefPtr<Element> Parse::launch(const Glib::ustring& pipeline_description, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ Glib::RefPtr<Element> retvalue = Glib::wrap(gst_parse_launch(pipeline_description.c_str(), &(gerror)));
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<Element> Parse::launchv(const gchar *argv[])
+#else
+Glib::RefPtr<Element> Parse::launchv(const gchar *argv[], std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ Glib::RefPtr<Element> retvalue = Glib::wrap(gst_parse_launchv(argv, &(gerror)));
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+}
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+Glib::RefPtr<Element> Parse::get_bin(const Glib::ustring& bin_description, bool ghost_unconnected_pads)
+#else
+Glib::RefPtr<Element> Parse::get_bin(const Glib::ustring& bin_description, bool ghost_unconnected_pads, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+ GError* gerror = 0;
+ Glib::RefPtr<Element> retvalue = Glib::wrap(gst_parse_bin_from_description(bin_description.c_str(), ghost_unconnected_pads, &(gerror)));
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ return retvalue;
+}
+
+} //namespace Gst
Added: gstreamermm/trunk/gstreamer/src/parse.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/parse.hg Tue Feb 19 04:31:07 2008
@@ -0,0 +1,95 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+class Element;
+
+/** GstParse â Get a pipeline from a text pipeline description.
+ * The methods in this class allow to create a pipeline based on the syntax
+ * used in the gst-launch utillity.
+ */
+class Parse
+{
+
+public:
+ /** Get the error quark used by the parsing subsystem.
+ * @return the quark of the parse errors.
+ */
+ static Glib::QueryQuark error_quark();
+
+ /** Create a new pipeline based on command line syntax. Please note that you
+ * might get a return value that is not NULL even though the error is set. In
+ * this case there was a recoverable parsing error and you can try to play
+ * the pipeline.
+ * @param pipeline_description the command line describing the pipeline
+ * @param error the error message in case of an erroneous pipeline.
+ * @return a new element on success, NULL on failure. If more than one
+ * toplevel element is specified by the pipeline_description, all elements
+ * are put into a Pipeline, which than is returned.
+
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ static Glib::RefPtr<Element> launch(const Glib::ustring& pipeline_description);
+#else
+ static Glib::RefPtr<Element> launch(const Glib::ustring& pipeline_description, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ /** Create a new element based on command line syntax. An error does not
+ * mean that the pipeline could not be constructed.
+ * @param argv null-terminated array of arguments
+ * @param error will contain an error message if an erroneuos pipeline is
+ * specified.
+ * @return a new element on success and NULL on failure.
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ static Glib::RefPtr<Element> launchv(const gchar *argv[]);
+#else
+ static Glib::RefPtr<Element> launchv(const gchar *argv[], std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ /** This is a convenience wrapper around launch() to create a Bin from a
+ * gst-launch-style pipeline description. See launch() and the gst-launch man
+ * page for details about the syntax. Ghost pads on the bin for unconnected
+ * source or sink pads within the bin can automatically be created (but only
+ * a maximum of one ghost pad for each direction will be created; if you
+ * expect multiple unconnected source pads or multiple unconnected sink pads
+ * and want them all ghosted, you will have to create the ghost pads
+ * yourself).
+ *
+ * @param bin_description command line describing the bin
+ * @param ghost_unconnected_pads whether to automatically create ghost pads
+ * for unconnected source or sink pads within the bin
+ * @param err where to store the error message in case of an error
+ * @return a newly-created bin, or NULL if an error occurred.
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ static Glib::RefPtr<Element> get_bin(const Glib::ustring& bin_description, bool ghost_unconnected_pads);
+#else
+ static Glib::RefPtr<Element> get_bin(const Glib::ustring& bin_description, bool ghost_unconnected_pads, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+};
+
+} // namespace Gst
Added: gstreamermm/trunk/gstreamer/src/task.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/task.ccg Tue Feb 19 04:31:07 2008
@@ -0,0 +1,64 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/gsttask.h>
+
+static void SignalProxy_Task_gstreamermm_callback(void* data)
+{
+ Gst::Task::SlotTask* the_slot = static_cast<Gst::Task::SlotTask*>(data);
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ (*the_slot)();
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+namespace Gst
+{
+
+Glib::RefPtr<Task> Task::create(const SlotTask& slot)
+{
+ //Create a copy of the slot. A pointer to this copy will be passed through
+ //the call back's data parameter. It will be destroyed in the Task's
+ //destructor
+ SlotTask *slot_copy = new SlotTask(slot);
+
+ Glib::RefPtr<Task> task = Glib::wrap(gst_task_create(&SignalProxy_Task_gstreamermm_callback, slot_copy));
+ task->slot = slot_copy;
+ return task;
+}
+
+Task::~Task()
+{
+ // Delete task's slot upon destruction
+ delete this->slot;
+}
+
+} //namespace Gst
Added: gstreamermm/trunk/gstreamer/src/task.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/task.hg Tue Feb 19 04:31:07 2008
@@ -0,0 +1,87 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gstreamermm/enums.h>
+#include <gstreamermm/object.h>
+
+_DEFS(gstreamermm,gst)
+_PINCLUDE(gstreamermm/private/object_p.h)
+
+namespace Gst
+{
+
+/** Task â Abstraction of GStreamer streaming threads.
+ * Task is used by Element and Pad to provide the data passing threads in a
+ * Pipeline.
+ *
+ * A Pad will typically start a Task to push or pull data to/from the peer
+ * pads. Most source elements start a Task to push data. In some cases a
+ * demuxer element can start a Task to pull data from a peer element. This is
+ * typically done when the demuxer can perform random access on the upstream
+ * peer element for improved performance.
+ *
+ * Although convenience functions exist on Pad to start/pause/stop tasks, it
+ * might sometimes be needed to create a Task manually if it is not related to
+ * a Pad.
+ *
+ * Before the Task can be run, it needs a Glib::StaticRecMutex that can be set
+ * with set_lock().
+ *
+ * The task can be started, paused and stopped with start(), pause() and stop()
+ * respectively.
+ *
+ * A Task will repeadedly call the SlotTask that was provided when creating the
+ * task with create(). Before calling the function it will acquire the provided
+ * lock.
+ *
+ * Stopping a task with stop() will not immediatly make sure the task is not
+ * running anymore. Use join() to make sure the task is completely stopped and
+ * the thread is stopped.
+ *
+ * Last reviewed on 2006-02-13 (0.10.4)
+ */
+class Task : public Object
+{
+ _CLASS_GOBJECT(Task, GstTask, GST_TASK, Object, GstObject)
+ _CUSTOM_DTOR()
+
+public:
+ /** For example,
+ * void on_do_task();
+ */
+ typedef sigc::slot<void> SlotTask;
+
+ static Glib::RefPtr<Task> create(const SlotTask& slot);
+
+ _WRAP_METHOD(static void cleanup_all(), gst_task_cleanup_all)
+ _WRAP_METHOD(TaskState get_state(), gst_task_get_state)
+ _WRAP_METHOD(bool join(), gst_task_join)
+ _WRAP_METHOD(bool pause(), gst_task_pause)
+ _WRAP_METHOD(void set_lock(Glib::StaticRecMutex& mutex), gst_task_set_lock)
+ _WRAP_METHOD(bool start(), gst_task_start)
+ _WRAP_METHOD(bool stop(), gst_task_stop)
+
+protected:
+ SlotTask* slot;
+};
+
+} // namespace Gst
+
Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4 (original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4 Tue Feb 19 04:31:07 2008
@@ -101,6 +101,7 @@
_CONVERSION(`GQuark',`Glib::QueryQuark',`Glib::QueryQuark($3)')
_CONVERSION(`const Glib::QueryQuark&',`GQuark',`$3')
_CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3)')
+_CONVERSION(`Glib::StaticRecMutex&',`GStaticRecMutex*',`($3).gobj()')
_CONV_ENUM(Gst,AssocFlags)
_CONV_ENUM(Gst,BufferCopyFlags)
@@ -125,3 +126,4 @@
_CONV_ENUM(Gst,State)
_CONV_ENUM(Gst,StateChange)
_CONV_ENUM(Gst,StateChangeReturn)
+_CONV_ENUM(Gst,TaskState)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]