gstreamer/sys/mediafoundation/gstmfutils.h
Seungha Yang 75f6f79e57 mfvideosrc: Fix for negative MF stride
Negative stride value can be used in MediaFoundation to inform
whether memory layout is top-down or bottom-up manner. Note that
negative stride is allowed only for RGB, system memory.

See also
https://docs.microsoft.com/en-us/windows/win32/medfound/image-stride

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1646
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2473>
2021-08-19 22:01:50 +09:00

78 lines
No EOL
2.8 KiB
C

/* GStreamer
* Copyright (C) 2019 Seungha Yang <seungha.yang@navercorp.com>
* Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_MF_UTILS_H__
#define __GST_MF_UTILS_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#ifndef INITGUID
#include <initguid.h>
#endif
#include <windows.h>
#include <mfidl.h>
#include <mfapi.h>
#include <mfreadwrite.h>
#include <mferror.h>
#include <mfobjects.h>
#include <strmif.h>
G_BEGIN_DECLS
#define GST_MF_VIDEO_FORMATS \
"{ BGRx, BGRA, BGR, RGB15, RGB16, VUYA, YUY2, YVYU, UYVY, NV12, YV12, I420," \
" P010, P016, v210, v216, GRAY16_LE }"
GstVideoFormat gst_mf_video_subtype_to_video_format (const GUID *subtype);
const GUID * gst_mf_video_subtype_from_video_format (GstVideoFormat format);
GstCaps * gst_mf_media_type_to_caps (IMFMediaType * media_type);
void gst_mf_media_type_release (IMFMediaType * media_type);
gboolean gst_mf_update_video_info_with_stride (GstVideoInfo * info,
gint stride);
gboolean _gst_mf_result (HRESULT hr,
GstDebugCategory * cat,
const gchar * file,
const gchar * function,
gint line);
#define gst_mf_result(result) \
_gst_mf_result (result, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__)
void _gst_mf_dump_attributes (IMFAttributes * attr,
const gchar * msg,
GstDebugLevel level,
GstDebugCategory * cat,
const gchar * file,
const gchar * function,
gint line);
#define gst_mf_dump_attributes(attr,msg,level) \
_gst_mf_dump_attributes (attr, msg, level, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__)
G_END_DECLS
#endif /* __GST_MF_UTILS_H__ */