+ And specify default restriction caps for audio tracks.
+ Add ges_track_set_restriction_caps to the sections, it
was missing.
https://bugzilla.gnome.org/show_bug.cgi?id=740726
GESCreateElementForGapFunc
ges_track_new
ges_track_add_element
+ges_track_set_restriction_caps
+ges_track_update_restriction_caps
ges_track_remove_element
ges_track_set_caps
ges_track_get_caps
/**
* SECTION: gesaudiotrack
* @short_description: A standard GESTrack for raw audio
+ *
+ * Sane default properties to specify and fixate the output stream are
+ * set as restriction-caps.
+ * It is advised, to modify these properties, to use
+ * #ges_track_update_restriction_caps, setting them directly is
+ * possible through #ges_track_set_restriction_caps, but not specifying
+ * one of them can lead to negotiation issues, only use that function
+ * if you actually know what you're doing :)
+ *
+ * The default properties are:
+ * - format: S32LE
+ * - channels: 2
+ * - rate: 44100
+ * - layout: interleaved
*/
-#define DEFAULT_CAPS "audio/x-raw"
-
#include "ges-internal.h"
#include "ges-smart-adder.h"
#include "ges-audio-track.h"
+#define DEFAULT_CAPS "audio/x-raw"
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define DEFAULT_RESTRICTION_CAPS "audio/x-raw, format=S32LE, channels=2, "\
+ "rate=44100, layout=interleaved"
+#else
+#define DEFAULT_RESTRICTION_CAPS "audio/x-raw, format=S32BE, channels=2, "\
+ "rate=44100, layout=interleaved"
+#endif
+
struct _GESAudioTrackPrivate
{
gpointer nothing;
ges_track_set_create_element_for_gap_func (GES_TRACK (ret),
create_element_for_raw_audio_gap);
+ ges_track_set_restriction_caps (GES_TRACK (ret),
+ gst_caps_from_string (DEFAULT_RESTRICTION_CAPS));
gst_caps_unref (caps);
return ret;
}
}
+static gboolean
+update_field (GQuark field_id, const GValue * value, GstStructure * original)
+{
+ gst_structure_id_set_value (original, field_id, value);
+ return TRUE;
+}
+
/* callbacks */
static void
sort_track_elements_cb (GESTrackElement * child,
}
/**
+ * ges_track_update_restriction_caps:
+ * @track: a #GESTrack
+ * @caps: the #GstCaps to update with
+ *
+ * Updates the restriction caps by modifying all the fields present in @caps
+ * in the original restriction caps. If for example the current restriction caps
+ * are video/x-raw, format=I420, width=360 and @caps is video/x-raw, format=RGB,
+ * the restriction caps will be updated to video/x-raw, format=RGB, width=360.
+ *
+ * Modification happens for each structure in the new caps, and
+ * one can add new fields or structures through that function.
+ */
+void
+ges_track_update_restriction_caps (GESTrack * self, const GstCaps * caps)
+{
+ guint i;
+ GstCaps *new_restriction_caps = gst_caps_copy (self->priv->restriction_caps);
+
+ for (i = 0; i < gst_caps_get_size (caps); i++) {
+ GstStructure *new = gst_caps_get_structure (caps, i);
+
+ if (gst_caps_get_size (new_restriction_caps) > i) {
+ GstStructure *original = gst_caps_get_structure (new_restriction_caps, i);
+ gst_structure_foreach (new, (GstStructureForeachFunc) update_field,
+ original);
+ } else
+ gst_caps_append_structure (new_restriction_caps,
+ gst_structure_copy (new));
+ }
+
+ ges_track_set_restriction_caps (self, new_restriction_caps);
+}
+
+/**
* ges_track_set_mixing:
* @track: a #GESTrack
* @mixing: TRUE if the track should be mixing, FALSE otherwise.
void ges_track_set_mixing (GESTrack *track, gboolean mixing);
gboolean ges_track_get_mixing (GESTrack *track);
void ges_track_set_restriction_caps (GESTrack *track, const GstCaps *caps);
+void ges_track_update_restriction_caps (GESTrack *track, const GstCaps *caps);
/* standard methods */
GType ges_track_get_type (void);
ges/mixers\
ges/group\
ges/project\
+ ges/track\
nle/simple \
nle/complex \
nle/nleoperation \
timelineedition
titles
transition
+track