Commit a43d6f6c authored by Seungha Yang's avatar Seungha Yang 🐑 Committed by GStreamer Merge Bot

mfvideosrc: Enable WinRT capture impl. for desktop target

... if target OS version was specified as Windows 10.
When enabled, desktop application can select target capture
implementation between WinRT and Win32
via GST_USE_MF_WINRT_CAPTURE environment
(e,g., GST_USE_MF_WINRT_CAPTURE=1 for WinRT impl.).
Default is Win32 implementation in case of desktop target.

Part-of: <!1434>
parent 2d71ad49
Pipeline #176829 waiting for manual action with stages
in 3 minutes and 21 seconds
...@@ -128,7 +128,6 @@ gst_mf_capture_winrt_constructed (GObject * object) ...@@ -128,7 +128,6 @@ gst_mf_capture_winrt_constructed (GObject * object)
g_cond_wait (&self->cond, &self->lock); g_cond_wait (&self->cond, &self->lock);
g_mutex_unlock (&self->lock); g_mutex_unlock (&self->lock);
done:
G_OBJECT_CLASS (parent_class)->constructed (object); G_OBJECT_CLASS (parent_class)->constructed (object);
} }
......
...@@ -25,11 +25,7 @@ ...@@ -25,11 +25,7 @@
#include "gstmfvideosrc.h" #include "gstmfvideosrc.h"
#include "gstmfutils.h" #include "gstmfutils.h"
#if GST_MF_WINAPI_ONLY_APP #include "gstmfsourceobject.h"
#include "gstmfcapturewinrt.h"
#else /* GST_MF_WINAPI_ONLY_APP */
#include "gstmfsourcereader.h"
#endif /* GST_MF_WINAPI_ONLY_APP */
#include "gstmfdevice.h" #include "gstmfdevice.h"
...@@ -180,12 +176,7 @@ gst_mf_device_provider_probe (GstDeviceProvider * provider) ...@@ -180,12 +176,7 @@ gst_mf_device_provider_probe (GstDeviceProvider * provider)
gchar *device_name = NULL; gchar *device_name = NULL;
gchar *device_path = NULL; gchar *device_path = NULL;
#if GST_MF_WINAPI_ONLY_APP obj = gst_mf_source_object_new (GST_MF_SOURCE_TYPE_VIDEO, i, NULL, NULL);
obj = gst_mf_capture_winrt_new (GST_MF_SOURCE_TYPE_VIDEO, i, NULL, NULL);
#else /* !GST_MF_WINAPI_ONLY_APP */
obj = gst_mf_source_reader_new (GST_MF_SOURCE_TYPE_VIDEO, i, NULL, NULL);
#endif /* GST_MF_WINAPI_ONLY_APP */
if (!obj) if (!obj)
break; break;
......
This diff is collapsed.
...@@ -35,7 +35,6 @@ G_BEGIN_DECLS ...@@ -35,7 +35,6 @@ G_BEGIN_DECLS
typedef struct _GstMFSourceObject GstMFSourceObject; typedef struct _GstMFSourceObject GstMFSourceObject;
typedef struct _GstMFSourceObjectClass GstMFSourceObjectClass; typedef struct _GstMFSourceObjectClass GstMFSourceObjectClass;
typedef struct _GstMFSourceObjectPrivate GstMFSourceObjectPrivate;
typedef enum typedef enum
{ {
...@@ -45,40 +44,26 @@ typedef enum ...@@ -45,40 +44,26 @@ typedef enum
#define GST_TYPE_MF_SOURCE_TYPE (gst_mf_source_type_get_type()) #define GST_TYPE_MF_SOURCE_TYPE (gst_mf_source_type_get_type())
GType gst_mf_source_type_get_type (void); GType gst_mf_source_type_get_type (void);
typedef struct
{
IMFActivate *handle;
guint index;
gchar *name;
gchar *path;
} GstMFDeviceActivate;
struct _GstMFSourceObject struct _GstMFSourceObject
{ {
GstObject parent; GstObject parent;
gboolean opened; gboolean opened;
GstMFSourceType source_type;
gchar *device_path; gchar *device_path;
gchar *device_name; gchar *device_name;
gint device_index; gint device_index;
GstMFSourceObjectPrivate *priv;
}; };
struct _GstMFSourceObjectClass struct _GstMFSourceObjectClass
{ {
GstObjectClass parent_class; GstObjectClass parent_class;
gboolean (*open) (GstMFSourceObject * object,
IMFActivate * activate);
gboolean (*start) (GstMFSourceObject * object); gboolean (*start) (GstMFSourceObject * object);
gboolean (*stop) (GstMFSourceObject * object); gboolean (*stop) (GstMFSourceObject * object);
gboolean (*close) (GstMFSourceObject * object);
GstFlowReturn (*fill) (GstMFSourceObject * object, GstFlowReturn (*fill) (GstMFSourceObject * object,
GstBuffer * buffer); GstBuffer * buffer);
...@@ -117,6 +102,12 @@ GstCaps * gst_mf_source_object_get_caps (GstMFSourceObject * object); ...@@ -117,6 +102,12 @@ GstCaps * gst_mf_source_object_get_caps (GstMFSourceObject * object);
gboolean gst_mf_source_object_set_caps (GstMFSourceObject * object, gboolean gst_mf_source_object_set_caps (GstMFSourceObject * object,
GstCaps * caps); GstCaps * caps);
/* A factory method for subclass impl. selection */
GstMFSourceObject * gst_mf_source_object_new (GstMFSourceType type,
gint device_index,
const gchar * device_name,
const gchar * device_path);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMFSourceObject, gst_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMFSourceObject, gst_object_unref)
G_END_DECLS G_END_DECLS
......
This diff is collapsed.
...@@ -569,7 +569,7 @@ gst_mf_guid_to_static_string (const GUID& guid) ...@@ -569,7 +569,7 @@ gst_mf_guid_to_static_string (const GUID& guid)
/* WAVE_FORMAT_MPEG_ADTS_AAC */ /* WAVE_FORMAT_MPEG_ADTS_AAC */
GST_MF_IF_EQUAL_RETURN(guid, MFAudioFormat_ADTS); GST_MF_IF_EQUAL_RETURN(guid, MFAudioFormat_ADTS);
#if !GST_MF_WINAPI_ONLY_APP #if GST_MF_WINAPI_DESKTOP
GST_MF_IF_EQUAL_RETURN(guid, MF_MT_CUSTOM_VIDEO_PRIMARIES); GST_MF_IF_EQUAL_RETURN(guid, MF_MT_CUSTOM_VIDEO_PRIMARIES);
GST_MF_IF_EQUAL_RETURN(guid, MF_MT_AM_FORMAT_TYPE); GST_MF_IF_EQUAL_RETURN(guid, MF_MT_AM_FORMAT_TYPE);
GST_MF_IF_EQUAL_RETURN(guid, MF_MT_ARBITRARY_HEADER); GST_MF_IF_EQUAL_RETURN(guid, MF_MT_ARBITRARY_HEADER);
......
...@@ -42,17 +42,13 @@ ...@@ -42,17 +42,13 @@
#include "gstmfvideosrc.h" #include "gstmfvideosrc.h"
#include "gstmfutils.h" #include "gstmfutils.h"
#if GST_MF_WINAPI_ONLY_APP #include "gstmfsourceobject.h"
#include "gstmfcapturewinrt.h"
#else /* GST_MF_WINAPI_ONLY_APP */
#include "gstmfsourcereader.h"
#endif /* !GST_MF_WINAPI_ONLY_APP */
#include <string.h> #include <string.h>
GST_DEBUG_CATEGORY (gst_mf_video_src_debug); GST_DEBUG_CATEGORY (gst_mf_video_src_debug);
#define GST_CAT_DEFAULT gst_mf_video_src_debug #define GST_CAT_DEFAULT gst_mf_video_src_debug
#if GST_MF_WINAPI_ONLY_APP #if (GST_MF_WINAPI_APP && !GST_MF_WINAPI_DESKTOP)
/* FIXME: need support JPEG for UWP */ /* FIXME: need support JPEG for UWP */
#define SRC_TEMPLATE_CAPS \ #define SRC_TEMPLATE_CAPS \
GST_VIDEO_CAPS_MAKE (GST_MF_VIDEO_FORMATS) GST_VIDEO_CAPS_MAKE (GST_MF_VIDEO_FORMATS)
...@@ -242,13 +238,8 @@ gst_mf_video_src_start (GstBaseSrc * src) ...@@ -242,13 +238,8 @@ gst_mf_video_src_start (GstBaseSrc * src)
GST_DEBUG_OBJECT (self, "Start"); GST_DEBUG_OBJECT (self, "Start");
#if GST_MF_WINAPI_ONLY_APP self->source = gst_mf_source_object_new (GST_MF_SOURCE_TYPE_VIDEO,
self->source = gst_mf_capture_winrt_new (GST_MF_SOURCE_TYPE_VIDEO,
self->device_index, self->device_name, self->device_path); self->device_index, self->device_name, self->device_path);
#else /* GST_MF_WINAPI_ONLY_APP */
self->source = gst_mf_source_reader_new (GST_MF_SOURCE_TYPE_VIDEO,
self->device_index, self->device_name, self->device_path);
#endif /* GST_MF_WINAPI_ONLY_APP */
self->first_pts = GST_CLOCK_TIME_NONE; self->first_pts = GST_CLOCK_TIME_NONE;
self->n_frames = 0; self->n_frames = 0;
......
...@@ -89,7 +89,7 @@ winapi_desktop = cxx.compiles('''#include <winapifamily.h> ...@@ -89,7 +89,7 @@ winapi_desktop = cxx.compiles('''#include <winapifamily.h>
#error "not win32" #error "not win32"
#endif''', #endif''',
dependencies: mf_lib_deps, dependencies: mf_lib_deps,
name: 'checking if building for Win32') name: 'building for Win32')
if runtimeobject_lib.found() if runtimeobject_lib.found()
winapi_app = cxx.compiles('''#include <winapifamily.h> winapi_app = cxx.compiles('''#include <winapifamily.h>
...@@ -97,24 +97,32 @@ if runtimeobject_lib.found() ...@@ -97,24 +97,32 @@ if runtimeobject_lib.found()
#include <wrl.h> #include <wrl.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#error "not winrt" #error "not winrt"
#endif
#ifndef WINVER
#error "unknown minimum supported OS version"
#endif
#if (WINVER < 0x0A00)
#error "Windows 10 API is not guaranteed"
#endif''', #endif''',
dependencies: [mf_lib_deps, runtimeobject_lib], dependencies: [mf_lib_deps, runtimeobject_lib],
name: 'checking if building for WinRT') name: 'building for WinRT')
endif endif
if not winapi_desktop and not winapi_app if not winapi_desktop and not winapi_app
error('Neither Desktop partition nor App partition') error('Neither Desktop partition nor App partition')
endif endif
winapi_app_only = winapi_app and not winapi_desktop if winapi_app
if winapi_app_only
mf_sources += mf_app_sources mf_sources += mf_app_sources
mf_lib_deps += [runtimeobject_lib] mf_lib_deps += [runtimeobject_lib]
else endif
if winapi_desktop
mf_sources += mf_desktop_sources mf_sources += mf_desktop_sources
endif endif
mf_config.set10('GST_MF_WINAPI_ONLY_APP', winapi_app_only) mf_config.set10('GST_MF_WINAPI_APP', winapi_app)
mf_config.set10('GST_MF_WINAPI_DESKTOP', winapi_desktop)
configure_file( configure_file(
output: 'gstmfconfig.h', output: 'gstmfconfig.h',
......
...@@ -70,7 +70,7 @@ plugin_init (GstPlugin * plugin) ...@@ -70,7 +70,7 @@ plugin_init (GstPlugin * plugin)
} }
/* mfvideosrc should be primary rank for UWP */ /* mfvideosrc should be primary rank for UWP */
#if GST_MF_WINAPI_ONLY_APP #if (GST_MF_WINAPI_APP && !GST_MF_WINAPI_DESKTOP)
rank = GST_RANK_PRIMARY + 1; rank = GST_RANK_PRIMARY + 1;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment