mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
h265bitwriter: Correct the all API to byte aligned.
In fact, all the h265 bit writer have byte aligned output. So we change the API from bit size in unit to byte size, which is easy to use. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3193>
This commit is contained in:
parent
c294ba82e6
commit
2408ca2f18
3 changed files with 35 additions and 35 deletions
|
@ -450,7 +450,7 @@ error:
|
||||||
* @vps: the vps of #GstH265VPS to write
|
* @vps: the vps of #GstH265VPS to write
|
||||||
* @start_code: whether adding the nal start code
|
* @start_code: whether adding the nal start code
|
||||||
* @data: (out): the bit stream generated by the sps
|
* @data: (out): the bit stream generated by the sps
|
||||||
* @size: (inout): the size in bits of the output
|
* @size: (inout): the size in bytes of the input and output
|
||||||
*
|
*
|
||||||
* Generating the according h265 bit stream by providing the vps.
|
* Generating the according h265 bit stream by providing the vps.
|
||||||
*
|
*
|
||||||
|
@ -460,7 +460,7 @@ error:
|
||||||
**/
|
**/
|
||||||
GstH265BitWriterResult
|
GstH265BitWriterResult
|
||||||
gst_h265_bit_writer_vps (const GstH265VPS * vps, gboolean start_code,
|
gst_h265_bit_writer_vps (const GstH265VPS * vps, gboolean start_code,
|
||||||
guint8 * data, gsize * size)
|
guint8 * data, guint * size)
|
||||||
{
|
{
|
||||||
gboolean have_space = TRUE;
|
gboolean have_space = TRUE;
|
||||||
GstBitWriter bw;
|
GstBitWriter bw;
|
||||||
|
@ -495,7 +495,7 @@ gst_h265_bit_writer_vps (const GstH265VPS * vps, gboolean start_code,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = gst_bit_writer_get_size (&bw);
|
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||||
gst_bit_writer_reset (&bw);
|
gst_bit_writer_reset (&bw);
|
||||||
|
|
||||||
return GST_H265_BIT_WRITER_OK;
|
return GST_H265_BIT_WRITER_OK;
|
||||||
|
@ -1054,7 +1054,7 @@ error:
|
||||||
* @sps: the sps of #GstH265SPS to write
|
* @sps: the sps of #GstH265SPS to write
|
||||||
* @start_code: whether adding the nal start code
|
* @start_code: whether adding the nal start code
|
||||||
* @data: (out): the bit stream generated by the sps
|
* @data: (out): the bit stream generated by the sps
|
||||||
* @size: (inout): the size in bits of the output
|
* @size: (inout): the size in bytes of the input and output
|
||||||
*
|
*
|
||||||
* Generating the according h265 bit stream by providing the sps.
|
* Generating the according h265 bit stream by providing the sps.
|
||||||
*
|
*
|
||||||
|
@ -1064,7 +1064,7 @@ error:
|
||||||
**/
|
**/
|
||||||
GstH265BitWriterResult
|
GstH265BitWriterResult
|
||||||
gst_h265_bit_writer_sps (const GstH265SPS * sps, gboolean start_code,
|
gst_h265_bit_writer_sps (const GstH265SPS * sps, gboolean start_code,
|
||||||
guint8 * data, gsize * size)
|
guint8 * data, guint * size)
|
||||||
{
|
{
|
||||||
gboolean have_space = TRUE;
|
gboolean have_space = TRUE;
|
||||||
GstBitWriter bw;
|
GstBitWriter bw;
|
||||||
|
@ -1100,7 +1100,7 @@ gst_h265_bit_writer_sps (const GstH265SPS * sps, gboolean start_code,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = gst_bit_writer_get_size (&bw);
|
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||||
gst_bit_writer_reset (&bw);
|
gst_bit_writer_reset (&bw);
|
||||||
|
|
||||||
return GST_H265_BIT_WRITER_OK;
|
return GST_H265_BIT_WRITER_OK;
|
||||||
|
@ -1343,7 +1343,7 @@ error:
|
||||||
* @pps: the pps of #GstH265PPS to write
|
* @pps: the pps of #GstH265PPS to write
|
||||||
* @start_code: whether adding the nal start code
|
* @start_code: whether adding the nal start code
|
||||||
* @data: (out): the bit stream generated by the pps
|
* @data: (out): the bit stream generated by the pps
|
||||||
* @size: (inout): the size in bits of the output
|
* @size: (inout): the size in bytes of the input and output
|
||||||
*
|
*
|
||||||
* Generating the according h265 bit stream by providing the pps.
|
* Generating the according h265 bit stream by providing the pps.
|
||||||
*
|
*
|
||||||
|
@ -1353,7 +1353,7 @@ error:
|
||||||
**/
|
**/
|
||||||
GstH265BitWriterResult
|
GstH265BitWriterResult
|
||||||
gst_h265_bit_writer_pps (const GstH265PPS * pps, gboolean start_code,
|
gst_h265_bit_writer_pps (const GstH265PPS * pps, gboolean start_code,
|
||||||
guint8 * data, gsize * size)
|
guint8 * data, guint * size)
|
||||||
{
|
{
|
||||||
gboolean have_space = TRUE;
|
gboolean have_space = TRUE;
|
||||||
GstBitWriter bw;
|
GstBitWriter bw;
|
||||||
|
@ -1389,7 +1389,7 @@ gst_h265_bit_writer_pps (const GstH265PPS * pps, gboolean start_code,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = gst_bit_writer_get_size (&bw);
|
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||||
gst_bit_writer_reset (&bw);
|
gst_bit_writer_reset (&bw);
|
||||||
|
|
||||||
return GST_H265_BIT_WRITER_OK;
|
return GST_H265_BIT_WRITER_OK;
|
||||||
|
@ -1771,7 +1771,7 @@ error:
|
||||||
* @start_code: whether adding the nal start code
|
* @start_code: whether adding the nal start code
|
||||||
* @nal_type: the slice's nal type of #GstH265NalUnitType
|
* @nal_type: the slice's nal type of #GstH265NalUnitType
|
||||||
* @data: (out): the bit stream generated by the slice header
|
* @data: (out): the bit stream generated by the slice header
|
||||||
* @size: (inout): the size in bits of the output
|
* @size: (inout): the size in bytes of the input and output
|
||||||
*
|
*
|
||||||
* Generating the according h265 bit stream by providing the slice header.
|
* Generating the according h265 bit stream by providing the slice header.
|
||||||
*
|
*
|
||||||
|
@ -1781,7 +1781,7 @@ error:
|
||||||
**/
|
**/
|
||||||
GstH265BitWriterResult
|
GstH265BitWriterResult
|
||||||
gst_h265_bit_writer_slice_hdr (const GstH265SliceHdr * slice,
|
gst_h265_bit_writer_slice_hdr (const GstH265SliceHdr * slice,
|
||||||
gboolean start_code, guint32 nal_type, guint8 * data, gsize * size)
|
gboolean start_code, guint32 nal_type, guint8 * data, guint * size)
|
||||||
{
|
{
|
||||||
gboolean have_space = TRUE;
|
gboolean have_space = TRUE;
|
||||||
GstBitWriter bw;
|
GstBitWriter bw;
|
||||||
|
@ -1820,7 +1820,7 @@ gst_h265_bit_writer_slice_hdr (const GstH265SliceHdr * slice,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = gst_bit_writer_get_size (&bw);
|
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||||
gst_bit_writer_reset (&bw);
|
gst_bit_writer_reset (&bw);
|
||||||
return GST_H265_BIT_WRITER_OK;
|
return GST_H265_BIT_WRITER_OK;
|
||||||
|
|
||||||
|
@ -2019,7 +2019,7 @@ error:
|
||||||
* @sei_messages: An array of #GstH265SEIMessage to write
|
* @sei_messages: An array of #GstH265SEIMessage to write
|
||||||
* @start_code: whether adding the nal start code
|
* @start_code: whether adding the nal start code
|
||||||
* @data: (out): the bit stream generated by the sei messages
|
* @data: (out): the bit stream generated by the sei messages
|
||||||
* @size: (inout): the size in bits of the output
|
* @size: (inout): the size in bytes of the input and output
|
||||||
*
|
*
|
||||||
* Generating the according h265 bit stream by providing sei messages.
|
* Generating the according h265 bit stream by providing sei messages.
|
||||||
*
|
*
|
||||||
|
@ -2030,7 +2030,7 @@ error:
|
||||||
GstH265BitWriterResult
|
GstH265BitWriterResult
|
||||||
gst_h265_bit_writer_sei (GArray * sei_messages,
|
gst_h265_bit_writer_sei (GArray * sei_messages,
|
||||||
GstH265NalUnitType nal_type, gboolean start_code, guint8 * data,
|
GstH265NalUnitType nal_type, gboolean start_code, guint8 * data,
|
||||||
gsize * size)
|
guint * size)
|
||||||
{
|
{
|
||||||
gboolean have_space = TRUE;
|
gboolean have_space = TRUE;
|
||||||
GstBitWriter bw;
|
GstBitWriter bw;
|
||||||
|
@ -2119,7 +2119,7 @@ gst_h265_bit_writer_sei (GArray * sei_messages,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = gst_bit_writer_get_size (&bw);
|
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||||
gst_bit_writer_reset (&bw);
|
gst_bit_writer_reset (&bw);
|
||||||
return GST_H265_BIT_WRITER_OK;
|
return GST_H265_BIT_WRITER_OK;
|
||||||
|
|
||||||
|
@ -2138,7 +2138,7 @@ error:
|
||||||
* as the H265 spec Table 7-2 defines
|
* as the H265 spec Table 7-2 defines
|
||||||
* @start_code: whether adding the nal start code
|
* @start_code: whether adding the nal start code
|
||||||
* @data: (out): the bit stream generated by the aud
|
* @data: (out): the bit stream generated by the aud
|
||||||
* @size: (inout): the size in bits of the output
|
* @size: (inout): the size in bytes of the input and output
|
||||||
*
|
*
|
||||||
* Generating the according h265 bit stream of an aud.
|
* Generating the according h265 bit stream of an aud.
|
||||||
*
|
*
|
||||||
|
@ -2148,7 +2148,7 @@ error:
|
||||||
**/
|
**/
|
||||||
GstH265BitWriterResult
|
GstH265BitWriterResult
|
||||||
gst_h265_bit_writer_aud (guint8 pic_type, gboolean start_code,
|
gst_h265_bit_writer_aud (guint8 pic_type, gboolean start_code,
|
||||||
guint8 * data, gsize * size)
|
guint8 * data, guint * size)
|
||||||
{
|
{
|
||||||
gboolean have_space = TRUE;
|
gboolean have_space = TRUE;
|
||||||
GstBitWriter bw;
|
GstBitWriter bw;
|
||||||
|
@ -2181,7 +2181,7 @@ gst_h265_bit_writer_aud (guint8 pic_type, gboolean start_code,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
*size = gst_bit_writer_get_size (&bw);
|
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||||
gst_bit_writer_reset (&bw);
|
gst_bit_writer_reset (&bw);
|
||||||
|
|
||||||
return GST_H265_BIT_WRITER_OK;
|
return GST_H265_BIT_WRITER_OK;
|
||||||
|
@ -2223,7 +2223,7 @@ GstH265BitWriterResult
|
||||||
gst_h265_bit_writer_convert_to_nal (guint nal_prefix_size,
|
gst_h265_bit_writer_convert_to_nal (guint nal_prefix_size,
|
||||||
gboolean packetized, gboolean has_startcode, gboolean add_trailings,
|
gboolean packetized, gboolean has_startcode, gboolean add_trailings,
|
||||||
const guint8 * raw_data, gsize raw_size, guint8 * nal_data,
|
const guint8 * raw_data, gsize raw_size, guint8 * nal_data,
|
||||||
guint32 * nal_size)
|
guint * nal_size)
|
||||||
{
|
{
|
||||||
NalWriter nw;
|
NalWriter nw;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
|
@ -49,35 +49,35 @@ GST_CODEC_PARSERS_API
|
||||||
GstH265BitWriterResult gst_h265_bit_writer_vps (const GstH265VPS * vps,
|
GstH265BitWriterResult gst_h265_bit_writer_vps (const GstH265VPS * vps,
|
||||||
gboolean start_code,
|
gboolean start_code,
|
||||||
guint8 * data,
|
guint8 * data,
|
||||||
gsize * size);
|
guint * size);
|
||||||
GST_CODEC_PARSERS_API
|
GST_CODEC_PARSERS_API
|
||||||
GstH265BitWriterResult gst_h265_bit_writer_sps (const GstH265SPS * sps,
|
GstH265BitWriterResult gst_h265_bit_writer_sps (const GstH265SPS * sps,
|
||||||
gboolean start_code,
|
gboolean start_code,
|
||||||
guint8 * data,
|
guint8 * data,
|
||||||
gsize * size);
|
guint * size);
|
||||||
GST_CODEC_PARSERS_API
|
GST_CODEC_PARSERS_API
|
||||||
GstH265BitWriterResult gst_h265_bit_writer_pps (const GstH265PPS * pps,
|
GstH265BitWriterResult gst_h265_bit_writer_pps (const GstH265PPS * pps,
|
||||||
gboolean start_code,
|
gboolean start_code,
|
||||||
guint8 * data,
|
guint8 * data,
|
||||||
gsize * size);
|
guint * size);
|
||||||
GST_CODEC_PARSERS_API
|
GST_CODEC_PARSERS_API
|
||||||
GstH265BitWriterResult gst_h265_bit_writer_slice_hdr (const GstH265SliceHdr * slice,
|
GstH265BitWriterResult gst_h265_bit_writer_slice_hdr (const GstH265SliceHdr * slice,
|
||||||
gboolean start_code,
|
gboolean start_code,
|
||||||
guint32 nal_type,
|
guint32 nal_type,
|
||||||
guint8 * data,
|
guint8 * data,
|
||||||
gsize * size);
|
guint * size);
|
||||||
GST_CODEC_PARSERS_API
|
GST_CODEC_PARSERS_API
|
||||||
GstH265BitWriterResult gst_h265_bit_writer_sei (GArray * sei_messages,
|
GstH265BitWriterResult gst_h265_bit_writer_sei (GArray * sei_messages,
|
||||||
GstH265NalUnitType nal_type,
|
GstH265NalUnitType nal_type,
|
||||||
gboolean start_code,
|
gboolean start_code,
|
||||||
guint8 * data,
|
guint8 * data,
|
||||||
gsize * size);
|
guint * size);
|
||||||
|
|
||||||
GST_CODEC_PARSERS_API
|
GST_CODEC_PARSERS_API
|
||||||
GstH265BitWriterResult gst_h265_bit_writer_aud (guint8 pic_type,
|
GstH265BitWriterResult gst_h265_bit_writer_aud (guint8 pic_type,
|
||||||
gboolean start_code,
|
gboolean start_code,
|
||||||
guint8 * data,
|
guint8 * data,
|
||||||
gsize * size);
|
guint * size);
|
||||||
|
|
||||||
GST_CODEC_PARSERS_API
|
GST_CODEC_PARSERS_API
|
||||||
GstH265BitWriterResult gst_h265_bit_writer_convert_to_nal (guint nal_prefix_size,
|
GstH265BitWriterResult gst_h265_bit_writer_convert_to_nal (guint nal_prefix_size,
|
||||||
|
@ -87,7 +87,7 @@ GstH265BitWriterResult gst_h265_bit_writer_convert_to_nal (guint nal_prefix_s
|
||||||
const guint8 * raw_data,
|
const guint8 * raw_data,
|
||||||
gsize raw_size,
|
gsize raw_size,
|
||||||
guint8 * nal_data,
|
guint8 * nal_data,
|
||||||
guint32 * nal_size);
|
guint * nal_size);
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_H265_BIT_WRITER_H__ */
|
#endif /* __GST_H265_BIT_WRITER_H__ */
|
||||||
|
|
|
@ -513,7 +513,7 @@ GST_START_TEST (test_h265_bitwriter_vps_sps_pps_slice_hdr)
|
||||||
GstH265SliceHdr slice_parsed;
|
GstH265SliceHdr slice_parsed;
|
||||||
guint8 header_data[2048] = { 0, };
|
guint8 header_data[2048] = { 0, };
|
||||||
guint8 header_nal[2048] = { 0, };
|
guint8 header_nal[2048] = { 0, };
|
||||||
gsize size;
|
guint size;
|
||||||
guint32 nal_size;
|
guint32 nal_size;
|
||||||
guint i, j;
|
guint i, j;
|
||||||
|
|
||||||
|
@ -523,9 +523,9 @@ GST_START_TEST (test_h265_bitwriter_vps_sps_pps_slice_hdr)
|
||||||
|
|
||||||
nal_size = sizeof (header_nal);
|
nal_size = sizeof (header_nal);
|
||||||
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
||||||
header_data, size, header_nal, &nal_size);
|
header_data, size * 8, header_nal, &nal_size);
|
||||||
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
||||||
fail_if (nal_size < GST_ROUND_UP_8 (size) / 8);
|
fail_if (nal_size < size);
|
||||||
|
|
||||||
/* Parse it again */
|
/* Parse it again */
|
||||||
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
||||||
|
@ -612,9 +612,9 @@ GST_START_TEST (test_h265_bitwriter_vps_sps_pps_slice_hdr)
|
||||||
|
|
||||||
nal_size = sizeof (header_nal);
|
nal_size = sizeof (header_nal);
|
||||||
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
||||||
header_data, size, header_nal, &nal_size);
|
header_data, size * 8, header_nal, &nal_size);
|
||||||
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
||||||
fail_if (nal_size < GST_ROUND_UP_8 (size) / 8);
|
fail_if (nal_size < size);
|
||||||
|
|
||||||
/* Parse it again */
|
/* Parse it again */
|
||||||
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
||||||
|
@ -805,9 +805,9 @@ GST_START_TEST (test_h265_bitwriter_vps_sps_pps_slice_hdr)
|
||||||
|
|
||||||
nal_size = sizeof (header_nal);
|
nal_size = sizeof (header_nal);
|
||||||
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
||||||
header_data, size, header_nal, &nal_size);
|
header_data, size * 8, header_nal, &nal_size);
|
||||||
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
||||||
fail_if (nal_size < GST_ROUND_UP_8 (size) / 8);
|
fail_if (nal_size < size);
|
||||||
|
|
||||||
/* Parse it again */
|
/* Parse it again */
|
||||||
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
||||||
|
@ -906,9 +906,9 @@ GST_START_TEST (test_h265_bitwriter_vps_sps_pps_slice_hdr)
|
||||||
|
|
||||||
nal_size = sizeof (header_nal);
|
nal_size = sizeof (header_nal);
|
||||||
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
ret = gst_h265_bit_writer_convert_to_nal (4, FALSE, TRUE, FALSE,
|
||||||
header_data, GST_ROUND_UP_8 (size), header_nal, &nal_size);
|
header_data, size * 8, header_nal, &nal_size);
|
||||||
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
fail_if (ret != GST_H265_BIT_WRITER_OK);
|
||||||
fail_if (nal_size < GST_ROUND_UP_8 (size) / 8);
|
fail_if (nal_size < size);
|
||||||
|
|
||||||
/* Parse it again */
|
/* Parse it again */
|
||||||
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
||||||
|
|
Loading…
Reference in a new issue