Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration #45

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions docs/libs/ges-sections.txt
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ ges_pipeline_preview_get_audio_sink
ges_pipeline_preview_get_video_sink
ges_pipeline_preview_set_audio_sink
ges_pipeline_preview_set_video_sink
ges_pipeline_get_mode
ges_pipeline_get_thumbnail
ges_pipeline_get_thumbnail_rgb24
ges_pipeline_save_thumbnail
Expand Down
24 changes: 24 additions & 0 deletions ges/ges-asset.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@

#include <gst/gst.h>

#include <string.h>

enum
{
PROP_0,
Expand Down Expand Up @@ -558,6 +560,27 @@ ges_asset_cache_put (GESAsset * asset, GSimpleAsyncResult * res)
UNLOCK_CACHE;
}

static void
_init_effect_assets (void)
{
GstRegistry *registry;
GList *features, *tmp;

registry = gst_registry_get ();
features = gst_registry_get_feature_list (registry, GST_TYPE_ELEMENT_FACTORY);
for (tmp = features; tmp; tmp = tmp->next) {
GstElementFactory *fact = tmp->data;
const gchar *klass;

klass = gst_element_factory_get_metadata (fact, "klass");
if (strstr (klass, "Effect")) {
GESAsset *asset = ges_asset_request (GES_TYPE_EFFECT,
gst_plugin_feature_get_name (fact), NULL);
gst_object_unref (asset);
}
}
}

void
ges_asset_cache_init (void)
{
Expand All @@ -567,6 +590,7 @@ ges_asset_cache_init (void)

_init_formatter_assets ();
_init_standard_transition_assets ();
_init_effect_assets ();
}

gboolean
Expand Down
4 changes: 2 additions & 2 deletions ges/ges-audio-track.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ ges_audio_track_class_init (GESAudioTrackClass * klass)
*
* Returns: A new #GESTrack
*/
GESVideoTrack *
GESAudioTrack *
ges_audio_track_new (void)
{
GESVideoTrack *ret;
GESAudioTrack *ret;
GstCaps *caps = gst_caps_from_string (DEFAULT_CAPS);

ret = g_object_new (GES_TYPE_AUDIO_TRACK, "caps", caps,
Expand Down
2 changes: 1 addition & 1 deletion ges/ges-audio-track.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct _GESAudioTrack
};

GType ges_audio_track_get_type (void) G_GNUC_CONST;
GESVideoTrack* ges_audio_track_new (void);
GESAudioTrack* ges_audio_track_new (void);

G_END_DECLS
#endif /* _GES_AUDIO_TRACK_H_ */
38 changes: 38 additions & 0 deletions ges/ges-base-xml-formatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ struct _GESBaseXmlFormatterPrivate

GESClip *current_clip;
PendingClip *current_pending_clip;

gboolean timeline_auto_transition;
};

static void
Expand Down Expand Up @@ -221,6 +223,8 @@ _load_from_uri (GESFormatter * self, GESTimeline * timeline, const gchar * uri,
{
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);

ges_timeline_set_auto_transition (timeline, FALSE);

priv->parsecontext =
create_parser_context (GES_BASE_XML_FORMATTER (self), uri, error);

Expand Down Expand Up @@ -356,6 +360,7 @@ ges_base_xml_formatter_init (GESBaseXmlFormatter * self)
priv->current_track_element = NULL;
priv->current_clip = NULL;
priv->current_pending_clip = NULL;
priv->timeline_auto_transition = FALSE;
}

static void
Expand Down Expand Up @@ -406,8 +411,12 @@ _loading_done (GESFormatter * self)
g_markup_parse_context_free (priv->parsecontext);
priv->parsecontext = NULL;

ges_timeline_set_auto_transition (self->timeline,
priv->timeline_auto_transition);

g_hash_table_foreach (priv->layers, (GHFunc) _set_auto_transition, NULL);
ges_project_set_loaded (self->project, self);
GST_ERROR ("loading done");
}

static void
Expand Down Expand Up @@ -807,6 +816,35 @@ ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
priv->current_clip = nclip;
}

void
ges_base_xml_formatter_set_timeline_properties (GESBaseXmlFormatter * self,
GESTimeline * timeline, const gchar * properties, const gchar * metadatas)
{
GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);
gboolean auto_transition = FALSE;

if (properties) {
GstStructure *props = gst_structure_from_string (properties, NULL);

if (props) {
if (gst_structure_get_boolean (props, "auto-transition",
&auto_transition))
gst_structure_remove_field (props, "auto-transition");

gst_structure_foreach (props,
(GstStructureForeachFunc) set_property_foreach, timeline);
gst_structure_free (props);
}
}

if (metadatas) {
ges_meta_container_add_metas_from_string (GES_META_CONTAINER (timeline),
metadatas);
};

priv->timeline_auto_transition = auto_transition;
}

