summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline_cdda.c
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2008-07-06 09:52:21 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2008-07-06 09:52:21 +0000
commitec19c6f7007ba54ecfe922514104ab217d0eae81 (patch)
tree7cf4ed71237a6cd069db8683fdb84e6b58c1a538 /legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline_cdda.c
parent10bac60aa1e04aa3c6ed0db040241c51e0a41651 (diff)
formatting
SVN revision: 35011
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline_cdda.c125
1 files changed, 64 insertions, 61 deletions
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline_cdda.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline_cdda.c
index c9ab41e2d6..5083f29ff9 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline_cdda.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline_cdda.c
@@ -5,121 +5,124 @@
5#include "emotion_gstreamer_pipeline.h" 5#include "emotion_gstreamer_pipeline.h"
6 6
7 7
8static Emotion_Audio_Sink *_emotion_audio_sink_new (Emotion_Gstreamer_Video *ev); 8static Emotion_Audio_Sink *_emotion_audio_sink_new (Emotion_Gstreamer_Video *ev);
9 9static void _emotion_audio_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink);
10static void _emotion_audio_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink);
11 10
12int 11int
13emotion_pipeline_cdda_build (void *video, const char * device, unsigned int track) 12emotion_pipeline_cdda_build(void *video, const char * device, unsigned int track)
14{ 13{
15 GstElement *cdiocddasrc; 14 GstElement *cdiocddasrc;
16 Emotion_Video_Sink *vsink; 15 Emotion_Video_Sink *vsink;
17 Emotion_Audio_Sink *asink; 16 Emotion_Audio_Sink *asink;
18 Emotion_Gstreamer_Video *ev; 17 Emotion_Gstreamer_Video *ev;
19/* GstFormat format; */ 18 /* GstFormat format; */
20/* gint64 tracks_count; */ 19 /* gint64 tracks_count; */
21 20
22 ev = (Emotion_Gstreamer_Video *)video; 21 ev = (Emotion_Gstreamer_Video *)video;
23 if (!ev) return 0; 22 if (!ev) return 0;
24 23
25 cdiocddasrc = gst_element_factory_make ("cdiocddasrc", "src"); 24 cdiocddasrc = gst_element_factory_make("cdiocddasrc", "src");
26 if (!cdiocddasrc) { 25 if (!cdiocddasrc)
27 g_print ("cdiocddasrc element missing. Install it.\n"); 26 {
28 goto failure_cdiocddasrc; 27 g_print("cdiocddasrc element missing. Install it.\n");
29 } 28 goto failure_cdiocddasrc;
29 }
30 30
31 if (device) 31 if (device)
32 g_object_set (G_OBJECT (cdiocddasrc), "device", device, NULL); 32 g_object_set(G_OBJECT(cdiocddasrc), "device", device, NULL);
33 33
34 g_object_set (G_OBJECT (cdiocddasrc), "track", track, NULL); 34 g_object_set(G_OBJECT(cdiocddasrc), "track", track, NULL);
35 35
36 asink = _emotion_audio_sink_new (ev); 36 asink = _emotion_audio_sink_new(ev);
37 if (!asink) 37 if (!asink)
38 goto failure_emotion_sink; 38 goto failure_emotion_sink;
39 39
40 asink->sink = emotion_audio_sink_create (ev, 1); 40 asink->sink = emotion_audio_sink_create(ev, 1);
41 if (!asink->sink) 41 if (!asink->sink)
42 goto failure_gstreamer_sink; 42 goto failure_gstreamer_sink;
43 43
44 gst_bin_add_many((GST_BIN (ev->pipeline)), cdiocddasrc, asink->sink, NULL); 44 gst_bin_add_many((GST_BIN(ev->pipeline)), cdiocddasrc, asink->sink, NULL);
45 45
46 if (!gst_element_link (cdiocddasrc, asink->sink)) 46 if (!gst_element_link(cdiocddasrc, asink->sink))
47 goto failure_link; 47 goto failure_link;
48 48
49 vsink = emotion_visualization_sink_create (ev, asink); 49 vsink = emotion_visualization_sink_create(ev, asink);
50 if (!vsink) goto failure_link; 50 if (!vsink) goto failure_link;
51 51
52 if (!emotion_pipeline_pause (ev->pipeline)) 52 if (!emotion_pipeline_pause(ev->pipeline))
53 goto failure_gstreamer_pause; 53 goto failure_gstreamer_pause;
54 54
55 { 55 {
56 GstQuery *query; 56 GstQuery *query;
57 GstPad *pad; 57 GstPad *pad;
58 GstCaps *caps; 58 GstCaps *caps;
59 GstStructure *structure; 59 GstStructure *structure;
60 60
61 /* should always be found */ 61 /* should always be found */
62 pad = gst_element_get_pad (cdiocddasrc, "src"); 62 pad = gst_element_get_pad(cdiocddasrc, "src");
63 63
64 caps = gst_pad_get_caps (pad); 64 caps = gst_pad_get_caps(pad);
65 structure = gst_caps_get_structure (GST_CAPS (caps), 0); 65 structure = gst_caps_get_structure(GST_CAPS(caps), 0);
66 66
67 gst_structure_get_int (structure, "channels", &asink->channels); 67 gst_structure_get_int(structure, "channels", &asink->channels);
68 gst_structure_get_int (structure, "rate", &asink->samplerate); 68 gst_structure_get_int(structure, "rate", &asink->samplerate);
69 69
70 gst_caps_unref (caps); 70 gst_caps_unref(caps);
71 71
72 query = gst_query_new_duration (GST_FORMAT_TIME); 72 query = gst_query_new_duration(GST_FORMAT_TIME);
73 if (gst_pad_query (pad, query)) { 73 if (gst_pad_query(pad, query))
74 gint64 time; 74 {
75 gint64 time;
75 76
76 gst_query_parse_duration (query, NULL, &time); 77 gst_query_parse_duration(query, NULL, &time);
77 asink->length_time = (double)time / (double)GST_SECOND; 78 asink->length_time = (double)time / (double)GST_SECOND;
78 vsink->length_time = asink->length_time; 79 vsink->length_time = asink->length_time;
79 } 80 }
80 gst_query_unref (query); 81 gst_query_unref(query);
81 gst_object_unref (GST_OBJECT (pad)); 82 gst_object_unref(GST_OBJECT(pad));
82 } 83 }
83 84
84 return 1; 85 return 1;
85 86
86 failure_gstreamer_pause: 87failure_gstreamer_pause:
87 emotion_video_sink_free (ev, vsink); 88 emotion_video_sink_free(ev, vsink);
88 failure_link: 89failure_link:
89 gst_bin_remove (GST_BIN (ev->pipeline), asink->sink); 90 gst_bin_remove(GST_BIN(ev->pipeline), asink->sink);
90 failure_gstreamer_sink: 91failure_gstreamer_sink:
91 _emotion_audio_sink_free (ev, asink); 92 _emotion_audio_sink_free(ev, asink);
92 failure_emotion_sink: 93failure_emotion_sink:
93 gst_bin_remove (GST_BIN (ev->pipeline), cdiocddasrc); 94 gst_bin_remove(GST_BIN(ev->pipeline), cdiocddasrc);
94 failure_cdiocddasrc: 95failure_cdiocddasrc:
95 96
96 return 0; 97 return 0;
97} 98}
98 99
99static Emotion_Audio_Sink * 100static Emotion_Audio_Sink *
100_emotion_audio_sink_new (Emotion_Gstreamer_Video *ev) 101_emotion_audio_sink_new(Emotion_Gstreamer_Video *ev)
101{ 102{
102 Emotion_Audio_Sink *asink; 103 Emotion_Audio_Sink *asink;
103 104
104 if (!ev) return NULL; 105 if (!ev) return NULL;
105 106
106 asink = (Emotion_Audio_Sink *)malloc (sizeof (Emotion_Audio_Sink)); 107 asink = (Emotion_Audio_Sink *)malloc(sizeof(Emotion_Audio_Sink));
107 if (!asink) return NULL; 108 if (!asink) return NULL;
108 109
109 if (!ecore_list_append (ev->audio_sinks, asink)) { 110 if (!ecore_list_append(ev->audio_sinks, asink))
110 free (asink); 111 {
111 return NULL; 112 free(asink);
112 } 113 return NULL;
114 }
113 return asink; 115 return asink;
114} 116}
115 117
116static void 118static void
117_emotion_audio_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink) 119_emotion_audio_sink_free(Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink)
118{ 120{
119 if (!ev || !asink) return; 121 if (!ev || !asink) return;
120 122
121 if (ecore_list_goto (ev->audio_sinks, asink)) { 123 if (ecore_list_goto(ev->audio_sinks, asink))
122 ecore_list_remove (ev->audio_sinks); 124 {
123 free (asink); 125 ecore_list_remove(ev->audio_sinks);
124 } 126 free(asink);
127 }
125} 128}