Commit 526d7015 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller Committed by Javier Jardón

Port brasero to GStreamer 1.0

Tentative port. Barely tested so far.
parent 84784825
......@@ -143,16 +143,18 @@ GTHREAD_REQUIRED=2.6.0
GMODULE_REQUIRED=2.6.0
GMODULE_EXPORT_REQUIRED=2.6.0
GIO_REQUIRED=2.28.0
GSTREAMER_REQUIRED=0.10.15
GSTREAMER_BASE_REQUIRED=0.10.0
GSTREAMER_REQUIRED=0.11.92
GSTREAMER_BASE_REQUIRED=0.11.92
LIBXML2_REQUIRED=2.6.0
dnl ** used by brasero and one plugin
PKG_CHECK_MODULES(BRASERO_GSTREAMER, \
gstreamer-0.10 >= $GSTREAMER_REQUIRED \
gstreamer-interfaces-0.10 \
gstreamer-plugins-base-0.10 >= $GSTREAMER_BASE_REQUIRED)
gstreamer-1.0 >= $GSTREAMER_REQUIRED \
gstreamer-base-1.0 >= $GSTREAMER_REQUIRED \
gstreamer-video-1.0 >= $GSTREAMER_BASE_REQUIRED \
gstreamer-pbutils-1.0 >= $GSTREAMER_BASE_REQUIRED \
gstreamer-tag-1.0 >= $GSTREAMER_BASE_REQUIRED)
BRASERO_GSTREAMER_CFLAGS="-DGST_USE_UNSTABLE_API $BRASERO_GSTREAMER_CFLAGS"
AC_SUBST(BRASERO_GSTREAMER_CFLAGS)
AC_SUBST(BRASERO_GSTREAMER_LIBS)
......
......@@ -783,6 +783,7 @@ end:
gst_query_unref (query);
}
/* FIXME: use GstDiscoverer ? */
static gboolean
brasero_metadata_get_mime_type (BraseroMetadata *self)
{
......@@ -825,72 +826,56 @@ brasero_metadata_get_mime_type (BraseroMetadata *self)
priv->info->type = g_strdup ("audio/mpeg");
else if (!strcmp (mime, "audio/x-wav")) {
GstElement *wavparse = NULL;
gpointer element = NULL;
GstIteratorResult res;
GstIterator *iter;
GValue value = { 0, };
priv->info->type = g_strdup (mime);
/* make sure it doesn't have dts inside */
iter = gst_bin_iterate_recurse (GST_BIN (priv->decode));
res = gst_iterator_next (iter, &element);
res = gst_iterator_next (iter, &value);
while (res == GST_ITERATOR_OK) {
GstElement *element;
gchar *name;
element = GST_ELEMENT (g_value_get_object (&value));
name = gst_object_get_name (GST_OBJECT (element));
if (name) {
if (!strncmp (name, "wavparse", 8)) {
wavparse = element;
wavparse = gst_object_ref (element);
g_value_unset (&value);
g_free (name);
break;
}
g_free (name);
}
gst_object_unref (element);
g_value_unset (&value);
element = NULL;
res = gst_iterator_next (iter, &element);
res = gst_iterator_next (iter, &value);
}
gst_iterator_free (iter);
if (wavparse) {
GstCaps *src_caps;
GstPad *src_pad;
iter = gst_element_iterate_src_pads (wavparse);
res = gst_iterator_next (iter, (gpointer *) &src_pad);
while (res == GST_ITERATOR_OK) {
GstCaps *src_caps;
src_caps = gst_pad_get_caps (src_pad);
if (src_caps) {
GstStructure *structure;
structure = gst_caps_get_structure (src_caps, 0);
if (structure) {
const gchar *name;
name = gst_structure_get_name (structure);
priv->info->has_dts = (g_strrstr (name, "audio/x-dts") != NULL);
if (priv->info->has_dts) {
gst_object_unref (src_pad);
gst_caps_unref (src_caps);
src_pad = NULL;
break;
}
}
gst_caps_unref (src_caps);
}
src_pad = gst_element_get_static_pad (wavparse, "src");
src_caps = gst_pad_get_current_caps (src_pad);
gst_object_unref (src_pad);
src_pad = NULL;
gst_object_unref (src_pad);
src_pad = NULL;
if (src_caps) {
GstStructure *structure;
res = gst_iterator_next (iter, (gpointer *) &src_pad);
/* negotiated caps will always have one structure */
structure = gst_caps_get_structure (src_caps, 0);
priv->info->has_dts = gst_structure_has_name (structure, "audio/x-dts");
gst_caps_unref (src_caps);
}
gst_iterator_free (iter);
gst_object_unref (wavparse);
}
......@@ -974,15 +959,18 @@ brasero_metadata_process_element_messages (BraseroMetadata *self,
GstMessage *msg)
{
BraseroMetadataPrivate *priv;
const GstStructure *s;
priv = BRASERO_METADATA_PRIVATE (self);
s = gst_message_get_structure (msg);
/* This is for snapshot function */
if (!strcmp (gst_structure_get_name (msg->structure), "preroll-pixbuf")
|| !strcmp (gst_structure_get_name (msg->structure), "pixbuf")) {
if (gst_message_has_name (msg, "preroll-pixbuf")
|| gst_message_has_name (msg, "pixbuf")) {
const GValue *value;
value = gst_structure_get_value (msg->structure, "pixbuf");
value = gst_structure_get_value (s, "pixbuf");
priv->info->snapshot = g_value_get_object (value);
g_object_ref (priv->info->snapshot);
......@@ -997,25 +985,25 @@ brasero_metadata_process_element_messages (BraseroMetadata *self,
&& gst_is_missing_plugin_message (msg)) {
priv->missing_plugins = g_slist_prepend (priv->missing_plugins, gst_message_ref (msg));
}
else if (!strcmp (gst_structure_get_name (msg->structure), "level")
&& gst_structure_has_field (msg->structure, "peak")) {
else if (gst_message_has_name (msg, "level")
&& gst_structure_has_field (s, "peak")) {
const GValue *value;
const GValue *list;
gdouble peak;
list = gst_structure_get_value (msg->structure, "peak");
/* FIXME: this might still be changed to GValueArray before 1.0 release */
list = gst_structure_get_value (s, "peak");
value = gst_value_list_get_value (list, 0);
peak = g_value_get_double (value);
/* detection of silence */
if (peak < -50.0) {
gint64 pos = -1;
GstFormat format = GST_FORMAT_TIME;
/* was there a silence last time we check ?
* NOTE: if that's the first signal we receive
* then consider that silence started from 0 */
gst_element_query_position (priv->pipeline, &format, &pos);
gst_element_query_position (priv->pipeline, GST_FORMAT_TIME, &pos);
if (pos == -1) {
BRASERO_UTILS_LOG ("impossible to retrieve position");
return TRUE;
......@@ -1110,7 +1098,6 @@ brasero_metadata_get_duration (BraseroMetadata *self,
GstElement *pipeline,
gboolean use_duration)
{
GstFormat format = GST_FORMAT_TIME;
BraseroMetadataPrivate *priv;
gint64 duration = -1;
......@@ -1118,11 +1105,11 @@ brasero_metadata_get_duration (BraseroMetadata *self,
if (!use_duration)
gst_element_query_position (GST_ELEMENT (pipeline),
&format,
GST_FORMAT_TIME,
&duration);
else
gst_element_query_duration (GST_ELEMENT (pipeline),
&format,
GST_FORMAT_TIME,
&duration);
if (duration == -1) {
......@@ -1200,7 +1187,7 @@ brasero_metadata_create_mp3_pipeline (BraseroMetadata *self)
source = gst_element_make_from_uri (GST_URI_SRC,
priv->info->uri,
NULL);
NULL, NULL);
if (!source) {
priv->error = g_error_new (BRASERO_UTILS_ERROR,
BRASERO_UTILS_ERROR_GENERAL,
......@@ -1485,12 +1472,12 @@ brasero_metadata_create_video_pipeline (BraseroMetadata *self)
"max-lateness", (gint64) - 1,
NULL);
colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
colorspace = gst_element_factory_make ("videoconvert", NULL);
if (!colorspace) {
gst_object_unref (priv->video);
priv->video = NULL;
BRASERO_UTILS_LOG ("ffmpegcolorspace is not installed");
BRASERO_UTILS_LOG ("videoconvert is not installed");
return FALSE;
}
gst_bin_add (GST_BIN (priv->video), colorspace);
......@@ -1642,7 +1629,6 @@ brasero_metadata_audio_caps (BraseroMetadata *self,
static void
brasero_metadata_new_decoded_pad_cb (GstElement *decode,
GstPad *pad,
gboolean is_lastpad, /* deprecated */
BraseroMetadata *self)
{
GstPad *sink;
......@@ -1661,11 +1647,13 @@ brasero_metadata_new_decoded_pad_cb (GstElement *decode,
BRASERO_UTILS_LOG ("New pad for %s", priv->info->uri);
/* make sure that this is audio / video */
caps = gst_pad_get_caps (pad);
structure = gst_caps_get_structure (caps, 0);
if (!structure)
/* FIXME: get_current_caps() doesn't always seem to work yet here */
caps = gst_pad_query_caps (pad, NULL);
if (!caps) {
g_warning ("Expected caps on decodebin pad %s", GST_PAD_NAME (pad));
return;
}
structure = gst_caps_get_structure (caps, 0);
name = gst_structure_get_name (structure);
has_audio = (g_strrstr (name, "audio") != NULL);
......@@ -1687,7 +1675,7 @@ brasero_metadata_new_decoded_pad_cb (GstElement *decode,
}
}
if (g_strrstr (name, "video/x-raw-") && !priv->video_linked) {
if (!strcmp (name, "video/x-raw") && !priv->video_linked) {
BRASERO_UTILS_LOG ("RAW video stream found");
if (!priv->video && (priv->flags & BRASERO_METADATA_FLAG_THUMBNAIL)) {
......@@ -1747,7 +1735,7 @@ brasero_metadata_create_pipeline (BraseroMetadata *self)
"\"Decodebin\"");
return FALSE;
}
g_signal_connect (G_OBJECT (priv->decode), "new-decoded-pad",
g_signal_connect (G_OBJECT (priv->decode), "pad-added",
G_CALLBACK (brasero_metadata_new_decoded_pad_cb),
self);
......@@ -1833,7 +1821,7 @@ brasero_metadata_set_new_uri (BraseroMetadata *self,
/* create a necessary source */
priv->source = gst_element_make_from_uri (GST_URI_SRC,
uri,
NULL);
NULL, NULL);
if (!priv->source) {
priv->error = g_error_new (BRASERO_UTILS_ERROR,
BRASERO_UTILS_ERROR_GENERAL,
......
......@@ -103,7 +103,6 @@ brasero_normalize_stop_pipeline (BraseroNormalize *normalize)
static void
brasero_normalize_new_decoded_pad_cb (GstElement *decode,
GstPad *pad,
gboolean arg2,
BraseroNormalize *normalize)
{
GstPad *sink;
......@@ -113,14 +112,15 @@ brasero_normalize_new_decoded_pad_cb (GstElement *decode,
priv = BRASERO_NORMALIZE_PRIVATE (normalize);
sink = gst_element_get_pad (priv->resample, "sink");
sink = gst_element_get_static_pad (priv->resample, "sink");
if (GST_PAD_IS_LINKED (sink)) {
BRASERO_JOB_LOG (normalize, "New decoded pad already linked");
return;
}
/* make sure we only have audio */
caps = gst_pad_get_caps (pad);
/* FIXME: get_current_caps() doesn't always seem to work yet here */
caps = gst_pad_query_caps (pad, NULL);
if (!caps)
return;
......@@ -164,7 +164,7 @@ brasero_normalize_build_pipeline (BraseroNormalize *normalize,
priv->pipeline = pipeline;
/* a new source is created */
source = gst_element_make_from_uri (GST_URI_SRC, uri, NULL);
source = gst_element_make_from_uri (GST_URI_SRC, uri, NULL, NULL);
if (source == NULL) {
g_set_error (error,
BRASERO_BURN_ERROR,
......@@ -246,7 +246,7 @@ brasero_normalize_build_pipeline (BraseroNormalize *normalize,
/* link everything */
g_signal_connect (G_OBJECT (decode),
"new-decoded-pad",
"pad-added",
G_CALLBACK (brasero_normalize_new_decoded_pad_cb),
normalize);
if (!gst_element_link_many (resample,
......@@ -582,12 +582,11 @@ brasero_normalize_clock_tick (BraseroJob *job)
gint64 position = 0.0;
gint64 duration = 0.0;
BraseroNormalizePrivate *priv;
GstFormat format = GST_FORMAT_TIME;
priv = BRASERO_NORMALIZE_PRIVATE (job);
gst_element_query_duration (priv->pipeline, &format, &duration);
gst_element_query_position (priv->pipeline, &format, &position);
gst_element_query_duration (priv->pipeline, GST_FORMAT_TIME, &duration);
gst_element_query_position (priv->pipeline, GST_FORMAT_TIME, &position);
if (duration > 0) {
GSList *tracks;
......
......@@ -66,7 +66,6 @@ static gboolean brasero_transcode_bus_messages (GstBus *bus,
BraseroTranscode *transcode);
static void brasero_transcode_new_decoded_pad_cb (GstElement *decode,
GstPad *pad,
gboolean arg2,
BraseroTranscode *transcode);
struct BraseroTranscodePrivate {
......@@ -99,21 +98,25 @@ typedef struct BraseroTranscodePrivate BraseroTranscodePrivate;
static GObjectClass *parent_class = NULL;
static gboolean
/* FIXME: this entire function looks completely wrong, if there is or
* was a bug in GStreamer it should be fixed there (tpm) */
static GstPadProbeReturn
brasero_transcode_buffer_handler (GstPad *pad,
GstBuffer *buffer,
BraseroTranscode *self)
GstPadProbeInfo *info,
gpointer user_data)
{
BraseroTranscodePrivate *priv;
BraseroTranscode *self = user_data;
GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER (info);
GstPad *peer;
gint64 size;
priv = BRASERO_TRANSCODE_PRIVATE (self);
size = GST_BUFFER_SIZE (buffer);
size = gst_buffer_get_size (buffer);
if (priv->segment_start <= 0 && priv->segment_end <= 0)
return TRUE;
return GST_PAD_PROBE_OK;
/* what we do here is more or less what gstreamer does when seeking:
* it reads and process from 0 to the seek position (I tried).
......@@ -121,7 +124,7 @@ brasero_transcode_buffer_handler (GstPad *pad,
* is a problem in our case as it would be written) */
if (priv->size > priv->segment_end) {
priv->size += size;
return FALSE;
return GST_PAD_PROBE_DROP;
}
if (priv->size + size > priv->segment_end) {
......@@ -132,9 +135,9 @@ brasero_transcode_buffer_handler (GstPad *pad,
/* create a new buffer and push it on the pad:
* NOTE: we're going to receive it ... */
data_size = priv->segment_end - priv->size;
new_buffer = gst_buffer_new_and_alloc (data_size);
memcpy (GST_BUFFER_DATA (new_buffer), GST_BUFFER_DATA (buffer), data_size);
new_buffer = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_METADATA, 0, data_size);
/* FIXME: we can now modify the probe buffer in 0.11 */
/* Recursive: the following calls ourselves BEFORE we finish */
peer = gst_pad_get_peer (pad);
gst_pad_push (peer, new_buffer);
......@@ -144,7 +147,7 @@ brasero_transcode_buffer_handler (GstPad *pad,
/* post an EOS event to stop pipeline */
gst_pad_push_event (peer, gst_event_new_eos ());
gst_object_unref (peer);
return FALSE;
return GST_PAD_PROBE_DROP;
}
/* see if the buffer is in the segment */
......@@ -155,36 +158,33 @@ brasero_transcode_buffer_handler (GstPad *pad,
/* see if all the buffer is interesting for us */
if (priv->size + size < priv->segment_start) {
priv->size += size;
return FALSE;
return GST_PAD_PROBE_DROP;
}
/* create a new buffer and push it on the pad:
* NOTE: we're going to receive it ... */
data_size = priv->size + size - priv->segment_start;
new_buffer = gst_buffer_new_and_alloc (data_size);
memcpy (GST_BUFFER_DATA (new_buffer),
GST_BUFFER_DATA (buffer) +
GST_BUFFER_SIZE (buffer) -
data_size,
data_size);
new_buffer = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_METADATA, size - data_size, data_size);
/* FIXME: this looks dodgy (tpm) */
GST_BUFFER_TIMESTAMP (new_buffer) = GST_BUFFER_TIMESTAMP (buffer) + data_size;
/* move forward by the size of bytes we dropped */
priv->size += size - data_size;
/* FIXME: we can now modify the probe buffer in 0.11 */
/* this is recursive the following calls ourselves
* BEFORE we finish */
peer = gst_pad_get_peer (pad);
gst_pad_push (peer, new_buffer);
gst_object_unref (peer);
return FALSE;
return GST_PAD_PROBE_DROP;
}
priv->size += size;
priv->pos += size;
return TRUE;
return GST_PAD_PROBE_OK;
}
static BraseroBurnResult
......@@ -236,11 +236,9 @@ brasero_transcode_send_volume_event (BraseroTranscode *transcode)
track_gain = g_value_get_double (value);
/* it's possible we fail */
tag_list = gst_tag_list_new ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, track_gain,
GST_TAG_TRACK_PEAK, track_peak,
NULL);
tag_list = gst_tag_list_new (GST_TAG_TRACK_GAIN, track_gain,
GST_TAG_TRACK_PEAK, track_peak,
NULL);
/* NOTE: that event is goind downstream */
event = gst_event_new_tag (tag_list);
......@@ -361,34 +359,6 @@ brasero_transcode_error_on_pad_linking (BraseroTranscode *self,
g_object_unref (bus);
}
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 gboolean
brasero_transcode_create_pipeline (BraseroTranscode *transcode,
GError **error)
......@@ -429,8 +399,8 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
/* create three types of pipeline according to the needs: (possibly adding grvolume)
* - filesrc ! decodebin ! audioconvert ! fakesink (find size) and filesrc!mp3parse!fakesink for mp3s
* - filesrc ! decodebin ! audioresample ! audioconvert ! audio/x-raw-int,rate=44100,width=16,depth=16,endianness=4321,signed ! filesink
* - filesrc ! decodebin ! audioresample ! audioconvert ! audio/x-raw-int,rate=44100,width=16,depth=16,endianness=4321,signed ! fdsink
* - filesrc ! decodebin ! audioresample ! audioconvert ! audio/x-raw,format=S16BE,rate=44100 ! filesink
* - filesrc ! decodebin ! audioresample ! audioconvert ! audio/x-raw,format=S16BE,rate=44100 ! fdsink
*/
pipeline = gst_pipeline_new (NULL);
......@@ -443,7 +413,7 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
/* source */
brasero_job_get_current_track (BRASERO_JOB (transcode), &track);
uri = brasero_track_stream_get_source (BRASERO_TRACK_STREAM (track), TRUE);
source = gst_element_make_from_uri (GST_URI_SRC, uri, NULL);
source = gst_element_make_from_uri (GST_URI_SRC, uri, NULL, NULL);
g_free (uri);
if (source == NULL) {
......@@ -546,7 +516,7 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
}
gst_bin_add (GST_BIN (pipeline), wavparse);
if (!gst_element_link (source, wavparse)) {
if (!gst_element_link_many (source, wavparse, sink, NULL)) {
g_set_error (error,
BRASERO_BURN_ERROR,
BRASERO_BURN_ERROR_GENERAL,
......@@ -554,19 +524,15 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
goto error;
}
g_signal_connect (wavparse,
"pad-added",
G_CALLBACK (brasero_transcode_wavparse_pad_added_cb),
transcode);
/* This is an ugly workaround for the lack of accuracy with
* gstreamer. Yet this is unfortunately a necessary evil. */
/* FIXME: this does not look like it makes sense... (tpm) */
priv->pos = 0;
priv->size = 0;
sinkpad = gst_element_get_pad (sink, "sink");
priv->probe = gst_pad_add_buffer_probe (sinkpad,
G_CALLBACK (brasero_transcode_buffer_handler),
transcode);
sinkpad = gst_element_get_static_pad (sink, "sink");
priv->probe = gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_BUFFER,
brasero_transcode_buffer_handler,
transcode, NULL);
gst_object_unref (sinkpad);
......@@ -625,14 +591,11 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
goto error;
}
gst_bin_add (GST_BIN (pipeline), filter);
filtercaps = gst_caps_new_full (gst_structure_new ("audio/x-raw-int",
"channels", G_TYPE_INT, 2,
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
filtercaps = gst_caps_new_full (gst_structure_new ("audio/x-raw",
/* NOTE: we use little endianness only for libburn which requires little */
"endianness", G_TYPE_INT, (session_format & BRASERO_AUDIO_FORMAT_RAW_LITTLE_ENDIAN) != 0 ? 1234:4321,
"format", G_TYPE_STRING, (session_format & BRASERO_AUDIO_FORMAT_RAW_LITTLE_ENDIAN) != 0 ? "S16LE" : "S16BE",
"channels", G_TYPE_INT, 2,
"rate", G_TYPE_INT, 44100,
"signed", G_TYPE_BOOLEAN, TRUE,
NULL),
NULL);
g_object_set (GST_OBJECT (filter), "caps", filtercaps, NULL);
......@@ -666,7 +629,7 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
priv->link = resample;
g_signal_connect (G_OBJECT (decode),
"new-decoded-pad",
"pad-added",
G_CALLBACK (brasero_transcode_new_decoded_pad_cb),
transcode);
......@@ -697,12 +660,13 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
/* This is an ugly workaround for the lack of accuracy with
* gstreamer. Yet this is unfortunately a necessary evil. */
/* FIXME: this does not look like it makes sense... (tpm) */
priv->pos = 0;
priv->size = 0;
sinkpad = gst_element_get_pad (sink, "sink");
priv->probe = gst_pad_add_buffer_probe (sinkpad,
G_CALLBACK (brasero_transcode_buffer_handler),
transcode);
sinkpad = gst_element_get_static_pad (sink, "sink");
priv->probe = gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_BUFFER,
brasero_transcode_buffer_handler,
transcode, NULL);
gst_object_unref (sinkpad);
}
else {
......@@ -718,7 +682,7 @@ brasero_transcode_create_pipeline (BraseroTranscode *transcode,
priv->link = convert;
g_signal_connect (G_OBJECT (decode),
"new-decoded-pad",
"pad-added",
G_CALLBACK (brasero_transcode_new_decoded_pad_cb),
transcode);
}
......@@ -1005,9 +969,9 @@ brasero_transcode_stop_pipeline (BraseroTranscode *transcode)
if (!priv->pipeline)
return;
sinkpad = gst_element_get_pad (priv->sink, "sink");
sinkpad = gst_element_get_static_pad (priv->sink, "sink");
if (priv->probe)
gst_pad_remove_buffer_probe (sinkpad, priv->probe);
gst_pad_remove_probe (sinkpad, priv->probe);
gst_object_unref (sinkpad);
......@@ -1322,7 +1286,6 @@ brasero_transcode_get_duration (BraseroTranscode *transcode)
{
gint64 duration = -1;
BraseroTranscodePrivate *priv;
GstFormat format = GST_FORMAT_TIME;
priv = BRASERO_TRANSCODE_PRIVATE (transcode);
......@@ -1331,17 +1294,17 @@ brasero_transcode_get_duration (BraseroTranscode *transcode)
/* This is the most reliable way to get the duration for mp3
* read them till the end and get the position. */
gst_element_query_position (priv->pipeline,
&format,
GST_FORMAT_TIME,
&duration);
}
/* This is for any sort of files */
if (duration == -1 || duration == 0)
gst_element_query_duration (priv->pipeline,
&format,
GST_FORMAT_TIME,
&duration);
BRASERO_JOB_LOG (transcode, "got duration %"G_GINT64_FORMAT, duration);
BRASERO_JOB_LOG (transcode, "got duration %" GST_TIME_FORMAT, GST_TIME_ARGS (duration));
if (duration == -1 || duration == 0)
brasero_job_error (BRASERO_JOB (transcode),
......@@ -1623,7 +1586,6 @@ brasero_transcode_bus_messages (GstBus *bus,
static void
brasero_transcode_new_decoded_pad_cb (GstElement *decode,
GstPad *pad,
gboolean arg2,
BraseroTranscode *transcode)
{
GstCaps *caps;
......@@ -1635,7 +1597,8 @@ brasero_transcode_new_decoded_pad_cb (GstElement *decode,
BRASERO_JOB_LOG (transcode, "New pad");
/* make sure we only have audio */
caps = gst_pad_get_caps (pad);
/* FIXME: get_current_caps() doesn't always seem to work yet here */
caps = gst_pad_query_caps (pad, NULL);
if (!caps)
return;
......@@ -1659,7 +1622,7 @@ brasero_transcode_new_decoded_pad_cb (GstElement *decode,
goto end;
}
sink = gst_element_get_pad (queue, "sink");
sink = gst_element_get_static_pad (queue, "sink");
if (GST_PAD_IS_LINKED (sink)) {
brasero_transcode_error_on_pad_linking (transcode, "Sent by brasero_transcode_new_decoded_pad_cb");
goto end;
......
......@@ -197,7 +197,6 @@ brasero_vob_error_on_pad_linking (BraseroVob *self,
static void
brasero_vob_new_decoded_pad_cb (GstElement *decode,
GstPad *pad,
gboolean arg2,
BraseroVob *vob)
{
GstPad *sink;
......@@ -208,7 +207,7 @@ brasero_vob_new_decoded_pad_cb (GstElement *decode,
priv = BRASERO_VOB_PRIVATE (vob);
/* make sure we only have audio */
caps = gst_pad_get_caps (pad);
caps = gst_pad_query_caps (pad, NULL);
if (!caps)
return;
......@@ -217,7 +216,7 @@ brasero_vob_new_decoded_pad_cb (GstElement *decode,
if (g_strrstr (gst_structure_get_name (structure), "video")) {
GstPadLinkReturn res;
sink = gst_element_get_pad (priv->video, "sink");
sink = gst_element_get_static_pad (priv->video, "sink");
res = gst_pad_link (pad, sink);
gst_object_unref (sink);
......@@ -230,7 +229,7 @@ brasero_vob_new_decoded_pad_cb (GstElement *decode,
if (g_strrstr (gst_structure_get_name (structure), "audio")) {
GstPadLinkReturn res;
sink = gst_element_get_pad (priv->audio, "sink");
sink = gst_element_get_static_pad (priv->audio, "sink");
res = gst_pad_link (pad, sink);
gst_object_unref (sink);
......@@ -255,7 +254,7 @@ brasero_vob_link_audio (BraseroVob *vob,
GstPad *sinkpad;
GstPadLinkReturn res;
srcpad = gst_element_get_request_pad (tee, "src%d");
srcpad = gst_element_get_request_pad (tee, "src_%u");
sinkpad = gst_element_get_static_pad (start, "sink");
res = gst_pad_link (srcpad, sinkpad);
gst_object_unref (sinkpad);
......@@ -265,7 +264,7 @@ brasero_vob_link_audio (BraseroVob *vob,
if (res != GST_PAD_LINK_OK)
return FALSE;
sinkpad = gst_element_get_request_pad (muxer, "audio_%d");
sinkpad = gst_element_get_request_pad (muxer, "audio_%u");
srcpad = gst_element_get_static_pad (end, "src");
res = gst_pad_link (srcpad, sinkpad);
gst_object_unref (sinkpad);
......@@ -377,12 +376,10 @@ brasero_vob_build_audio_pcm (BraseroVob *vob,
gst_bin_add (GST_BIN (priv->pipeline), filter);
/* NOTE: what about the number of channels (up to 6) ? */
filtercaps = gst_caps_new_full (gst_structure_new ("audio/x-raw-int",
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, 48000,
NULL),
NULL);
filtercaps = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, "S16BE",
"rate", G_TYPE_INT, 48000,
NULL);
g_object_set (GST_OBJECT (filter), "caps", filtercaps, NULL);
gst_caps_unref (filtercaps);
......@@ -464,13 +461,13 @@ brasero_vob_build_audio_mp2 (BraseroVob *vob,
gst_bin_add (GST_BIN (priv->pipeline), resample);
/* encoder */
encode = gst_element_factory_make ("ffenc_mp2", NULL);
encode = gst_element_factory_make ("avenc_mp2", NULL);
if (encode == NULL) {
g_set_error (error,
BRASERO_BURN_ERROR,
BRASERO_BURN_ERROR_GENERAL,
_("%s element could not be created"),