static BraseroBurnResult brasero_transcode_start (BraseroJob *job, GError **error) { BraseroTranscode *transcode; BraseroBurnResult result; BraseroJobAction action; transcode = BRASERO_TRANSCODE (job); brasero_job_get_action (job, &action); brasero_job_set_use_average_rate (job, TRUE); if (action == BRASERO_JOB_ACTION_SIZE) { BraseroTrack *track; /* see if the track size was already set since then no need to * carry on with a lengthy get size and the library will do it * itself. */ brasero_job_get_current_track (job, &track); if (brasero_track_stream_get_end (BRASERO_TRACK_STREAM (track)) > 0) return BRASERO_BURN_NOT_SUPPORTED; if (!brasero_transcode_create_pipeline (transcode, error)) return BRASERO_BURN_ERR; brasero_job_set_current_action (job, BRASERO_BURN_ACTION_GETTING_SIZE, NULL, TRUE); brasero_job_start_progress (job, FALSE); return BRASERO_BURN_OK; } if (action == BRASERO_JOB_ACTION_IMAGE) { /* Look for a sibling to avoid transcoding twice. In this case * though start and end of this track must be inside start and * end of the previous track. Of course if we are piping that * operation is simply impossible. */ if (brasero_job_get_fd_out (job, NULL) != BRASERO_BURN_OK) { result = brasero_transcode_has_track_sibling (BRASERO_TRANSCODE (job), error); if (result != BRASERO_BURN_OK) return result; } brasero_transcode_set_boundaries (transcode); if (!brasero_transcode_create_pipeline (transcode, error)) return BRASERO_BURN_ERR; } else BRASERO_JOB_NOT_SUPPORTED (transcode); return BRASERO_BURN_OK; }
static void brasero_transcode_wavparse_pad_added_cb (GstElement *wavparse, GstPad *new_pad, gpointer user_data) { GstPad *pad = NULL; BraseroTranscodePrivate *priv; priv = BRASERO_TRANSCODE_PRIVATE (user_data); pad = gst_element_get_static_pad (priv->sink, "sink"); if (!pad) goto error; if (gst_pad_link (new_pad, pad) != GST_PAD_LINK_OK) goto error; gst_element_set_state (priv->sink, GST_STATE_PLAYING); return; error: if (pad) gst_object_unref (pad); brasero_transcode_error_on_pad_linking (BRASERO_TRANSCODE (user_data), "Sent by brasero_transcode_wavparse_pad_added_cb"); }
static void brasero_transcode_finalize (GObject *object) { BraseroTranscodePrivate *priv; priv = BRASERO_TRANSCODE_PRIVATE (object); if (priv->pad_id) { g_source_remove (priv->pad_id); priv->pad_id = 0; } brasero_transcode_stop_pipeline (BRASERO_TRANSCODE (object)); G_OBJECT_CLASS (parent_class)->finalize (object); }
static BraseroBurnResult brasero_transcode_stop (BraseroJob *job, GError **error) { BraseroTranscodePrivate *priv; priv = BRASERO_TRANSCODE_PRIVATE (job); priv->mp3_size_pipeline = 0; if (priv->pad_id) { g_source_remove (priv->pad_id); priv->pad_id = 0; } brasero_transcode_stop_pipeline (BRASERO_TRANSCODE (job)); return BRASERO_BURN_OK; }