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
This commit is contained in:
Thibault Saunier 2020-02-18 16:09:55 -03:00
parent df6058c802
commit 221353e75c
2 changed files with 22 additions and 0 deletions

View file

@ -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 \

View file

@ -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;
}