gstreamer 1.2.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. data/Rakefile +78 -39
  2. data/ext/gstreamer/extconf.rb +8 -22
  3. data/ext/gstreamer/rbgst.c +82 -194
  4. data/lib/gst/base_loader.rb +20 -0
  5. data/lib/gst/bin.rb +32 -0
  6. data/lib/gst/bus.rb +24 -0
  7. data/lib/gst/element.rb +48 -0
  8. data/lib/gst.rb +87 -22
  9. data/sample/helloworld.rb +75 -0
  10. data/sample/mp3parselaunch.rb +74 -0
  11. data/sample/queue.rb +92 -0
  12. data/sample/typefind.rb +101 -0
  13. metadata +29 -84
  14. data/README +0 -33
  15. data/ext/gstreamer/misc.c +0 -63
  16. data/ext/gstreamer/rbgst-bin.c +0 -456
  17. data/ext/gstreamer/rbgst-buffer.c +0 -363
  18. data/ext/gstreamer/rbgst-bus.c +0 -92
  19. data/ext/gstreamer/rbgst-caps.c +0 -446
  20. data/ext/gstreamer/rbgst-child-proxy.c +0 -34
  21. data/ext/gstreamer/rbgst-clock.c +0 -108
  22. data/ext/gstreamer/rbgst-element-factory.c +0 -249
  23. data/ext/gstreamer/rbgst-element.c +0 -1106
  24. data/ext/gstreamer/rbgst-event.c +0 -352
  25. data/ext/gstreamer/rbgst-ghost-pad.c +0 -45
  26. data/ext/gstreamer/rbgst-index-factory.c +0 -69
  27. data/ext/gstreamer/rbgst-install-plugins-context.c +0 -87
  28. data/ext/gstreamer/rbgst-install-plugins-return.c +0 -45
  29. data/ext/gstreamer/rbgst-install-plugins.c +0 -125
  30. data/ext/gstreamer/rbgst-message.c +0 -785
  31. data/ext/gstreamer/rbgst-mini-object.c +0 -221
  32. data/ext/gstreamer/rbgst-object.c +0 -81
  33. data/ext/gstreamer/rbgst-pad-template.c +0 -125
  34. data/ext/gstreamer/rbgst-pad.c +0 -336
  35. data/ext/gstreamer/rbgst-pipeline.c +0 -91
  36. data/ext/gstreamer/rbgst-plugin-feature.c +0 -131
  37. data/ext/gstreamer/rbgst-plugin.c +0 -162
  38. data/ext/gstreamer/rbgst-private.c +0 -88
  39. data/ext/gstreamer/rbgst-private.h +0 -97
  40. data/ext/gstreamer/rbgst-query.c +0 -291
  41. data/ext/gstreamer/rbgst-seek.c +0 -39
  42. data/ext/gstreamer/rbgst-static-caps.c +0 -49
  43. data/ext/gstreamer/rbgst-static-pad-template.c +0 -65
  44. data/ext/gstreamer/rbgst-structure.c +0 -300
  45. data/ext/gstreamer/rbgst-system-clock.c +0 -48
  46. data/ext/gstreamer/rbgst-type-find-factory.c +0 -125
  47. data/ext/gstreamer/rbgst-value.c +0 -527
  48. data/ext/gstreamer/rbgst-x-overlay.c +0 -131
  49. data/ext/gstreamer/rbgst.h +0 -197
  50. data/ext/gstreamer/rbgstclockentry.c +0 -271
  51. data/ext/gstreamer/rbgstformat.c +0 -162
  52. data/ext/gstreamer/rbgstindex.c +0 -315
  53. data/ext/gstreamer/rbgstindexentry.c +0 -99
  54. data/ext/gstreamer/rbgstparse.c +0 -69
  55. data/ext/gstreamer/rbgstquerytype.c +0 -162
  56. data/ext/gstreamer/rbgstregistry.c +0 -288
  57. data/ext/gstreamer/rbgsttag.c +0 -113
  58. data/ext/gstreamer/rbgsttagsetter.c +0 -53
  59. data/ext/gstreamer/rbgstxml.c +0 -192
  60. data/sample/audio-player.rb +0 -54
  61. data/sample/gst-gi.rb +0 -55
  62. data/sample/gst-inspect.rb +0 -417
  63. data/sample/install-plugins.rb +0 -40
  64. data/sample/media-type.rb +0 -55
  65. data/sample/media-type2.rb +0 -268
  66. data/sample/ogg-audio-player.rb +0 -54
  67. data/sample/type-find.rb +0 -46
  68. data/sample/video-player.rb +0 -57
  69. data/sample/xml-player.rb +0 -60
  70. data/test/gst-test-utils.rb +0 -18
  71. data/test/run-test.rb +0 -25
  72. data/test/test_bin.rb +0 -167
  73. data/test/test_buffer.rb +0 -185
  74. data/test/test_caps.rb +0 -24
  75. data/test/test_element.rb +0 -85
  76. data/test/test_element_factory.rb +0 -28
  77. data/test/test_event.rb +0 -10
  78. data/test/test_index_factory.rb +0 -7
  79. data/test/test_install-plugins.rb +0 -18
  80. data/test/test_message.rb +0 -191
  81. data/test/test_mini_object.rb +0 -38
  82. data/test/test_object.rb +0 -10
  83. data/test/test_pad.rb +0 -68
  84. data/test/test_plugin.rb +0 -6
  85. data/test/test_plugin_feature.rb +0 -20
  86. data/test/test_seek.rb +0 -17
  87. data/test/test_static_caps.rb +0 -18
  88. data/test/test_static_pad_template.rb +0 -16
  89. data/test/test_structure.rb +0 -159
  90. data/test/test_thread_handling.rb +0 -58
  91. data/test/test_type_find_factory.rb +0 -8
  92. data/test/test_value.rb +0 -69
