mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 23:48:53 +00:00
mediafoundation: Run gst-indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2375>
This commit is contained in:
parent
b269cd5319
commit
3f8632dc96
13 changed files with 502 additions and 473 deletions
|
@ -43,7 +43,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_mf_aac_enc_debug);
|
GST_DEBUG_CATEGORY (gst_mf_aac_enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_aac_enc_debug
|
#define GST_CAT_DEFAULT gst_mf_aac_enc_debug
|
||||||
|
@ -70,6 +72,7 @@ typedef struct _GstMFAacEncClass
|
||||||
|
|
||||||
} GstMFAacEncClass;
|
} GstMFAacEncClass;
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstCaps *sink_caps;
|
GstCaps *sink_caps;
|
||||||
|
@ -79,6 +82,7 @@ typedef struct
|
||||||
guint device_index;
|
guint device_index;
|
||||||
std::set<UINT32> bitrate_list;
|
std::set<UINT32> bitrate_list;
|
||||||
} GstMFAacEncClassData;
|
} GstMFAacEncClassData;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
|
@ -110,14 +114,16 @@ gst_mf_aac_enc_class_init (GstMFAacEncClass * klass, gpointer data)
|
||||||
gobject_class->get_property = gst_mf_aac_enc_get_property;
|
gobject_class->get_property = gst_mf_aac_enc_get_property;
|
||||||
gobject_class->set_property = gst_mf_aac_enc_set_property;
|
gobject_class->set_property = gst_mf_aac_enc_set_property;
|
||||||
|
|
||||||
bitrate_blurb =
|
bitrate_blurb = "Bitrate in bit/sec, (0 = auto), valid values are { 0";
|
||||||
"Bitrate in bit/sec, (0 = auto), valid values are { 0";
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
for (auto iter: cdata->bitrate_list) {
|
for (auto iter: cdata->bitrate_list) {
|
||||||
bitrate_blurb += ", " + std::to_string (iter);
|
bitrate_blurb += ", " + std::to_string (iter);
|
||||||
/* std::set<> stores values in a sorted fashion */
|
/* std::set<> stores values in a sorted fashion */
|
||||||
max_bitrate = iter;
|
max_bitrate = iter;
|
||||||
}
|
}
|
||||||
bitrate_blurb += " }";
|
bitrate_blurb += " }";
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_BITRATE,
|
g_object_class_install_property (gobject_class, PROP_BITRATE,
|
||||||
g_param_spec_uint ("bitrate", "Bitrate", bitrate_blurb.c_str (), 0,
|
g_param_spec_uint ("bitrate", "Bitrate", bitrate_blurb.c_str (), 0,
|
||||||
|
@ -147,8 +153,7 @@ gst_mf_aac_enc_class_init (GstMFAacEncClass * klass, gpointer data)
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_aac_enc_get_output_type);
|
GST_DEBUG_FUNCPTR (gst_mf_aac_enc_get_output_type);
|
||||||
mfenc_class->get_input_type =
|
mfenc_class->get_input_type =
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_aac_enc_get_input_type);
|
GST_DEBUG_FUNCPTR (gst_mf_aac_enc_get_input_type);
|
||||||
mfenc_class->set_src_caps =
|
mfenc_class->set_src_caps = GST_DEBUG_FUNCPTR (gst_mf_aac_enc_set_src_caps);
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_aac_enc_set_src_caps);
|
|
||||||
|
|
||||||
mfenc_class->codec_id = MFAudioFormat_AAC;
|
mfenc_class->codec_id = MFAudioFormat_AAC;
|
||||||
mfenc_class->enum_flags = cdata->enum_flags;
|
mfenc_class->enum_flags = cdata->enum_flags;
|
||||||
|
@ -310,6 +315,8 @@ gst_mf_aac_enc_get_output_type (GstMFAudioEnc * mfenc, GstAudioInfo * info,
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Available bitrates");
|
GST_DEBUG_OBJECT (self, "Available bitrates");
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
for (auto it: bitrate_list)
|
for (auto it: bitrate_list)
|
||||||
GST_DEBUG_OBJECT (self, "\t%d", it);
|
GST_DEBUG_OBJECT (self, "\t%d", it);
|
||||||
|
|
||||||
|
@ -335,6 +342,7 @@ gst_mf_aac_enc_get_output_type (GstMFAudioEnc * mfenc, GstAudioInfo * info,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
if (!target_output) {
|
if (!target_output) {
|
||||||
GST_ERROR_OBJECT (self, "Failed to decide final output type");
|
GST_ERROR_OBJECT (self, "Failed to decide final output type");
|
||||||
|
@ -424,8 +432,7 @@ gst_mf_aac_enc_get_input_type (GstMFAudioEnc * mfenc, GstAudioInfo * info,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mf_aac_enc_set_src_caps (GstMFAudioEnc * mfenc,
|
gst_mf_aac_enc_set_src_caps (GstMFAudioEnc * mfenc, GstAudioInfo * info)
|
||||||
GstAudioInfo * info)
|
|
||||||
{
|
{
|
||||||
GstMFAacEnc *self = (GstMFAacEnc *) mfenc;
|
GstMFAacEnc *self = (GstMFAacEnc *) mfenc;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -437,7 +444,8 @@ gst_mf_aac_enc_set_src_caps (GstMFAudioEnc * mfenc,
|
||||||
ComPtr < IMFMediaType > output_type;
|
ComPtr < IMFMediaType > output_type;
|
||||||
static const guint config_data_offset = 12;
|
static const guint config_data_offset = 12;
|
||||||
|
|
||||||
if (!gst_mf_transform_get_output_current_type (mfenc->transform, &output_type)) {
|
if (!gst_mf_transform_get_output_current_type (mfenc->transform,
|
||||||
|
&output_type)) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't get current output type");
|
GST_ERROR_OBJECT (self, "Couldn't get current output type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -480,7 +488,8 @@ gst_mf_aac_enc_set_src_caps (GstMFAudioEnc * mfenc,
|
||||||
blob + config_data_offset, blob_size - config_data_offset);
|
blob + config_data_offset, blob_size - config_data_offset);
|
||||||
CoTaskMemFree (blob);
|
CoTaskMemFree (blob);
|
||||||
|
|
||||||
ret = gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (self), src_caps);
|
ret =
|
||||||
|
gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (self), src_caps);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
GST_WARNING_OBJECT (self,
|
GST_WARNING_OBJECT (self,
|
||||||
"Couldn't set output format %" GST_PTR_FORMAT, src_caps);
|
"Couldn't set output format %" GST_PTR_FORMAT, src_caps);
|
||||||
|
@ -583,7 +592,8 @@ gst_mf_aac_enc_plugin_init_internal (GstPlugin * plugin, guint rank,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_INFO_OBJECT (transform, "Have %d output type", g_list_length (output_list));
|
GST_INFO_OBJECT (transform, "Have %d output type",
|
||||||
|
g_list_length (output_list));
|
||||||
|
|
||||||
for (iter = output_list, i = 0; iter; iter = g_list_next (iter), i++) {
|
for (iter = output_list, i = 0; iter; iter = g_list_next (iter), i++) {
|
||||||
UINT32 channels, rate, bitrate;
|
UINT32 channels, rate, bitrate;
|
||||||
|
@ -652,6 +662,7 @@ gst_mf_aac_enc_plugin_init_internal (GstPlugin * plugin, guint rank,
|
||||||
g_value_init (&channles_value, GST_TYPE_LIST);
|
g_value_init (&channles_value, GST_TYPE_LIST);
|
||||||
g_value_init (&rate_value, GST_TYPE_LIST);
|
g_value_init (&rate_value, GST_TYPE_LIST);
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
for (auto it: channels_list) {
|
for (auto it: channels_list) {
|
||||||
GValue channles = G_VALUE_INIT;
|
GValue channles = G_VALUE_INIT;
|
||||||
|
|
||||||
|
@ -667,6 +678,7 @@ gst_mf_aac_enc_plugin_init_internal (GstPlugin * plugin, guint rank,
|
||||||
g_value_set_int (&rate, (gint) it);
|
g_value_set_int (&rate, (gint) it);
|
||||||
gst_value_list_append_and_take_value (&rate_value, &rate);
|
gst_value_list_append_and_take_value (&rate_value, &rate);
|
||||||
}
|
}
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
gst_caps_set_value (src_caps, "channels", &channles_value);
|
gst_caps_set_value (src_caps, "channels", &channles_value);
|
||||||
gst_caps_set_value (sink_caps, "channels", &channles_value);
|
gst_caps_set_value (sink_caps, "channels", &channles_value);
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_mf_audio_enc_debug);
|
GST_DEBUG_CATEGORY (gst_mf_audio_enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_audio_enc_debug
|
#define GST_CAT_DEFAULT gst_mf_audio_enc_debug
|
||||||
|
@ -56,8 +58,7 @@ gst_mf_audio_enc_class_init (GstMFAudioEncClass * klass)
|
||||||
audioenc_class->set_format = GST_DEBUG_FUNCPTR (gst_mf_audio_enc_set_format);
|
audioenc_class->set_format = GST_DEBUG_FUNCPTR (gst_mf_audio_enc_set_format);
|
||||||
audioenc_class->handle_frame =
|
audioenc_class->handle_frame =
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_audio_enc_handle_frame);
|
GST_DEBUG_FUNCPTR (gst_mf_audio_enc_handle_frame);
|
||||||
audioenc_class->flush =
|
audioenc_class->flush = GST_DEBUG_FUNCPTR (gst_mf_audio_enc_flush);
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_audio_enc_flush);
|
|
||||||
|
|
||||||
gst_type_mark_as_plugin_api (GST_TYPE_MF_AUDIO_ENC, (GstPluginAPIFlags) 0);
|
gst_type_mark_as_plugin_api (GST_TYPE_MF_AUDIO_ENC, (GstPluginAPIFlags) 0);
|
||||||
}
|
}
|
||||||
|
@ -273,8 +274,7 @@ gst_mf_audio_enc_process_output (GstMFAudioEnc * self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_mf_audio_enc_handle_frame (GstAudioEncoder * enc,
|
gst_mf_audio_enc_handle_frame (GstAudioEncoder * enc, GstBuffer * buffer)
|
||||||
GstBuffer *buffer)
|
|
||||||
{
|
{
|
||||||
GstMFAudioEnc *self = GST_MF_AUDIO_ENC (enc);
|
GstMFAudioEnc *self = GST_MF_AUDIO_ENC (enc);
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
using namespace Microsoft::WRL::Wrappers;
|
using namespace Microsoft::WRL::Wrappers;
|
||||||
using namespace ABI::Windows::Media::MediaProperties;
|
using namespace ABI::Windows::Media::MediaProperties;
|
||||||
|
@ -42,6 +43,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_mf_source_object_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_source_object_debug
|
#define GST_CAT_DEFAULT gst_mf_source_object_debug
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -254,6 +256,7 @@ gst_mf_capture_winrt_thread_func (GstMFCaptureWinRT * self)
|
||||||
|
|
||||||
hr = self->capture->EnumrateFrameSourceGroup (group_list);
|
hr = self->capture->EnumrateFrameSourceGroup (group_list);
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
index = 0;
|
index = 0;
|
||||||
for (const auto& iter: group_list) {
|
for (const auto& iter: group_list) {
|
||||||
|
@ -291,6 +294,7 @@ gst_mf_capture_winrt_thread_func (GstMFCaptureWinRT * self)
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
if (!target_group) {
|
if (!target_group) {
|
||||||
GST_WARNING_OBJECT (self, "No matching device");
|
GST_WARNING_OBJECT (self, "No matching device");
|
||||||
|
@ -309,8 +313,10 @@ gst_mf_capture_winrt_thread_func (GstMFCaptureWinRT * self)
|
||||||
|
|
||||||
self->supported_caps = gst_caps_new_empty ();
|
self->supported_caps = gst_caps_new_empty ();
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
for (auto iter: target_group->source_list_)
|
for (auto iter: target_group->source_list_)
|
||||||
gst_caps_append (self->supported_caps, gst_caps_copy (iter.caps_));
|
gst_caps_append (self->supported_caps, gst_caps_copy (iter.caps_));
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Available output caps %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (self, "Available output caps %" GST_PTR_FORMAT,
|
||||||
self->supported_caps);
|
self->supported_caps);
|
||||||
|
@ -384,8 +390,7 @@ gst_mf_capture_winrt_stop (GstMFSourceObject * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT
|
static HRESULT
|
||||||
gst_mf_capture_winrt_on_frame (IMediaFrameReference * frame,
|
gst_mf_capture_winrt_on_frame (IMediaFrameReference * frame, void *user_data)
|
||||||
void * user_data)
|
|
||||||
{
|
{
|
||||||
GstMFCaptureWinRT *self = GST_MF_CAPTURE_WINRT (user_data);
|
GstMFCaptureWinRT *self = GST_MF_CAPTURE_WINRT (user_data);
|
||||||
GstMFCaptureWinRTFrame winrt_frame;
|
GstMFCaptureWinRTFrame winrt_frame;
|
||||||
|
@ -666,6 +671,7 @@ gst_mf_capture_winrt_get_caps (GstMFSourceObject * object)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mf_capture_winrt_set_caps (GstMFSourceObject * object, GstCaps * caps)
|
gst_mf_capture_winrt_set_caps (GstMFSourceObject * object, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
@ -701,6 +707,7 @@ gst_mf_capture_winrt_set_caps (GstMFSourceObject * object, GstCaps * caps)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mf_capture_winrt_frame_clear (GstMFCaptureWinRTFrame * winrt_frame)
|
gst_mf_capture_winrt_frame_clear (GstMFCaptureWinRTFrame * winrt_frame)
|
||||||
|
|
|
@ -47,7 +47,9 @@
|
||||||
#include <gst/d3d11/gstd3d11.h>
|
#include <gst/d3d11/gstd3d11.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_mf_h264_enc_debug);
|
GST_DEBUG_CATEGORY (gst_mf_h264_enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_h264_enc_debug
|
#define GST_CAT_DEFAULT gst_mf_h264_enc_debug
|
||||||
|
@ -867,8 +869,7 @@ gst_mf_h264_enc_set_option (GstMFVideoEnc * mfenc, GstVideoCodecState * state,
|
||||||
|
|
||||||
if (device_caps->adaptive_mode) {
|
if (device_caps->adaptive_mode) {
|
||||||
guint adaptive_mode;
|
guint adaptive_mode;
|
||||||
adaptive_mode =
|
adaptive_mode = gst_mf_h264_enc_adaptive_mode_to_enum (self->adaptive_mode);
|
||||||
gst_mf_h264_enc_adaptive_mode_to_enum (self->adaptive_mode);
|
|
||||||
if (adaptive_mode != G_MAXUINT) {
|
if (adaptive_mode != G_MAXUINT) {
|
||||||
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
||||||
&CODECAPI_AVEncAdaptiveMode, adaptive_mode);
|
&CODECAPI_AVEncAdaptiveMode, adaptive_mode);
|
||||||
|
@ -891,8 +892,7 @@ gst_mf_h264_enc_set_option (GstMFVideoEnc * mfenc, GstVideoCodecState * state,
|
||||||
|
|
||||||
if (device_caps->quality_vs_speed) {
|
if (device_caps->quality_vs_speed) {
|
||||||
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
||||||
&CODECAPI_AVEncCommonQualityVsSpeed,
|
&CODECAPI_AVEncCommonQualityVsSpeed, self->quality_vs_speed);
|
||||||
self->quality_vs_speed);
|
|
||||||
WARNING_HR (hr, CODECAPI_AVEncCommonQualityVsSpeed);
|
WARNING_HR (hr, CODECAPI_AVEncCommonQualityVsSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,9 @@
|
||||||
#include "gstmfh265enc.h"
|
#include "gstmfh265enc.h"
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_mf_h265_enc_debug);
|
GST_DEBUG_CATEGORY (gst_mf_h265_enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_h265_enc_debug
|
#define GST_CAT_DEFAULT gst_mf_h265_enc_debug
|
||||||
|
@ -647,8 +649,7 @@ gst_mf_h265_enc_set_option (GstMFVideoEnc * mfenc, GstVideoCodecState * state,
|
||||||
|
|
||||||
if (device_caps->quality_vs_speed) {
|
if (device_caps->quality_vs_speed) {
|
||||||
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
||||||
&CODECAPI_AVEncCommonQualityVsSpeed,
|
&CODECAPI_AVEncCommonQualityVsSpeed, self->quality_vs_speed);
|
||||||
self->quality_vs_speed);
|
|
||||||
WARNING_HR (hr, CODECAPI_AVEncCommonQualityVsSpeed);
|
WARNING_HR (hr, CODECAPI_AVEncCommonQualityVsSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_mf_mp3_enc_debug);
|
GST_DEBUG_CATEGORY (gst_mf_mp3_enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_mp3_enc_debug
|
#define GST_CAT_DEFAULT gst_mf_mp3_enc_debug
|
||||||
|
@ -70,6 +72,7 @@ typedef struct _GstMFMp3EncClass
|
||||||
|
|
||||||
} GstMFMp3EncClass;
|
} GstMFMp3EncClass;
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstCaps *sink_caps;
|
GstCaps *sink_caps;
|
||||||
|
@ -79,6 +82,7 @@ typedef struct
|
||||||
guint device_index;
|
guint device_index;
|
||||||
std::set<UINT32> bitrate_list;
|
std::set<UINT32> bitrate_list;
|
||||||
} GstMFMp3EncClassData;
|
} GstMFMp3EncClassData;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
|
@ -110,14 +114,16 @@ gst_mf_mp3_enc_class_init (GstMFMp3EncClass * klass, gpointer data)
|
||||||
gobject_class->get_property = gst_mf_mp3_enc_get_property;
|
gobject_class->get_property = gst_mf_mp3_enc_get_property;
|
||||||
gobject_class->set_property = gst_mf_mp3_enc_set_property;
|
gobject_class->set_property = gst_mf_mp3_enc_set_property;
|
||||||
|
|
||||||
bitrate_blurb =
|
bitrate_blurb = "Bitrate in bit/sec, (0 = auto), valid values are { 0";
|
||||||
"Bitrate in bit/sec, (0 = auto), valid values are { 0";
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
for (auto iter: cdata->bitrate_list) {
|
for (auto iter: cdata->bitrate_list) {
|
||||||
bitrate_blurb += ", " + std::to_string (iter);
|
bitrate_blurb += ", " + std::to_string (iter);
|
||||||
/* std::set<> stores values in a sorted fashion */
|
/* std::set<> stores values in a sorted fashion */
|
||||||
max_bitrate = iter;
|
max_bitrate = iter;
|
||||||
}
|
}
|
||||||
bitrate_blurb += " }";
|
bitrate_blurb += " }";
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_BITRATE,
|
g_object_class_install_property (gobject_class, PROP_BITRATE,
|
||||||
g_param_spec_uint ("bitrate", "Bitrate", bitrate_blurb.c_str (), 0,
|
g_param_spec_uint ("bitrate", "Bitrate", bitrate_blurb.c_str (), 0,
|
||||||
|
@ -147,8 +153,7 @@ gst_mf_mp3_enc_class_init (GstMFMp3EncClass * klass, gpointer data)
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_mp3_enc_get_output_type);
|
GST_DEBUG_FUNCPTR (gst_mf_mp3_enc_get_output_type);
|
||||||
mfenc_class->get_input_type =
|
mfenc_class->get_input_type =
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_mp3_enc_get_input_type);
|
GST_DEBUG_FUNCPTR (gst_mf_mp3_enc_get_input_type);
|
||||||
mfenc_class->set_src_caps =
|
mfenc_class->set_src_caps = GST_DEBUG_FUNCPTR (gst_mf_mp3_enc_set_src_caps);
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_mp3_enc_set_src_caps);
|
|
||||||
|
|
||||||
mfenc_class->codec_id = MFAudioFormat_MP3;
|
mfenc_class->codec_id = MFAudioFormat_MP3;
|
||||||
mfenc_class->enum_flags = cdata->enum_flags;
|
mfenc_class->enum_flags = cdata->enum_flags;
|
||||||
|
@ -294,6 +299,8 @@ gst_mf_mp3_enc_get_output_type (GstMFAudioEnc * mfenc, GstAudioInfo * info,
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Available bitrates");
|
GST_DEBUG_OBJECT (self, "Available bitrates");
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
for (auto it: bitrate_list)
|
for (auto it: bitrate_list)
|
||||||
GST_DEBUG_OBJECT (self, "\t%d", it);
|
GST_DEBUG_OBJECT (self, "\t%d", it);
|
||||||
|
|
||||||
|
@ -319,6 +326,7 @@ gst_mf_mp3_enc_get_output_type (GstMFAudioEnc * mfenc, GstAudioInfo * info,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
if (!target_output) {
|
if (!target_output) {
|
||||||
GST_ERROR_OBJECT (self, "Failed to decide final output type");
|
GST_ERROR_OBJECT (self, "Failed to decide final output type");
|
||||||
|
@ -408,8 +416,7 @@ gst_mf_mp3_enc_get_input_type (GstMFAudioEnc * mfenc, GstAudioInfo * info,
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mf_mp3_enc_set_src_caps (GstMFAudioEnc * mfenc,
|
gst_mf_mp3_enc_set_src_caps (GstMFAudioEnc * mfenc, GstAudioInfo * info)
|
||||||
GstAudioInfo * info)
|
|
||||||
{
|
{
|
||||||
GstMFMp3Enc *self = (GstMFMp3Enc *) mfenc;
|
GstMFMp3Enc *self = (GstMFMp3Enc *) mfenc;
|
||||||
GstCaps *src_caps;
|
GstCaps *src_caps;
|
||||||
|
@ -417,7 +424,8 @@ gst_mf_mp3_enc_set_src_caps (GstMFAudioEnc * mfenc,
|
||||||
ComPtr < IMFMediaType > output_type;
|
ComPtr < IMFMediaType > output_type;
|
||||||
gint version = 1;
|
gint version = 1;
|
||||||
|
|
||||||
if (!gst_mf_transform_get_output_current_type (mfenc->transform, &output_type)) {
|
if (!gst_mf_transform_get_output_current_type (mfenc->transform,
|
||||||
|
&output_type)) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't get current output type");
|
GST_ERROR_OBJECT (self, "Couldn't get current output type");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -434,10 +442,10 @@ gst_mf_mp3_enc_set_src_caps (GstMFAudioEnc * mfenc,
|
||||||
"mpegaudioversion", G_TYPE_INT, version,
|
"mpegaudioversion", G_TYPE_INT, version,
|
||||||
"layer", G_TYPE_INT, 3,
|
"layer", G_TYPE_INT, 3,
|
||||||
"channels", G_TYPE_INT, GST_AUDIO_INFO_CHANNELS (info),
|
"channels", G_TYPE_INT, GST_AUDIO_INFO_CHANNELS (info),
|
||||||
"rate", G_TYPE_INT, GST_AUDIO_INFO_RATE (info),
|
"rate", G_TYPE_INT, GST_AUDIO_INFO_RATE (info), NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
ret = gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (self), src_caps);
|
ret =
|
||||||
|
gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (self), src_caps);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
GST_WARNING_OBJECT (self,
|
GST_WARNING_OBJECT (self,
|
||||||
"Couldn't set output format %" GST_PTR_FORMAT, src_caps);
|
"Couldn't set output format %" GST_PTR_FORMAT, src_caps);
|
||||||
|
@ -544,6 +552,7 @@ gst_mf_mp3_enc_create_template_caps (const std::set<UINT32> &rate_list,
|
||||||
|
|
||||||
g_value_init (&rate_value, GST_TYPE_LIST);
|
g_value_init (&rate_value, GST_TYPE_LIST);
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
for (const auto &it: rate_list) {
|
for (const auto &it: rate_list) {
|
||||||
GValue rate = G_VALUE_INIT;
|
GValue rate = G_VALUE_INIT;
|
||||||
|
|
||||||
|
@ -551,6 +560,7 @@ gst_mf_mp3_enc_create_template_caps (const std::set<UINT32> &rate_list,
|
||||||
g_value_set_int (&rate, (gint) it);
|
g_value_set_int (&rate, (gint) it);
|
||||||
gst_value_list_append_and_take_value (&rate_value, &rate);
|
gst_value_list_append_and_take_value (&rate_value, &rate);
|
||||||
}
|
}
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
gst_caps_set_value (src, "rate", &rate_value);
|
gst_caps_set_value (src, "rate", &rate_value);
|
||||||
gst_caps_set_value (sink, "rate", &rate_value);
|
gst_caps_set_value (sink, "rate", &rate_value);
|
||||||
|
@ -600,7 +610,8 @@ gst_mf_mp3_enc_plugin_init_internal (GstPlugin * plugin, guint rank,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_INFO_OBJECT (transform, "Have %d output type", g_list_length (output_list));
|
GST_INFO_OBJECT (transform, "Have %d output type",
|
||||||
|
g_list_length (output_list));
|
||||||
|
|
||||||
for (iter = output_list, i = 0; iter; iter = g_list_next (iter), i++) {
|
for (iter = output_list, i = 0; iter; iter = g_list_next (iter), i++) {
|
||||||
UINT32 channels, rate, bitrate;
|
UINT32 channels, rate, bitrate;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -39,6 +40,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_mf_source_object_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_source_object_debug
|
#define GST_CAT_DEFAULT gst_mf_source_object_debug
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
typedef struct _GstMFStreamMediaType
|
typedef struct _GstMFStreamMediaType
|
||||||
{
|
{
|
||||||
|
@ -854,9 +856,9 @@ gst_mf_source_enum_device_activate (GstMFSourceReader * self,
|
||||||
|
|
||||||
switch (source_type) {
|
switch (source_type) {
|
||||||
case GST_MF_SOURCE_TYPE_VIDEO:
|
case GST_MF_SOURCE_TYPE_VIDEO:
|
||||||
hr = activate->GetAllocatedString (
|
hr = activate->GetAllocatedString
|
||||||
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
|
(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, &name,
|
||||||
&name, &name_len);
|
&name_len);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -254,6 +255,7 @@ private:
|
||||||
|
|
||||||
bool running_;
|
bool running_;
|
||||||
};
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -623,8 +625,7 @@ gst_mf_transform_process_output (GstMFTransform * self)
|
||||||
ComPtr < IMFMediaBuffer > buffer;
|
ComPtr < IMFMediaBuffer > buffer;
|
||||||
ComPtr < IMFSample > new_sample;
|
ComPtr < IMFSample > new_sample;
|
||||||
|
|
||||||
hr = MFCreateMemoryBuffer (out_stream_info.cbSize,
|
hr = MFCreateMemoryBuffer (out_stream_info.cbSize, buffer.GetAddressOf ());
|
||||||
buffer.GetAddressOf ());
|
|
||||||
if (!gst_mf_result (hr)) {
|
if (!gst_mf_result (hr)) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't create memory buffer");
|
GST_ERROR_OBJECT (self, "Couldn't create memory buffer");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
@ -709,8 +710,7 @@ done:
|
||||||
|
|
||||||
/* Must be called with event_lock */
|
/* Must be called with event_lock */
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mf_transform_process_input_sync (GstMFTransform * self,
|
gst_mf_transform_process_input_sync (GstMFTransform * self, IMFSample * sample)
|
||||||
IMFSample * sample)
|
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -723,8 +723,7 @@ gst_mf_transform_process_input_sync (GstMFTransform * self,
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_mf_transform_process_input (GstMFTransform * object,
|
gst_mf_transform_process_input (GstMFTransform * object, IMFSample * sample)
|
||||||
IMFSample * sample)
|
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
@ -792,8 +791,7 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
GstFlowReturn
|
GstFlowReturn
|
||||||
gst_mf_transform_get_output (GstMFTransform * object,
|
gst_mf_transform_get_output (GstMFTransform * object, IMFSample ** sample)
|
||||||
IMFSample ** sample)
|
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
|
@ -1085,8 +1083,7 @@ gst_mf_transform_event_type_to_string (MediaEventType event)
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT
|
static HRESULT
|
||||||
gst_mf_transform_on_event (MediaEventType event,
|
gst_mf_transform_on_event (MediaEventType event, GstMFTransform * self)
|
||||||
GstMFTransform * self)
|
|
||||||
{
|
{
|
||||||
GST_TRACE_OBJECT (self, "Have event %s (%d)",
|
GST_TRACE_OBJECT (self, "Have event %s (%d)",
|
||||||
gst_mf_transform_event_type_to_string (event), (gint) event);
|
gst_mf_transform_event_type_to_string (event), (gint) event);
|
||||||
|
@ -1142,8 +1139,7 @@ gst_mf_transform_get_codec_api_handle (GstMFTransform * object)
|
||||||
g_return_val_if_fail (GST_IS_MF_TRANSFORM (object), NULL);
|
g_return_val_if_fail (GST_IS_MF_TRANSFORM (object), NULL);
|
||||||
|
|
||||||
if (!object->codec_api) {
|
if (!object->codec_api) {
|
||||||
GST_WARNING_OBJECT (object,
|
GST_WARNING_OBJECT (object, "ICodecAPI is not configured, open MFT first");
|
||||||
"ICodecAPI is not configured, open MFT first");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1409,4 +1405,3 @@ gst_mf_transform_set_codec_api_boolean (GstMFTransform * object,
|
||||||
|
|
||||||
return gst_mf_result (hr);
|
return gst_mf_result (hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "gstmfutils.h"
|
#include "gstmfutils.h"
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -80,6 +81,7 @@ static struct
|
||||||
{MFVideoFormat_VP90, "video/x-vp9"},
|
{MFVideoFormat_VP90, "video/x-vp9"},
|
||||||
{MFVideoFormat_MJPG, "image/jpeg"},
|
{MFVideoFormat_MJPG, "image/jpeg"},
|
||||||
};
|
};
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GstVideoFormat
|
GstVideoFormat
|
||||||
gst_mf_video_subtype_to_video_format (const GUID * subtype)
|
gst_mf_video_subtype_to_video_format (const GUID * subtype)
|
||||||
|
@ -639,8 +641,8 @@ gst_mf_attribute_value_to_string (const GUID& guid, const PROPVARIANT& var)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mf_dump_attribute_value_by_index (IMFAttributes * attr, const gchar * msg,
|
gst_mf_dump_attribute_value_by_index (IMFAttributes * attr, const gchar * msg,
|
||||||
guint index, GstDebugLevel level, GstDebugCategory * cat, const gchar * file,
|
guint index, GstDebugLevel level, GstDebugCategory * cat,
|
||||||
const gchar * function, gint line)
|
const gchar * file, const gchar * function, gint line)
|
||||||
{
|
{
|
||||||
gchar *guid_name = NULL;
|
gchar *guid_name = NULL;
|
||||||
gchar *value = NULL;
|
gchar *value = NULL;
|
||||||
|
@ -663,8 +665,7 @@ gst_mf_dump_attribute_value_by_index (IMFAttributes * attr, const gchar * msg,
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
gst_debug_log (cat, level, file, function, line,
|
gst_debug_log (cat, level, file, function, line,
|
||||||
NULL, "%s attribute %d, %s: %s", msg ? msg : "", index, guid_name,
|
NULL, "%s attribute %d, %s: %s", msg ? msg : "", index, guid_name, value);
|
||||||
value);
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
PropVariantClear (&var);
|
PropVariantClear (&var);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "gstmfvideobuffer.h"
|
#include "gstmfvideobuffer.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (gst_mf_video_buffer_debug);
|
GST_DEBUG_CATEGORY_EXTERN (gst_mf_video_buffer_debug);
|
||||||
|
@ -504,3 +505,5 @@ IGstMFVideoBuffer::ContiguousCopyFrom (const BYTE * src_buffer,
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <d3d10.h>
|
#include <d3d10.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -41,6 +42,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_mf_video_enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_video_enc_debug
|
#define GST_CAT_DEFAULT gst_mf_video_enc_debug
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
#define gst_mf_video_enc_parent_class parent_class
|
#define gst_mf_video_enc_parent_class parent_class
|
||||||
G_DEFINE_ABSTRACT_TYPE (GstMFVideoEnc, gst_mf_video_enc,
|
G_DEFINE_ABSTRACT_TYPE (GstMFVideoEnc, gst_mf_video_enc,
|
||||||
|
@ -89,10 +91,8 @@ gst_mf_video_enc_class_init (GstMFVideoEncClass * klass)
|
||||||
videoenc_class->flush = GST_DEBUG_FUNCPTR (gst_mf_video_enc_flush);
|
videoenc_class->flush = GST_DEBUG_FUNCPTR (gst_mf_video_enc_flush);
|
||||||
videoenc_class->propose_allocation =
|
videoenc_class->propose_allocation =
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_video_enc_propose_allocation);
|
GST_DEBUG_FUNCPTR (gst_mf_video_enc_propose_allocation);
|
||||||
videoenc_class->sink_query =
|
videoenc_class->sink_query = GST_DEBUG_FUNCPTR (gst_mf_video_enc_sink_query);
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_video_enc_sink_query);
|
videoenc_class->src_query = GST_DEBUG_FUNCPTR (gst_mf_video_enc_src_query);
|
||||||
videoenc_class->src_query =
|
|
||||||
GST_DEBUG_FUNCPTR (gst_mf_video_enc_src_query);
|
|
||||||
|
|
||||||
gst_type_mark_as_plugin_api (GST_TYPE_MF_VIDEO_ENC, (GstPluginAPIFlags) 0);
|
gst_type_mark_as_plugin_api (GST_TYPE_MF_VIDEO_ENC, (GstPluginAPIFlags) 0);
|
||||||
}
|
}
|
||||||
|
@ -162,8 +162,7 @@ gst_mf_video_enc_open (GstVideoEncoder * enc)
|
||||||
|
|
||||||
device = self->d3d11_device;
|
device = self->d3d11_device;
|
||||||
|
|
||||||
hr = MFCreateDXGIDeviceManager (&self->reset_token,
|
hr = MFCreateDXGIDeviceManager (&self->reset_token, &self->device_manager);
|
||||||
&self->device_manager);
|
|
||||||
if (!gst_mf_result (hr)) {
|
if (!gst_mf_result (hr)) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't create DXGI device manager");
|
GST_ERROR_OBJECT (self, "Couldn't create DXGI device manager");
|
||||||
gst_clear_object (&self->other_d3d11_device);
|
gst_clear_object (&self->other_d3d11_device);
|
||||||
|
@ -187,8 +186,7 @@ gst_mf_video_enc_open (GstVideoEncoder * enc)
|
||||||
hr = self->device_manager->ResetDevice ((IUnknown *) device_handle,
|
hr = self->device_manager->ResetDevice ((IUnknown *) device_handle,
|
||||||
self->reset_token);
|
self->reset_token);
|
||||||
if (!gst_mf_result (hr)) {
|
if (!gst_mf_result (hr)) {
|
||||||
GST_ERROR_OBJECT (self,
|
GST_ERROR_OBJECT (self, "Couldn't reset device with given d3d11 device");
|
||||||
"Couldn't reset device with given d3d11 device");
|
|
||||||
gst_clear_object (&self->other_d3d11_device);
|
gst_clear_object (&self->other_d3d11_device);
|
||||||
gst_clear_object (&self->d3d11_device);
|
gst_clear_object (&self->d3d11_device);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -230,8 +228,7 @@ gst_mf_video_enc_open (GstVideoEncoder * enc)
|
||||||
MFT_ENUM_FLAG_HARDWARE) {
|
MFT_ENUM_FLAG_HARDWARE) {
|
||||||
self->async_mft = TRUE;
|
self->async_mft = TRUE;
|
||||||
gst_mf_transform_set_new_sample_callback (self->transform,
|
gst_mf_transform_set_new_sample_callback (self->transform,
|
||||||
(GstMFTransformNewSampleCallback) gst_mf_video_on_new_sample,
|
(GstMFTransformNewSampleCallback) gst_mf_video_on_new_sample, self);
|
||||||
self);
|
|
||||||
} else {
|
} else {
|
||||||
self->async_mft = FALSE;
|
self->async_mft = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +247,6 @@ gst_mf_video_enc_close (GstVideoEncoder * enc)
|
||||||
gst_video_codec_state_unref (self->input_state);
|
gst_video_codec_state_unref (self->input_state);
|
||||||
self->input_state = NULL;
|
self->input_state = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_MF_HAVE_D3D11
|
#if GST_MF_HAVE_D3D11
|
||||||
if (self->device_manager) {
|
if (self->device_manager) {
|
||||||
self->device_manager->Release ();
|
self->device_manager->Release ();
|
||||||
|
@ -309,7 +305,6 @@ gst_mf_video_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state)
|
||||||
GST_ERROR_OBJECT (self, "Failed to open MFT");
|
GST_ERROR_OBJECT (self, "Failed to open MFT");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_MF_HAVE_D3D11
|
#if GST_MF_HAVE_D3D11
|
||||||
if (self->device_manager) {
|
if (self->device_manager) {
|
||||||
if (!gst_mf_transform_set_device_manager (self->transform,
|
if (!gst_mf_transform_set_device_manager (self->transform,
|
||||||
|
@ -460,7 +455,6 @@ gst_mf_video_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state)
|
||||||
GST_ERROR_OBJECT (self, "subclass couldn't set src caps");
|
GST_ERROR_OBJECT (self, "subclass couldn't set src caps");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_MF_HAVE_D3D11
|
#if GST_MF_HAVE_D3D11
|
||||||
if (self->mf_allocator) {
|
if (self->mf_allocator) {
|
||||||
self->mf_allocator->UninitializeSampleAllocator ();
|
self->mf_allocator->UninitializeSampleAllocator ();
|
||||||
|
@ -482,7 +476,8 @@ gst_mf_video_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state)
|
||||||
|
|
||||||
hr = MFCreateVideoSampleAllocatorEx (IID_PPV_ARGS (&allocator));
|
hr = MFCreateVideoSampleAllocatorEx (IID_PPV_ARGS (&allocator));
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
GST_WARNING_OBJECT (self, "IMFVideoSampleAllocatorEx interface is unavailable");
|
GST_WARNING_OBJECT (self,
|
||||||
|
"IMFVideoSampleAllocatorEx interface is unavailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allocator) {
|
if (allocator) {
|
||||||
|
@ -523,9 +518,7 @@ gst_mf_video_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state)
|
||||||
2,
|
2,
|
||||||
/* max samples, why 16 + 2? it's just magic number
|
/* max samples, why 16 + 2? it's just magic number
|
||||||
* (H264 max dpb size 16 + our min sample size 2) */
|
* (H264 max dpb size 16 + our min sample size 2) */
|
||||||
16 + 2,
|
16 + 2, attr.Get (), in_type.Get ()
|
||||||
attr.Get (),
|
|
||||||
in_type.Get ()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
|
@ -660,8 +653,9 @@ gst_mf_video_enc_process_input (GstMFVideoEnc * self,
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
hr = sample->SetSampleDuration (
|
hr = sample->
|
||||||
GST_CLOCK_TIME_IS_VALID (frame->duration) ? frame->duration / 100 : 0);
|
SetSampleDuration (GST_CLOCK_TIME_IS_VALID (frame->duration) ? frame->
|
||||||
|
duration / 100 : 0);
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -871,8 +865,7 @@ gst_mf_video_enc_finish_sample (GstMFVideoEnc * self, IMFSample * sample)
|
||||||
|
|
||||||
/* make sure PTS > DTS */
|
/* make sure PTS > DTS */
|
||||||
if (GST_CLOCK_TIME_IS_VALID (frame->pts) &&
|
if (GST_CLOCK_TIME_IS_VALID (frame->pts) &&
|
||||||
GST_CLOCK_TIME_IS_VALID (frame->dts) &&
|
GST_CLOCK_TIME_IS_VALID (frame->dts) && frame->pts < frame->dts) {
|
||||||
frame->pts < frame->dts) {
|
|
||||||
GST_WARNING_OBJECT (self, "Calculated DTS %" GST_TIME_FORMAT
|
GST_WARNING_OBJECT (self, "Calculated DTS %" GST_TIME_FORMAT
|
||||||
" is larger than PTS %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->pts),
|
" is larger than PTS %" GST_TIME_FORMAT, GST_TIME_ARGS (frame->pts),
|
||||||
GST_TIME_ARGS (frame->dts));
|
GST_TIME_ARGS (frame->dts));
|
||||||
|
@ -882,7 +875,8 @@ gst_mf_video_enc_finish_sample (GstMFVideoEnc * self, IMFSample * sample)
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (self, "Frame pts %" GST_TIME_FORMAT ", Frame DTS %"
|
GST_LOG_OBJECT (self, "Frame pts %" GST_TIME_FORMAT ", Frame DTS %"
|
||||||
GST_TIME_FORMAT, GST_TIME_ARGS (frame->pts), GST_TIME_ARGS (frame->dts));
|
GST_TIME_FORMAT, GST_TIME_ARGS (frame->pts),
|
||||||
|
GST_TIME_ARGS (frame->dts));
|
||||||
|
|
||||||
res = gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (self), frame);
|
res = gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (self), frame);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1111,8 +1105,7 @@ gst_mf_video_enc_create_input_sample_d3d11 (GstMFVideoEnc * self,
|
||||||
|
|
||||||
hr = dxgi_resource->GetSharedHandle (&shared_handle);
|
hr = dxgi_resource->GetSharedHandle (&shared_handle);
|
||||||
if (!gst_mf_result (hr)) {
|
if (!gst_mf_result (hr)) {
|
||||||
GST_WARNING_OBJECT (self,
|
GST_WARNING_OBJECT (self, "Couldn't get shared handle from IDXGIResource");
|
||||||
"Couldn't get shared handle from IDXGIResource");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1127,7 +1120,8 @@ gst_mf_video_enc_create_input_sample_d3d11 (GstMFVideoEnc * self,
|
||||||
|
|
||||||
/* 2) Copy upstream texture to mf's texture */
|
/* 2) Copy upstream texture to mf's texture */
|
||||||
/* Map memory so that ensure pending upload from staging texture */
|
/* Map memory so that ensure pending upload from staging texture */
|
||||||
if (!gst_memory_map (mem, &info, (GstMapFlags) (GST_MAP_READ | GST_MAP_D3D11))) {
|
if (!gst_memory_map (mem, &info,
|
||||||
|
(GstMapFlags) (GST_MAP_READ | GST_MAP_D3D11))) {
|
||||||
GST_ERROR_OBJECT (self, "Couldn't map d3d11 memory");
|
GST_ERROR_OBJECT (self, "Couldn't map d3d11 memory");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1197,7 +1191,6 @@ gst_mf_video_enc_handle_frame (GstVideoEncoder * enc,
|
||||||
ret = self->last_ret;
|
ret = self->last_ret;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_MF_HAVE_D3D11
|
#if GST_MF_HAVE_D3D11
|
||||||
if (self->mf_allocator &&
|
if (self->mf_allocator &&
|
||||||
!gst_mf_video_enc_create_input_sample_d3d11 (self, frame, &sample)) {
|
!gst_mf_video_enc_create_input_sample_d3d11 (self, frame, &sample)) {
|
||||||
|
@ -1291,8 +1284,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mf_video_enc_propose_allocation (GstVideoEncoder * enc,
|
gst_mf_video_enc_propose_allocation (GstVideoEncoder * enc, GstQuery * query)
|
||||||
GstQuery * query)
|
|
||||||
{
|
{
|
||||||
#if GST_MF_HAVE_D3D11
|
#if GST_MF_HAVE_D3D11
|
||||||
GstMFVideoEnc *self = GST_MF_VIDEO_ENC (enc);
|
GstMFVideoEnc *self = GST_MF_VIDEO_ENC (enc);
|
||||||
|
@ -1610,7 +1602,8 @@ gst_mf_video_enc_enum_internal (GstMFTransform * transform, GUID &subtype,
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hr = out_type->SetUINT32 (MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive);
|
hr = out_type->SetUINT32 (MF_MT_INTERLACE_MODE,
|
||||||
|
MFVideoInterlace_Progressive);
|
||||||
if (!gst_mf_result (hr))
|
if (!gst_mf_result (hr))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,9 @@
|
||||||
#include "gstmfvp9enc.h"
|
#include "gstmfvp9enc.h"
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_mf_vp9_enc_debug);
|
GST_DEBUG_CATEGORY (gst_mf_vp9_enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_mf_vp9_enc_debug
|
#define GST_CAT_DEFAULT gst_mf_vp9_enc_debug
|
||||||
|
@ -467,8 +469,7 @@ gst_mf_vp9_enc_set_option (GstMFVideoEnc * mfenc, GstVideoCodecState * state,
|
||||||
|
|
||||||
if (device_caps->quality_vs_speed) {
|
if (device_caps->quality_vs_speed) {
|
||||||
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
hr = gst_mf_transform_set_codec_api_uint32 (transform,
|
||||||
&CODECAPI_AVEncCommonQualityVsSpeed,
|
&CODECAPI_AVEncCommonQualityVsSpeed, self->quality_vs_speed);
|
||||||
self->quality_vs_speed);
|
|
||||||
WARNING_HR (hr, CODECAPI_AVEncCommonQualityVsSpeed);
|
WARNING_HR (hr, CODECAPI_AVEncCommonQualityVsSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
using namespace ABI::Windows::ApplicationModel::Core;
|
using namespace ABI::Windows::ApplicationModel::Core;
|
||||||
using namespace ABI::Windows::Foundation::Collections;
|
using namespace ABI::Windows::Foundation::Collections;
|
||||||
using namespace ABI::Windows::Media::Devices;
|
using namespace ABI::Windows::Media::Devices;
|
||||||
|
@ -1176,3 +1177,5 @@ WinRTCapsCompareFunc (const GstWinRTMediaDescription & a,
|
||||||
{
|
{
|
||||||
return gst_mf_source_object_caps_compare (a.caps_, b.caps_) < 0;
|
return gst_mf_source_object_caps_compare (a.caps_, b.caps_) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
Loading…
Reference in a new issue