mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
videosink: Add new GstVideoSink::set_info() virtual method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/986>
This commit is contained in:
parent
198434e71a
commit
7e16eed522
2 changed files with 19 additions and 3 deletions
|
@ -36,7 +36,6 @@
|
|||
#endif
|
||||
|
||||
#include "gstvideosink.h"
|
||||
#include "video-info.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -199,7 +198,7 @@ gst_video_sink_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
memset (&vsink->priv->info, 0, sizeof (vsink->priv->info));
|
||||
gst_video_info_init (&vsink->priv->info);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -212,9 +211,11 @@ static gboolean
|
|||
gst_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
|
||||
{
|
||||
GstVideoSink *vsink;
|
||||
GstVideoSinkClass *klass;
|
||||
GstVideoInfo info;
|
||||
|
||||
vsink = GST_VIDEO_SINK_CAST (bsink);
|
||||
klass = GST_VIDEO_SINK_GET_CLASS (vsink);
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps)) {
|
||||
GST_ERROR_OBJECT (bsink, "Failed to parse caps %" GST_PTR_FORMAT, caps);
|
||||
|
@ -224,6 +225,9 @@ gst_video_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
|
|||
GST_DEBUG_OBJECT (bsink, "Setting caps %" GST_PTR_FORMAT, caps);
|
||||
vsink->priv->info = info;
|
||||
|
||||
if (klass->set_info)
|
||||
return klass->set_info (vsink, caps, &vsink->priv->info);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/base/gstbasesink.h>
|
||||
#include <gst/video/video-prelude.h>
|
||||
#include <gst/video/video-info.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -117,8 +118,19 @@ struct _GstVideoSinkClass {
|
|||
|
||||
GstFlowReturn (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
|
||||
|
||||
/**
|
||||
* GstVideoSinkClass::set_info:
|
||||
* @caps: A #GstCaps.
|
||||
* @info: A #GstVideoInfo corresponding to @caps.
|
||||
*
|
||||
* Notifies the subclass of changed #GstVideoInfo.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
gboolean (*set_info) (GstVideoSink *video_sink, GstCaps *caps, const GstVideoInfo *info);
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
gpointer _gst_reserved[GST_PADDING-1];
|
||||
};
|
||||
|
||||
GST_VIDEO_API
|
||||
|
|
Loading…
Reference in a new issue