@@ -1,197 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2004 Ruby-GNOME2 Project
5
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
6
- *
7
- * This library is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU Lesser General Public
9
- * License as published by the Free Software Foundation; either
10
- * version 2.1 of the License, or (at your option) any later version.
11
- *
12
- * This library is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * Lesser General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Lesser General Public
18
- * License along with this library; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
- * MA 02110-1301 USA
21
- */
22
-
23
- #ifndef __RBGST_H_
24
- #define __RBGST_H_
25
-
26
- #include <ruby.h>
27
- #include <gst/gst.h>
28
- #include <gst/gsttypefind.h>
29
-
30
- #include <rbglib.h>
31
- #include <rbgobject.h>
32
-
33
- /* Gst module */
34
- extern VALUE mGst;
35
-
36
- extern VALUE rb_cGstMiniObject;
37
-
38
- #define RBGST_INITIALIZE(obj,gstobj) \
39
- (rbgst_initialize_gstobject(obj, GST_OBJECT(gstobj)))
40
-
41
- #define GST_EVENT_MASK(o) ((GstEventMask *) o)
42
- #define GST_FORMAT2(o) ((GstFormat *) o)
43
- #define GST_INDEX_ENTRY(o) ((GstIndexEntry *) o)
44
- #define GST_QUERY_TYPE2(o) ((GstQueryType *) o)
45
- #define GST_TYPE(o) ((GstType *) o)
46
-
47
- #define GST_TYPE_CLOCK_ENTRY (gst_clock_entry_get_type())
48
- #define GST_TYPE_EVENT_MASK (gst_event_mask_get_type())
49
- #define GST_TYPE_FORMAT2 (gst_format_get_type2())
50
- #define GST_TYPE_QUERY_TYPE2 (gst_query_type_get_type2())
51
- #define GST_TYPE_TYPE (gst_type_get_type())
52
-
53
- #define RVAL2GST_OBJ(obj) (GST_OBJECT(RVAL2GOBJ(obj)))
54
- #define GST_OBJ2RVAL(obj) (GOBJ2RVAL(obj))
55
- #define RVAL2GST_MINI_OBJ(obj) (GST_MINI_OBJECT(RVAL2GOBJ(obj)))
56
- #define RVAL2GST_BUF(obj) (GST_BUFFER(RVAL2GOBJ(obj)))
57
- #define RVAL2GST_MSG(obj) (GST_MESSAGE(RVAL2GOBJ(obj)))
58
- #define RVAL2GST_ELEMENT(obj) (GST_ELEMENT(RVAL2GOBJ(obj)))
59
- #define RVAL2GST_EVENT(obj) (GST_EVENT(RVAL2GOBJ(obj)))
60
- #define GST_ELEMENT2RVAL(obj) (GOBJ2RVAL(obj))
61
- #define RVAL2GST_ELEMENT_FACTORY(obj) \
62
- (GST_ELEMENT_FACTORY(RVAL2GOBJ(obj)))
63
- #define RVAL2GST_INDEX_FACTORY(obj) \
64
- (GST_INDEX_FACTORY(RVAL2GOBJ(obj)))
65
- #define RVAL2GST_TYPE_FIND_FACTORY(obj) \
66
- (GST_TYPE_FIND_FACTORY(RVAL2GOBJ(obj)))
67
- #define RVAL2GST_PLUGIN_FEATURE(obj) \
68
- (GST_PLUGIN_FEATURE(RVAL2GOBJ(obj)))
69
- #define RVAL2GST_PLUGIN(obj) (GST_PLUGIN(RVAL2GOBJ(obj)))
70
-
71
- #define RVAL2GST_CAPS(obj) (GST_CAPS(RVAL2BOXED(obj, GST_TYPE_CAPS)))
72
- #define GST_CAPS2RVAL(obj) (BOXED2RVAL(obj, GST_TYPE_CAPS))
73
- #define GST_CAPS2RVAL_UNREF(obj) \
74
- (rbgst_ruby_object_from_gst_caps_with_unref((obj)))
75
- #define RVAL2GST_STATIC_CAPS(obj) ((GstStaticCaps *)RVAL2GPTR(obj))
76
- #define GST_STATIC_CAPS2RVAL(obj) (GPTR2RVAL(obj, GST_TYPE_STATIC_CAPS))
77
-
78
- #define RVAL2GST_STATE(obj) (RVAL2GENUM(obj, GST_TYPE_STATE))
79
- #define GST_STATE2RVAL(obj) (GENUM2RVAL(obj, GST_TYPE_STATE))
80
- #define RVAL2GST_FORMAT(obj) (RVAL2GENUM(obj, GST_TYPE_FORMAT))
81
- #define GST_FORMAT2RVAL(obj) (GENUM2RVAL(obj, GST_TYPE_FORMAT))
82
-
83
- #define RVAL2GST_STRUCT(obj) (GST_STRUCTURE(RVAL2BOXED(obj, GST_TYPE_STRUCTURE)))
84
- #define GST_STRUCT2RVAL(obj) (BOXED2RVAL(obj, GST_TYPE_STRUCTURE))
85
-
86
- #define RVAL2GST_PAD(obj) (GST_PAD(RVAL2GOBJ(obj)))
87
- #define GST_PAD2RVAL(obj) (GOBJ2RVAL(obj))
88
- #define GST_PAD2RVAL_UNREF(obj) (GOBJ2RVAL_UNREF(obj))
89
-
90
- #define RVAL2GST_PAD_TEMPLATE(obj) (GST_PAD_TEMPLATE(RVAL2GOBJ(obj)))
91
- #define GST_PAD_TEMPLATE2RVAL(obj) (GOBJ2RVAL(obj))
92
- #define RVAL2GST_STATIC_PAD_TEMPLATE(obj) ((GstStaticPadTemplate *)(RVAL2GPTR(obj)))
93
- #define GST_STATIC_PAD_TEMPLATE2RVAL(obj) (GPTR2RVAL(obj, GST_TYPE_STATIC_PAD_TEMPLATE))
94
-
95
- #define RVAL2GST_BUS(obj) (GST_BUS(RVAL2GOBJ(obj)))
96
- #define GST_BUS2RVAL(obj) (GOBJ2RVAL(obj))
97
- #define GST_BUS2RVAL_UNREF(obj) (GOBJ2RVAL_UNREF(obj))
98
- #define RVAL2GST_PIPELINE(obj) (GST_PIPELINE(RVAL2GOBJ(obj)))
99
- #define RVAL2GST_CLOCK(obj) (GST_CLOCK(RVAL2GOBJ(obj)))
100
- #define GST_CLOCK2RVAL(obj) (GOBJ2RVAL(obj))
101
-
102
- #define RVAL2GST_BIN(obj) (GST_BIN(RVAL2GOBJ(obj)))
103
- #define GST_BIN2RVAL(obj) (GOBJ2RVAL(obj))
104
-
105
- #define RVAL2GST_QUERY(obj) (GST_QUERY(RVAL2GOBJ(obj)))
106
- #define GST_QUERY2RVAL(obj) (GOBJ2RVAL(obj))
107
-
108
-
109
-
110
- #define RGST_BIN(o) (GST_BIN(RVAL2GOBJ(o)))
111
- #define RGST_CAPS(o) (GST_CAPS(RVAL2BOXED(o, GST_TYPE_CAPS)))
112
- #define RGST_CLOCK_ENTRY(o) (GST_CLOCK_ENTRY(RVAL2BOXED(o, GST_TYPE_CLOCK_ENTRY)))
113
- #define RGST_ELEMENT(o) (GST_ELEMENT(RVAL2GOBJ(o)))
114
- #define RGST_ELEMENT_FACTORY(o) (GST_ELEMENT_FACTORY(RVAL2GOBJ(o)))
115
- #define RGST_EVENT(o) (GST_EVENT(RVAL2BOXED(o, GST_TYPE_EVENT)))
116
- #define RGST_EVENT_MASK(o) (GST_EVENT_MASK(RVAL2BOXED(o, GST_TYPE_EVENT_MASK)))
117
- #define RGST_FORMAT(o) (GST_FORMAT2(RVAL2BOXED(o, GST_TYPE_FORMAT2)))
118
- #define RGST_INDEX(o) (GST_INDEX(RVAL2GOBJ(o)))
119
- #define RGST_INDEX_ENTRY(o) (GST_INDEX_ENTRY(RVAL2BOXED(o, GST_TYPE_INDEX_ENTRY)))
120
- #define RGST_INDEX_FACTORY(o) (GST_INDEX_FACTORY(RVAL2GOBJ(o)))
121
- #define RGST_OBJECT(o) (GST_OBJECT(RVAL2GOBJ(o)))
122
- #define RGST_PAD(o) (GST_PAD(RVAL2GOBJ(o)))
123
- #define RGST_PAD_TEMPLATE(o) (GST_PAD_TEMPLATE(RVAL2GOBJ(o)))
124
- #define RGST_PIPELINE(o) (RVAL2GST_PIPELINE(o))
125
- #define RGST_PLUGIN(o) (GST_PLUGIN(RVAL2GOBJ(o)))
126
- #define RGST_PLUGIN_FEATURE(o) (GST_PLUGIN_FEATURE(RVAL2GOBJ(o)))
127
- #define RGST_QUERY_TYPE(o) (GST_QUERY_TYPE2(RVAL2BOXED(o, GST_TYPE_QUERY_TYPE2)))
128
- #define RGST_REGISTRY(o) (GST_REGISTRY(RVAL2GOBJ(o)))
129
- #define RGST_SCHEDULER(o) (GST_SCHEDULER(RVAL2GOBJ(o)))
130
- #define RGST_SCHEDULER_FACTORY(o) (GST_SCHEDULER_FACTORY(RVAL2GOBJ(o)))
131
- #define RGST_TAG_SETTER(o) (GST_TAG_SETTER(RVAL2GOBJ(o)))
132
- #define RGST_THREAD(o) (GST_THREAD(RVAL2GOBJ(o)))
133
- #define RGST_TYPE_FIND_FACTORY(o) (GST_TYPE_FIND_FACTORY(RVAL2GOBJ(o)))
134
- #define RGST_XML(o) (GST_XML(RVAL2GOBJ(o)))
135
-
136
- #define RGST_GOBJ_NEW(o) (rbgst_new_gstobject(o))
137
- #define GOBJ2RGST(obj) (RGST_GOBJ_NEW(obj))
138
-
139
- #define GST_MINI_OBJ2RVAL(obj) (rbgst_mini_object_to_ruby_object(obj))
140
-
141
- #define RGST_BIN_NEW(o) (RGST_GOBJ_NEW(GST_BIN(o)))
142
- #define RGST_CAPS_NEW(o) (BOXED2RVAL(GST_CAPS(o), GST_TYPE_CAPS))
143
- #define RGST_CLOCK_NEW(o) (RGST_GOBJ_NEW(GST_CLOCK(o)))
144
- #define RGST_CLOCK_ENTRY_NEW(o) (BOXED2RVAL(GST_CLOCK_ENTRY(o), GST_TYPE_CLOCK_ENTRY))
145
- #define RGST_ELEMENT_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_ELEMENT_FACTORY(o)))
146
- #define RGST_ELEMENT_NEW(o) (RGST_GOBJ_NEW(GST_ELEMENT(o)))
147
- #define RGST_EVENT_NEW(o) (BOXED2RVAL(GST_EVENT(o), GST_TYPE_EVENT))
148
- #define RGST_EVENT_MASK_NEW(o) (BOXED2RVAL(GST_EVENT_MASK(o), GST_TYPE_EVENT_MASK))
149
- #define RGST_FORMAT_NEW(o) (BOXED2RVAL(GST_FORMAT2(o), GST_TYPE_FORMAT2))
150
- #define RGST_INDEX_NEW(o) (RGST_GOBJ_NEW(GST_INDEX(o)))
151
- #define RGST_INDEX_ENTRY_NEW(o) (BOXED2RVAL(GST_INDEX_ENTRY(o), GST_TYPE_INDEX_ENTRY))
152
- #define RGST_INDEX_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_INDEX_FACTORY(o)))
153
- #define RGST_OBJECT_NEW(o) (RGST_GOBJ_NEW(GST_OBJECT(o)))
154
- #define RGST_PAD_NEW(o) (RGST_GOBJ_NEW(GST_PAD(o)))
155
- #define RGST_PAD_TEMPLATE_NEW(o) (RGST_GOBJ_NEW(GST_PAD_TEMPLATE(o)))
156
- #define RGST_PIPELINE_NEW(o) (RGST_GOBJ_NEW(GST_PIPELINE(o)))
157
- #define RGST_PLUGIN_NEW(o) (RGST_GOBJ_NEW(GST_PLUGIN(o)))
158
- #define RGST_PLUGIN_FEATURE_NEW(o) (RGST_GOBJ_NEW(GST_PLUGIN_FEATURE(o)))
159
- #define RGST_QUERY_TYPE_NEW(o) (BOXED2RVAL(GST_QUERY_TYPE2(o), GST_TYPE_QUERY_TYPE2))
160
- #define RGST_REGISTRY_NEW(o) (RGST_GOBJ_NEW(GST_REGISTRY(o)))
161
- #define RGST_SCHEDULER_NEW(o) (RGST_GOBJ_NEW(GST_SCHEDULER(o)))
162
- #define RGST_SCHEDULER_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_SCHEDULER_FACTORY(o)))
163
- #define RGST_SYSTEM_CLOCK_NEW(o) (RGST_GOBJ_NEW(GST_SYSTEM_CLOCK(o)))
164
- #define RGST_THREAD_NEW(o) (RGST_GOBJ_NEW(GST_THREAD(o)))
165
- #define RGST_TYPE_FIND_FACTORY_NEW(o) (RGST_GOBJ_NEW(GST_TYPE_FIND_FACTORY(o)))
166
-
167
- #define RGST_BUS2RVAL(obj) (GOBJ2RGST(obj))
168
- #define GST_MSG2RVAL(obj) (GOBJ2RGST(obj))
169
-
170
- extern VALUE rbgst_ruby_object_from_gst_caps_with_unref(GstCaps *caps);
171
-
172
- GType gst_clock_entry_get_type ();
173
- GType gst_event_mask_get_type ();
174
- GType gst_format_get_type2 ();
175
- GType gst_query_type_get_type2 ();
176
- GType gst_type_get_type ();
177
-
178
-
179
- /* misc.c interface */
180
- void rbgst_initialize_gstobject (VALUE obj, GstObject * gstobj);
181
- VALUE rbgst_new_gstobject (void *);
182
- VALUE rb_str_new_with_format (char *fmt, ...);
183
- VALUE rb_ary_yield (VALUE arr);
184
-
185
- /* implemented in rbgstpluginfeature.c */
186
- gboolean is_valid_pluginfeature_type (const GType type);
187
- VALUE instanciate_pluginfeature (GstPluginFeature * feature);
188
-
189
- /* implemented in rbgst-structure.c */
190
- VALUE rbgst_structure_to_hash(GstStructure *structure);
191
- GstStructure *rbgst_hash_to_structure(VALUE hash);
192
- GstStructure *rbgst_hash_to_structure_with_name(VALUE hash, const char *name);
193
-
194
-
195
- #define GST_TAG_LIST_STRUCTURE_NAME "taglist"
196
-
197
- #endif /* __RBGST_H_ */
@@ -1,271 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgst-private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cClockEntry
25
-
26
- /* Class: Gst::ClockEntry
27
- * A wrapper for GstClockID, used to create and start timers
28
- * on Gst::Clock objects.
29
- */
30
-
31
- static GstClockEntry *
32
- clock_entry_copy (const GstClockEntry * clock_entry)
33
- {
34
- GstClockEntry *new_clock_entry;
35
-
36
- g_return_val_if_fail (clock_entry != NULL, NULL);
37
- new_clock_entry = g_new (GstClockEntry, sizeof (GstClockEntry));
38
- *new_clock_entry = *clock_entry;
39
- return new_clock_entry;
40
- }
41
-
42
- GType
43
- gst_clock_entry_get_type (void)
44
- {
45
- static GType our_type = 0;
46
-
47
- if (our_type == 0) {
48
- our_type = g_boxed_type_register_static ("GstClockID",
49
- (GBoxedCopyFunc)
50
- clock_entry_copy,
51
- (GBoxedFreeFunc) g_free);
52
- }
53
- return our_type;
54
- }
55
-
56
- /*
57
- * Class method: new(clock, time, interval=nil)
58
- * clock: a Gst::Clock.
59
- * time: a time period, in nanoseconds.
60
- * interval: an interval period, in nanoseconds.
61
- *
62
- * Creates a new Gst::ClockEntry object based on the given Gst::Clock.
63
- *
64
- * Two types of Gst::ClockEntry objects can be created:
65
- *
66
- * * One-shot: if the interval is ommited or nil, the entry will trigger a single shot notification, at the requested time (in nanoseconds);
67
- * * Periodic: if the interval is not nil, the timer entry will trigger a periodic notification, starting at time (in nanoseconds), and be fired with the given interval (also in nanoseconds).
68
- *
69
- * The timer will be issued after Gst::ClockEntry#wait or
70
- * Gst::ClockEntry#wait_async.
71
- *
72
- * Returns: a new Gst::ClockEntry object.
73
- */
74
- static VALUE
75
- rg_initialize (int argc, VALUE * argv, VALUE self)
76
- {
77
- VALUE clock, time, interval;
78
- GstClockID id;
79
-
80
- rb_scan_args (argc, argv, "21", &clock, &time, &interval);
81
-
82
- /*
83
- * Single-shot
84
- */
85
- if (NIL_P (interval))
86
- id = gst_clock_new_single_shot_id (RVAL2GST_CLOCK (clock), NUM2ULL (time));
87
- /*
88
- * Periodic
89
- */
90
- else
91
- id = gst_clock_new_periodic_id (RVAL2GST_CLOCK (clock),
92
- NUM2ULL (time), NUM2ULL (interval));
93
-
94
- G_INITIALIZE (self, GST_CLOCK_ENTRY (id));
95
- return Qnil;
96
- }
97
-
98
- /* Method: single_shot?
99
- * Returns: true if the entry is single-shot, false otherwise.
100
- */
101
- static VALUE
102
- rg_single_shot_p (VALUE self)
103
- {
104
- return CBOOL2RVAL (GST_CLOCK_ENTRY_TYPE (RGST_CLOCK_ENTRY (self)) ==
105
- GST_CLOCK_ENTRY_SINGLE);
106
- }
107
-
108
- /* Method: periodic?
109
- * Returns: true if the entry is periodic, false otherwise.
110
- */
111
- static VALUE
112
- rg_periodic_p (VALUE self)
113
- {
114
- return CBOOL2RVAL (GST_CLOCK_ENTRY_TYPE (RGST_CLOCK_ENTRY (self)) ==
115
- GST_CLOCK_ENTRY_PERIODIC);
116
- }
117
-
118
- /*
119
- * Method: unschedule
120
- *
121
- * Cancels an outstanding async notification request.
122
- *
123
- * Returns: self.
124
- */
125
- static VALUE
126
- rg_unschedule (VALUE self)
127
- {
128
- gst_clock_id_unschedule (RGST_CLOCK_ENTRY (self));
129
- return self;
130
- }
131
-
132
- /*
133
- * Method: wait
134
- *
135
- * Performs a blocking wait on the entry.
136
- *
137
- * Returns: a return code (see Gst::Clock::Return).
138
- */
139
- static VALUE
140
- rg_wait (VALUE self)
141
- {
142
- return GENUM2RVAL (gst_clock_id_wait (RGST_CLOCK_ENTRY (self), NULL),
143
- GST_TYPE_CLOCK_RETURN);
144
- }
145
-
146
- struct __callback {
147
- GstClockID id;
148
- VALUE callback;
149
- };
150
-
151
- static GSList *__callbacks = NULL;
152
-
153
- static struct __callback *
154
- __callback_get (GstClockID id)
155
- {
156
- GSList *i;
157
-
158
- for (i = __callbacks; i != NULL; i = g_slist_next (i)) {
159
- struct __callback *e = (struct __callback *)i->data;
160
-
161
- if (e->id == id)
162
- return e;
163
- }
164
- return NULL;
165
- }
166
-
167
- static gboolean
168
- __callback_dispatcher (GstClock * clock, GstClockTime time, GstClockID id,
169
- gpointer user_data)
170
- {
171
- struct __callback *e = __callback_get (id);
172
-
173
- g_assert (e != NULL);
174
- return RVAL2CBOOL (rb_funcall (e->callback,
175
- rb_intern ("call"),
176
- 3,
177
- RGST_CLOCK_NEW (clock),
178
- ULL2NUM (time), RGST_CLOCK_ENTRY_NEW (id)));
179
- }
180
-
181
- /*
182
- * Method: wait_async { |clock, time, clock_entry| ... }
183
- *
184
- * Registers a block code, which will be called passing references
185
- * to the Gst::Clock, the time (in nanoseconds) and the Gst::ClockEntry as
186
- * parameters.
187
- *
188
- * Returns: a return code (see Gst::Clock::Return).
189
- */
190
- static VALUE
191
- rg_wait_async (VALUE self)
192
- {
193
- GstClockID id = (GstClockID) RGST_CLOCK_ENTRY (self);
194
-
195
- if (__callback_get (id) != NULL)
196
- rb_raise (rb_eRuntimeError,
197
- "An asynch callback is already registred to this entry.");
198
- else {
199
- struct __callback *e = g_malloc (sizeof (struct __callback));
200
-
201
- g_assert (e != NULL);
202
- e->id = id;
203
- e->callback = rb_block_proc ();
204
- __callbacks = g_slist_append (__callbacks, e);
205
- return GENUM2RVAL (INT2FIX (gst_clock_id_wait_async (id,
206
- __callback_dispatcher,
207
- NULL)),
208
- GST_TYPE_CLOCK_RETURN);
209
- }
210
- return Qnil;
211
- }
212
-
213
- /* Method: time
214
- * Returns: the requested time of the entry, in nanoseconds.
215
- */
216
- static VALUE
217
- rg_time (VALUE self)
218
- {
219
- return ULL2NUM (GST_CLOCK_ENTRY_TIME (RGST_CLOCK_ENTRY (self)));
220
- }
221
-
222
- /* Method: interval
223
- * Returns: the interval of the entry (in nanoseconds), or 0
224
- * if the entry is not periodic.
225
- */
226
- static VALUE
227
- rg_interval (VALUE self)
228
- {
229
- return ULL2NUM (GST_CLOCK_ENTRY_INTERVAL (RGST_CLOCK_ENTRY (self)));
230
- }
231
-
232
- /* Method: clock
233
- * Returns: the owner clock of the entry, as a Gst::Clock object.
234
- */
235
- static VALUE
236
- rg_clock (VALUE self)
237
- {
238
- return RGST_CLOCK_NEW (GST_CLOCK_ENTRY_CLOCK (RGST_CLOCK_ENTRY (self)));
239
- }
240
-
241
- /* Method: status
242
- * Returns: the status of the entry (see Gst::ClockEntry::Return).
243
- */
244
- static VALUE
245
- rg_status (VALUE self)
246
- {
247
- return GENUM2RVAL(GST_CLOCK_ENTRY_STATUS(RGST_CLOCK_ENTRY (self)),
248
- GST_TYPE_CLOCK_RETURN);
249
- }
250
-
251
- void
252
- Init_gst_clock_entry (VALUE mGst)
253
- {
254
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GST_TYPE_CLOCK_ENTRY, "ClockEntry", mGst);
255
-
256
- RG_DEF_METHOD(initialize, -1);
257
- RG_DEF_METHOD_P(single_shot, 0);
258
- RG_DEF_METHOD_P(periodic, 0);
259
- RG_DEF_METHOD(wait, 0);
260
- RG_DEF_METHOD(wait_async, 0);
261
- RG_DEF_METHOD(unschedule, 0);
262
- RG_DEF_METHOD(clock, 0);
263
- RG_DEF_METHOD(time, 0);
264
- RG_DEF_METHOD(interval, 0);
265
- RG_DEF_METHOD(status, 0);
266
-
267
- G_DEF_CLASS (GST_TYPE_CLOCK_ENTRY_TYPE, "Type", RG_TARGET_NAMESPACE);
268
- G_DEF_CONSTANTS (RG_TARGET_NAMESPACE, GST_TYPE_CLOCK_ENTRY_TYPE, "GST_CLOCK_ENTRY_");
269
- G_DEF_CLASS (GST_TYPE_CLOCK_RETURN, "Return", RG_TARGET_NAMESPACE);
270
- G_DEF_CONSTANTS (RG_TARGET_NAMESPACE, GST_TYPE_CLOCK_RETURN, "GST_CLOCK_");
271
- }
@@ -1,162 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2003, 2004 Laurent Sansonetti <lrz@gnome.org>
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgst-private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cFormat
25
-
26
- /* Class: Gst::Format
27
- * Dynamically register new formats.
28
- */
29
-
30
- static GstFormat *
31
- format_copy (const GstFormat* format)
32
- {
33
- GstFormat *new_format;
34
- g_return_val_if_fail (format != NULL, NULL);
35
- new_format = g_new (GstFormat, sizeof (GstFormat));
36
- *new_format = *format;
37
- return new_format;
38
- }
39
-
40
- GType
41
- gst_format_get_type2 (void)
42
- {
43
- static GType our_type = 0;
44
- if (our_type == 0)
45
- our_type = g_boxed_type_register_static ("GstFormatClass",
46
- (GBoxedCopyFunc)format_copy,
47
- (GBoxedFreeFunc)g_free);
48
- return our_type;
49
- }
50
-
51
- /*
52
- * Class method: find(nick)
53
- * nick: the nick of an existing format.
54
- *
55
- * Returns: a reference to the Gst::Format object registered with the
56
- * given nick, or nil if this query was not registered.
57
- */
58
- static VALUE
59
- rg_s_find (G_GNUC_UNUSED VALUE self, VALUE nick)
60
- {
61
- GstFormat format = gst_format_get_by_nick (RVAL2CSTR (nick));
62
- return format != GST_FORMAT_UNDEFINED
63
- ? RGST_FORMAT_NEW (&format)
64
- : Qnil;
65
- }
66
-
67
- /*
68
- * Class method: each { |format| ... }
69
- *
70
- * Calls the block for each registered format, passing a reference
71
- * to the Gst::Format object as parameter.
72
- *
73
- * Returns: always nil.
74
- */
75
- static VALUE
76
- rg_s_each (G_GNUC_UNUSED VALUE self)
77
- {
78
- GstIterator *iter;
79
- gpointer value;
80
-
81
- iter = gst_format_iterate_definitions();
82
- while (gst_iterator_next(iter, &value) == GST_ITERATOR_OK) {
83
- GstFormatDefinition *def = (GstFormatDefinition *)value;
84
- rb_yield(RGST_FORMAT_NEW(&(def->value)));
85
- }
86
- gst_iterator_free(iter);
87
- return Qnil;
88
- }
89
-
90
- /* Method: type_id
91
- * Returns: the type id of this format (see Gst::Format::Type).
92
- */
93
- static VALUE
94
- rg_type_id (VALUE self)
95
- {
96
- GstFormat *format = RGST_FORMAT (self);
97
- return GENUM2RVAL (*format, GST_TYPE_FORMAT);
98
- }
99
-
100
- /* Method: nick
101
- * Returns: the short nick of the format.
102
- */
103
- static VALUE
104
- rg_nick (VALUE self)
105
- {
106
- GstFormat *format = RGST_FORMAT (self);
107
- return CSTR2RVAL (gst_format_get_details (*format)->nick);
108
- }
109
-
110
- /* Method: description
111
- * Returns: a longer description of the format.
112
- */
113
- static VALUE
114
- rg_description (VALUE self)
115
- {
116
- GstFormat *format = RGST_FORMAT (self);
117
- return CSTR2RVAL (gst_format_get_details (*format)->description);
118
- }
119
-
120
- /*
121
- * Method: ==(format)
122
- * format: a Gst::Format.
123
- *
124
- * Checks if two Gst::Format objects are registered under the
125
- * same nick.
126
- *
127
- * Returns: true on success, false on failure.
128
- */
129
- static VALUE
130
- rg_operator_is_equal (VALUE self, VALUE other_format)
131
- {
132
- GstFormat *f1, *f2;
133
- const gchar *n1, *n2;
134
-
135
- if (NIL_P (other_format))
136
- return Qfalse;
137
-
138
- f1 = RGST_FORMAT (self);
139
- f2 = RGST_FORMAT (other_format);
140
-
141
- n1 = gst_format_get_details (*f1)->nick;
142
- n2 = gst_format_get_details (*f2)->nick;
143
-
144
- return CBOOL2RVAL (strcmp (n1, n2) == 0);
145
- }
146
-
147
- void
148
- Init_gst_format (VALUE mGst)
149
- {
150
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GST_TYPE_FORMAT2, "Format", mGst);
151
-
152
- RG_DEF_SMETHOD(each, 0);
153
- RG_DEF_SMETHOD(find, 1);
154
-
155
- RG_DEF_METHOD(type_id, 0);
156
- RG_DEF_METHOD(nick, 0);
157
- RG_DEF_METHOD(description, 0);
158
- RG_DEF_METHOD_OPERATOR("==", is_equal, 1);
159
-
160
- G_DEF_CLASS (GST_TYPE_FORMAT, "Type", RG_TARGET_NAMESPACE);
161
- G_DEF_CONSTANTS (RG_TARGET_NAMESPACE, GST_TYPE_FORMAT, "GST_FORMAT_");
162
- }