~matttbe/ubuntu/raring/rhythmbox/lp1010619_RB_2.98

« back to all changes in this revision

Viewing changes to plugins/mtpdevice/rb-mtp-gst-sink.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-11-06 20:52:57 UTC
  • mfrom: (1.1.67) (214.1.1 quantal-proposed)
  • Revision ID: package-import@ubuntu.com-20121106205257-0btjh8jqley153el
Tags: 2.98-0ubuntu1
* New upstream release (LP: #1060601)
* debian/control.in:
  - Bump minimum glib, gtk, totem-plparser, clutter, and clutter-gst
  - Drop no longer needed musicbrainz dependency
* Refreshed 09_keywords.patch
* Updated 11_fix_cd_pausing.patch with fix from git
* Dropped patches applied in new version:
  - 00git_musicbrainz5.patch
  - 08_CVE-2012-3355.patch
  - dont_free_consumed_floating_gvariant.patch
  - git_scale_click.patch
  - git_crash_during_monitor.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        GstPad *ghostpad;
62
62
 
63
63
        GError *upload_error;
64
 
        GMutex *upload_mutex;
65
 
        GCond *upload_cond;
 
64
        GMutex upload_mutex;
 
65
        GCond upload_cond;
66
66
        gboolean got_folder;
67
67
        gboolean upload_done;
68
68
};
124
124
{
125
125
        GstPad *pad;
126
126
 
127
 
        sink->upload_mutex = g_mutex_new ();
128
 
        sink->upload_cond = g_cond_new ();
129
 
 
130
127
        /* create actual sink */
131
128
        sink->fdsink = gst_element_factory_make ("fdsink", NULL);
132
129
        if (sink->fdsink == NULL) {
179
176
static void
180
177
folder_callback (uint32_t folder_id, RBMTPSink *sink)
181
178
{
182
 
        g_mutex_lock (sink->upload_mutex);
 
179
        g_mutex_lock (&sink->upload_mutex);
183
180
        if (folder_id == 0) {
184
181
                rb_debug ("mtp folder create failed");
185
182
        } else {
189
186
 
190
187
        sink->got_folder = TRUE;
191
188
 
192
 
        g_cond_signal (sink->upload_cond);
193
 
        g_mutex_unlock (sink->upload_mutex);
 
189
        g_cond_signal (&sink->upload_cond);
 
190
        g_mutex_unlock (&sink->upload_mutex);
194
191
}
195
192
 
196
193
static void
197
194
upload_callback (LIBMTP_track_t *track, GError *error, RBMTPSink *sink)
198
195
{
199
196
        rb_debug ("mtp upload callback for %s: item ID %d", track->filename, track->item_id);
200
 
        g_mutex_lock (sink->upload_mutex);
 
197
        g_mutex_lock (&sink->upload_mutex);
201
198
 
202
199
        if (error != NULL) {
203
200
                sink->upload_error = g_error_copy (error);
204
201
        }
205
202
        sink->upload_done = TRUE;
206
203
 
207
 
        g_cond_signal (sink->upload_cond);
208
 
        g_mutex_unlock (sink->upload_mutex);
 
204
        g_cond_signal (&sink->upload_cond);
 
205
        g_mutex_unlock (&sink->upload_mutex);
209
206
}
210
207
 
211
208
static void
231
228
                /* we can just block waiting for mtp thread operations to finish here
232
229
                 * as we're on a streaming thread.
233
230
                 */
234
 
                g_mutex_lock (sink->upload_mutex);
 
231
                g_mutex_lock (&sink->upload_mutex);
235
232
 
236
233
                if (sink->folder_path != NULL) {
237
234
                        /* find or create the target folder.
245
242
                                                     g_object_ref (sink),
246
243
                                                     g_object_unref);
247
244
                        while (sink->got_folder == FALSE) {
248
 
                                g_cond_wait (sink->upload_cond, sink->upload_mutex);
 
245
                                g_cond_wait (&sink->upload_cond, &sink->upload_mutex);
249
246
                        }
250
247
                }
251
248
 
259
256
                                            g_object_unref);
260
257
 
261
258
                while (sink->upload_done == FALSE) {
262
 
                        g_cond_wait (sink->upload_cond, sink->upload_mutex);
 
259
                        g_cond_wait (&sink->upload_cond, &sink->upload_mutex);
263
260
                }
264
 
                g_mutex_unlock (sink->upload_mutex);
 
261
                g_mutex_unlock (&sink->upload_mutex);
265
262
 
266
263
                /* post error message if the upload failed - this should get there before
267
264
                 * this EOS message does, so it should work OK.
406
403
        RBMTPSink *sink;
407
404
        sink = RB_MTP_SINK (object);
408
405
 
409
 
        g_mutex_free (sink->upload_mutex);
410
 
        g_cond_free (sink->upload_cond);
411
 
 
412
406
        if (sink->upload_error) {
413
407
                g_error_free (sink->upload_error);
414
408
        }