encode: Attach the codec-data to out caps only based on negotiated caps

Attach the codec_data to out_caps only if downstream needed.
For eg: h264 encoder doesn't need to stuff codec_data to the
src caps if the negotiated caps has a stream format of byte-stream.

https://bugzilla.gnome.org/show_bug.cgi?id=734902
This commit is contained in:
Sreerenj Balachandran 2014-10-29 15:46:12 +02:00
parent 58eefcac9a
commit 7f3795c9fb
3 changed files with 13 additions and 6 deletions

View file

@ -241,10 +241,12 @@ ensure_output_state (GstVaapiEncode * encode)
encode->output_state = gst_video_encoder_set_output_state (venc, out_caps,
encode->input_state);
status = gst_vaapi_encoder_get_codec_data (encode->encoder,
&encode->output_state->codec_data);
if (status != GST_VAAPI_ENCODER_STATUS_SUCCESS)
return FALSE;
if (encode->need_codec_data) {
status = gst_vaapi_encoder_get_codec_data (encode->encoder,
&encode->output_state->codec_data);
if (status != GST_VAAPI_ENCODER_STATUS_SUCCESS)
return FALSE;
}
#if GST_CHECK_VERSION(1,0,0)
if (!gst_video_encoder_negotiate (venc))

View file

@ -55,6 +55,8 @@ struct _GstVaapiEncode
GstVaapiEncoder *encoder;
GstVideoCodecState *input_state;
gboolean input_state_changed;
/* needs to be set by the subclass implementation */
gboolean need_codec_data;
GstVideoCodecState *output_state;
GPtrArray *prop_values;
};

View file

@ -37,8 +37,9 @@
GST_DEBUG_CATEGORY_STATIC (gst_vaapi_h264_encode_debug);
#define GST_CAT_DEFAULT gst_vaapi_h264_encode_debug
#define GST_CODEC_CAPS \
"video/x-h264, " \
#define GST_CODEC_CAPS \
"video/x-h264, " \
"stream-format = (string) { avc, byte-stream }, " \
"alignment = (string) au"
/* *INDENT-OFF* */
@ -238,6 +239,8 @@ gst_vaapiencode_h264_get_caps (GstVaapiEncode * base_encode)
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING,
encode->is_avc ? "avc" : "byte-stream", NULL);
base_encode->need_codec_data = encode->is_avc;
/* XXX: update profile and level information */
return caps;
}