nvdec: Use gst_video_info_to_caps to build caps.

Don't build caps directly, as that won't add any GstVideoInfo
newer fields (such as colorimetry) automatically.
This commit is contained in:
Jan Schmidt 2018-04-27 14:41:14 +10:00 committed by Sebastian Dröge
parent 3117d396c8
commit 4341d16a13

View file

@ -642,6 +642,7 @@ handle_pending_frames (GstNvDec * nvdec)
GstNvDecQueueItem *item; GstNvDecQueueItem *item;
CUVIDEOFORMAT *format; CUVIDEOFORMAT *format;
GstVideoCodecState *state; GstVideoCodecState *state;
GstVideoInfo *vinfo;
guint width, height, fps_n, fps_d, i, num_resources; guint width, height, fps_n, fps_d, i, num_resources;
CUVIDPICPARAMS *decode_params; CUVIDPICPARAMS *decode_params;
CUVIDPARSERDISPINFO *dispinfo; CUVIDPARSERDISPINFO *dispinfo;
@ -689,16 +690,21 @@ handle_pending_frames (GstNvDec * nvdec)
state = gst_video_decoder_set_output_state (decoder, state = gst_video_decoder_set_output_state (decoder,
GST_VIDEO_FORMAT_NV12, nvdec->width, nvdec->height, GST_VIDEO_FORMAT_NV12, nvdec->width, nvdec->height,
nvdec->input_state); nvdec->input_state);
state->caps = gst_caps_new_simple ("video/x-raw", vinfo = &state->info;
"format", G_TYPE_STRING, "NV12", vinfo->fps_n = fps_n;
"width", G_TYPE_INT, nvdec->width, vinfo->fps_d = fps_d;
"height", G_TYPE_INT, nvdec->height, if (format->progressive_sequence)
"framerate", GST_TYPE_FRACTION, nvdec->fps_n, nvdec->fps_d, vinfo->interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
"interlace-mode", G_TYPE_STRING, format->progressive_sequence else
? "progressive" : "interleaved", vinfo->interlace_mode = GST_VIDEO_INTERLACE_MODE_MIXED;
"texture-target", G_TYPE_STRING, "2D", NULL);
state->caps = gst_video_info_to_caps (&state->info);
gst_caps_set_features (state->caps, 0, gst_caps_set_features (state->caps, 0,
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL)); gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, NULL));
gst_caps_set_simple (state->caps, "texture-target", G_TYPE_STRING,
"2D", NULL);
gst_video_codec_state_unref (state); gst_video_codec_state_unref (state);
if (!gst_video_decoder_negotiate (decoder)) { if (!gst_video_decoder_negotiate (decoder)) {