[brasero] Port brasero to GStreamer 1.0
- From: Javier JardÃn <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [brasero] Port brasero to GStreamer 1.0
- Date: Tue, 21 Aug 2012 21:10:35 +0000 (UTC)
commit 526d70150af05fd6700c37deac7c0d6c540a4198
Author: Tim-Philipp MÃller <tim centricular net>
Date: Wed Aug 1 11:09:53 2012 +0100
Port brasero to GStreamer 1.0
Tentative port. Barely tested so far.
configure.in | 14 ++--
libbrasero-utils/brasero-metadata.c | 102 ++++++++++++---------------
plugins/transcode/burn-normalize.c | 15 ++--
plugins/transcode/burn-transcode.c | 135 +++++++++++++----------------------
plugins/transcode/burn-vob.c | 80 +++++++++------------
src/brasero-player-bacon.c | 77 +++++++++++---------
src/brasero-song-control.c | 7 +-
7 files changed, 188 insertions(+), 242 deletions(-)
---
diff --git a/configure.in b/configure.in
index 4a9a3ed..e1110a5 100644
--- a/configure.in
+++ b/configure.in
@@ -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)
diff --git a/libbrasero-utils/brasero-metadata.c b/libbrasero-utils/brasero-metadata.c
index f1c69fb..1088121 100644
--- a/libbrasero-utils/brasero-metadata.c
+++ b/libbrasero-utils/brasero-metadata.c
@@ -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,
diff --git a/plugins/transcode/burn-normalize.c b/plugins/transcode/burn-normalize.c
index 60098fa..38baf56 100644
--- a/plugins/transcode/burn-normalize.c
+++ b/plugins/transcode/burn-normalize.c
@@ -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;
diff --git a/plugins/transcode/burn-transcode.c b/plugins/transcode/burn-transcode.c
index eace97f..a6a0f40 100644
--- a/plugins/transcode/burn-transcode.c
+++ b/plugins/transcode/burn-transcode.c
@@ -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;
diff --git a/plugins/transcode/burn-vob.c b/plugins/transcode/burn-vob.c
index ced3c23..1ddcdef 100644
--- a/plugins/transcode/burn-vob.c
+++ b/plugins/transcode/burn-vob.c
@@ -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"),
- "\"ffenc_mp2\"");
+ "\"avenc_mp2\"");
goto error;
}
gst_bin_add (GST_BIN (priv->pipeline), encode);
@@ -511,10 +508,7 @@ brasero_vob_build_audio_mp2 (BraseroVob *vob,
NULL);
/* NOTE: what about the number of channels (up to 7.1) ? */
- filtercaps = gst_caps_new_full (gst_structure_new ("audio/x-raw-int",
- "rate", G_TYPE_INT, 48000,
- NULL),
- NULL);
+ filtercaps = gst_caps_new_simple ("audio/x-raw", "rate", G_TYPE_INT, 48000, NULL);
}
else if (!priv->svcd) {
/* VCD */
@@ -524,11 +518,10 @@ brasero_vob_build_audio_mp2 (BraseroVob *vob,
NULL);
/* 2 channels tops */
- filtercaps = gst_caps_new_full (gst_structure_new ("audio/x-raw-int",
- "channels", G_TYPE_INT, 2,
- "rate", G_TYPE_INT, 44100,
- NULL),
- NULL);
+ filtercaps = gst_caps_new_simple ("audio/x-raw",
+ "channels", G_TYPE_INT, 2,
+ "rate", G_TYPE_INT, 44100,
+ NULL);
}
else {
/* SVCDs */
@@ -538,10 +531,7 @@ brasero_vob_build_audio_mp2 (BraseroVob *vob,
NULL);
/* NOTE: channels up to 5.1 or dual */
- filtercaps = gst_caps_new_full (gst_structure_new ("audio/x-raw-int",
- "rate", G_TYPE_INT, 44100,
- NULL),
- NULL);
+ filtercaps = gst_caps_new_simple ("audio/x-raw", "rate", G_TYPE_INT, 44100, NULL);
}
g_object_set (GST_OBJECT (filter), "caps", filtercaps, NULL);
@@ -638,22 +628,19 @@ brasero_vob_build_audio_ac3 (BraseroVob *vob,
BRASERO_JOB_LOG (vob, "Setting AC3 rate to 48000");
/* NOTE: we may want to limit the number of channels. */
- filtercaps = gst_caps_new_full (gst_structure_new ("audio/x-raw-int",
- "rate", G_TYPE_INT, 48000,
- NULL),
- NULL);
+ filtercaps = gst_caps_new_simple ("audio/x-raw", "rate", G_TYPE_INT, 48000, NULL);
g_object_set (GST_OBJECT (filter), "caps", filtercaps, NULL);
gst_caps_unref (filtercaps);
/* encoder */
- encode = gst_element_factory_make ("ffenc_ac3", NULL);
+ encode = gst_element_factory_make ("avenc_ac3", NULL);
if (encode == NULL) {
g_set_error (error,
BRASERO_BURN_ERROR,
BRASERO_BURN_ERROR_GENERAL,
_("%s element could not be created"),
- "\"Ffenc_ac3\"");
+ "\"avenc_ac3\"");
goto error;
}
gst_bin_add (GST_BIN (priv->pipeline), encode);
@@ -842,13 +829,13 @@ brasero_vob_build_video_bin (BraseroVob *vob,
}
gst_bin_add (GST_BIN (priv->pipeline), filter);
- colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
+ colorspace = gst_element_factory_make ("videoconvert", NULL);
if (colorspace == NULL) {
g_set_error (error,
BRASERO_BURN_ERROR,
BRASERO_BURN_ERROR_GENERAL,
_("%s element could not be created"),
- "\"Ffmepgcolorspace\"");
+ "\"videoconvert\"");
goto error;
}
gst_bin_add (GST_BIN (priv->pipeline), colorspace);
@@ -1054,7 +1041,7 @@ brasero_vob_build_video_bin (BraseroVob *vob,
}
srcpad = gst_element_get_static_pad (queue1, "src");
- sinkpad = gst_element_get_request_pad (muxer, "video_%d");
+ sinkpad = gst_element_get_request_pad (muxer, "video_%u");
res = gst_pad_link (srcpad, sinkpad);
BRASERO_JOB_LOG (vob, "Linked video bin to muxer == %d", res)
gst_object_unref (sinkpad);
@@ -1092,7 +1079,7 @@ brasero_vob_build_pipeline (BraseroVob *vob,
/* source */
brasero_job_get_current_track (BRASERO_JOB (vob), &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);
if (!source) {
g_set_error (error,
BRASERO_BURN_ERROR,
@@ -1192,7 +1179,7 @@ brasero_vob_build_pipeline (BraseroVob *vob,
/* to be able to link everything */
g_signal_connect (G_OBJECT (decode),
- "new-decoded-pad",
+ "pad-added",
G_CALLBACK (brasero_vob_new_decoded_pad_cb),
vob);
@@ -1276,17 +1263,16 @@ brasero_vob_get_progress_from_element (BraseroJob *job,
{
gint64 position = 0;
gint64 duration = 0;
- GstFormat format = GST_FORMAT_TIME;
- gst_element_query_duration (element, &format, &duration);
- gst_element_query_position (element, &format, &position);
+ gst_element_query_duration (element, GST_FORMAT_TIME, &duration);
+ gst_element_query_position (element, GST_FORMAT_TIME, &position);
+ /* FIXME: could also try GST_FORMAT_PERCENT position query */
if (duration <= 0 || position < 0) {
- format = GST_FORMAT_BYTES;
duration = 0;
position = 0;
- gst_element_query_duration (element, &format, &duration);
- gst_element_query_position (element, &format, &position);
+ gst_element_query_duration (element, GST_FORMAT_BYTES, &duration);
+ gst_element_query_position (element, GST_FORMAT_BYTES, &position);
}
if (duration > 0 && position >= 0) {
@@ -1412,8 +1398,8 @@ G_MODULE_EXPORT void
brasero_plugin_check_config (BraseroPlugin *plugin)
{
/* Let's see if we've got the plugins we need */
- brasero_plugin_test_gstreamer_plugin (plugin, "ffenc_mpeg2video");
- brasero_plugin_test_gstreamer_plugin (plugin, "ffenc_ac3");
- brasero_plugin_test_gstreamer_plugin (plugin, "ffenc_mp2");
+ brasero_plugin_test_gstreamer_plugin (plugin, "avenc_mpeg2video");
+ brasero_plugin_test_gstreamer_plugin (plugin, "avenc_ac3");
+ brasero_plugin_test_gstreamer_plugin (plugin, "avenc_mp2");
brasero_plugin_test_gstreamer_plugin (plugin, "mplex");
}
diff --git a/src/brasero-player-bacon.c b/src/brasero-player-bacon.c
index 8a7b3f0..eeec83c 100644
--- a/src/brasero-player-bacon.c
+++ b/src/brasero-player-bacon.c
@@ -38,7 +38,7 @@
#include <gtk/gtk.h>
#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/video/videooverlay.h>
#include "brasero-player-bacon.h"
#include "brasero-setting.h"
@@ -48,7 +48,7 @@ struct BraseroPlayerBaconPrivate {
GstElement *pipe;
GstState state;
- GstXOverlay *xoverlay;
+ GstVideoOverlay *xoverlay;
XID xid;
gchar *uri;
@@ -178,9 +178,9 @@ brasero_player_bacon_draw (GtkWidget *widget, cairo_t *cr)
bacon->priv->xid = gdk_x11_window_get_xid (window);
if (bacon->priv->xoverlay
- && GST_IS_X_OVERLAY (bacon->priv->xoverlay)
+ && GST_IS_VIDEO_OVERLAY (bacon->priv->xoverlay)
&& bacon->priv->state >= GST_STATE_PAUSED)
- gst_x_overlay_expose (bacon->priv->xoverlay);
+ gst_video_overlay_expose (bacon->priv->xoverlay);
else if (window)
gtk_widget_queue_draw (GTK_WIDGET (widget));
@@ -253,28 +253,26 @@ brasero_player_bacon_size_allocate (GtkWidget *widget,
GTK_WIDGET_CLASS (brasero_player_bacon_parent_class)->size_allocate (widget, allocation);
}
+/* FIXME: we could get rid of this by setting the XID directly on playbin
+ * right after creation, since it proxies the video overlay interface now */
static GstBusSyncReply
brasero_player_bacon_bus_messages_handler (GstBus *bus,
GstMessage *message,
BraseroPlayerBacon *bacon)
{
- const GstStructure *structure;
-
- structure = gst_message_get_structure (message);
- if (!structure)
- return GST_BUS_PASS;
-
- if (!gst_structure_has_name (structure, "prepare-xwindow-id"))
+ if (!gst_is_video_overlay_prepare_window_handle_message (message))
return GST_BUS_PASS;
/* NOTE: apparently GDK does not like to be asked to retrieve the XID
* in a thread so we do it in the callback of the expose event. */
- bacon->priv->xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
- gst_x_overlay_set_xwindow_id (bacon->priv->xoverlay, bacon->priv->xid);
+ bacon->priv->xoverlay = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
+ gst_video_overlay_set_window_handle (bacon->priv->xoverlay,
+ bacon->priv->xid);
return GST_BUS_DROP;
}
+#if 0
static void
brasero_player_bacon_clear_pipe (BraseroPlayerBacon *bacon)
{
@@ -299,6 +297,7 @@ brasero_player_bacon_clear_pipe (BraseroPlayerBacon *bacon)
bacon->priv->uri = NULL;
}
}
+#endif
void
brasero_player_bacon_set_uri (BraseroPlayerBacon *bacon, const gchar *uri)
@@ -460,34 +459,36 @@ gboolean
brasero_player_bacon_forward (BraseroPlayerBacon *bacon,
gint64 pos)
{
+ gint64 cur;
+
if (!bacon->priv->pipe)
return FALSE;
- return gst_element_seek (bacon->priv->pipe,
- 1.0,
+ if (!gst_element_query_position (bacon->priv->pipe, GST_FORMAT_TIME, &cur))
+ return FALSE;
+
+ return gst_element_seek_simple (bacon->priv->pipe,
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_CUR,
- pos,
- GST_SEEK_TYPE_NONE,
- 0);
+ cur + pos);
}
gboolean
brasero_player_bacon_backward (BraseroPlayerBacon *bacon,
gint64 pos)
{
+ gint64 cur;
+
if (!bacon->priv->pipe)
return FALSE;
- return gst_element_seek (bacon->priv->pipe,
- 1.0,
+ if (!gst_element_query_position (bacon->priv->pipe, GST_FORMAT_TIME, &cur))
+ return FALSE;
+
+ return gst_element_seek_simple (bacon->priv->pipe,
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET,
- - pos,
- GST_SEEK_TYPE_NONE,
- 0);
+ MAX (0, cur - pos));
}
gboolean
@@ -511,7 +512,6 @@ gboolean
brasero_player_bacon_get_pos (BraseroPlayerBacon *bacon,
gint64 *pos)
{
- GstFormat format = GST_FORMAT_TIME;
gboolean result;
gint64 value;
@@ -520,7 +520,7 @@ brasero_player_bacon_get_pos (BraseroPlayerBacon *bacon,
if (pos) {
result = gst_element_query_position (bacon->priv->pipe,
- &format,
+ GST_FORMAT_TIME,
&value);
if (!result)
return FALSE;
@@ -545,15 +545,19 @@ brasero_player_bacon_setup_pipe (BraseroPlayerBacon *bacon)
return;
}
- audio_sink = gst_element_factory_make ("gconfaudiosink", NULL);
+ audio_sink = gst_element_factory_make ("gsettingsaudiosink", NULL);
if (audio_sink)
g_object_set (G_OBJECT (bacon->priv->pipe),
"audio-sink", audio_sink,
NULL);
+/* FIXME: fall back on autoaudiosink for now, since gsettings plugin is
+ * not ported yet */
+#if 0
else
goto error;
+#endif
- video_sink = gst_element_factory_make ("gconfvideosink", NULL);
+ video_sink = gst_element_factory_make ("gsettingsvideosink", NULL);
if (video_sink) {
GstElement *element;
@@ -562,15 +566,18 @@ brasero_player_bacon_setup_pipe (BraseroPlayerBacon *bacon)
NULL);
element = gst_bin_get_by_interface (GST_BIN (video_sink),
- GST_TYPE_X_OVERLAY);
- if (element && GST_IS_X_OVERLAY (element))
- bacon->priv->xoverlay = GST_X_OVERLAY (element);
+ GST_TYPE_VIDEO_OVERLAY);
+ if (element && GST_IS_VIDEO_OVERLAY (element))
+ bacon->priv->xoverlay = GST_VIDEO_OVERLAY (element);
}
bus = gst_pipeline_get_bus (GST_PIPELINE (bacon->priv->pipe));
+ /* FIXME: we should just set the XID directly on playbin right after
+ * creation, since it proxies the video overlay interface now, and get
+ * rid of the sync message handler and the stuff above */
gst_bus_set_sync_handler (bus,
(GstBusSyncHandler) brasero_player_bacon_bus_messages_handler,
- bacon);
+ bacon, NULL);
gst_bus_add_watch (bus,
(GstBusFunc) brasero_player_bacon_bus_messages,
bacon);
@@ -588,6 +595,7 @@ brasero_player_bacon_setup_pipe (BraseroPlayerBacon *bacon)
return;
+#if 0
error:
g_message ("player creation error");
brasero_player_bacon_clear_pipe (bacon);
@@ -596,6 +604,7 @@ error:
0,
BACON_STATE_ERROR);
gtk_widget_queue_resize (GTK_WIDGET (bacon));
+#endif
}
static void
@@ -627,7 +636,7 @@ brasero_player_bacon_destroy (GtkWidget *obj)
}
if (cobj->priv->xoverlay
- && GST_IS_X_OVERLAY (cobj->priv->xoverlay))
+ && GST_IS_VIDEO_OVERLAY (cobj->priv->xoverlay))
cobj->priv->xoverlay = NULL;
if (cobj->priv->pipe) {
diff --git a/src/brasero-song-control.c b/src/brasero-song-control.c
index 06cf14f..3a67a8f 100644
--- a/src/brasero-song-control.c
+++ b/src/brasero-song-control.c
@@ -159,11 +159,10 @@ brasero_song_control_update_progress_cb (BraseroSongControl *player)
{
gint64 pos;
BraseroSongControlPrivate *priv;
- GstFormat format = GST_FORMAT_TIME;
priv = BRASERO_SONG_CONTROL_PRIVATE (player);
gst_element_query_position (priv->pipe,
- &format,
+ GST_FORMAT_TIME,
&pos);
if (pos >= 0) {
@@ -491,11 +490,11 @@ brasero_song_control_init (BraseroSongControl *object)
priv = BRASERO_SONG_CONTROL_PRIVATE (object);
/* Pipeline */
- priv->pipe = gst_element_factory_make ("playbin2", NULL);
+ priv->pipe = gst_element_factory_make ("playbin", NULL);
if (priv->pipe) {
GstElement *audio_sink;
- audio_sink = gst_element_factory_make ("gconfaudiosink", NULL);
+ audio_sink = gst_element_factory_make ("gsettingsaudiosink", NULL);
if (audio_sink)
g_object_set (G_OBJECT (priv->pipe),
"audio-sink", audio_sink,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]