mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
videosource: Always add a deinterlace at the beining of videosrcbin
It might be needed in some cases (for example when decoding prores files) and it is the way it is done with playbin now. Also deinterlace now properly supports passtrough mode.
This commit is contained in:
parent
94dbf20400
commit
f4ce6dcab7
2 changed files with 35 additions and 43 deletions
|
@ -23,6 +23,8 @@
|
|||
* @short_description: Base Class for video sources
|
||||
*/
|
||||
|
||||
#include <gst/pbutils/missing-plugins.h>
|
||||
|
||||
#include "ges-internal.h"
|
||||
#include "ges/ges-meta-container.h"
|
||||
#include "ges-track-element.h"
|
||||
|
@ -74,6 +76,15 @@ layer_changed_cb (GESClip * clip, GParamSpec * arg G_GNUC_UNUSED,
|
|||
10000 - ges_layer_get_priority (self->priv->layer), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
post_missing_element_message (GstElement * element, const gchar * name)
|
||||
{
|
||||
GstMessage *msg;
|
||||
|
||||
msg = gst_missing_element_message_new (element, name);
|
||||
gst_element_post_message (element, msg);
|
||||
}
|
||||
|
||||
static GstElement *
|
||||
ges_video_source_create_element (GESTrackElement * trksrc)
|
||||
{
|
||||
|
@ -81,7 +92,8 @@ ges_video_source_create_element (GESTrackElement * trksrc)
|
|||
GstElement *sub_element;
|
||||
GESVideoSourceClass *source_class = GES_VIDEO_SOURCE_GET_CLASS (trksrc);
|
||||
GESVideoSource *self;
|
||||
GstElement *positionner, *videoscale, *videorate, *capsfilter;
|
||||
GstElement *positionner, *videoscale, *videorate, *capsfilter, *videoconvert,
|
||||
*deinterlace;
|
||||
const gchar *props[] = { "alpha", "posx", "posy", "width", "height", NULL };
|
||||
GESTimelineElement *parent;
|
||||
|
||||
|
@ -98,7 +110,13 @@ ges_video_source_create_element (GESTrackElement * trksrc)
|
|||
|
||||
videoscale =
|
||||
gst_element_factory_make ("videoscale", "track-element-videoscale");
|
||||
videoconvert =
|
||||
gst_element_factory_make ("videoconvert", "track-element-videoconvert");
|
||||
videorate = gst_element_factory_make ("videorate", "track-element-videorate");
|
||||
deinterlace = gst_element_factory_make ("deinterlace", "deinterlace");
|
||||
if (deinterlace == NULL) {
|
||||
deinterlace = gst_element_factory_make ("avdeinterlace", "deinterlace");
|
||||
}
|
||||
capsfilter =
|
||||
gst_element_factory_make ("capsfilter", "track-element-capsfilter");
|
||||
|
||||
|
@ -106,9 +124,22 @@ ges_video_source_create_element (GESTrackElement * trksrc)
|
|||
(positionner), trksrc, capsfilter);
|
||||
|
||||
ges_track_element_add_children_props (trksrc, positionner, NULL, NULL, props);
|
||||
topbin =
|
||||
ges_source_create_topbin ("videosrcbin", sub_element, positionner,
|
||||
videoscale, videorate, capsfilter, NULL);
|
||||
|
||||
if (deinterlace == NULL) {
|
||||
post_missing_element_message (sub_element, "deinterlace");
|
||||
|
||||
GST_ELEMENT_WARNING (sub_element, CORE, MISSING_PLUGIN,
|
||||
("Missing element '%s' - check your GStreamer installation.",
|
||||
"deinterlace"), ("deinterlacing won't work"));
|
||||
topbin =
|
||||
ges_source_create_topbin ("videosrcbin", sub_element, videoconvert,
|
||||
positionner, videoscale, videorate, capsfilter, NULL);
|
||||
} else {
|
||||
topbin =
|
||||
ges_source_create_topbin ("videosrcbin", sub_element, videoconvert,
|
||||
deinterlace, positionner, videoscale, videorate, capsfilter, NULL);
|
||||
}
|
||||
|
||||
parent = ges_timeline_element_get_parent (GES_TIMELINE_ELEMENT (trksrc));
|
||||
if (parent) {
|
||||
self->priv->positionner = GST_FRAME_POSITIONNER (positionner);
|
||||
|
|
|
@ -43,23 +43,12 @@ enum
|
|||
PROP_URI
|
||||
};
|
||||
|
||||
static void
|
||||
post_missing_element_message (GstElement * element, const gchar * name)
|
||||
{
|
||||
GstMessage *msg;
|
||||
|
||||
msg = gst_missing_element_message_new (element, name);
|
||||
gst_element_post_message (element, msg);
|
||||
}
|
||||
|
||||
/* GESSource VMethod */
|
||||
static GstElement *
|
||||
ges_video_uri_source_create_source (GESTrackElement * trksrc)
|
||||
{
|
||||
GESVideoUriSource *self;
|
||||
GESTrack *track;
|
||||
GstDiscovererVideoInfo *info;
|
||||
GESUriSourceAsset *asset;
|
||||
GstElement *decodebin;
|
||||
|
||||
self = (GESVideoUriSource *) trksrc;
|
||||
|
@ -71,34 +60,6 @@ ges_video_uri_source_create_source (GESTrackElement * trksrc)
|
|||
g_object_set (decodebin, "caps", ges_track_get_caps (track),
|
||||
"expose-all-streams", FALSE, "uri", self->uri, NULL);
|
||||
|
||||
if ((asset =
|
||||
GES_URI_SOURCE_ASSET (ges_extractable_get_asset (GES_EXTRACTABLE
|
||||
(trksrc)))) != NULL) {
|
||||
info =
|
||||
GST_DISCOVERER_VIDEO_INFO (ges_uri_source_asset_get_stream_info
|
||||
(asset));
|
||||
|
||||
g_assert (info);
|
||||
if (gst_discoverer_video_info_is_interlaced (info)) {
|
||||
GstElement *deinterlace;
|
||||
|
||||
deinterlace = gst_element_factory_make ("deinterlace", "deinterlace");
|
||||
if (deinterlace == NULL) {
|
||||
deinterlace = gst_element_factory_make ("avdeinterlace", "deinterlace");
|
||||
}
|
||||
if (deinterlace == NULL) {
|
||||
post_missing_element_message (decodebin, "deinterlace");
|
||||
GST_ELEMENT_WARNING (decodebin, CORE, MISSING_PLUGIN,
|
||||
("Missing element '%s' - check your GStreamer installation.",
|
||||
"deinterlace"), ("deinterlacing won't work"));
|
||||
}
|
||||
|
||||
return ges_source_create_topbin ("deinterlace-bin", decodebin,
|
||||
gst_element_factory_make ("videoconvert", NULL), deinterlace, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return decodebin;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue