[gstreamermm] ClockUtils: move some clock-related artifacts to separated file
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] ClockUtils: move some clock-related artifacts to separated file
- Date: Sun, 28 Aug 2016 18:50:39 +0000 (UTC)
commit 9b725e4295b78445444dc6e3702058ef20a1c18d
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sat Aug 27 15:18:20 2016 +0200
ClockUtils: move some clock-related artifacts to separated file
.gitignore | 2 +
gstreamer/src/clock.ccg | 44 +-----------------
gstreamer/src/clock.hg | 77 +------------------------------
gstreamer/src/clockutils.ccg | 67 +++++++++++++++++++++++++++
gstreamer/src/clockutils.hg | 104 ++++++++++++++++++++++++++++++++++++++++++
gstreamer/src/filelist.am | 3 +-
gstreamer/src/object.hg | 10 ++--
7 files changed, 182 insertions(+), 125 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 2d1c891..dab89f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,6 +85,8 @@ gstreamer/gstreamermm/childproxy.cc
gstreamer/gstreamermm/childproxy.h
gstreamer/gstreamermm/clock.cc
gstreamer/gstreamermm/clock.h
+gstreamer/gstreamermm/clockutils.cc
+gstreamer/gstreamermm/clockutils.h
gstreamer/gstreamermm/colorbalance.cc
gstreamer/gstreamermm/colorbalance.h
gstreamer/gstreamermm/colorbalancechannel.cc
diff --git a/gstreamer/src/clock.ccg b/gstreamer/src/clock.ccg
index 7a2de52..e629927 100644
--- a/gstreamer/src/clock.ccg
+++ b/gstreamer/src/clock.ccg
@@ -54,52 +54,10 @@ static gboolean ClockID_Clock_gstreamermm_callback(GstClock* clock, GstClockTime
namespace Gst
{
-const ClockTime CLOCK_TIME_NONE = GST_CLOCK_TIME_NONE;
-const ClockTime SECOND = GST_SECOND;
-const ClockTime MILLI_SECOND = GST_MSECOND;
-const ClockTime MICRO_SECOND = GST_USECOND;
-const ClockTime NANO_SECOND = GST_NSECOND;
-
-
-guint get_hours(ClockTime time)
-{
- return GST_CLOCK_TIME_IS_VALID (time) ? time / (GST_SECOND * 60 * 60) : 99;
-}
-
-guint get_minutes(ClockTime time)
-{
- return GST_CLOCK_TIME_IS_VALID (time) ? (time / (GST_SECOND * 60)) % 60 : 99;
-}
-
-guint get_seconds(ClockTime time)
-{
- return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_SECOND) % 60 : 99;
-}
-
-guint get_milliseconds(ClockTime time)
-{
- return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_MSECOND) % 1000 : 999;
-}
-
-guint get_microseconds(ClockTime time)
-{
- return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_USECOND) % 1000 : 999;
-}
-
-guint get_nanoseconds(ClockTime time)
-{
- return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_NSECOND) % 1000 : 999;
-}
-
-guint get_fractional_seconds(ClockTime time)
-{
- return GST_CLOCK_TIME_IS_VALID (time) ? time % GST_SECOND : 999999999;
-}
-
ClockReturn ClockID::wait_async(const SlotClock& slot)
{
SlotClock* slot_copy = new SlotClock(slot);
return static_cast<ClockReturn>(gst_clock_id_wait_async(gobj(), &ClockID_Clock_gstreamermm_callback,
slot_copy, nullptr)); // TODO temporary NULL value
}
-} //namespace Gst
+}
diff --git a/gstreamer/src/clock.hg b/gstreamer/src/clock.hg
index af87a43..49419f5 100644
--- a/gstreamer/src/clock.hg
+++ b/gstreamer/src/clock.hg
@@ -19,7 +19,7 @@
#include <gst/gstclock.h>
#include <gstreamermm/object.h>
-#include <gstreamermmconfig.h>
+#include <gstreamermm/clockutils.h>
_DEFS(gstreamermm,gst)
@@ -28,38 +28,6 @@ namespace Gst
class Clock;
-/** A data type to hold a time, measured in nanoseconds.
- */
-typedef GstClockTime ClockTime;
-
-/** A data type to hold a timedifference, measured in nanoseconds.
- */
-typedef GstClockTimeDiff ClockTimeDiff;
-
-/** A constant to define an undefined clock time.
- */
-extern GSTREAMERMM_API const ClockTime CLOCK_TIME_NONE;
-
-/** A constant that defines one GStreamer second.
- */
-extern GSTREAMERMM_API const ClockTime SECOND;
-
-/** A constant that defines one GStreamer millisecond.
- */
-extern GSTREAMERMM_API const ClockTime MILLI_SECOND;
-
-/** A constant that defines one GStreamer microsecond.
- */
-extern GSTREAMERMM_API const ClockTime MICRO_SECOND;
-
-/** A constant that defines one GStreamer nanosecond.
- */
-extern GSTREAMERMM_API const ClockTime NANO_SECOND;
-
-_WRAP_ENUM(ClockEntryType, GstClockEntryType)
-_WRAP_ENUM(ClockReturn, GstClockReturn)
-_WRAP_ENUM(ClockFlags, GstClockFlags)
-
/** A data type to hold the handle to an outstanding sync or async clock
* callback.
*/
@@ -93,49 +61,6 @@ public:
_WRAP_METHOD(void unschedule(), gst_clock_id_unschedule)
};
-/** Gets the hour component of Gst::ClockTime.
- * @param time The Gst::ClockTime to parse.
- * @return The hour component of the Gst::ClockTime.
- */
-guint get_hours(Gst::ClockTime time);
-
-/** Gets the minute component of Gst::ClockTime.
- * @param time The Gst::ClockTime to parse.
- * @return The minute component of the Gst::ClockTime.
- */
-guint get_minutes(Gst::ClockTime time);
-
-/** Gets the seconds component of Gst::ClockTime.
- * @param time The Gst::ClockTime to parse.
- * @return The seconds component of the Gst::ClockTime.
- */
-guint get_seconds(Gst::ClockTime time);
-
-/** Gets the milliseconds component of Gst::ClockTime.
- * @param time The Gst::ClockTime to parse.
- * @return The milliseconds component of the Gst::ClockTime.
- */
-guint get_milliseconds(Gst::ClockTime time);
-
-/** Gets the microseconds component of Gst::ClockTime.
- * @param time The Gst::ClockTime to parse.
- * @return The microseconds component of the Gst::ClockTime.
- */
-guint get_microseconds(Gst::ClockTime time);
-
-/** Gets the nanoseconds component of Gst::ClockTime.
- * @param time The Gst::ClockTime to parse.
- * @return The nanoseconds component of the Gst::ClockTime.
- */
-guint get_nanoseconds(Gst::ClockTime time);
-
-/** Gets the fractional component (milli, micro and nano seconds) of
- * Gst::ClockTime.
- * @param time The Gst::ClockTime to parse.
- * @return The fractional component of the Gst::ClockTime.
- */
-guint get_fractional_seconds(Gst::ClockTime time);
-
/** Abstract class for global clocks
* GStreamer uses a global clock to synchronize the plugins in a pipeline.
* Different clock implementations are possible by implementing this abstract
diff --git a/gstreamer/src/clockutils.ccg b/gstreamer/src/clockutils.ccg
new file mode 100644
index 0000000..3041223
--- /dev/null
+++ b/gstreamer/src/clockutils.ccg
@@ -0,0 +1,67 @@
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008-2016 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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/gst.h>
+
+namespace Gst
+{
+
+const ClockTime CLOCK_TIME_NONE = GST_CLOCK_TIME_NONE;
+const ClockTime SECOND = GST_SECOND;
+const ClockTime MILLI_SECOND = GST_MSECOND;
+const ClockTime MICRO_SECOND = GST_USECOND;
+const ClockTime NANO_SECOND = GST_NSECOND;
+
+
+guint get_hours(ClockTime time)
+{
+ return GST_CLOCK_TIME_IS_VALID (time) ? time / (GST_SECOND * 60 * 60) : 99;
+}
+
+guint get_minutes(ClockTime time)
+{
+ return GST_CLOCK_TIME_IS_VALID (time) ? (time / (GST_SECOND * 60)) % 60 : 99;
+}
+
+guint get_seconds(ClockTime time)
+{
+ return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_SECOND) % 60 : 99;
+}
+
+guint get_milliseconds(ClockTime time)
+{
+ return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_MSECOND) % 1000 : 999;
+}
+
+guint get_microseconds(ClockTime time)
+{
+ return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_USECOND) % 1000 : 999;
+}
+
+guint get_nanoseconds(ClockTime time)
+{
+ return GST_CLOCK_TIME_IS_VALID (time) ? (time / GST_NSECOND) % 1000 : 999;
+}
+
+guint get_fractional_seconds(ClockTime time)
+{
+ return GST_CLOCK_TIME_IS_VALID (time) ? time % GST_SECOND : 999999999;
+}
+
+} //namespace Gst
diff --git a/gstreamer/src/clockutils.hg b/gstreamer/src/clockutils.hg
new file mode 100644
index 0000000..28032be
--- /dev/null
+++ b/gstreamer/src/clockutils.hg
@@ -0,0 +1,104 @@
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008-2016 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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/gstclock.h>
+#include <gstreamermmconfig.h>
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+/** A data type to hold a time, measured in nanoseconds.
+ */
+typedef GstClockTime ClockTime;
+
+/** A data type to hold a timedifference, measured in nanoseconds.
+ */
+typedef GstClockTimeDiff ClockTimeDiff;
+
+/** A constant to define an undefined clock time.
+ */
+extern GSTREAMERMM_API const ClockTime CLOCK_TIME_NONE;
+
+/** A constant that defines one GStreamer second.
+ */
+extern GSTREAMERMM_API const ClockTime SECOND;
+
+/** A constant that defines one GStreamer millisecond.
+ */
+extern GSTREAMERMM_API const ClockTime MILLI_SECOND;
+
+/** A constant that defines one GStreamer microsecond.
+ */
+extern GSTREAMERMM_API const ClockTime MICRO_SECOND;
+
+/** A constant that defines one GStreamer nanosecond.
+ */
+extern GSTREAMERMM_API const ClockTime NANO_SECOND;
+
+_WRAP_ENUM(ClockEntryType, GstClockEntryType)
+_WRAP_ENUM(ClockReturn, GstClockReturn)
+_WRAP_ENUM(ClockFlags, GstClockFlags)
+
+
+/** Gets the hour component of Gst::ClockTime.
+ * @param time The Gst::ClockTime to parse.
+ * @return The hour component of the Gst::ClockTime.
+ */
+guint get_hours(Gst::ClockTime time);
+
+/** Gets the minute component of Gst::ClockTime.
+ * @param time The Gst::ClockTime to parse.
+ * @return The minute component of the Gst::ClockTime.
+ */
+guint get_minutes(Gst::ClockTime time);
+
+/** Gets the seconds component of Gst::ClockTime.
+ * @param time The Gst::ClockTime to parse.
+ * @return The seconds component of the Gst::ClockTime.
+ */
+guint get_seconds(Gst::ClockTime time);
+
+/** Gets the milliseconds component of Gst::ClockTime.
+ * @param time The Gst::ClockTime to parse.
+ * @return The milliseconds component of the Gst::ClockTime.
+ */
+guint get_milliseconds(Gst::ClockTime time);
+
+/** Gets the microseconds component of Gst::ClockTime.
+ * @param time The Gst::ClockTime to parse.
+ * @return The microseconds component of the Gst::ClockTime.
+ */
+guint get_microseconds(Gst::ClockTime time);
+
+/** Gets the nanoseconds component of Gst::ClockTime.
+ * @param time The Gst::ClockTime to parse.
+ * @return The nanoseconds component of the Gst::ClockTime.
+ */
+guint get_nanoseconds(Gst::ClockTime time);
+
+/** Gets the fractional component (milli, micro and nano seconds) of
+ * Gst::ClockTime.
+ * @param time The Gst::ClockTime to parse.
+ * @return The fractional component of the Gst::ClockTime.
+ */
+guint get_fractional_seconds(Gst::ClockTime time);
+
+}
diff --git a/gstreamer/src/filelist.am b/gstreamer/src/filelist.am
index 5868546..4698fa2 100644
--- a/gstreamer/src/filelist.am
+++ b/gstreamer/src/filelist.am
@@ -28,7 +28,7 @@ files_hg = \
allocator.hg \
audiobasesink.hg \
audiobasesrc.hg \
- audiocdsrc.hg \
+ audiocdsrc.hg \
audioclock.hg \
audiofilter.hg \
audioformat.hg \
@@ -47,6 +47,7 @@ files_hg = \
capsfeatures.hg \
childproxy.hg \
clock.hg \
+ clockutils.hg \
context.hg \
colorbalance.hg \
colorbalancechannel.hg \
diff --git a/gstreamer/src/object.hg b/gstreamer/src/object.hg
index 1b1bc2f..8641782 100644
--- a/gstreamer/src/object.hg
+++ b/gstreamer/src/object.hg
@@ -21,6 +21,7 @@
#include <glibmm/object.h>
#include <glibmm/listhandle.h>
#include <glibmm/threads.h>
+#include <gstreamermm/clockutils.h>
_DEFS(gstreamermm,gst)
@@ -80,11 +81,10 @@ public:
_WRAP_METHOD(Glib::RefPtr<const Gst::Object> get_parent() const, gst_object_get_parent, constversion)
_WRAP_METHOD(void unparent(), gst_object_unparent)
- // TODO: Use Gst::ClockTime instead
- _WRAP_METHOD(void set_control_rate(GstClockTime control_rate), gst_object_set_control_rate)
- _WRAP_METHOD(GstClockTime get_control_rate() const, gst_object_get_control_rate)
- _WRAP_METHOD(GstClockTime suggest_next_sync() const, gst_object_suggest_next_sync)
- _WRAP_METHOD(bool sync_values(GstClockTime timestamp), gst_object_sync_values)
+ _WRAP_METHOD(void set_control_rate(Gst::ClockTime control_rate), gst_object_set_control_rate)
+ _WRAP_METHOD(Gst::ClockTime get_control_rate() const, gst_object_get_control_rate)
+ _WRAP_METHOD(Gst::ClockTime suggest_next_sync() const, gst_object_suggest_next_sync)
+ _WRAP_METHOD(bool sync_values(Gst::ClockTime timestamp), gst_object_sync_values)
_WRAP_METHOD(void set_control_bindings_disabled(bool disabled), gst_object_set_control_bindings_disabled)
_WRAP_METHOD(bool has_asctive_control_bindings() const, gst_object_has_active_control_bindings)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]