diff --git a/sys/d3d11/gstd3d11_fwd.h b/sys/d3d11/gstd3d11_fwd.h index f0b04db831..b81824a248 100644 --- a/sys/d3d11/gstd3d11_fwd.h +++ b/sys/d3d11/gstd3d11_fwd.h @@ -71,22 +71,6 @@ typedef struct _GstD3D11BufferPoolPrivate GstD3D11BufferPoolPrivate; typedef struct _GstD3D11Format GstD3D11Format; -typedef struct _GstD3D11BaseFilter GstD3D11BaseFilter; -typedef struct _GstD3D11BaseFilterClass GstD3D11BaseFilterClass; - -typedef struct _GstD3D11Upload GstD3D11Upload; -typedef struct _GstD3D11UploadClass GstD3D11UploadClass; - -typedef struct _GstD3D11Download GstD3D11Download; -typedef struct _GstD3D11DownloadClass GstD3D11DownloadClass; - -typedef struct _GstD3D11ColorConvert GstD3D11ColorConvert; -typedef struct _GstD3D11ColorConvertClass GstD3D11ColorConvertClass; - -typedef struct _GstD3D11Decoder GstD3D11Decoder; -typedef struct _GstD3D11DecoderClass GstD3D11DecoderClass; -typedef struct _GstD3D11DecoderPrivate GstD3D11DecoderPrivate; - G_END_DECLS #endif /* __GST_D3D11_FWD_H__ */ diff --git a/sys/d3d11/gstd3d11basefilter.h b/sys/d3d11/gstd3d11basefilter.h index 1750959240..7a52abc7a6 100644 --- a/sys/d3d11/gstd3d11basefilter.h +++ b/sys/d3d11/gstd3d11basefilter.h @@ -36,6 +36,9 @@ G_BEGIN_DECLS #define GST_IS_D3D11_BASE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_D3D11_BASE_FILTER)) #define GST_D3D11_BASE_FILTER_CAST(obj) ((GstD3D11BaseFilter*)(obj)) +typedef struct _GstD3D11BaseFilter GstD3D11BaseFilter; +typedef struct _GstD3D11BaseFilterClass GstD3D11BaseFilterClass; + struct _GstD3D11BaseFilter { GstBaseTransform parent; @@ -60,6 +63,8 @@ struct _GstD3D11BaseFilterClass GType gst_d3d11_base_filter_get_type (void); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstD3D11BaseFilter, gst_object_unref) + G_END_DECLS #endif /* __GST_D3D11_BASE_FILTER_H__ */ diff --git a/sys/d3d11/gstd3d11colorconvert.c b/sys/d3d11/gstd3d11colorconvert.c index 65c78b7243..e4439fbe27 100644 --- a/sys/d3d11/gstd3d11colorconvert.c +++ b/sys/d3d11/gstd3d11colorconvert.c @@ -48,6 +48,7 @@ #endif #include "gstd3d11colorconvert.h" +#include "gstd3d11colorconverter.h" #include "gstd3d11utils.h" #include "gstd3d11memory.h" #include "gstd3d11device.h" @@ -78,6 +79,28 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_D3D11_SRC_FORMATS)) ); +struct _GstD3D11ColorConvert +{ + GstD3D11BaseFilter parent; + + const GstD3D11Format *in_d3d11_format; + const GstD3D11Format *out_d3d11_format; + + ID3D11Texture2D *in_texture[GST_VIDEO_MAX_PLANES]; + ID3D11ShaderResourceView *shader_resource_view[GST_VIDEO_MAX_PLANES]; + guint num_input_view; + + ID3D11Texture2D *out_texture[GST_VIDEO_MAX_PLANES]; + ID3D11RenderTargetView *render_target_view[GST_VIDEO_MAX_PLANES]; + guint num_output_view; + + GstD3D11ColorConverter *converter; + + /* used for fallback texture copy */ + D3D11_BOX in_src_box; + D3D11_BOX out_src_box; +}; + #define gst_d3d11_color_convert_parent_class parent_class G_DEFINE_TYPE (GstD3D11ColorConvert, gst_d3d11_color_convert, GST_TYPE_D3D11_BASE_FILTER); diff --git a/sys/d3d11/gstd3d11colorconvert.h b/sys/d3d11/gstd3d11colorconvert.h index 52fa883466..331ca9c8b2 100644 --- a/sys/d3d11/gstd3d11colorconvert.h +++ b/sys/d3d11/gstd3d11colorconvert.h @@ -23,45 +23,12 @@ #include #include "gstd3d11basefilter.h" -#include "gstd3d11colorconverter.h" G_BEGIN_DECLS -#define GST_TYPE_D3D11_COLOR_CONVERT (gst_d3d11_color_convert_get_type()) -#define GST_D3D11_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3D11_COLOR_CONVERT,GstD3D11ColorConvert)) -#define GST_D3D11_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_D3D11_COLOR_CONVERT,GstD3D11ColorConvertClass)) -#define GST_D3D11_COLOR_CONVERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_D3D11_COLOR_CONVERT,GstD3D11ColorConvertClass)) -#define GST_IS_D3D11_COLOR_CONVERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3D11_COLOR_CONVERT)) -#define GST_IS_D3D11_COLOR_CONVERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_D3D11_COLOR_CONVERT)) - -struct _GstD3D11ColorConvert -{ - GstD3D11BaseFilter parent; - - const GstD3D11Format *in_d3d11_format; - const GstD3D11Format *out_d3d11_format; - - ID3D11Texture2D *in_texture[GST_VIDEO_MAX_PLANES]; - ID3D11ShaderResourceView *shader_resource_view[GST_VIDEO_MAX_PLANES]; - guint num_input_view; - - ID3D11Texture2D *out_texture[GST_VIDEO_MAX_PLANES]; - ID3D11RenderTargetView *render_target_view[GST_VIDEO_MAX_PLANES]; - guint num_output_view; - - GstD3D11ColorConverter *converter; - - /* used for fallback texture copy */ - D3D11_BOX in_src_box; - D3D11_BOX out_src_box; -}; - -struct _GstD3D11ColorConvertClass -{ - GstD3D11BaseFilterClass parent_class; -}; - -GType gst_d3d11_color_convert_get_type (void); +#define GST_TYPE_D3D11_COLOR_CONVERT (gst_d3d11_color_convert_get_type()) +G_DECLARE_FINAL_TYPE (GstD3D11ColorConvert, + gst_d3d11_color_convert, GST, D3D11_COLOR_CONVERT, GstD3D11BaseFilter); G_END_DECLS diff --git a/sys/d3d11/gstd3d11decoder.h b/sys/d3d11/gstd3d11decoder.h index 50dacc35a2..1eb7d95a29 100644 --- a/sys/d3d11/gstd3d11decoder.h +++ b/sys/d3d11/gstd3d11decoder.h @@ -28,19 +28,11 @@ G_BEGIN_DECLS -#define GST_TYPE_D3D11_DECODER \ - (gst_d3d11_decoder_get_type()) -#define GST_D3D11_DECODER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3D11_DECODER,GstD3D11Decoder)) -#define GST_D3D11_DECODER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_D3D11_DECODER,GstD3D11DecoderClass)) -#define GST_D3D11_DECODER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_D3D11_DECODER,GstD3D11DecoderClass)) -#define GST_IS_D3D11_DECODER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3D11_DECODER)) -#define GST_IS_D3D11_DECODER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_D3D11_DECODER)) +#define GST_TYPE_D3D11_DECODER (gst_d3d11_decoder_get_type()) +G_DECLARE_FINAL_TYPE (GstD3D11Decoder, + gst_d3d11_decoder, GST, D3D11_DECODER, GstObject); +typedef struct _GstD3D11DecoderPrivate GstD3D11DecoderPrivate; typedef struct _GstD3D11DecoderOutputView GstD3D11DecoderOutputView; struct _GstD3D11DecoderOutputView @@ -84,13 +76,6 @@ struct _GstD3D11Decoder gpointer padding[GST_PADDING_LARGE]; }; -struct _GstD3D11DecoderClass -{ - GstObjectClass parent_class; -}; - -GType gst_d3d11_decoder_get_type (void); - GstD3D11Decoder * gst_d3d11_decoder_new (GstD3D11Device * device); gboolean gst_d3d11_decoder_open (GstD3D11Decoder * decoder, diff --git a/sys/d3d11/gstd3d11download.c b/sys/d3d11/gstd3d11download.c index 7176209773..456ebf7acb 100644 --- a/sys/d3d11/gstd3d11download.c +++ b/sys/d3d11/gstd3d11download.c @@ -62,6 +62,11 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_D3D11_ALL_FORMATS) )); +struct _GstD3D11Download +{ + GstD3D11BaseFilter parent; +}; + #define gst_d3d11_download_parent_class parent_class G_DEFINE_TYPE (GstD3D11Download, gst_d3d11_download, GST_TYPE_D3D11_BASE_FILTER); diff --git a/sys/d3d11/gstd3d11download.h b/sys/d3d11/gstd3d11download.h index 4ca4f43589..573101576d 100644 --- a/sys/d3d11/gstd3d11download.h +++ b/sys/d3d11/gstd3d11download.h @@ -24,24 +24,9 @@ G_BEGIN_DECLS -#define GST_TYPE_D3D11_DOWNLOAD (gst_d3d11_download_get_type()) -#define GST_D3D11_DOWNLOAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3D11_DOWNLOAD,GstD3D11Download)) -#define GST_D3D11_DOWNLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_D3D11_DOWNLOAD,GstD3D11DownloadClass)) -#define GST_D3D11_DOWNLOAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_D3D11_DOWNLOAD,GstD3D11DownloadClass)) -#define GST_IS_D3D11_DOWNLOAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3D11_DOWNLOAD)) -#define GST_IS_D3D11_DOWNLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_D3D11_DOWNLOAD)) - -struct _GstD3D11Download -{ - GstD3D11BaseFilter parent; -}; - -struct _GstD3D11DownloadClass -{ - GstD3D11BaseFilterClass parent_class; -}; - -GType gst_d3d11_download_get_type (void); +#define GST_TYPE_D3D11_DOWNLOAD (gst_d3d11_download_get_type()) +G_DECLARE_FINAL_TYPE (GstD3D11Download, + gst_d3d11_download, GST, D3D11_DOWNLOAD, GstD3D11BaseFilter); G_END_DECLS diff --git a/sys/d3d11/gstd3d11upload.c b/sys/d3d11/gstd3d11upload.c index 3ed64ac07b..77d539908f 100644 --- a/sys/d3d11/gstd3d11upload.c +++ b/sys/d3d11/gstd3d11upload.c @@ -57,6 +57,11 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, GST_D3D11_ALL_FORMATS))); +struct _GstD3D11Upload +{ + GstD3D11BaseFilter parent; +}; + #define gst_d3d11_upload_parent_class parent_class G_DEFINE_TYPE (GstD3D11Upload, gst_d3d11_upload, GST_TYPE_D3D11_BASE_FILTER); diff --git a/sys/d3d11/gstd3d11upload.h b/sys/d3d11/gstd3d11upload.h index 851c400f9d..523c83d837 100644 --- a/sys/d3d11/gstd3d11upload.h +++ b/sys/d3d11/gstd3d11upload.h @@ -24,24 +24,9 @@ G_BEGIN_DECLS -#define GST_TYPE_D3D11_UPLOAD (gst_d3d11_upload_get_type()) -#define GST_D3D11_UPLOAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3D11_UPLOAD,GstD3D11Upload)) -#define GST_D3D11_UPLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_D3D11_UPLOAD,GstD3D11UploadClass)) -#define GST_D3D11_UPLOAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_D3D11_UPLOAD,GstD3D11UploadClass)) -#define GST_IS_D3D11_UPLOAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3D11_UPLOAD)) -#define GST_IS_D3D11_UPLOAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_D3D11_UPLOAD)) - -struct _GstD3D11Upload -{ - GstD3D11BaseFilter parent; -}; - -struct _GstD3D11UploadClass -{ - GstD3D11BaseFilterClass parent_class; -}; - -GType gst_d3d11_upload_get_type (void); +#define GST_TYPE_D3D11_UPLOAD (gst_d3d11_upload_get_type()) +G_DECLARE_FINAL_TYPE (GstD3D11Upload, + gst_d3d11_upload, GST, D3D11_UPLOAD, GstD3D11BaseFilter); G_END_DECLS diff --git a/sys/d3d11/gstd3d11videosink.c b/sys/d3d11/gstd3d11videosink.c index f8ce40e595..8bb5aa04bb 100644 --- a/sys/d3d11/gstd3d11videosink.c +++ b/sys/d3d11/gstd3d11videosink.c @@ -66,6 +66,34 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_DEBUG_CATEGORY (d3d11_video_sink_debug); #define GST_CAT_DEFAULT d3d11_video_sink_debug +struct _GstD3D11VideoSink +{ + GstVideoSink parent; + GstD3D11Device *device; + GstD3D11Window *window; + gint video_width; + gint video_height; + + GstVideoInfo info; + + guintptr window_id; + + /* properties */ + gint adapter; + gboolean force_aspect_ratio; + gboolean enable_navigation_events; + GstD3D11WindowFullscreenToggleMode fullscreen_toggle_mode; + gboolean fullscreen; + + /* saved render rectangle until we have a window */ + GstVideoRectangle render_rect; + gboolean pending_render_rect; + + GstBufferPool *fallback_pool; + gboolean can_convert; + gboolean have_video_processor; +}; + static void gst_d3d11_videosink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_d3d11_videosink_get_property (GObject * object, guint prop_id, diff --git a/sys/d3d11/gstd3d11videosink.h b/sys/d3d11/gstd3d11videosink.h index c599f930fe..2d35a6e109 100644 --- a/sys/d3d11/gstd3d11videosink.h +++ b/sys/d3d11/gstd3d11videosink.h @@ -31,52 +31,10 @@ G_BEGIN_DECLS -#define GST_TYPE_D3D11_VIDEO_SINK (gst_d3d11_video_sink_get_type()) -#define GST_D3D11_VIDEO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3D11_VIDEO_SINK,GstD3D11VideoSink)) -#define GST_D3D11_VIDEO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_D3D11_VIDEO_SINK,GstD3D11VideoSinkClass)) -#define GST_D3D11_VIDEO_SINK_GET_CLASS(obj) (GST_D3D11_VIDEO_SINK_CLASS(G_OBJECT_GET_CLASS(obj))) -#define GST_IS_D3D11_VIDEO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3D11_VIDEO_SINK)) -#define GST_IS_D3D11_VIDEO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_D3D11_VIDEO_SINK)) - -typedef struct _GstD3D11VideoSink GstD3D11VideoSink; -typedef struct _GstD3D11VideoSinkClass GstD3D11VideoSinkClass; - -struct _GstD3D11VideoSink -{ - GstVideoSink sink; - GstD3D11Device *device; - GstD3D11Window *window; - gint video_width; - gint video_height; - - GstVideoInfo info; - - guintptr window_id; - - /* properties */ - gint adapter; - gboolean force_aspect_ratio; - gboolean enable_navigation_events; - GstD3D11WindowFullscreenToggleMode fullscreen_toggle_mode; - gboolean fullscreen; - - /* saved render rectangle until we have a window */ - GstVideoRectangle render_rect; - gboolean pending_render_rect; - - GstBufferPool *fallback_pool; - gboolean can_convert; - gboolean have_video_processor; -}; - -struct _GstD3D11VideoSinkClass -{ - GstVideoSinkClass parent_class; -}; - -GType gst_d3d11_video_sink_get_type (void); +#define GST_TYPE_D3D11_VIDEO_SINK (gst_d3d11_video_sink_get_type()) +G_DECLARE_FINAL_TYPE (GstD3D11VideoSink, + gst_d3d11_video_sink, GST, D3D11_VIDEO_SINK, GstVideoSink); G_END_DECLS - #endif /* __GST_D3D11_VIDEO_SINK_H__ */ diff --git a/sys/d3d11/gstd3d11videosinkbin.c b/sys/d3d11/gstd3d11videosinkbin.c index aeb807a9f9..d6481d77c3 100644 --- a/sys/d3d11/gstd3d11videosinkbin.c +++ b/sys/d3d11/gstd3d11videosinkbin.c @@ -21,6 +21,11 @@ #include "config.h" #endif +#include +#include +#include +#include + #include "gstd3d11videosinkbin.h" #include "gstd3d11videosink.h" #include "gstd3d11upload.h" @@ -100,6 +105,16 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_DEBUG_CATEGORY (d3d11_video_sink_bin_debug); #define GST_CAT_DEFAULT d3d11_video_sink_bin_debug +struct _GstD3D11VideoSinkBin +{ + GstBin parent; + + GstPad *sinkpad; + + GstElement *upload; + GstElement *sink; +}; + static void gst_d3d11_video_sink_bin_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_d3d11_video_sink_bin_get_property (GObject * object, diff --git a/sys/d3d11/gstd3d11videosinkbin.h b/sys/d3d11/gstd3d11videosinkbin.h index 7e16b7ffdb..6df6f9259b 100644 --- a/sys/d3d11/gstd3d11videosinkbin.h +++ b/sys/d3d11/gstd3d11videosinkbin.h @@ -21,43 +21,13 @@ #define __GST_D3D11_VIDEO_SINK_BIN_H__ #include -#include -#include -#include -#include - -#include "gstd3d11_fwd.h" G_BEGIN_DECLS -#define GST_TYPE_D3D11_VIDEO_SINK_BIN (gst_d3d11_video_sink_bin_get_type()) -#define GST_D3D11_VIDEO_SINK_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3D11_VIDEO_SINK_BIN,GstD3D11VideoSinkBin)) -#define GST_D3D11_VIDEO_SINK_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_D3D11_VIDEO_SINK_BIN,GstD3D11VideoSinkBinClass)) -#define GST_D3D11_VIDEO_SINK_BIN_GET_CLASS(obj) (GST_D3D11_VIDEO_SINK_BIN_CLASS(G_OBJECT_GET_CLASS(obj))) -#define GST_IS_D3D11_VIDEO_SINK_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3D11_VIDEO_SINK_BIN)) -#define GST_IS_D3D11_VIDEO_SINK_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_D3D11_VIDEO_SINK_BIN)) - -typedef struct _GstD3D11VideoSinkBin GstD3D11VideoSinkBin; -typedef struct _GstD3D11VideoSinkBinClass GstD3D11VideoSinkBinClass; - -struct _GstD3D11VideoSinkBin -{ - GstBin parent; - - GstPad *sinkpad; - - GstElement *upload; - GstElement *sink; -}; - -struct _GstD3D11VideoSinkBinClass -{ - GstBinClass parent_class; -}; - -GType gst_d3d11_video_sink_bin_get_type (void); +#define GST_TYPE_D3D11_VIDEO_SINK_BIN (gst_d3d11_video_sink_bin_get_type()) +G_DECLARE_FINAL_TYPE (GstD3D11VideoSinkBin, + gst_d3d11_video_sink_bin, GST, D3D11_VIDEO_SINK_BIN, GstBin); G_END_DECLS - #endif /* __GST_D3D11_VIDEO_SINK_BIN_H__ */