void
ges_base_xml_formatter_add_layer (GESBaseXmlFormatter * self,
GType extractable_type, guint priority, GstStructure * properties,
Expand Down
6 changes: 4 additions & 2 deletions ges/ges-clip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,6 @@ ges_clip_split (GESClip * clip, guint64 position)
{
GList *tmp;
GESClip *new_object;

GstClockTime start, inpoint, duration;

g_return_val_if_fail (GES_IS_CLIP (clip), NULL);
Expand Down Expand Up @@ -1243,7 +1242,6 @@ ges_clip_split (GESClip * clip, guint64 position)
ges_layer_add_clip (clip->priv->layer, new_object);
ges_clip_set_moving_from_layer (new_object, FALSE);

_set_duration0 (GES_TIMELINE_ELEMENT (clip), position - _START (clip));
for (tmp = GES_CONTAINER_CHILDREN (clip); tmp; tmp = tmp->next) {
GESTrackElement *new_trackelement, *trackelement =
GES_TRACK_ELEMENT (tmp->data);
Expand All @@ -1267,8 +1265,12 @@ ges_clip_split (GESClip * clip, guint64 position)
GES_TIMELINE_ELEMENT (new_trackelement));
ges_track_element_copy_properties (GES_TIMELINE_ELEMENT (trackelement),
GES_TIMELINE_ELEMENT (new_trackelement));

ges_track_element_split_bindings (trackelement, new_trackelement, position);
}

_set_duration0 (GES_TIMELINE_ELEMENT (clip), position - _START (clip));

return new_object;
}

Expand Down
2 changes: 2 additions & 0 deletions ges/ges-container.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ ges_container_add (GESContainer * container, GESTimelineElement * child)

container->children = g_list_prepend (container->children, child);

_ges_container_sort_children (container);

/* Listen to all property changes */
mapping->start_notifyid =
g_signal_connect (G_OBJECT (child), "notify::start",
Expand Down
9 changes: 9 additions & 0 deletions ges/ges-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ G_GNUC_INTERNAL gint element_start_compare (GESTimelineElement *
G_GNUC_INTERNAL gint element_end_compare (GESTimelineElement * a,
GESTimelineElement * b);

void
ges_base_xml_formatter_set_timeline_properties(GESBaseXmlFormatter * self,
GESTimeline *timeline,
const gchar *properties,
const gchar *metadatas);

/****************************************************
* GESContainer *
****************************************************/
Expand All @@ -279,4 +285,7 @@ G_GNUC_INTERNAL guint32 _ges_track_element_get_layer_priority (GESTrackElement
G_GNUC_INTERNAL void ges_track_element_copy_properties (GESTimelineElement * element,
GESTimelineElement * elementcopy);

G_GNUC_INTERNAL void ges_track_element_split_bindings (GESTrackElement *element,
GESTrackElement *new_element,
guint64 position);
#endif /* __GES_INTERNAL_H__ */
24 changes: 18 additions & 6 deletions ges/ges-pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ _overlay_set_render_rectangle (GstVideoOverlay * overlay, gint x,
{
GESPipeline *pipeline = GES_TIMELINE_PIPELINE (overlay);

gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (pipeline->
priv->playsink), x, y, width, height);
gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (pipeline->priv->
playsink), x, y, width, height);
}

static void
_overlay_set_window_handle (GstVideoOverlay * overlay, guintptr handle)
{
GESPipeline *pipeline = GES_TIMELINE_PIPELINE (overlay);

gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline->priv->
playsink), handle);
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (pipeline->
priv->playsink), handle);
}

static void
Expand Down Expand Up @@ -448,8 +448,8 @@ ges_pipeline_change_state (GstElement * element, GstStateChange transition)
ret = GST_STATE_CHANGE_FAILURE;
goto done;
}
if (self->
priv->mode & (TIMELINE_MODE_RENDER | TIMELINE_MODE_SMART_RENDER))
if (self->priv->
mode & (TIMELINE_MODE_RENDER | TIMELINE_MODE_SMART_RENDER))
GST_DEBUG ("rendering => Updating pipeline caps");
if (!ges_pipeline_update_caps (self)) {
GST_ERROR_OBJECT (element, "Error setting the caps for rendering");
Expand Down Expand Up @@ -921,6 +921,18 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline,
return TRUE;
}

/**
* ges_pipeline_get_mode:
* @pipeline: a #GESPipeline
*
* Returns: the #GESPipelineFlags currently in use.
**/
GESPipelineFlags
ges_pipeline_get_mode (GESPipeline * pipeline)
{
return pipeline->priv->mode;
}

/**
* ges_pipeline_set_mode:
* @pipeline: a #GESPipeline
Expand Down
2 changes: 2 additions & 0 deletions ges/ges-pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ gboolean ges_pipeline_set_render_settings (GESPipeline *pipeline,
gboolean ges_pipeline_set_mode (GESPipeline *pipeline,
GESPipelineFlags mode);

GESPipelineFlags ges_pipeline_get_mode (GESPipeline *pipeline);

GstSample *
ges_pipeline_get_thumbnail(GESPipeline *self, GstCaps *caps);

Expand Down
7 changes: 6 additions & 1 deletion ges/ges-timeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,15 @@ timeline_update_duration (GESTimeline * timeline)
GSequenceIter *it = g_sequence_get_end_iter (timeline->priv->starts_ends);

it = g_sequence_iter_prev (it);
if (g_sequence_iter_is_end (it))

if (g_sequence_iter_is_end (it)) {
timeline->priv->duration = 0;
g_object_notify_by_pspec (G_OBJECT (timeline), properties[PROP_DURATION]);
return;
}

cduration = g_sequence_get (it);

if (cduration && timeline->priv->duration != *cduration) {
GST_DEBUG ("track duration : %" GST_TIME_FORMAT " current : %"
GST_TIME_FORMAT, GST_TIME_ARGS (*cduration),
Expand Down
Loading