/* Must be called from D3D11Device thread */
static gboolean
gst_d3d11_decoder_prepare_output_view_pool (GstD3D11Decoder * self,
- GstVideoInfo * info, guint pool_size, const GUID * decoder_profile)
+ GstVideoInfo * info, guint coded_width, guint coded_height,
+ guint pool_size, const GUID * decoder_profile)
{
GstD3D11DecoderPrivate *priv = self->priv;
GstD3D11AllocationParams *alloc_params = NULL;
GstBufferPool *pool = NULL;
GstStructure *config = NULL;
GstCaps *caps = NULL;
+ GstVideoAlignment align;
gst_clear_object (&priv->internal_pool);
}
alloc_params->desc[0].ArraySize = pool_size;
+ gst_video_alignment_reset (&align);
+
+ align.padding_right = coded_width - GST_VIDEO_INFO_WIDTH (info);
+ align.padding_bottom = coded_height - GST_VIDEO_INFO_HEIGHT (info);
+ if (!gst_d3d11_allocation_params_alignment (alloc_params, &align)) {
+ GST_ERROR_OBJECT (self, "Cannot set alignment");
+ return FALSE;
+ }
pool = gst_d3d11_buffer_pool_new (priv->device);
if (!pool) {
gboolean
gst_d3d11_decoder_open (GstD3D11Decoder * decoder, GstD3D11Codec codec,
- GstVideoInfo * info, guint pool_size, const GUID ** decoder_profiles,
- guint profile_size)
+ GstVideoInfo * info, guint coded_width, guint coded_height,
+ guint pool_size, const GUID ** decoder_profiles, guint profile_size)
{
GstD3D11DecoderPrivate *priv;
const GstD3D11Format *d3d11_format;
g_return_val_if_fail (codec > GST_D3D11_CODEC_NONE, FALSE);
g_return_val_if_fail (codec < GST_D3D11_CODEC_LAST, FALSE);
g_return_val_if_fail (info != NULL, FALSE);
+ g_return_val_if_fail (coded_width >= GST_VIDEO_INFO_WIDTH (info), FALSE);
+ g_return_val_if_fail (coded_height >= GST_VIDEO_INFO_HEIGHT (info), FALSE);
g_return_val_if_fail (pool_size > 0, FALSE);
g_return_val_if_fail (decoder_profiles != NULL, FALSE);
g_return_val_if_fail (profile_size > 0, FALSE);
gst_d3d11_decoder_reset_unlocked (decoder);
- decoder_desc.SampleWidth = GST_VIDEO_INFO_WIDTH (info);
- decoder_desc.SampleHeight = GST_VIDEO_INFO_HEIGHT (info);
+ decoder_desc.SampleWidth = coded_width;
+ decoder_desc.SampleHeight = coded_height;
decoder_desc.OutputFormat = d3d11_format->dxgi_format;
decoder_desc.Guid = *selected_profile;
}
if (!gst_d3d11_decoder_prepare_output_view_pool (decoder,
- info, pool_size, selected_profile)) {
+ info, coded_width, coded_height, pool_size, selected_profile)) {
GST_ERROR_OBJECT (decoder, "Couldn't prepare output view pool");
goto error;
}
gboolean gst_d3d11_decoder_open (GstD3D11Decoder * decoder,
GstD3D11Codec codec,
GstVideoInfo * info,
+ guint codec_width,
+ guint codec_height,
guint pool_size,
const GUID ** decoder_profiles,
guint profile_size);
if (self->width != crop_width || self->height != crop_height ||
self->coded_width != sps->width || self->coded_height != sps->height) {
- GST_INFO_OBJECT (self, "resolution changed %dx%d", crop_width, crop_height);
+ GST_INFO_OBJECT (self, "resolution changed %dx%d (%dx%d)",
+ crop_width, crop_height, sps->width, sps->height);
self->width = crop_width;
self->height = crop_height;
self->coded_width = sps->width;
return FALSE;
}
- /* allocated internal pool with coded width/height */
gst_video_info_set_format (&info,
- self->out_format, self->coded_width, self->coded_height);
+ self->out_format, self->width, self->height);
gst_d3d11_decoder_reset (self->d3d11_decoder);
if (!gst_d3d11_decoder_open (self->d3d11_decoder, GST_D3D11_CODEC_H264,
- &info, NUM_OUTPUT_VIEW, supported_profiles,
- G_N_ELEMENTS (supported_profiles))) {
+ &info, self->coded_width, self->coded_height, NUM_OUTPUT_VIEW,
+ supported_profiles, G_N_ELEMENTS (supported_profiles))) {
GST_ERROR_OBJECT (self, "Failed to create decoder");
return FALSE;
}
gst_video_info_set_format (&info, GST_VIDEO_FORMAT_NV12, 1280, 720);
ret = gst_d3d11_decoder_open (decoder, GST_D3D11_CODEC_H264,
- &info, NUM_OUTPUT_VIEW, supported_profiles,
+ &info, 1280, 720, NUM_OUTPUT_VIEW, supported_profiles,
G_N_ELEMENTS (supported_profiles));
gst_object_unref (decoder);
if (self->width != crop_width || self->height != crop_height ||
self->coded_width != sps->width || self->coded_height != sps->height) {
- GST_INFO_OBJECT (self, "resolution changed %dx%d", crop_width, crop_height);
+ GST_INFO_OBJECT (self, "resolution changed %dx%d (%dx%d)",
+ crop_width, crop_height, sps->width, sps->height);
self->width = crop_width;
self->height = crop_height;
self->coded_width = sps->width;
return FALSE;
}
- /* allocated internal pool with coded width/height */
gst_video_info_set_format (&info,
- self->out_format, self->coded_width, self->coded_height);
+ self->out_format, self->width, self->height);
gst_d3d11_decoder_reset (self->d3d11_decoder);
if (!gst_d3d11_decoder_open (self->d3d11_decoder, GST_D3D11_CODEC_H265,
- &info, NUM_OUTPUT_VIEW, &profile_guid, 1)) {
+ &info, self->coded_width, self->coded_height,
+ NUM_OUTPUT_VIEW, &profile_guid, 1)) {
GST_ERROR_OBJECT (self, "Failed to create decoder");
return FALSE;
}
gst_video_info_set_format (&info, GST_VIDEO_FORMAT_NV12, 1280, 720);
ret = gst_d3d11_decoder_open (decoder, GST_D3D11_CODEC_H265,
- &info, NUM_OUTPUT_VIEW, supported_profiles,
+ &info, 1280, 720, NUM_OUTPUT_VIEW, supported_profiles,
G_N_ELEMENTS (supported_profiles));
gst_object_unref (decoder);
gst_d3d11_decoder_reset (self->d3d11_decoder);
if (!gst_d3d11_decoder_open (self->d3d11_decoder, GST_D3D11_CODEC_VP9,
- &info, NUM_OUTPUT_VIEW, &profile_guid, 1)) {
+ &info, self->width, self->height,
+ NUM_OUTPUT_VIEW, &profile_guid, 1)) {
GST_ERROR_OBJECT (self, "Failed to create decoder");
return FALSE;
}
gst_video_info_set_format (&info, GST_VIDEO_FORMAT_NV12, 1280, 720);
ret = gst_d3d11_decoder_open (decoder, GST_D3D11_CODEC_VP9,
- &info, NUM_OUTPUT_VIEW, supported_profiles,
+ &info, 1280, 720, NUM_OUTPUT_VIEW, supported_profiles,
G_N_ELEMENTS (supported_profiles));
gst_object_unref (decoder);