Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gstreamer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luzpaz
gstreamer
Commits
10f3adfd
Commit
10f3adfd
authored
Jul 09, 2012
by
Wim Taymans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clock: make abstract
Make the GstClock type abstract. Fix a horrible hack in the clock unit test.
parent
af73f3fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
14 deletions
+45
-14
gst/gstclock.c
gst/gstclock.c
+1
-1
tests/check/gst/gstclock.c
tests/check/gst/gstclock.c
+44
-13
No files found.
gst/gstclock.c
View file @
10f3adfd
...
...
@@ -643,7 +643,7 @@ gst_clock_id_unschedule (GstClockID id)
* GstClock abstract base class implementation
*/
#define gst_clock_parent_class parent_class
G_DEFINE_TYPE
(
GstClock
,
gst_clock
,
GST_TYPE_OBJECT
);
G_DEFINE_
ABSTRACT_
TYPE
(
GstClock
,
gst_clock
,
GST_TYPE_OBJECT
);
static
void
gst_clock_class_init
(
GstClockClass
*
klass
)
...
...
tests/check/gst/gstclock.c
View file @
10f3adfd
...
...
@@ -19,11 +19,27 @@
#include <gst/check/gstcheck.h>
static
void
weak_notify
(
gpointer
data
,
GObject
*
object
)
typedef
struct
{
*
(
gboolean
*
)
data
=
FALSE
;
}
GstClock
parent
;
}
GstTestClock
;
typedef
struct
{
GstClockClass
parent_class
;
}
GstTestClockClass
;
#define GST_TYPE_TEST_CLOCK (gst_test_clock_get_type ())
#define GST_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TEST_CLOCK, GstTestClock))
#define GST_TEST_CLOCK_CAST(obj) ((GstTestClock *)(obj))
#define GST_IS_TEST_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TEST_CLOCK))
#define GST_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TEST_CLOCK, GstTestClockClass))
#define GST_IS_TEST_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TEST_CLOCK))
#define GST_TEST_CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TEST_CLOCK, GstTestClockClass))
GType
gst_test_clock_get_type
(
void
);
G_DEFINE_TYPE
(
GstTestClock
,
gst_test_clock
,
GST_TYPE_CLOCK
);
static
GstClockReturn
fake_wait_async
(
GstClock
*
clock
,
GstClockEntry
*
entry
)
...
...
@@ -31,21 +47,38 @@ fake_wait_async (GstClock * clock, GstClockEntry * entry)
return
GST_CLOCK_OK
;
}
static
void
gst_test_clock_class_init
(
GstTestClockClass
*
klass
)
{
GstClockClass
*
clock_class
;
clock_class
=
GST_CLOCK_CLASS
(
klass
);
clock_class
->
wait_async
=
fake_wait_async
;
}
static
void
gst_test_clock_init
(
GstTestClock
*
clock
)
{
}
static
void
weak_notify
(
gpointer
data
,
GObject
*
object
)
{
*
(
gboolean
*
)
data
=
FALSE
;
}
GST_START_TEST
(
test_set_master_refcount
)
{
GstClock
*
master
,
*
slave
;
GstClockClass
*
klass
;
gboolean
master_alive
=
TRUE
;
/* create master and slave */
master
=
g_object_new
(
GST_TYPE_CLOCK
,
"name"
,
"TestClockMaster"
,
NULL
);
slave
=
g_object_new
(
GST_TYPE_CLOCK
,
"name"
,
"TestClockMaster"
,
NULL
);
master
=
g_object_new
(
GST_TYPE_
TEST_
CLOCK
,
"name"
,
"TestClockMaster"
,
NULL
);
slave
=
g_object_new
(
GST_TYPE_
TEST_
CLOCK
,
"name"
,
"TestClockMaster"
,
NULL
);
GST_OBJECT_FLAG_SET
(
slave
,
GST_CLOCK_FLAG_CAN_SET_MASTER
);
/* look ma! i'm doing monkey patching in C */
klass
=
GST_CLOCK_GET_CLASS
(
master
);
klass
->
wait_async
=
fake_wait_async
;
fail_unless_equals_int
(
GST_OBJECT_REFCOUNT
(
master
),
1
);
fail_unless_equals_int
(
GST_OBJECT_REFCOUNT
(
slave
),
1
);
...
...
@@ -72,8 +105,6 @@ GST_START_TEST (test_set_master_refcount)
fail_unless_equals_int
(
GST_OBJECT_REFCOUNT
(
slave
),
1
);
gst_object_unref
(
slave
);
klass
->
wait_async
=
NULL
;
}
GST_END_TEST
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment