From: Thibault Saunier Date: Tue, 18 Feb 2020 19:09:55 +0000 (-0300) Subject: ges: Set default caps for GESVideoTrack X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=221353e75c4ca800102b7d67cc3e523384adfd77;p=platform%2Fupstream%2Fgst-editing-services.git ges: Set default caps for GESVideoTrack By default, video track output full HD@30fps, this makes the behaviour of clip position much more understandable and guarantess that we always have a framerate. The user can modify the values whenever he wants --- diff --git a/ges/ges-internal.h b/ges/ges-internal.h index 306372d..0141bc2 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -61,6 +61,11 @@ GstDebugCategory * _ges_debug (void); #define _set_duration0 ges_timeline_element_set_duration #define _set_priority0 ges_timeline_element_set_priority +#define DEFAULT_FRAMERATE_N 30 +#define DEFAULT_FRAMERATE_D 1 +#define DEFAULT_WIDTH 1280 +#define DEFAULT_HEIGHT 720 + #define GES_TIMELINE_ELEMENT_FORMAT \ "s<%p>" \ " [ %" GST_TIME_FORMAT \ diff --git a/ges/ges-video-track.c b/ges/ges-video-track.c index 90fdeda..6f2fc34 100644 --- a/ges/ges-video-track.c +++ b/ges/ges-video-track.c @@ -21,6 +21,17 @@ * SECTION: gesvideotrack * @title: GESVideoTrack * @short_description: A standard GESTrack for raw video + * + * 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. + * + * The default properties are: + * - width: 1920 + * - height: 1080 + * - framerate: 30/1 */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -28,6 +39,9 @@ #include "ges-video-track.h" #include "ges-smart-video-mixer.h" +#include "ges-internal.h" + +#define DEFAULT_RESTRICTION_CAPS "video/x-raw(ANY), framerate=" G_STRINGIFY(DEFAULT_FRAMERATE_N) "/" G_STRINGIFY(DEFAULT_FRAMERATE_D) ", width=" G_STRINGIFY(DEFAULT_WIDTH) ", height=" G_STRINGIFY(DEFAULT_HEIGHT) struct _GESVideoTrackPrivate { @@ -144,14 +158,17 @@ ges_video_track_new (void) { GESVideoTrack *ret; GstCaps *caps = gst_caps_new_empty_simple ("video/x-raw"); + GstCaps *restriction_caps = gst_caps_from_string (DEFAULT_RESTRICTION_CAPS); ret = g_object_new (GES_TYPE_VIDEO_TRACK, "track-type", GES_TRACK_TYPE_VIDEO, "caps", caps, NULL); ges_track_set_create_element_for_gap_func (GES_TRACK (ret), create_element_for_raw_video_gap); + ges_track_set_restriction_caps (GES_TRACK (ret), restriction_caps); gst_caps_unref (caps); + gst_caps_unref (restriction_caps); return ret; }