mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
ges: Add a maxduration property to TrackFileSource
API: GESTrackFileSource::maxduration property
This commit is contained in:
parent
ce6edd94f4
commit
4acc711e52
3 changed files with 36 additions and 4 deletions
|
@ -233,6 +233,7 @@ ges_timeline_filesource_set_max_duration (GESTimelineFileSource * self,
|
|||
guint64 maxduration)
|
||||
{
|
||||
GESTimelineObject *object = GES_TIMELINE_OBJECT (self);
|
||||
GList *tmp, *tckobjs;
|
||||
|
||||
self->priv->maxduration = maxduration;
|
||||
if (object->duration == GST_CLOCK_TIME_NONE || object->duration == 0) {
|
||||
|
@ -240,6 +241,15 @@ ges_timeline_filesource_set_max_duration (GESTimelineFileSource * self,
|
|||
g_object_set (self, "duration", self->priv->maxduration - object->inpoint,
|
||||
NULL);
|
||||
}
|
||||
|
||||
tckobjs = ges_timeline_object_get_track_objects (GES_TIMELINE_OBJECT (self));
|
||||
for (tmp = tckobjs; tmp; tmp = g_list_next (tmp)) {
|
||||
g_object_set (tmp->data, "max-duration", maxduration, NULL);
|
||||
|
||||
/* We free the list in the same loop */
|
||||
g_object_unref (tmp->data);
|
||||
g_list_free_1 (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -579,7 +579,10 @@ discoverer_discovered_cb (GstDiscoverer * discoverer,
|
|||
g_object_set (tfs, "is_image", (gboolean) TRUE, NULL);
|
||||
}
|
||||
|
||||
else {
|
||||
/* Continue the processing on tfs */
|
||||
add_object_to_tracks (timeline, GES_TIMELINE_OBJECT (tfs));
|
||||
|
||||
if (!is_image) {
|
||||
g_object_set (tfs, "max-duration",
|
||||
gst_discoverer_info_get_duration (info), NULL);
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@ G_DEFINE_TYPE (GESTrackFileSource, ges_track_filesource, GES_TYPE_TRACK_SOURCE);
|
|||
|
||||
struct _GESTrackFileSourcePrivate
|
||||
{
|
||||
/* Dummy variable */
|
||||
void *nothing;
|
||||
guint64 maxduration;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_URI
|
||||
PROP_URI,
|
||||
PROP_MAX_DURATION
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -54,6 +54,9 @@ ges_track_filesource_get_property (GObject * object, guint property_id,
|
|||
case PROP_URI:
|
||||
g_value_set_string (value, tfs->uri);
|
||||
break;
|
||||
case PROP_MAX_DURATION:
|
||||
g_value_set_uint64 (value, tfs->priv->maxduration);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
|
@ -69,6 +72,9 @@ ges_track_filesource_set_property (GObject * object, guint property_id,
|
|||
case PROP_URI:
|
||||
tfs->uri = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_MAX_DURATION:
|
||||
tfs->priv->maxduration = g_value_get_uint64 (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
|
@ -108,6 +114,19 @@ ges_track_filesource_class_init (GESTrackFileSourceClass * klass)
|
|||
object_class->set_property = ges_track_filesource_set_property;
|
||||
object_class->dispose = ges_track_filesource_dispose;
|
||||
|
||||
/**
|
||||
* GESTrackFileSource:max-duration:
|
||||
*
|
||||
* The maximum duration (in nanoseconds) of the file.
|
||||
*
|
||||
* If not set before adding the object to a layer, it will be discovered
|
||||
* asynchronously. Connect to 'notify::max-duration' to be notified of it.
|
||||
*/
|
||||
g_object_class_install_property (object_class, PROP_MAX_DURATION,
|
||||
g_param_spec_uint64 ("max-duration", "Maximum duration",
|
||||
"The duration of the file", 0, G_MAXUINT64, GST_CLOCK_TIME_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
|
||||
/**
|
||||
* GESTrackFileSource:uri
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue