1 /* GStreamer Editing Services
2  * Copyright (C) 2010 Brandon Lewis <brandon.lewis@collabora.co.uk>
3  *               2010 Nokia Corporation
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 /**
22  * SECTION:ges-enums
23  * @title: GES Enumerations
24  * @short_description: Various enums for the Gstreamer Editing Services
25  */
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29 
30 #include "ges-enums.h"
31 #include "ges-internal.h"
32 #include "ges-asset.h"
33 #include "ges-meta-container.h"
34 #include "ges-transition-clip.h"
35 
36 #define C_ENUM(v) ((guint) v)
37 
38 static const GFlagsValue track_types_values[] = {
39   {C_ENUM (GES_TRACK_TYPE_UNKNOWN), "GES_TRACK_TYPE_UNKNOWN", "unknown"},
40   {C_ENUM (GES_TRACK_TYPE_AUDIO), "GES_TRACK_TYPE_AUDIO", "audio"},
41   {C_ENUM (GES_TRACK_TYPE_VIDEO), "GES_TRACK_TYPE_VIDEO", "video"},
42   {C_ENUM (GES_TRACK_TYPE_TEXT), "GES_TRACK_TYPE_TEXT", "text"},
43   {C_ENUM (GES_TRACK_TYPE_CUSTOM), "GES_TRACK_TYPE_CUSTOM", "custom"},
44   {0, NULL, NULL}
45 };
46 
47 static void
register_ges_track_type_select_result(GType * id)48 register_ges_track_type_select_result (GType * id)
49 {
50   *id = g_flags_register_static ("GESTrackType", track_types_values);
51 }
52 
53 const gchar *
ges_track_type_name(GESTrackType type)54 ges_track_type_name (GESTrackType type)
55 {
56   guint i;
57 
58   for (i = 0; i < G_N_ELEMENTS (track_types_values); i++) {
59     if (type == track_types_values[i].value)
60       return track_types_values[i].value_nick;
61   }
62 
63   return "Unknown (mixed?) ";
64 }
65 
66 GType
ges_track_type_get_type(void)67 ges_track_type_get_type (void)
68 {
69   static GType id;
70   static GOnce once = G_ONCE_INIT;
71 
72   g_once (&once, (GThreadFunc) register_ges_track_type_select_result, &id);
73   return id;
74 }
75 
76 static void
register_ges_pipeline_flags(GType * id)77 register_ges_pipeline_flags (GType * id)
78 {
79   static const GFlagsValue values[] = {
80     {C_ENUM (GES_PIPELINE_MODE_PREVIEW_AUDIO),
81           "GES_PIPELINE_MODE_PREVIEW_AUDIO",
82         "audio_preview"},
83     {C_ENUM (GES_PIPELINE_MODE_PREVIEW_VIDEO),
84           "GES_PIPELINE_MODE_PREVIEW_VIDEO",
85         "video_preview"},
86     {C_ENUM (GES_PIPELINE_MODE_PREVIEW), "GES_PIPELINE_MODE_PREVIEW",
87         "full_preview"},
88     {C_ENUM (GES_PIPELINE_MODE_RENDER), "GES_PIPELINE_MODE_RENDER", "render"},
89     {C_ENUM (GES_PIPELINE_MODE_SMART_RENDER), "GES_PIPELINE_MODE_SMART_RENDER",
90         "smart_render"},
91     {0, NULL, NULL}
92   };
93 
94   *id = g_flags_register_static ("GESPipelineFlags", values);
95 }
96 
97 GType
ges_pipeline_flags_get_type(void)98 ges_pipeline_flags_get_type (void)
99 {
100   static GType id;
101   static GOnce once = G_ONCE_INIT;
102 
103   g_once (&once, (GThreadFunc) register_ges_pipeline_flags, &id);
104   return id;
105 }
106 
107 static void
register_ges_edit_mode(GType * id)108 register_ges_edit_mode (GType * id)
109 {
110   static const GEnumValue edit_mode[] = {
111     {C_ENUM (GES_EDIT_MODE_NORMAL), "GES_EDIT_MODE_NORMAL",
112         "edit_normal"},
113 
114     {C_ENUM (GES_EDIT_MODE_RIPPLE), "GES_EDIT_MODE_RIPPLE",
115         "edit_ripple"},
116 
117     {C_ENUM (GES_EDIT_MODE_ROLL), "GES_EDIT_MODE_ROLL",
118         "edit_roll"},
119 
120     {C_ENUM (GES_EDIT_MODE_TRIM), "GES_EDIT_MODE_TRIM",
121         "edit_trim"},
122 
123     {C_ENUM (GES_EDIT_MODE_SLIDE), "GES_EDIT_MODE_SLIDE",
124         "edit_slide"},
125 
126     {0, NULL, NULL}
127   };
128 
129   *id = g_enum_register_static ("GESEditMode", edit_mode);
130 }
131 
132 GType
ges_edit_mode_get_type(void)133 ges_edit_mode_get_type (void)
134 {
135   static GType id;
136   static GOnce once = G_ONCE_INIT;
137 
138   g_once (&once, (GThreadFunc) register_ges_edit_mode, &id);
139   return id;
140 }
141 
142 static void
register_ges_edge(GType * id)143 register_ges_edge (GType * id)
144 {
145   static const GEnumValue edges[] = {
146     {C_ENUM (GES_EDGE_START), "GES_EDGE_START", "edge_start"},
147     {C_ENUM (GES_EDGE_END), "GES_EDGE_END", "edge_end"},
148     {C_ENUM (GES_EDGE_NONE), "GES_EDGE_NONE", "edge_none"},
149     {0, NULL, NULL}
150   };
151 
152   *id = g_enum_register_static ("GESEdge", edges);
153 }
154 
155 const gchar *
ges_edge_name(GESEdge edge)156 ges_edge_name (GESEdge edge)
157 {
158   switch (edge) {
159     case GES_EDGE_START:
160       return "start";
161     case GES_EDGE_END:
162       return "end";
163     default:
164       return "none";
165   }
166 }
167 
168 GType
ges_edge_get_type(void)169 ges_edge_get_type (void)
170 {
171   static GType id;
172   static GOnce once = G_ONCE_INIT;
173 
174   g_once (&once, (GThreadFunc) register_ges_edge, &id);
175   return id;
176 }
177 
178 static GEnumValue transition_types[] = {
179   {GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE,
180         "GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE",
181       "none"},
182   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_LR,
183         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_LR",
184       "bar-wipe-lr"},
185   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_TB,
186         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_TB",
187       "bar-wipe-tb"},
188   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TL,
189         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TL",
190       "box-wipe-tl"},
191   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TR,
192         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TR",
193       "box-wipe-tr"},
194   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BR,
195         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BR",
196       "box-wipe-br"},
197   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BL,
198         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BL",
199       "box-wipe-bl"},
200   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FOUR_BOX_WIPE_CI,
201         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FOUR_BOX_WIPE_CI",
202       "four-box-wipe-ci"},
203   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FOUR_BOX_WIPE_CO,
204         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FOUR_BOX_WIPE_CO",
205       "four-box-wipe-co"},
206   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_V,
207         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_V",
208       "barndoor-v"},
209   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_H,
210         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_H",
211       "barndoor-h"},
212   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TC,
213         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TC",
214       "box-wipe-tc"},
215   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_RC,
216         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_RC",
217       "box-wipe-rc"},
218   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BC,
219         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BC",
220       "box-wipe-bc"},
221   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_LC,
222         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_LC",
223       "box-wipe-lc"},
224   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DIAGONAL_TL,
225         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DIAGONAL_TL",
226       "diagonal-tl"},
227   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DIAGONAL_TR,
228         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DIAGONAL_TR",
229       "diagonal-tr"},
230   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOWTIE_V,
231         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOWTIE_V",
232       "bowtie-v"},
233   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BOWTIE_H,
234         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BOWTIE_H",
235       "bowtie-h"},
236   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_DBL,
237         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_DBL",
238       "barndoor-dbl"},
239   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_DTL,
240         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_DTL",
241       "barndoor-dtl"},
242   {GES_VIDEO_STANDARD_TRANSITION_TYPE_MISC_DIAGONAL_DBD,
243         "GES_VIDEO_STANDARD_TRANSITION_TYPE_MISC_DIAGONAL_DBD",
244       "misc-diagonal-dbd"},
245   {GES_VIDEO_STANDARD_TRANSITION_TYPE_MISC_DIAGONAL_DD,
246         "GES_VIDEO_STANDARD_TRANSITION_TYPE_MISC_DIAGONAL_DD",
247       "misc-diagonal-dd"},
248   {GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_D,
249         "GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_D",
250       "vee-d"},
251   {GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_L,
252         "GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_L",
253       "vee-l"},
254   {GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_U,
255         "GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_U",
256       "vee-u"},
257   {GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_R,
258         "GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_R",
259       "vee-r"},
260   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_D,
261         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_D",
262       "barnvee-d"},
263   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_L,
264         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_L",
265       "barnvee-l"},
266   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_U,
267         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_U",
268       "barnvee-u"},
269   {GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_R,
270         "GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_R",
271       "barnvee-r"},
272   {GES_VIDEO_STANDARD_TRANSITION_TYPE_IRIS_RECT,
273         "GES_VIDEO_STANDARD_TRANSITION_TYPE_IRIS_RECT",
274       "iris-rect"},
275   {GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW12,
276         "GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW12",
277       "clock-cw12"},
278   {GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW3,
279         "GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW3",
280       "clock-cw3"},
281   {GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW6,
282         "GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW6",
283       "clock-cw6"},
284   {GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW9,
285         "GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW9",
286       "clock-cw9"},
287   {GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_TBV,
288         "GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_TBV",
289       "pinwheel-tbv"},
290   {GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_TBH,
291         "GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_TBH",
292       "pinwheel-tbh"},
293   {GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_FB,
294         "GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_FB",
295       "pinwheel-fb"},
296   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_CT,
297         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_CT",
298       "fan-ct"},
299   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_CR,
300         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_CR",
301       "fan-cr"},
302   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FOV,
303         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FOV",
304       "doublefan-fov"},
305   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FOH,
306         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FOH",
307       "doublefan-foh"},
308   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWT,
309         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWT",
310       "singlesweep-cwt"},
311   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWR,
312         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWR",
313       "singlesweep-cwr"},
314   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWB,
315         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWB",
316       "singlesweep-cwb"},
317   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWL,
318         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWL",
319       "singlesweep-cwl"},
320   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PV,
321         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PV",
322       "doublesweep-pv"},
323   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PD,
324         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PD",
325       "doublesweep-pd"},
326   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_OV,
327         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_OV",
328       "doublesweep-ov"},
329   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_OH,
330         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_OH",
331       "doublesweep-oh"},
332   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_T,
333         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_T",
334       "fan-t"},
335   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_R,
336         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_R",
337       "fan-r"},
338   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_B,
339         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_B",
340       "fan-b"},
341   {GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_L,
342         "GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_L",
343       "fan-l"},
344   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FIV,
345         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FIV",
346       "doublefan-fiv"},
347   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FIH,
348         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FIH",
349       "doublefan-fih"},
350   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWTL,
351         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWTL",
352       "singlesweep-cwtl"},
353   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWBL,
354         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWBL",
355       "singlesweep-cwbl"},
356   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWBR,
357         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWBR",
358       "singlesweep-cwbr"},
359   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWTR,
360         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWTR",
361       "singlesweep-cwtr"},
362   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PDTL,
363         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PDTL",
364       "doublesweep-pdtl"},
365   {GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PDBL,
366         "GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PDBL",
367       "doublesweep-pdbl"},
368   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_T,
369         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_T",
370       "saloondoor-t"},
371   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_L,
372         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_L",
373       "saloondoor-l"},
374   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_B,
375         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_B",
376       "saloondoor-b"},
377   {GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_R,
378         "GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_R",
379       "saloondoor-r"},
380   {GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_R,
381         "GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_R",
382       "windshield-r"},
383   {GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_U,
384         "GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_U",
385       "windshield-u"},
386   {GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_V,
387         "GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_V",
388       "windshield-v"},
389   {GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_H,
390         "GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_H",
391       "windshield-h"},
392   {GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE,
393         "GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE",
394       "crossfade"},
395   {0, NULL, NULL}
396 };
397 
398 void
_init_standard_transition_assets(void)399 _init_standard_transition_assets (void)
400 {
401   guint i;
402 
403   for (i = 1; i < G_N_ELEMENTS (transition_types) - 1; i++) {
404     GESAsset *asset = ges_asset_request (GES_TYPE_TRANSITION_CLIP,
405         transition_types[i].value_nick, NULL);
406 
407     ges_meta_container_register_meta_string (GES_META_CONTAINER (asset),
408         GES_META_READABLE, GES_META_DESCRIPTION,
409         transition_types[i].value_name);
410 
411     gst_object_unref (asset);
412   }
413 
414 }
415 
416 GType
ges_video_standard_transition_type_get_type(void)417 ges_video_standard_transition_type_get_type (void)
418 {
419   static GType the_type = 0;
420   static gsize once = 0;
421 
422   if (g_once_init_enter (&once)) {
423     g_assert (!once);
424 
425     the_type = g_enum_register_static ("GESVideoStandardTransitionType",
426         transition_types);
427     g_once_init_leave (&once, 1);
428   }
429 
430   return the_type;
431 }
432 
433 GType
ges_text_valign_get_type(void)434 ges_text_valign_get_type (void)
435 {
436   static GType text_overlay_valign_type = 0;
437   static gsize initialized = 0;
438   static const GEnumValue text_overlay_valign[] = {
439     {GES_TEXT_VALIGN_BASELINE, "GES_TEXT_VALIGN_BASELINE", "baseline"},
440     {GES_TEXT_VALIGN_BOTTOM, "GES_TEXT_VALIGN_BOTTOM", "bottom"},
441     {GES_TEXT_VALIGN_TOP, "GES_TEXT_VALIGN_TOP", "top"},
442     {GES_TEXT_VALIGN_POSITION, "GES_TEXT_VALIGN_POSITION", "position"},
443     {GES_TEXT_VALIGN_CENTER, "GES_TEXT_VALIGN_CENTER", "center"},
444     {GES_TEXT_VALIGN_ABSOLUTE, "GES_TEXT_VALIGN_ABSOLUTE", "absolute"},
445     {0, NULL, NULL},
446   };
447 
448   if (g_once_init_enter (&initialized)) {
449     text_overlay_valign_type =
450         g_enum_register_static ("GESTextVAlign", text_overlay_valign);
451     g_once_init_leave (&initialized, 1);
452   }
453   return text_overlay_valign_type;
454 }
455 
456 GType
ges_text_halign_get_type(void)457 ges_text_halign_get_type (void)
458 {
459   static GType text_overlay_halign_type = 0;
460   static gsize initialized = 0;
461   static const GEnumValue text_overlay_halign[] = {
462     {GES_TEXT_HALIGN_LEFT, "GES_TEXT_HALIGN_LEFT", "left"},
463     {GES_TEXT_HALIGN_CENTER, "GES_TEXT_HALIGN_CENTER", "center"},
464     {GES_TEXT_HALIGN_RIGHT, "GES_TEXT_HALIGN_RIGHT", "right"},
465     {GES_TEXT_HALIGN_POSITION, "GES_TEXT_HALIGN_POSITION", "position"},
466     {GES_TEXT_HALIGN_ABSOLUTE, "GES_TEXT_HALIGN_ABSOLUTE", "absolute"},
467     {0, NULL, NULL},
468   };
469 
470   if (g_once_init_enter (&initialized)) {
471     text_overlay_halign_type =
472         g_enum_register_static ("GESTextHAlign", text_overlay_halign);
473     g_once_init_leave (&initialized, 1);
474   }
475   return text_overlay_halign_type;
476 }
477 
478 /* table more-or-less copied from gstvideotestsrc.c */
479 static GEnumValue vpattern_enum_values[] = {
480   {GES_VIDEO_TEST_PATTERN_SMPTE, "GES_VIDEO_TEST_PATTERN_SMPTE", "smpte"}
481   ,
482   {GES_VIDEO_TEST_PATTERN_SNOW, "GES_VIDEO_TEST_PATTERN_SNOW", "snow"}
483   ,
484   {GES_VIDEO_TEST_PATTERN_BLACK, "GES_VIDEO_TEST_PATTERN_BLACK", "black"}
485   ,
486   {GES_VIDEO_TEST_PATTERN_WHITE, "GES_VIDEO_TEST_PATTERN_WHITE", "white"}
487   ,
488   {GES_VIDEO_TEST_PATTERN_RED, "GES_VIDEO_TEST_PATTERN_RED", "red"}
489   ,
490   {GES_VIDEO_TEST_PATTERN_GREEN, "GES_VIDEO_TEST_PATTERN_GREEN", "green"}
491   ,
492   {GES_VIDEO_TEST_PATTERN_BLUE, "GES_VIDEO_TEST_PATTERN_BLUE", "blue"}
493   ,
494   {GES_VIDEO_TEST_PATTERN_CHECKERS1,
495       "GES_VIDEO_TEST_PATTERN_CHECKERS1", "checkers-1"}
496   ,
497   {GES_VIDEO_TEST_PATTERN_CHECKERS2,
498       "GES_VIDEO_TEST_PATTERN_CHECKERS2", "checkers-2"}
499   ,
500   {GES_VIDEO_TEST_PATTERN_CHECKERS4,
501       "GES_VIDEO_TEST_PATTERN_CHECKERS4", "checkers-4"}
502   ,
503   {GES_VIDEO_TEST_PATTERN_CHECKERS8,
504       "GES_VIDEO_TEST_PATTERN_CHECKERS8", "checkers-8"}
505   ,
506   {GES_VIDEO_TEST_PATTERN_CIRCULAR,
507       "GES_VIDEO_TEST_PATTERN_CIRCULAR", "circular"}
508   ,
509   {GES_VIDEO_TEST_PATTERN_BLINK, "GES_VIDEO_TEST_PATTERN_BLINK", "blink"}
510   ,
511   {GES_VIDEO_TEST_PATTERN_SMPTE75, "GES_VIDEO_TEST_PATTERN_SMPTE75", "smpte75"}
512   ,
513   {GES_VIDEO_TEST_ZONE_PLATE, "GES_VIDEO_TEST_ZONE_PLATE", "zone-plate"}
514   ,
515   {GES_VIDEO_TEST_GAMUT, "GES_VIDEO_TEST_GAMUT", "gamut"}
516   ,
517   {GES_VIDEO_TEST_CHROMA_ZONE_PLATE, "GES_VIDEO_TEST_CHROMA_ZONE_PLATE",
518       "chroma-zone-plate"}
519   ,
520   {GES_VIDEO_TEST_PATTERN_SOLID, "GES_VIDEO_TEST_PATTERN_SOLID", "solid-color"}
521   ,
522   {0, NULL, NULL}
523 };
524 
525 GType
ges_video_test_pattern_get_type(void)526 ges_video_test_pattern_get_type (void)
527 {
528 
529   static gsize once = 0;
530   static GType theType = 0;
531 
532   if (g_once_init_enter (&once)) {
533     theType = g_enum_register_static ("GESVideoTestPattern",
534         vpattern_enum_values);
535     g_once_init_leave (&once, 1);
536   };
537 
538   return theType;
539 }
540 
541 static void
register_ges_meta_flag(GType * id)542 register_ges_meta_flag (GType * id)
543 {
544   static const GFlagsValue values[] = {
545     {C_ENUM (GES_META_READABLE), "GES_META_READABLE", "readable"},
546     {C_ENUM (GES_META_WRITABLE), "GES_META_WRITABLE", "writable"},
547     {C_ENUM (GES_META_READ_WRITE), "GES_META_READ_WRITE", "readwrite"},
548     {0, NULL, NULL}
549   };
550 
551   *id = g_flags_register_static ("GESMetaFlag", values);
552 }
553 
554 GType
ges_meta_flag_get_type(void)555 ges_meta_flag_get_type (void)
556 {
557   static GType id;
558   static GOnce once = G_ONCE_INIT;
559 
560   g_once (&once, (GThreadFunc) register_ges_meta_flag, &id);
561   return id;
562 }
563