mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
msdk: move and rename the function msdk_video_alignment
Move the msdk_video_alignment function from decoder to msdk.c and rename so that others could call this function without duplicated declaration. https://bugzilla.gnome.org/show_bug.cgi?id=790752
This commit is contained in:
parent
5b1a968840
commit
8f0450dad4
3 changed files with 25 additions and 15 deletions
|
@ -70,19 +70,6 @@ typedef struct _MsdkSurface
|
||||||
GstVideoFrame copy;
|
GstVideoFrame copy;
|
||||||
} MsdkSurface;
|
} MsdkSurface;
|
||||||
|
|
||||||
static void
|
|
||||||
msdk_video_alignment (GstVideoAlignment * alignment, GstVideoInfo * info)
|
|
||||||
{
|
|
||||||
guint i, height;
|
|
||||||
|
|
||||||
height = GST_VIDEO_INFO_HEIGHT (info);
|
|
||||||
gst_video_alignment_reset (alignment);
|
|
||||||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++)
|
|
||||||
alignment->stride_align[i] = 31; /* 32-byte alignment */
|
|
||||||
if (height & 31)
|
|
||||||
alignment->padding_bottom = 32 - (height & 31);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
allocate_output_buffer (GstMsdkDec * thiz, GstBuffer ** buffer)
|
allocate_output_buffer (GstMsdkDec * thiz, GstBuffer ** buffer)
|
||||||
{
|
{
|
||||||
|
@ -356,7 +343,7 @@ gst_msdkdec_set_src_caps (GstMsdkDec * thiz)
|
||||||
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (thiz),
|
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (thiz),
|
||||||
GST_VIDEO_FORMAT_NV12, width, height, thiz->input_state);
|
GST_VIDEO_FORMAT_NV12, width, height, thiz->input_state);
|
||||||
|
|
||||||
msdk_video_alignment (&align, &output_state->info);
|
gst_msdk_set_video_alignment (&output_state->info, &align);
|
||||||
gst_video_info_align (&output_state->info, &align);
|
gst_video_info_align (&output_state->info, &align);
|
||||||
memcpy (&thiz->output_info, &output_state->info, sizeof (GstVideoInfo));
|
memcpy (&thiz->output_info, &output_state->info, sizeof (GstVideoInfo));
|
||||||
if (output_state->caps)
|
if (output_state->caps)
|
||||||
|
@ -616,7 +603,7 @@ gst_msdkdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
requirements by default. */
|
requirements by default. */
|
||||||
gst_video_info_from_caps (&info_from_caps, pool_caps);
|
gst_video_info_from_caps (&info_from_caps, pool_caps);
|
||||||
memcpy (&info_aligned, &info_from_caps, sizeof (info_aligned));
|
memcpy (&info_aligned, &info_from_caps, sizeof (info_aligned));
|
||||||
msdk_video_alignment (&alignment, &info_from_caps);
|
gst_msdk_set_video_alignment (&info_from_caps, &alignment);
|
||||||
gst_video_info_align (&info_aligned, &alignment);
|
gst_video_info_align (&info_aligned, &alignment);
|
||||||
need_aligned = !gst_video_info_is_equal (&info_from_caps, &info_aligned);
|
need_aligned = !gst_video_info_is_equal (&info_from_caps, &info_aligned);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_msdkenc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_msdkenc_debug
|
#define GST_CAT_DEFAULT gst_msdkenc_debug
|
||||||
|
|
||||||
#define INVALID_INDEX ((guint) -1)
|
#define INVALID_INDEX ((guint) -1)
|
||||||
|
#define GST_MSDK_ALIGNMENT_PADDING(num) (32 - ((num) & 31))
|
||||||
|
|
||||||
static inline guint
|
static inline guint
|
||||||
msdk_get_free_surface_index (mfxFrameSurface1 * surfaces, guint size)
|
msdk_get_free_surface_index (mfxFrameSurface1 * surfaces, guint size)
|
||||||
|
@ -362,3 +363,22 @@ msdk_is_available (void)
|
||||||
msdk_close_session (session);
|
msdk_close_session (session);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_msdk_set_video_alignment (GstVideoInfo * info,
|
||||||
|
GstVideoAlignment * alignment)
|
||||||
|
{
|
||||||
|
guint i, width, height;
|
||||||
|
|
||||||
|
width = GST_VIDEO_INFO_WIDTH (info);
|
||||||
|
height = GST_VIDEO_INFO_HEIGHT (info);
|
||||||
|
|
||||||
|
gst_video_alignment_reset (alignment);
|
||||||
|
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (info); i++)
|
||||||
|
alignment->stride_align[i] = 31; /* 32-byte alignment */
|
||||||
|
|
||||||
|
if (width & 31)
|
||||||
|
alignment->padding_right = GST_MSDK_ALIGNMENT_PADDING (width);
|
||||||
|
if (height & 31)
|
||||||
|
alignment->padding_bottom = GST_MSDK_ALIGNMENT_PADDING (height);
|
||||||
|
}
|
||||||
|
|
|
@ -66,6 +66,9 @@ void msdk_frame_to_surface (GstVideoFrame * frame, mfxFrameSurface1 * surface);
|
||||||
|
|
||||||
const gchar *msdk_status_to_string (mfxStatus status);
|
const gchar *msdk_status_to_string (mfxStatus status);
|
||||||
|
|
||||||
|
void gst_msdk_set_video_alignment (GstVideoInfo * info,
|
||||||
|
GstVideoAlignment * alignment);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __MSDK_H__ */
|
#endif /* __MSDK_H__ */
|
||||||
|
|
Loading…
Reference in a new issue