mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +00:00
track: [API]: ges_track_update_restriction_caps.
+ 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
This commit is contained in:
parent
0d3044b78d
commit
f85c463b93
6 changed files with 72 additions and 2 deletions
|
@ -71,6 +71,8 @@ GESTrack
|
|||
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
|
||||
|
|
|
@ -20,14 +20,36 @@
|
|||
/**
|
||||
* 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;
|
||||
|
@ -106,6 +128,8 @@ ges_audio_track_new (void)
|
|||
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;
|
||||
|
|
|
@ -248,6 +248,13 @@ track_resort_and_fill_gaps (GESTrack * track)
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -749,6 +756,40 @@ ges_track_set_restriction_caps (GESTrack * track, const GstCaps * caps)
|
|||
g_object_notify (G_OBJECT (track), "restriction-caps");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -92,6 +92,7 @@ void ges_track_set_create_element_for_gap_func (GESTrack *track, G
|
|||
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);
|
||||
|
|
|
@ -42,6 +42,7 @@ check_PROGRAMS = \
|
|||
ges/mixers\
|
||||
ges/group\
|
||||
ges/project\
|
||||
ges/track\
|
||||
nle/simple \
|
||||
nle/complex \
|
||||
nle/nleoperation \
|
||||
|
|
1
tests/check/ges/.gitignore
vendored
1
tests/check/ges/.gitignore
vendored
|
@ -11,3 +11,4 @@ clip
|
|||
timelineedition
|
||||
titles
|
||||
transition
|
||||
track
|
||||
|
|
Loading…
Reference in a new issue