mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-16 19:25:18 +00:00
msdkallocator: Use const ptr of videoinfo in func param
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3621>
This commit is contained in:
parent
16ad80179b
commit
dfe16a5cf2
6 changed files with 15 additions and 13 deletions
|
@ -32,17 +32,18 @@
|
||||||
#include "gstmsdkallocator.h"
|
#include "gstmsdkallocator.h"
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
map_data (GstBuffer * buffer, mfxFrameSurface1 * mfx_surface, GstVideoInfo info)
|
map_data (GstBuffer * buffer, mfxFrameSurface1 * mfx_surface,
|
||||||
|
const GstVideoInfo * info)
|
||||||
{
|
{
|
||||||
guint stride;
|
guint stride;
|
||||||
GstVideoFrame frame;
|
GstVideoFrame frame;
|
||||||
|
|
||||||
if (!gst_video_frame_map (&frame, &info, buffer, GST_MAP_READWRITE))
|
if (!gst_video_frame_map (&frame, info, buffer, GST_MAP_READWRITE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
stride = GST_VIDEO_FRAME_PLANE_STRIDE (&frame, 0);
|
stride = GST_VIDEO_FRAME_PLANE_STRIDE (&frame, 0);
|
||||||
|
|
||||||
switch (GST_VIDEO_INFO_FORMAT (&info)) {
|
switch (GST_VIDEO_INFO_FORMAT (info)) {
|
||||||
case GST_VIDEO_FORMAT_NV12:
|
case GST_VIDEO_FORMAT_NV12:
|
||||||
case GST_VIDEO_FORMAT_P010_10LE:
|
case GST_VIDEO_FORMAT_P010_10LE:
|
||||||
case GST_VIDEO_FORMAT_P012_LE:
|
case GST_VIDEO_FORMAT_P012_LE:
|
||||||
|
@ -119,7 +120,8 @@ map_data (GstBuffer * buffer, mfxFrameSurface1 * mfx_surface, GstVideoInfo info)
|
||||||
}
|
}
|
||||||
|
|
||||||
GstMsdkSurface *
|
GstMsdkSurface *
|
||||||
gst_msdk_import_sys_mem_to_msdk_surface (GstBuffer * buf, GstVideoInfo info)
|
gst_msdk_import_sys_mem_to_msdk_surface (GstBuffer * buf,
|
||||||
|
const GstVideoInfo * info)
|
||||||
{
|
{
|
||||||
GstMsdkSurface *msdk_surface = NULL;
|
GstMsdkSurface *msdk_surface = NULL;
|
||||||
GstMapInfo map_info;
|
GstMapInfo map_info;
|
||||||
|
@ -141,7 +143,7 @@ gst_msdk_import_sys_mem_to_msdk_surface (GstBuffer * buf, GstVideoInfo info)
|
||||||
|
|
||||||
gst_buffer_unmap (buf, &map_info);
|
gst_buffer_unmap (buf, &map_info);
|
||||||
|
|
||||||
gst_msdk_set_mfx_frame_info_from_video_info (&frame_info, &info);
|
gst_msdk_set_mfx_frame_info_from_video_info (&frame_info, info);
|
||||||
mfx_surface->Info = frame_info;
|
mfx_surface->Info = frame_info;
|
||||||
|
|
||||||
msdk_surface = g_slice_new0 (GstMsdkSurface);
|
msdk_surface = g_slice_new0 (GstMsdkSurface);
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct _GstMsdkSurface
|
||||||
};
|
};
|
||||||
|
|
||||||
GstMsdkSurface *
|
GstMsdkSurface *
|
||||||
gst_msdk_import_sys_mem_to_msdk_surface (GstBuffer * buf, GstVideoInfo info);
|
gst_msdk_import_sys_mem_to_msdk_surface (GstBuffer * buf, const GstVideoInfo * info);
|
||||||
|
|
||||||
mfxStatus gst_msdk_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp);
|
mfxStatus gst_msdk_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp);
|
||||||
mfxStatus gst_msdk_frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp);
|
mfxStatus gst_msdk_frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp);
|
||||||
|
|
|
@ -1662,7 +1662,7 @@ gst_msdkenc_get_surface_from_pool_old (GstMsdkEnc * thiz, GstBufferPool * pool,
|
||||||
&thiz->aligned_info, 0);
|
&thiz->aligned_info, 0);
|
||||||
#else
|
#else
|
||||||
msdk_surface =
|
msdk_surface =
|
||||||
gst_msdk_import_sys_mem_to_msdk_surface (new_buffer, thiz->aligned_info);
|
gst_msdk_import_sys_mem_to_msdk_surface (new_buffer, &thiz->aligned_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (msdk_surface)
|
if (msdk_surface)
|
||||||
|
@ -1745,7 +1745,7 @@ gst_msdkenc_get_surface_from_pool (GstMsdkEnc * thiz,
|
||||||
} else {
|
} else {
|
||||||
msdk_surface =
|
msdk_surface =
|
||||||
gst_msdk_import_sys_mem_to_msdk_surface (upload_buf,
|
gst_msdk_import_sys_mem_to_msdk_surface (upload_buf,
|
||||||
thiz->aligned_info);
|
&thiz->aligned_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_replace (&frame->input_buffer, upload_buf);
|
gst_buffer_replace (&frame->input_buffer, upload_buf);
|
||||||
|
|
|
@ -857,7 +857,7 @@ gst_msdkvpp_get_surface_from_pool (GstMsdkVPP * thiz, GstBufferPool * pool,
|
||||||
} else {
|
} else {
|
||||||
msdk_surface =
|
msdk_surface =
|
||||||
gst_msdk_import_sys_mem_to_msdk_surface (upload_buf,
|
gst_msdk_import_sys_mem_to_msdk_surface (upload_buf,
|
||||||
thiz->sinkpad_buffer_pool_info);
|
&thiz->sinkpad_buffer_pool_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msdk_surface)
|
if (msdk_surface)
|
||||||
|
@ -938,7 +938,7 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
&thiz->srcpad_info, GST_MAP_WRITE);
|
&thiz->srcpad_info, GST_MAP_WRITE);
|
||||||
if (!thiz->use_video_memory) {
|
if (!thiz->use_video_memory) {
|
||||||
out_surface =
|
out_surface =
|
||||||
gst_msdk_import_sys_mem_to_msdk_surface (outbuf, thiz->srcpad_info);
|
gst_msdk_import_sys_mem_to_msdk_surface (outbuf, &thiz->srcpad_info);
|
||||||
}
|
}
|
||||||
if (out_surface)
|
if (out_surface)
|
||||||
out_surface->buf = gst_buffer_ref (outbuf);
|
out_surface->buf = gst_buffer_ref (outbuf);
|
||||||
|
@ -1032,7 +1032,7 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
if (!thiz->use_video_memory) {
|
if (!thiz->use_video_memory) {
|
||||||
out_surface =
|
out_surface =
|
||||||
gst_msdk_import_sys_mem_to_msdk_surface (outbuf_new,
|
gst_msdk_import_sys_mem_to_msdk_surface (outbuf_new,
|
||||||
thiz->srcpad_buffer_pool_info);
|
&thiz->srcpad_buffer_pool_info);
|
||||||
}
|
}
|
||||||
if (out_surface) {
|
if (out_surface) {
|
||||||
out_surface->buf = gst_buffer_ref (outbuf_new);
|
out_surface->buf = gst_buffer_ref (outbuf_new);
|
||||||
|
|
|
@ -467,7 +467,7 @@ gst_msdk_get_mfx_fourcc_from_format (GstVideoFormat format)
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info,
|
gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info,
|
||||||
GstVideoInfo * info)
|
const GstVideoInfo * info)
|
||||||
{
|
{
|
||||||
g_return_if_fail (info && mfx_info);
|
g_return_if_fail (info && mfx_info);
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ void gst_msdk_set_video_alignment (GstVideoInfo * info, guint alloc_w, guint all
|
||||||
gint gst_msdk_get_mfx_chroma_from_format (GstVideoFormat format);
|
gint gst_msdk_get_mfx_chroma_from_format (GstVideoFormat format);
|
||||||
gint gst_msdk_get_mfx_fourcc_from_format (GstVideoFormat format);
|
gint gst_msdk_get_mfx_fourcc_from_format (GstVideoFormat format);
|
||||||
void gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info,
|
void gst_msdk_set_mfx_frame_info_from_video_info (mfxFrameInfo * mfx_info,
|
||||||
GstVideoInfo * info);
|
const GstVideoInfo * info);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_msdk_is_msdk_buffer (GstBuffer * buf);
|
gst_msdk_is_msdk_buffer (GstBuffer * buf);
|
||||||
|
|
Loading…
Reference in a new issue