encoder: h264: fix multiple slices support in packed headers mode.

Handle packedi slice headers and packed raw data on a per-slice basis,
which is necessary for multi slice encoding.
This commit is contained in:
Sreerenj Balachandran 2014-06-05 15:32:29 +03:00 committed by Gwenole Beauchesne
parent 786b68ac21
commit 781abad2c7

View file

@ -1411,7 +1411,7 @@ get_nal_hdr_attributes (GstVaapiEncPicture * picture,
headers to pass down as-is to the encoder */ headers to pass down as-is to the encoder */
static gboolean static gboolean
add_packed_prefix_nal_header (GstVaapiEncoderH264 * encoder, add_packed_prefix_nal_header (GstVaapiEncoderH264 * encoder,
GstVaapiEncPicture * picture) GstVaapiEncPicture * picture, GstVaapiEncSlice * slice)
{ {
GstVaapiEncPackedHeader *packed_prefix_nal; GstVaapiEncPackedHeader *packed_prefix_nal;
GstBitWriter bs; GstBitWriter bs;
@ -1443,7 +1443,7 @@ add_packed_prefix_nal_header (GstVaapiEncoderH264 * encoder,
(data_bit_size + 7) / 8); (data_bit_size + 7) / 8);
g_assert (packed_prefix_nal); g_assert (packed_prefix_nal);
gst_vaapi_enc_picture_add_packed_header (picture, packed_prefix_nal); gst_vaapi_enc_slice_add_packed_header (slice, packed_prefix_nal);
gst_vaapi_codec_object_replace (&packed_prefix_nal, NULL); gst_vaapi_codec_object_replace (&packed_prefix_nal, NULL);
gst_bit_writer_clear (&bs, TRUE); gst_bit_writer_clear (&bs, TRUE);
@ -1493,7 +1493,7 @@ add_packed_slice_header (GstVaapiEncoderH264 * encoder,
data, (data_bit_size + 7) / 8); data, (data_bit_size + 7) / 8);
g_assert (packed_slice); g_assert (packed_slice);
gst_vaapi_enc_picture_add_packed_header (picture, packed_slice); gst_vaapi_enc_slice_add_packed_header (slice, packed_slice);
gst_vaapi_codec_object_replace (&packed_slice, NULL); gst_vaapi_codec_object_replace (&packed_slice, NULL);
gst_bit_writer_clear (&bs, TRUE); gst_bit_writer_clear (&bs, TRUE);
@ -1887,11 +1887,11 @@ add_slice_headers (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture,
last_mb_index += cur_slice_mbs; last_mb_index += cur_slice_mbs;
if (encoder->is_mvc && if (encoder->is_mvc &&
(GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) & VAEncPackedHeaderRawData) (GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) & VA_ENC_PACKED_HEADER_RAW_DATA)
&& !add_packed_prefix_nal_header (encoder, picture)) && !add_packed_prefix_nal_header (encoder, picture, slice))
goto error_create_packed_prefix_nal_hdr; goto error_create_packed_prefix_nal_hdr;
if ((GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) & if ((GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) &
VAEncPackedHeaderH264_Slice) VA_ENC_PACKED_HEADER_SLICE)
&& !add_packed_slice_header (encoder, picture, slice)) && !add_packed_slice_header (encoder, picture, slice))
goto error_create_packed_slice_hdr; goto error_create_packed_slice_hdr;