mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
ges: Let the compositor do the scaling if mixing is enabled
Differential Revision: https://phabricator.freedesktop.org/D1241
This commit is contained in:
parent
ff6937d044
commit
1cef62ab79
5 changed files with 30 additions and 19 deletions
|
@ -167,6 +167,7 @@ ges_title_source_class_init (GESTitleSourceClass * klass)
|
||||||
|
|
||||||
timeline_element_class->set_inpoint = NULL;
|
timeline_element_class->set_inpoint = NULL;
|
||||||
timeline_element_class->lookup_child = _lookup_child;
|
timeline_element_class->lookup_child = _lookup_child;
|
||||||
|
source_class->ABI.abi.disable_scale_in_compositor = TRUE;
|
||||||
source_class->create_source = ges_title_source_create_source;
|
source_class->create_source = ges_title_source_create_source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,8 @@ ges_video_source_create_element (GESTrackElement * trksrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
self->priv->positioner = GST_FRAME_POSITIONNER (positioner);
|
self->priv->positioner = GST_FRAME_POSITIONNER (positioner);
|
||||||
|
self->priv->positioner->scale_in_compositor =
|
||||||
|
!GES_VIDEO_SOURCE_GET_CLASS (self)->ABI.abi.disable_scale_in_compositor;
|
||||||
self->priv->capsfilter = capsfilter;
|
self->priv->capsfilter = capsfilter;
|
||||||
|
|
||||||
return topbin;
|
return topbin;
|
||||||
|
|
|
@ -80,7 +80,12 @@ struct _GESVideoSourceClass {
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
/* Padding for API extension */
|
/* Padding for API extension */
|
||||||
gpointer _ges_reserved[GES_PADDING];
|
union {
|
||||||
|
gpointer _ges_reserved[GES_PADDING];
|
||||||
|
struct {
|
||||||
|
gboolean disable_scale_in_compositor;
|
||||||
|
} abi;
|
||||||
|
} ABI;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType ges_video_source_get_type (void);
|
GType ges_video_source_get_type (void);
|
||||||
|
|
|
@ -79,14 +79,15 @@ _weak_notify_cb (GstFramePositioner * pos, GObject * old)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_frame_positioner_update_properties (GstFramePositioner * pos,
|
gst_frame_positioner_update_properties (GstFramePositioner * pos,
|
||||||
gint old_track_width, gint old_track_height)
|
gboolean track_mixing, gint old_track_width, gint old_track_height)
|
||||||
{
|
{
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
if (pos->capsfilter == NULL)
|
if (pos->capsfilter == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pos->track_width && pos->track_height) {
|
if (pos->track_width && pos->track_height &&
|
||||||
|
(!track_mixing || !pos->scale_in_compositor)) {
|
||||||
caps =
|
caps =
|
||||||
gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT,
|
gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT,
|
||||||
pos->track_width, "height", G_TYPE_INT, pos->track_height, NULL);
|
pos->track_width, "height", G_TYPE_INT, pos->track_height, NULL);
|
||||||
|
@ -117,10 +118,13 @@ gst_frame_positioner_update_properties (GstFramePositioner * pos,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sync_properties_from_caps (GstFramePositioner * pos, GstCaps * caps)
|
sync_properties_from_track (GstFramePositioner * pos, GESTrack * track)
|
||||||
{
|
{
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gint old_track_width, old_track_height;
|
gint old_track_width, old_track_height;
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
|
g_object_get (track, "restriction-caps", &caps, NULL);
|
||||||
|
|
||||||
width = height = 0;
|
width = height = 0;
|
||||||
|
|
||||||
|
@ -146,24 +150,15 @@ sync_properties_from_caps (GstFramePositioner * pos, GstCaps * caps)
|
||||||
GST_DEBUG_OBJECT (pos, "syncing framerate from caps : %d/%d", pos->fps_n,
|
GST_DEBUG_OBJECT (pos, "syncing framerate from caps : %d/%d", pos->fps_n,
|
||||||
pos->fps_d);
|
pos->fps_d);
|
||||||
|
|
||||||
gst_frame_positioner_update_properties (pos, old_track_width,
|
gst_frame_positioner_update_properties (pos, ges_track_get_mixing (track),
|
||||||
old_track_height);
|
old_track_width, old_track_height);
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
sync_properties_with_track (GstFramePositioner * pos, GESTrack * track)
|
|
||||||
{
|
|
||||||
GstCaps *caps;
|
|
||||||
|
|
||||||
g_object_get (track, "restriction-caps", &caps, NULL);
|
|
||||||
sync_properties_from_caps (pos, caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_track_restriction_changed_cb (GESTrack * track, GParamSpec * arg G_GNUC_UNUSED,
|
_track_restriction_changed_cb (GESTrack * track, GParamSpec * arg G_GNUC_UNUSED,
|
||||||
GstFramePositioner * pos)
|
GstFramePositioner * pos)
|
||||||
{
|
{
|
||||||
sync_properties_with_track (pos, track);
|
sync_properties_from_track (pos, track);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -187,7 +182,7 @@ set_track (GstFramePositioner * pos)
|
||||||
|
|
||||||
g_signal_connect (pos->current_track, "notify::restriction-caps",
|
g_signal_connect (pos->current_track, "notify::restriction-caps",
|
||||||
(GCallback) _track_restriction_changed_cb, pos);
|
(GCallback) _track_restriction_changed_cb, pos);
|
||||||
sync_properties_with_track (pos, pos->current_track);
|
sync_properties_from_track (pos, pos->current_track);
|
||||||
} else {
|
} else {
|
||||||
pos->current_track = NULL;
|
pos->current_track = NULL;
|
||||||
}
|
}
|
||||||
|
@ -342,6 +337,7 @@ gst_frame_positioner_init (GstFramePositioner * framepositioner)
|
||||||
framepositioner->capsfilter = NULL;
|
framepositioner->capsfilter = NULL;
|
||||||
framepositioner->track_source = NULL;
|
framepositioner->track_source = NULL;
|
||||||
framepositioner->current_track = NULL;
|
framepositioner->current_track = NULL;
|
||||||
|
framepositioner->scale_in_compositor = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -349,6 +345,10 @@ gst_frame_positioner_set_property (GObject * object, guint property_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstFramePositioner *framepositioner = GST_FRAME_POSITIONNER (object);
|
GstFramePositioner *framepositioner = GST_FRAME_POSITIONNER (object);
|
||||||
|
gboolean track_mixing = TRUE;
|
||||||
|
|
||||||
|
if (framepositioner->current_track)
|
||||||
|
track_mixing = ges_track_get_mixing (framepositioner->current_track);
|
||||||
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (framepositioner);
|
GST_OBJECT_LOCK (framepositioner);
|
||||||
|
@ -367,11 +367,13 @@ gst_frame_positioner_set_property (GObject * object, guint property_id,
|
||||||
break;
|
break;
|
||||||
case PROP_WIDTH:
|
case PROP_WIDTH:
|
||||||
framepositioner->width = g_value_get_int (value);
|
framepositioner->width = g_value_get_int (value);
|
||||||
gst_frame_positioner_update_properties (framepositioner, 0, 0);
|
gst_frame_positioner_update_properties (framepositioner, track_mixing,
|
||||||
|
0, 0);
|
||||||
break;
|
break;
|
||||||
case PROP_HEIGHT:
|
case PROP_HEIGHT:
|
||||||
framepositioner->height = g_value_get_int (value);
|
framepositioner->height = g_value_get_int (value);
|
||||||
gst_frame_positioner_update_properties (framepositioner, 0, 0);
|
gst_frame_positioner_update_properties (framepositioner, track_mixing,
|
||||||
|
0, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct _GstFramePositioner
|
||||||
GESTrackElement *track_source;
|
GESTrackElement *track_source;
|
||||||
GESTrack *current_track;
|
GESTrack *current_track;
|
||||||
|
|
||||||
|
gboolean scale_in_compositor;
|
||||||
gdouble alpha;
|
gdouble alpha;
|
||||||
gint posx;
|
gint posx;
|
||||||
gint posy;
|
gint posy;
|
||||||
|
|
Loading…
Reference in a new issue