Merge lp:~tintou/noise/noise-gst1.0 into lp:~elementary-apps/noise/trunk
- noise-gst1.0
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Corentin Noël |
Approved revision: | 1543 |
Merged at revision: | 1546 |
Proposed branch: | lp:~tintou/noise/noise-gst1.0 |
Merge into: | lp:~elementary-apps/noise/trunk |
Diff against target: |
705 lines (+116/-115) 12 files modified
CMakeLists.txt (+6/-8) core/GStreamer/Equalizer.vala (+2/-2) core/GStreamer/Pipeline.vala (+10/-6) plugins/Devices/CDRom/CDPlayer.vala (+6/-6) plugins/Devices/CDRom/CDRipper.vala (+4/-4) plugins/Devices/CDRom/CDRomDevice.vala (+1/-1) plugins/Devices/CDRom/CMakeLists.txt (+0/-15) plugins/Devices/iPod/iPodStreamer.vala (+6/-6) src/Dialogs/InstallGstreamerPluginsDialog.vala (+5/-5) src/GStreamer/CoverImport.vala (+41/-28) src/GStreamer/GStreamerTagger.vala (+29/-28) src/GStreamer/Streamer.vala (+6/-6) |
To merge this branch: | bzr merge lp:~tintou/noise/noise-gst1.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Victor Martinez (community) | Approve | ||
Rico Tzschichholz | Approve | ||
Corentin Noël | Needs Resubmitting | ||
Review via email: mp+193349@code.launchpad.net |
Commit message
Ported to GStreamer 1.0
Description of the change
Noise is now ported to GStreamer 1.0, the default vala vapis are giving warning about Gst being experimental, but it is a bug as the stable version 1.2 is out.
Victor Martinez (victored) wrote : | # |
Now that Noise using Gst 1.0, it can have a more efficient version of get_pixbuf_
Victor Martinez (victored) wrote : | # |
edit: get_pixbuf_
Victor Martinez (victored) wrote : | # |
In diff lines 752-762 is may be better to add some type checking code, like:
foreach (var stream_info in info.get_
if (stream_info != null && stream_info is Gst.PbUtils.
var audio_stream_info = stream_info as Gst.PbUtils.
if (this.sample_rate == 0)
if (this.bitrate == 0)
}
}
I'm not sure if this can be safely shortened to: (Check with Rico on this)
foreach (var stream_info in info.get_
var audio_stream_info = stream_info as Gst.PbUtils.
if (audio_stream_info != null) {
if (this.sample_rate == 0)
if (this.bitrate == 0)
}
}
I could not spot any API usage errors. Looks good.
I'll be using the branch for a couple of days to see how it goes.
- 1542. By Victor Martinez
-
Changed the way we get the pixbuf
Corentin Noël (tintou) wrote : | # |
Okay, I've fixed averything according to your comments
- 1543. By Corentin Noël
-
Fixed typo and type cast
Victor Martinez (victored) wrote : | # |
Can you change diff line 422 to the following?
unowned Gst.Structure structure = loop_sample.
The call to "copy" seems unnecessary.
- 1544. By Corentin Noël
-
minor fix
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2013-09-29 18:49:57 +0000 |
3 | +++ CMakeLists.txt 2013-11-22 15:48:54 +0000 |
4 | @@ -61,10 +61,9 @@ |
5 | libpeas-gtk-1.0 |
6 | gtk+-3.0 |
7 | granite |
8 | - gstreamer-0.10 |
9 | - gstreamer-interfaces-0.10 |
10 | - gstreamer-pbutils-0.10 |
11 | - gstreamer-tag-0.10 |
12 | + gstreamer-1.0 |
13 | + gstreamer-pbutils-1.0 |
14 | + gstreamer-tag-1.0 |
15 | ) |
16 | |
17 | set (CORE_PKG |
18 | @@ -75,10 +74,9 @@ |
19 | libpeas-gtk-1.0 |
20 | gtk+-3.0>=3.4.2 |
21 | granite |
22 | - gstreamer-0.10 |
23 | - gstreamer-interfaces-0.10 |
24 | - gstreamer-tag-0.10 |
25 | - gstreamer-pbutils-0.10 |
26 | + gstreamer-1.0 |
27 | + gstreamer-tag-1.0 |
28 | + gstreamer-pbutils-1.0 |
29 | ) |
30 | |
31 | set (DEPS_PACKAGES |
32 | |
33 | === modified file 'core/GStreamer/Equalizer.vala' |
34 | --- core/GStreamer/Equalizer.vala 2013-02-26 21:56:08 +0000 |
35 | +++ core/GStreamer/Equalizer.vala 2013-11-22 15:48:54 +0000 |
36 | @@ -45,7 +45,7 @@ |
37 | |
38 | float last_freq = 0; |
39 | for (int index = 0; index < 10; index++) { |
40 | - Gst.Object band = ((Gst.ChildProxy)element).get_child_by_index(index); |
41 | + GLib.Object? band = ((Gst.ChildProxy)element).get_child_by_index (index); |
42 | |
43 | float freq = freqs[index]; |
44 | float bandwidth = freq - last_freq; |
45 | @@ -58,7 +58,7 @@ |
46 | } |
47 | |
48 | public void setGain(int index, double gain) { |
49 | - Gst.Object band = ((Gst.ChildProxy)element).get_child_by_index(index); |
50 | + GLib.Object? band = ((Gst.ChildProxy)element).get_child_by_index (index); |
51 | |
52 | if (gain < 0) |
53 | gain *= 0.24f; |
54 | |
55 | === modified file 'core/GStreamer/Pipeline.vala' |
56 | --- core/GStreamer/Pipeline.vala 2013-07-26 20:44:29 +0000 |
57 | +++ core/GStreamer/Pipeline.vala 2013-11-22 15:48:54 +0000 |
58 | @@ -48,7 +48,7 @@ |
59 | public Pipeline() { |
60 | |
61 | pipe = new Gst.Pipeline("pipeline"); |
62 | - playbin = Gst.ElementFactory.make("playbin2", "play"); |
63 | + playbin = Gst.ElementFactory.make ("playbin", "play"); |
64 | |
65 | audiosink = Gst.ElementFactory.make("autoaudiosink", "audio-sink"); |
66 | |
67 | @@ -68,7 +68,7 @@ |
68 | |
69 | ((Gst.Bin)audiobin).add_many(audiotee, audiosinkqueue, audiosink); |
70 | |
71 | - audiobin.add_pad(new Gst.GhostPad("sink", audiotee.get_pad("sink"))); |
72 | + audiobin.add_pad (new Gst.GhostPad ("sink", audiotee.get_static_pad ("sink"))); |
73 | |
74 | if (eq.element != null) |
75 | audiosinkqueue.link_many(eq_audioconvert, preamp, eq.element, eq_audioconvert2, audiosink); |
76 | @@ -79,22 +79,26 @@ |
77 | bus = playbin.get_bus(); |
78 | |
79 | // Link the first tee pad to the primary audio sink queue |
80 | - Gst.Pad sinkpad = audiosinkqueue.get_pad("sink"); |
81 | - pad = audiotee.get_request_pad("src%d"); |
82 | + Gst.Pad sinkpad = audiosinkqueue.get_static_pad ("sink"); |
83 | + pad = audiotee.get_request_pad ("src_%u"); |
84 | audiotee.set("alloc-pad", pad); |
85 | pad.link(sinkpad); |
86 | } |
87 | |
88 | public void enableEqualizer() { |
89 | if (eq.element != null) { |
90 | - audiosinkqueue.unlink_many(audiosink); // link the queue with the real audio sink |
91 | + audiosinkqueue.unlink (audiosink); // link the queue with the real audio sink |
92 | audiosinkqueue.link_many(eq_audioconvert, preamp, eq.element, eq_audioconvert2, audiosink); |
93 | } |
94 | } |
95 | |
96 | public void disableEqualizer() { |
97 | if (eq.element != null) { |
98 | - audiosinkqueue.unlink_many(eq_audioconvert, preamp, eq.element, eq_audioconvert2, audiosink); |
99 | + audiosinkqueue.unlink (eq_audioconvert); |
100 | + audiosinkqueue.unlink (preamp); |
101 | + audiosinkqueue.unlink (eq.element); |
102 | + audiosinkqueue.unlink (eq_audioconvert2); |
103 | + audiosinkqueue.unlink (audiosink); |
104 | audiosinkqueue.link_many(audiosink); // link the queue with the real audio sink |
105 | } |
106 | } |
107 | |
108 | === modified file 'plugins/Devices/CDRom/CDPlayer.vala' |
109 | --- plugins/Devices/CDRom/CDPlayer.vala 2013-10-11 11:58:03 +0000 |
110 | +++ plugins/Devices/CDRom/CDPlayer.vala 2013-11-22 15:48:54 +0000 |
111 | @@ -46,7 +46,7 @@ |
112 | pipe.playbin.set ("uri", "cdda://1"); |
113 | |
114 | pipe.bus.add_signal_watch (); |
115 | - pipe.bus.add_watch (bus_callback); |
116 | + pipe.bus.add_watch (GLib.Priority.DEFAULT, bus_callback); |
117 | |
118 | Timeout.add (200, update_position); |
119 | return true; |
120 | @@ -116,7 +116,7 @@ |
121 | int64 rv = (int64)0; |
122 | Gst.Format f = Gst.Format.TIME; |
123 | |
124 | - pipe.playbin.query_position (ref f, out rv); |
125 | + pipe.playbin.query_position (f, out rv); |
126 | |
127 | return rv; |
128 | } |
129 | @@ -125,7 +125,7 @@ |
130 | int64 rv = (int64)0; |
131 | Gst.Format f = Gst.Format.TIME; |
132 | |
133 | - pipe.playbin.query_duration(ref f, out rv); |
134 | + pipe.playbin.query_duration (f, out rv); |
135 | |
136 | return rv; |
137 | } |
138 | @@ -166,7 +166,7 @@ |
139 | error_occured(); |
140 | break; |
141 | case Gst.MessageType.ELEMENT: |
142 | - if(message.get_structure() != null && Gst.is_missing_plugin_message(message) && (dialog == null || !dialog.visible)) { |
143 | + if (message.get_structure () != null && Gst.PbUtils.is_missing_plugin_message (message) && (dialog == null || !dialog.visible)) { |
144 | dialog = new InstallGstreamerPluginsDialog (message); |
145 | } |
146 | break; |
147 | @@ -190,9 +190,9 @@ |
148 | |
149 | message.parse_tag (out tag_list); |
150 | if (tag_list != null) { |
151 | - if (tag_list.get_tag_size(Gst.TAG_TITLE) > 0) { |
152 | + if (tag_list.get_tag_size (Gst.Tags.TITLE) > 0) { |
153 | string title = ""; |
154 | - tag_list.get_string(Gst.TAG_TITLE, out title); |
155 | + tag_list.get_string (Gst.Tags.TITLE, out title); |
156 | |
157 | if (App.player.media_info.media.mediatype == 3 && title != "") { // is radio |
158 | string[] pieces = title.split("-", 0); |
159 | |
160 | === modified file 'plugins/Devices/CDRom/CDRipper.vala' |
161 | --- plugins/Devices/CDRom/CDRipper.vala 2013-04-26 22:01:17 +0000 |
162 | +++ plugins/Devices/CDRom/CDRipper.vala 2013-11-22 15:48:54 +0000 |
163 | @@ -69,7 +69,7 @@ |
164 | |
165 | queue.set ("max-size-time", 120 * Gst.SECOND); |
166 | |
167 | - _format = Gst.format_get_by_nick ("track"); |
168 | + _format = Gst.Format.get_by_nick ("track"); |
169 | |
170 | ((Gst.Bin)pipeline).add_many (src, queue, filter, sink); |
171 | if(!src.link_many (queue, filter, sink)) { |
172 | @@ -77,7 +77,7 @@ |
173 | return false; |
174 | } |
175 | |
176 | - pipeline.bus.add_watch (busCallback); |
177 | + pipeline.bus.add_watch (GLib.Priority.DEFAULT, busCallback); |
178 | |
179 | Timeout.add (500, doPositionUpdate); |
180 | |
181 | @@ -97,7 +97,7 @@ |
182 | int64 rv = (int64)0; |
183 | Format f = Format.TIME; |
184 | |
185 | - src.query_position(ref f, out rv); |
186 | + src.query_position (f, out rv); |
187 | |
188 | return rv; |
189 | } |
190 | @@ -106,7 +106,7 @@ |
191 | int64 rv = (int64)0; |
192 | Format f = Format.TIME; |
193 | |
194 | - src.query_duration(ref f, out rv); |
195 | + src.query_duration (f, out rv); |
196 | |
197 | return rv; |
198 | } |
199 | |
200 | === modified file 'plugins/Devices/CDRom/CDRomDevice.vala' |
201 | --- plugins/Devices/CDRom/CDRomDevice.vala 2013-06-17 12:58:33 +0000 |
202 | +++ plugins/Devices/CDRom/CDRomDevice.vala 2013-11-22 15:48:54 +0000 |
203 | @@ -372,7 +372,7 @@ |
204 | public void ripperError(string err, Gst.Message message) { |
205 | stop_importation (); |
206 | if(err == "missing element") { |
207 | - if(message.get_structure() != null && Gst.is_missing_plugin_message(message)) { |
208 | + if (message.get_structure () != null && Gst.PbUtils.is_missing_plugin_message (message)) { |
209 | Noise.InstallGstreamerPluginsDialog dialog = new Noise.InstallGstreamerPluginsDialog(message); |
210 | dialog.show(); |
211 | } |
212 | |
213 | === modified file 'plugins/Devices/CDRom/CMakeLists.txt' |
214 | --- plugins/Devices/CDRom/CMakeLists.txt 2012-12-30 11:42:47 +0000 |
215 | +++ plugins/Devices/CDRom/CMakeLists.txt 2013-11-22 15:48:54 +0000 |
216 | @@ -1,11 +1,3 @@ |
217 | -pkg_check_modules(CD_DEPS gstreamer-cdda-0.10) |
218 | - |
219 | -if (CD_DEPS_FOUND) |
220 | - |
221 | -set(DEPS_CFLAGS ${DEPS_CFLAGS} ${CD_DEPS_CFLAGS}) |
222 | -set(DEPS_LIBRARIES ${DEPS_LIBRARIES} ${CD_DEPS_LIBRARIES}) |
223 | -set(DEPS_LIBRARY_DIRS ${DEPS_LIBRARY_DIRS} ${CD_DEPS_LIBRARY_DIRS}) |
224 | - |
225 | add_definitions(${DEPS_CFLAGS}) |
226 | link_directories(${DEPS_LIBRARY_DIRS}) |
227 | |
228 | @@ -21,7 +13,6 @@ |
229 | CDView.vala |
230 | PACKAGES |
231 | ${DEPS_PACKAGES} |
232 | - gstreamer-cdda-0.10 |
233 | OPTIONS |
234 | ${GLOBAL_VALAC_OPTIONS} |
235 | ) |
236 | @@ -32,9 +23,3 @@ |
237 | |
238 | install(TARGETS ${TARGET_NAME} DESTINATION ${PLUGIN_DIR}/CDRom-Device/) |
239 | install(FILES cdrom-device.plugin DESTINATION ${PLUGIN_DIR}/CDRom-Device/) |
240 | - |
241 | -else () |
242 | - |
243 | -message("-- CD-Rom device plugin disabled") |
244 | - |
245 | -endif () |
246 | |
247 | === modified file 'plugins/Devices/iPod/iPodStreamer.vala' |
248 | --- plugins/Devices/iPod/iPodStreamer.vala 2013-10-11 11:58:03 +0000 |
249 | +++ plugins/Devices/iPod/iPodStreamer.vala 2013-11-22 15:48:54 +0000 |
250 | @@ -42,7 +42,7 @@ |
251 | pipe = new Noise.Pipeline(); |
252 | this.dm = dm; |
253 | |
254 | - pipe.bus.add_watch (bus_callback); |
255 | + pipe.bus.add_watch (GLib.Priority.DEFAULT, bus_callback); |
256 | //pipe.playbin.about_to_finish.connect(about_to_finish); |
257 | |
258 | |
259 | @@ -109,7 +109,7 @@ |
260 | int64 rv = (int64)0; |
261 | Format f = Format.TIME; |
262 | |
263 | - pipe.playbin.query_position (ref f, out rv); |
264 | + pipe.playbin.query_position (f, out rv); |
265 | |
266 | return rv; |
267 | } |
268 | @@ -118,7 +118,7 @@ |
269 | int64 rv = (int64)0; |
270 | Format f = Format.TIME; |
271 | |
272 | - pipe.playbin.query_duration(ref f, out rv); |
273 | + pipe.playbin.query_duration (f, out rv); |
274 | |
275 | return rv; |
276 | } |
277 | @@ -157,7 +157,7 @@ |
278 | error_occured(); |
279 | break; |
280 | case Gst.MessageType.ELEMENT: |
281 | - if(message.get_structure() != null && is_missing_plugin_message(message) && (dialog == null || !dialog.visible)) { |
282 | + if (message.get_structure () != null && Gst.PbUtils.is_missing_plugin_message (message) && (dialog == null || !dialog.visible)) { |
283 | dialog = new InstallGstreamerPluginsDialog(message); |
284 | } |
285 | break; |
286 | @@ -181,9 +181,9 @@ |
287 | |
288 | message.parse_tag (out tag_list); |
289 | if (tag_list != null) { |
290 | - if (tag_list.get_tag_size(TAG_TITLE) > 0) { |
291 | + if (tag_list.get_tag_size (Gst.Tags.TITLE) > 0) { |
292 | string title = ""; |
293 | - tag_list.get_string(TAG_TITLE, out title); |
294 | + tag_list.get_string (Gst.Tags.TITLE, out title); |
295 | |
296 | if (App.player.media_info.media.mediatype == 3 && title != "") { // is radio |
297 | string[] pieces = title.split("-", 0); |
298 | |
299 | === modified file 'src/Dialogs/InstallGstreamerPluginsDialog.vala' |
300 | --- src/Dialogs/InstallGstreamerPluginsDialog.vala 2013-02-03 01:03:51 +0000 |
301 | +++ src/Dialogs/InstallGstreamerPluginsDialog.vala 2013-11-22 15:48:54 +0000 |
302 | @@ -35,7 +35,7 @@ |
303 | |
304 | public InstallGstreamerPluginsDialog(Gst.Message message) { |
305 | this.message = message; |
306 | - this.detail = Gst.missing_plugin_message_get_description(message); |
307 | + this.detail = Gst.PbUtils.missing_plugin_message_get_description (message); |
308 | |
309 | // set the size based on saved gconf settings |
310 | //this.window_position = WindowPosition.CENTER; |
311 | @@ -94,10 +94,10 @@ |
312 | } |
313 | |
314 | public void installPluginClicked() { |
315 | - var installer = Gst.missing_plugin_message_get_installer_detail(message); |
316 | - var context = new Gst.InstallPluginsContext(); |
317 | + var installer = Gst.PbUtils.missing_plugin_message_get_installer_detail (message); |
318 | + var context = new Gst.PbUtils.InstallPluginsContext (); |
319 | |
320 | - Gst.install_plugins_async({installer}, context, (Gst.InstallPluginsResultFunc)install_plugins_finished); |
321 | + Gst.PbUtils.install_plugins_async ({installer}, context, (Gst.PbUtils.InstallPluginsResultFunc) install_plugins_finished); |
322 | // This callback was called before APT was done, so let's periodically check |
323 | // whether the plugins have actually been installed. We won't update the |
324 | // registry here. |
325 | @@ -105,7 +105,7 @@ |
326 | this.hide (); |
327 | } |
328 | |
329 | - public void install_plugins_finished(Gst.InstallPluginsReturn result) { |
330 | + public void install_plugins_finished (Gst.PbUtils.InstallPluginsReturn result) { |
331 | GLib.message ("Install of plugins finished.. updating registry"); |
332 | } |
333 | private bool installation_done = false; |
334 | |
335 | === modified file 'src/GStreamer/CoverImport.vala' |
336 | --- src/GStreamer/CoverImport.vala 2013-06-17 12:58:33 +0000 |
337 | +++ src/GStreamer/CoverImport.vala 2013-11-22 15:48:54 +0000 |
338 | @@ -25,7 +25,7 @@ |
339 | private const int DISCOVER_SET_SIZE = 50; |
340 | private const int DISCOVERER_TIMEOUT_MS = 10; |
341 | |
342 | - private Gst.Discoverer d = null; |
343 | + private Gst.PbUtils.Discoverer d = null; |
344 | private Gee.LinkedList<Media> uri_queue; |
345 | private Gee.LinkedList<Media> original_queue; |
346 | |
347 | @@ -55,7 +55,7 @@ |
348 | private async void import_next_file_set () { |
349 | if (d == null) { |
350 | try { |
351 | - d = new Gst.Discoverer ((Gst.ClockTime) (10 * Gst.SECOND)); |
352 | + d = new Gst.PbUtils.Discoverer ((Gst.ClockTime) (10 * Gst.SECOND)); |
353 | } catch (Error err) { |
354 | critical ("Could not create Gst discoverer object: %s", err.message); |
355 | } |
356 | @@ -94,34 +94,34 @@ |
357 | import_next_file_set.begin (); |
358 | } |
359 | |
360 | - private async void import_media (Gst.DiscovererInfo info, Error err) { |
361 | + private async void import_media (Gst.PbUtils.DiscovererInfo info, Error err) { |
362 | |
363 | string uri = info.get_uri (); |
364 | |
365 | bool gstreamer_discovery_successful = false; |
366 | |
367 | switch (info.get_result ()) { |
368 | - case Gst.DiscovererResult.OK: |
369 | + case Gst.PbUtils.DiscovererResult.OK: |
370 | gstreamer_discovery_successful = true; |
371 | break; |
372 | |
373 | - case Gst.DiscovererResult.URI_INVALID: |
374 | + case Gst.PbUtils.DiscovererResult.URI_INVALID: |
375 | warning ("GStreamer could not import '%s': invalid URI.", uri); |
376 | break; |
377 | |
378 | - case Gst.DiscovererResult.ERROR: |
379 | + case Gst.PbUtils.DiscovererResult.ERROR: |
380 | warning ("GStreamer could not import '%s': %s", uri, err.message); |
381 | break; |
382 | |
383 | - case Gst.DiscovererResult.TIMEOUT: |
384 | + case Gst.PbUtils.DiscovererResult.TIMEOUT: |
385 | warning ("GStreamer could not import '%s': Discovery timed out.", uri); |
386 | break; |
387 | |
388 | - case Gst.DiscovererResult.BUSY: |
389 | + case Gst.PbUtils.DiscovererResult.BUSY: |
390 | warning ("GStreamer could not import '%s': Already discovering a file.", uri); |
391 | break; |
392 | |
393 | - case Gst.DiscovererResult.MISSING_PLUGINS: |
394 | + case Gst.PbUtils.DiscovererResult.MISSING_PLUGINS: |
395 | warning ("GStreamer could not import '%s': Missing plugins.", uri); |
396 | |
397 | /** |
398 | @@ -144,7 +144,7 @@ |
399 | |
400 | } |
401 | |
402 | - private async void import_art_async (Media m, Gst.DiscovererInfo info) { |
403 | + private async void import_art_async (Media m, Gst.PbUtils.DiscovererInfo info) { |
404 | var cache = CoverartCache.instance; |
405 | if (cache.has_image (m)) |
406 | return; |
407 | @@ -162,25 +162,25 @@ |
408 | Gst.Buffer? buffer = null; |
409 | |
410 | for (int i = 0; ; i++) { |
411 | - Gst.Buffer? loop_buffer = null; |
412 | - if (!tag.get_buffer_index (Gst.TAG_IMAGE, i, out loop_buffer)) |
413 | + Gst.Sample? loop_sample = null; |
414 | + if (!tag.get_sample_index (Gst.Tags.IMAGE, i, out loop_sample)) |
415 | break; |
416 | |
417 | - if (loop_buffer == null) |
418 | + if (loop_sample == null) |
419 | continue; |
420 | |
421 | - var structure = loop_buffer.caps.get_structure (0); |
422 | + var structure = loop_sample.get_caps ().get_structure (0); |
423 | if (structure == null) |
424 | continue; |
425 | |
426 | int image_type; |
427 | - structure.get_enum ("image-type", typeof (Gst.TagImageType), out image_type); |
428 | + structure.get_enum ("image-type", typeof (Gst.Tag.ImageType), out image_type); |
429 | |
430 | - if (image_type == Gst.TagImageType.FRONT_COVER) { |
431 | - buffer = loop_buffer; |
432 | + if (image_type == Gst.Tag.ImageType.FRONT_COVER) { |
433 | + buffer = loop_sample.get_buffer (); |
434 | break; |
435 | - } else if (image_type == Gst.TagImageType.UNDEFINED || buffer == null) { |
436 | - buffer = loop_buffer; |
437 | + } else if (image_type == Gst.Tag.ImageType.UNDEFINED || buffer == null) { |
438 | + buffer = loop_sample.get_buffer (); |
439 | } |
440 | } |
441 | |
442 | @@ -193,17 +193,30 @@ |
443 | } |
444 | |
445 | private static Gdk.Pixbuf? get_pixbuf_from_buffer (Gst.Buffer buffer) { |
446 | + var memory = buffer.get_memory (0); |
447 | + if (memory == null) |
448 | + return null; |
449 | + |
450 | + Gst.MapInfo map_info; |
451 | + if (!memory.map (out map_info, Gst.MapFlags.READ)) |
452 | + return null; |
453 | + |
454 | Gdk.Pixbuf? pix = null; |
455 | - var loader = new Gdk.PixbufLoader (); |
456 | - |
457 | - try { |
458 | - if (loader.write (buffer.data)) |
459 | - pix = loader.get_pixbuf (); |
460 | - loader.close (); |
461 | - } catch (Error err) { |
462 | - warning ("Error processing pixbuf data: %s", err.message); |
463 | + |
464 | + if (map_info.data != null) { |
465 | + var loader = new Gdk.PixbufLoader (); |
466 | + |
467 | + try { |
468 | + if (loader.write (map_info.data)) |
469 | + pix = loader.get_pixbuf (); |
470 | + loader.close (); |
471 | + } catch (Error err) { |
472 | + warning ("Error processing image data: %s", err.message); |
473 | + } |
474 | } |
475 | - |
476 | + |
477 | + memory.unmap (map_info); |
478 | + |
479 | return pix; |
480 | } |
481 | |
482 | |
483 | === modified file 'src/GStreamer/GStreamerTagger.vala' |
484 | --- src/GStreamer/GStreamerTagger.vala 2013-05-19 23:06:40 +0000 |
485 | +++ src/GStreamer/GStreamerTagger.vala 2013-11-22 15:48:54 +0000 |
486 | @@ -29,7 +29,7 @@ |
487 | public signal void import_error (string file_uri); |
488 | public signal void queue_finished (); |
489 | |
490 | - private Gst.Discoverer d; |
491 | + private Gst.PbUtils.Discoverer d; |
492 | private Gee.LinkedList<string> uri_queue; |
493 | |
494 | private bool cancelled; |
495 | @@ -57,7 +57,7 @@ |
496 | private async void import_next_file_set () { |
497 | if (d == null) { |
498 | try { |
499 | - d = new Gst.Discoverer ((Gst.ClockTime) (10 * Gst.SECOND)); |
500 | + d = new Gst.PbUtils.Discoverer ((Gst.ClockTime) (10 * Gst.SECOND)); |
501 | } catch (Error err) { |
502 | critical ("Could not create Gst discoverer object: %s", err.message); |
503 | } |
504 | @@ -96,7 +96,7 @@ |
505 | import_next_file_set.begin (); |
506 | } |
507 | |
508 | - private async void import_media (Gst.DiscovererInfo info, Error err) { |
509 | + private async void import_media (Gst.PbUtils.DiscovererInfo info, Error err) { |
510 | Media? m = null; |
511 | |
512 | string uri = info.get_uri (); |
513 | @@ -104,27 +104,27 @@ |
514 | bool gstreamer_discovery_successful = false; |
515 | |
516 | switch (info.get_result ()) { |
517 | - case Gst.DiscovererResult.OK: |
518 | + case Gst.PbUtils.DiscovererResult.OK: |
519 | gstreamer_discovery_successful = true; |
520 | break; |
521 | |
522 | - case Gst.DiscovererResult.URI_INVALID: |
523 | + case Gst.PbUtils.DiscovererResult.URI_INVALID: |
524 | warning ("GStreamer could not import '%s': invalid URI.", uri); |
525 | break; |
526 | |
527 | - case Gst.DiscovererResult.ERROR: |
528 | + case Gst.PbUtils.DiscovererResult.ERROR: |
529 | warning ("GStreamer could not import '%s': %s", uri, err.message); |
530 | break; |
531 | |
532 | - case Gst.DiscovererResult.TIMEOUT: |
533 | + case Gst.PbUtils.DiscovererResult.TIMEOUT: |
534 | warning ("GStreamer could not import '%s': Discovery timed out.", uri); |
535 | break; |
536 | |
537 | - case Gst.DiscovererResult.BUSY: |
538 | + case Gst.PbUtils.DiscovererResult.BUSY: |
539 | warning ("GStreamer could not import '%s': Already discovering a file.", uri); |
540 | break; |
541 | |
542 | - case Gst.DiscovererResult.MISSING_PLUGINS: |
543 | + case Gst.PbUtils.DiscovererResult.MISSING_PLUGINS: |
544 | warning ("GStreamer could not import '%s': Missing plugins.", uri); |
545 | |
546 | /** |
547 | @@ -149,68 +149,68 @@ |
548 | |
549 | if (tags != null) { |
550 | string title; |
551 | - if (tags.get_string (Gst.TAG_TITLE, out title)) |
552 | + if (tags.get_string (Gst.Tags.TITLE, out title)) |
553 | m.title = title; |
554 | |
555 | string artist; |
556 | - if (tags.get_string (Gst.TAG_ARTIST, out artist)) |
557 | + if (tags.get_string (Gst.Tags.ARTIST, out artist)) |
558 | m.artist = artist; |
559 | |
560 | string composer; |
561 | - if (tags.get_string (Gst.TAG_COMPOSER, out composer)) |
562 | + if (tags.get_string (Gst.Tags.COMPOSER, out composer)) |
563 | m.composer = composer; |
564 | |
565 | string album_artist; |
566 | - if (tags.get_string (Gst.TAG_ALBUM_ARTIST, out album_artist)) |
567 | + if (tags.get_string (Gst.Tags.ALBUM_ARTIST, out album_artist)) |
568 | m.album_artist = album_artist; |
569 | |
570 | string album; |
571 | - if (tags.get_string (Gst.TAG_ALBUM, out album)) |
572 | + if (tags.get_string (Gst.Tags.ALBUM, out album)) |
573 | m.album = album; |
574 | |
575 | string grouping; |
576 | - if (tags.get_string (Gst.TAG_GROUPING, out grouping)) |
577 | + if (tags.get_string (Gst.Tags.GROUPING, out grouping)) |
578 | m.grouping = grouping; |
579 | |
580 | string genre; |
581 | - if (tags.get_string (Gst.TAG_GENRE, out genre)) |
582 | + if (tags.get_string (Gst.Tags.GENRE, out genre)) |
583 | m.genre = genre; |
584 | |
585 | string comment; |
586 | - if (tags.get_string (Gst.TAG_COMMENT, out comment)) |
587 | + if (tags.get_string (Gst.Tags.COMMENT, out comment)) |
588 | m.comment = comment; |
589 | |
590 | string lyrics; |
591 | - if (tags.get_string (Gst.TAG_LYRICS, out lyrics)) |
592 | + if (tags.get_string (Gst.Tags.LYRICS, out lyrics)) |
593 | m.lyrics = lyrics; |
594 | |
595 | uint track_number; |
596 | - if (tags.get_uint (Gst.TAG_TRACK_NUMBER, out track_number)) |
597 | + if (tags.get_uint (Gst.Tags.TRACK_NUMBER, out track_number)) |
598 | m.track = track_number; |
599 | |
600 | uint track_count; |
601 | - if (tags.get_uint (Gst.TAG_TRACK_COUNT, out track_count)) |
602 | + if (tags.get_uint (Gst.Tags.TRACK_COUNT, out track_count)) |
603 | m.track_count = track_count; |
604 | |
605 | uint album_number; |
606 | - if (tags.get_uint (Gst.TAG_ALBUM_VOLUME_NUMBER, out album_number)) |
607 | + if (tags.get_uint (Gst.Tags.ALBUM_VOLUME_NUMBER, out album_number)) |
608 | m.album_number = album_number; |
609 | |
610 | uint album_count; |
611 | - if (tags.get_uint (Gst.TAG_ALBUM_VOLUME_COUNT, out album_count)) |
612 | + if (tags.get_uint (Gst.Tags.ALBUM_VOLUME_COUNT, out album_count)) |
613 | m.album_count = album_count; |
614 | |
615 | uint bitrate; |
616 | - if (tags.get_uint (Gst.TAG_BITRATE, out bitrate)) |
617 | + if (tags.get_uint (Gst.Tags.BITRATE, out bitrate)) |
618 | m.bitrate = bitrate / 1000; |
619 | |
620 | uint rating; |
621 | - if (tags.get_uint (Gst.TAG_USER_RATING, out rating)) |
622 | + if (tags.get_uint (Gst.Tags.USER_RATING, out rating)) |
623 | m.rating = rating; // Noise.Media will clamp the value |
624 | |
625 | // Get the year |
626 | Date? date; |
627 | - if (tags.get_date (Gst.TAG_DATE, out date)) { |
628 | + if (tags.get_date (Gst.Tags.DATE, out date)) { |
629 | // Don't let the assumption that @date is non-null deceive you. |
630 | // This is sometimes null even though get_date() returned true! |
631 | if (date != null) |
632 | @@ -218,17 +218,18 @@ |
633 | } |
634 | |
635 | double bpm; |
636 | - if (tags.get_double (Gst.TAG_BEATS_PER_MINUTE, out bpm)) |
637 | + if (tags.get_double (Gst.Tags.BEATS_PER_MINUTE, out bpm)) |
638 | m.bpm = (uint) bpm.clamp (0, bpm); |
639 | |
640 | if (duration == 0) |
641 | - if (!tags.get_uint64 (Gst.TAG_DURATION, out duration)) |
642 | + if (!tags.get_uint64 (Gst.Tags.DURATION, out duration)) |
643 | duration = 0; |
644 | } |
645 | |
646 | m.length = TimeUtils.nanoseconds_to_miliseconds (duration); |
647 | |
648 | - foreach (var audio_stream in info.get_audio_streams ()) { |
649 | + foreach (var stream_info in info.get_audio_streams ()) { |
650 | + var audio_stream = stream_info as Gst.PbUtils.DiscovererAudioInfo; |
651 | if (audio_stream == null) |
652 | continue; |
653 | |
654 | |
655 | === modified file 'src/GStreamer/Streamer.vala' |
656 | --- src/GStreamer/Streamer.vala 2013-10-11 11:58:03 +0000 |
657 | +++ src/GStreamer/Streamer.vala 2013-11-22 15:48:54 +0000 |
658 | @@ -40,7 +40,7 @@ |
659 | public Streamer () { |
660 | pipe = new Noise.Pipeline(); |
661 | |
662 | - pipe.bus.add_watch(bus_callback); |
663 | + pipe.bus.add_watch (GLib.Priority.DEFAULT, bus_callback); |
664 | //pipe.playbin.about_to_finish.connect(about_to_finish); |
665 | |
666 | |
667 | @@ -104,7 +104,7 @@ |
668 | int64 rv = (int64)0; |
669 | Format f = Format.TIME; |
670 | |
671 | - pipe.playbin.query_position (ref f, out rv); |
672 | + pipe.playbin.query_position (f, out rv); |
673 | |
674 | return rv; |
675 | } |
676 | @@ -113,7 +113,7 @@ |
677 | int64 rv = (int64)0; |
678 | Format f = Format.TIME; |
679 | |
680 | - pipe.playbin.query_duration(ref f, out rv); |
681 | + pipe.playbin.query_duration (f, out rv); |
682 | |
683 | return rv; |
684 | } |
685 | @@ -152,7 +152,7 @@ |
686 | error_occured(); |
687 | break; |
688 | case Gst.MessageType.ELEMENT: |
689 | - if(message.get_structure() != null && is_missing_plugin_message(message) && (dialog == null || !dialog.visible)) { |
690 | + if(message.get_structure() != null && Gst.PbUtils.is_missing_plugin_message(message) && (dialog == null || !dialog.visible)) { |
691 | dialog = new InstallGstreamerPluginsDialog(message); |
692 | } |
693 | break; |
694 | @@ -176,9 +176,9 @@ |
695 | |
696 | message.parse_tag (out tag_list); |
697 | if (tag_list != null) { |
698 | - if (tag_list.get_tag_size(TAG_TITLE) > 0) { |
699 | + if (tag_list.get_tag_size (Gst.Tags.TITLE) > 0) { |
700 | string title = ""; |
701 | - tag_list.get_string(TAG_TITLE, out title); |
702 | + tag_list.get_string (Gst.Tags.TITLE, out title); |
703 | |
704 | if (App.player.media_info.media.mediatype == 3 && title != "") { // is radio |
705 | string[] pieces = title.split("-", 0); |
Try to do the changes for src/Dialogs/ InstallGstreame rPluginsDialog. vala without re-indenting it.
For lines you are touching you can fix the code-style, e.g. add missing spaces.