~timo-jyrinki/ubuntu/utopic/rhythmbox/enable_grilo_rhythmbox

« back to all changes in this revision

Viewing changes to backends/gstreamer/rb-encoder-gst.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2012-03-12 12:07:21 UTC
  • mfrom: (1.2.28)
  • Revision ID: package-import@ubuntu.com-20120312120721-ubdep6yl0sgfbr7i
Tags: 2.96-1
* New upstream release.
* Update Build-Depends:
  - Bump libgtk-3-dev to (>= 3.2.0).
  - Drop gir1.2-gtk-3.0, pulled via libgtk-3-dev.
  - Bump libglib2.0-dev (>= 2.28.0).
* Re-add magnatune plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
438
438
attach_output_pipeline (RBEncoderGst *encoder,
439
439
                        GstElement *end,
440
440
                        const char *dest,
 
441
                        gboolean overwrite,
441
442
                        GError **error)
442
443
{
443
444
        GFile *file;
466
467
                        } else if (g_error_matches (local_error,
467
468
                                                    G_IO_ERROR,
468
469
                                                    G_IO_ERROR_EXISTS)) {
469
 
                                if (_rb_encoder_emit_overwrite (RB_ENCODER (encoder), file)) {
 
470
                                if (overwrite) {
470
471
                                        g_error_free (local_error);
471
472
                                        stream = g_file_replace (file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, error);
472
473
                                        if (stream == NULL) {
473
474
                                                return FALSE;
474
475
                                        }
475
476
                                } else {
476
 
                                        g_propagate_error (error, local_error);
 
477
                                        g_set_error_literal (error,
 
478
                                                             RB_ENCODER_ERROR,
 
479
                                                             RB_ENCODER_ERROR_DEST_EXISTS,
 
480
                                                             local_error->message);
 
481
                                        g_error_free (local_error);
477
482
                                        return FALSE;
478
483
                                }
479
484
                        } else {
549
554
copy_track (RBEncoderGst *encoder,
550
555
            RhythmDBEntry *entry,
551
556
            const char *dest,
 
557
            gboolean overwrite,
552
558
            GError **error)
553
559
{
554
560
        /* source ! sink */
560
566
        if (src == NULL)
561
567
                return FALSE;
562
568
 
563
 
        if (!attach_output_pipeline (encoder, src, dest, error))
 
569
        if (!attach_output_pipeline (encoder, src, dest, overwrite, error))
564
570
                return FALSE;
565
571
 
566
572
        start_pipeline (encoder);
571
577
transcode_track (RBEncoderGst *encoder,
572
578
                 RhythmDBEntry *entry,
573
579
                 const char *dest,
 
580
                 gboolean overwrite,
574
581
                 GError **error)
575
582
{
576
583
        /* src ! decodebin2 ! encodebin ! sink */
616
623
                      NULL);
617
624
        gst_bin_add (GST_BIN (encoder->priv->pipeline), encoder->priv->encodebin);
618
625
 
619
 
        if (!attach_output_pipeline (encoder, encoder->priv->encodebin, dest, error))
 
626
        if (!attach_output_pipeline (encoder, encoder->priv->encodebin, dest, overwrite, error))
620
627
                goto error;
621
628
        if (!add_tags_from_entry (encoder, entry, error))
622
629
                goto error;
680
687
impl_encode (RBEncoder *bencoder,
681
688
             RhythmDBEntry *entry,
682
689
             const char *dest,
 
690
             gboolean overwrite,
683
691
             GstEncodingProfile *profile)
684
692
{
685
693
        RBEncoderGst *encoder = RB_ENCODER_GST (bencoder);
712
720
                encoder->priv->position_format = GST_FORMAT_BYTES;
713
721
                encoder->priv->dest_media_type = rhythmdb_entry_dup_string (entry, RHYTHMDB_PROP_MEDIA_TYPE);
714
722
 
715
 
                result = copy_track (encoder, entry, dest, &error);
 
723
                result = copy_track (encoder, entry, dest, overwrite, &error);
716
724
        } else {
717
725
                gst_encoding_profile_ref (profile);
718
726
                encoder->priv->profile = profile;
720
728
                encoder->priv->position_format = GST_FORMAT_TIME;
721
729
                encoder->priv->dest_media_type = rb_gst_encoding_profile_get_media_type (profile);
722
730
 
723
 
                result = transcode_track (encoder, entry, dest, &error);
 
731
                result = transcode_track (encoder, entry, dest, overwrite, &error);
724
732
        }
725
733
 
726
734
        if (result == FALSE && encoder->priv->cancelled == FALSE) {