mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +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
|
||||
* @start_code: whether adding the nal start code
|
||||
* @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.
|
||||
*
|
||||
|
@ -460,7 +460,7 @@ error:
|
|||
**/
|
||||
GstH265BitWriterResult
|
||||
gst_h265_bit_writer_vps (const GstH265VPS * vps, gboolean start_code,
|
||||
guint8 * data, gsize * size)
|
||||
guint8 * data, guint * size)
|
||||
{
|
||||
gboolean have_space = TRUE;
|
||||
GstBitWriter bw;
|
||||
|
@ -495,7 +495,7 @@ gst_h265_bit_writer_vps (const GstH265VPS * vps, gboolean start_code,
|
|||
goto error;
|
||||
}
|
||||
|
||||
*size = gst_bit_writer_get_size (&bw);
|
||||
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||
gst_bit_writer_reset (&bw);
|
||||
|
||||
return GST_H265_BIT_WRITER_OK;
|
||||
|
@ -1054,7 +1054,7 @@ error:
|
|||
* @sps: the sps of #GstH265SPS to write
|
||||
* @start_code: whether adding the nal start code
|
||||
* @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.
|
||||
*
|
||||
|
@ -1064,7 +1064,7 @@ error:
|
|||
**/
|
||||
GstH265BitWriterResult
|
||||
gst_h265_bit_writer_sps (const GstH265SPS * sps, gboolean start_code,
|
||||
guint8 * data, gsize * size)
|
||||
guint8 * data, guint * size)
|
||||
{
|
||||
gboolean have_space = TRUE;
|
||||
GstBitWriter bw;
|
||||
|
@ -1100,7 +1100,7 @@ gst_h265_bit_writer_sps (const GstH265SPS * sps, gboolean start_code,
|
|||
goto error;
|
||||
}
|
||||
|
||||
*size = gst_bit_writer_get_size (&bw);
|
||||
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||
gst_bit_writer_reset (&bw);
|
||||
|
||||
return GST_H265_BIT_WRITER_OK;
|
||||
|
@ -1343,7 +1343,7 @@ error:
|
|||
* @pps: the pps of #GstH265PPS to write
|
||||
* @start_code: whether adding the nal start code
|
||||
* @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.
|
||||
*
|
||||
|
@ -1353,7 +1353,7 @@ error:
|
|||
**/
|
||||
GstH265BitWriterResult
|
||||
gst_h265_bit_writer_pps (const GstH265PPS * pps, gboolean start_code,
|
||||
guint8 * data, gsize * size)
|
||||
guint8 * data, guint * size)
|
||||
{
|
||||
gboolean have_space = TRUE;
|
||||
GstBitWriter bw;
|
||||
|
@ -1389,7 +1389,7 @@ gst_h265_bit_writer_pps (const GstH265PPS * pps, gboolean start_code,
|
|||
goto error;
|
||||
}
|
||||
|
||||
*size = gst_bit_writer_get_size (&bw);
|
||||
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||
gst_bit_writer_reset (&bw);
|
||||
|
||||
return GST_H265_BIT_WRITER_OK;
|
||||
|
@ -1771,7 +1771,7 @@ error:
|
|||
* @start_code: whether adding the nal start code
|
||||
* @nal_type: the slice's nal type of #GstH265NalUnitType
|
||||
* @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.
|
||||
*
|
||||
|
@ -1781,7 +1781,7 @@ error:
|
|||
**/
|
||||
GstH265BitWriterResult
|
||||
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;
|
||||
GstBitWriter bw;
|
||||
|
@ -1820,7 +1820,7 @@ gst_h265_bit_writer_slice_hdr (const GstH265SliceHdr * slice,
|
|||
goto error;
|
||||
}
|
||||
|
||||
*size = gst_bit_writer_get_size (&bw);
|
||||
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||
gst_bit_writer_reset (&bw);
|
||||
return GST_H265_BIT_WRITER_OK;
|
||||
|
||||
|
@ -2019,7 +2019,7 @@ error:
|
|||
* @sei_messages: An array of #GstH265SEIMessage to write
|
||||
* @start_code: whether adding the nal start code
|
||||
* @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.
|
||||
*
|
||||
|
@ -2030,7 +2030,7 @@ error:
|
|||
GstH265BitWriterResult
|
||||
gst_h265_bit_writer_sei (GArray * sei_messages,
|
||||
GstH265NalUnitType nal_type, gboolean start_code, guint8 * data,
|
||||
gsize * size)
|
||||
guint * size)
|
||||
{
|
||||
gboolean have_space = TRUE;
|
||||
GstBitWriter bw;
|
||||
|
@ -2119,7 +2119,7 @@ gst_h265_bit_writer_sei (GArray * sei_messages,
|
|||
goto error;
|
||||
}
|
||||
|
||||
*size = gst_bit_writer_get_size (&bw);
|
||||
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||
gst_bit_writer_reset (&bw);
|
||||
return GST_H265_BIT_WRITER_OK;
|
||||
|
||||
|
@ -2138,7 +2138,7 @@ error:
|
|||
* as the H265 spec Table 7-2 defines
|
||||
* @start_code: whether adding the nal start code
|
||||
* @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.
|
||||
*
|
||||
|
@ -2148,7 +2148,7 @@ error:
|
|||
**/
|
||||
GstH265BitWriterResult
|
||||
gst_h265_bit_writer_aud (guint8 pic_type, gboolean start_code,
|
||||
guint8 * data, gsize * size)
|
||||
guint8 * data, guint * size)
|
||||
{
|
||||
gboolean have_space = TRUE;
|
||||
GstBitWriter bw;
|
||||
|
@ -2181,7 +2181,7 @@ gst_h265_bit_writer_aud (guint8 pic_type, gboolean start_code,
|
|||
goto error;
|
||||
}
|
||||
|
||||
*size = gst_bit_writer_get_size (&bw);
|
||||
*size = gst_bit_writer_get_size (&bw) / 8;
|
||||
gst_bit_writer_reset (&bw);
|
||||
|
||||
return GST_H265_BIT_WRITER_OK;
|
||||
|
@ -2223,7 +2223,7 @@ GstH265BitWriterResult
|
|||
gst_h265_bit_writer_convert_to_nal (guint nal_prefix_size,
|
||||
gboolean packetized, gboolean has_startcode, gboolean add_trailings,
|
||||
const guint8 * raw_data, gsize raw_size, guint8 * nal_data,
|
||||
guint32 * nal_size)
|
||||
guint * nal_size)
|
||||
{
|
||||
NalWriter nw;
|
||||
guint8 *data;
|
||||
|
|
|
@ -49,35 +49,35 @@ GST_CODEC_PARSERS_API
|
|||
GstH265BitWriterResult gst_h265_bit_writer_vps (const GstH265VPS * vps,
|
||||
gboolean start_code,
|
||||
guint8 * data,
|
||||
gsize * size);
|
||||
guint * size);
|
||||
GST_CODEC_PARSERS_API
|
||||
GstH265BitWriterResult gst_h265_bit_writer_sps (const GstH265SPS * sps,
|
||||
gboolean start_code,
|
||||
guint8 * data,
|
||||
gsize * size);
|
||||
guint * size);
|
||||
GST_CODEC_PARSERS_API
|
||||
GstH265BitWriterResult gst_h265_bit_writer_pps (const GstH265PPS * pps,
|
||||
gboolean start_code,
|
||||
guint8 * data,
|
||||
gsize * size);
|
||||
guint * size);
|
||||
GST_CODEC_PARSERS_API
|
||||
GstH265BitWriterResult gst_h265_bit_writer_slice_hdr (const GstH265SliceHdr * slice,
|
||||
gboolean start_code,
|
||||
guint32 nal_type,
|
||||
guint8 * data,
|
||||
gsize * size);
|
||||
guint * size);
|
||||
GST_CODEC_PARSERS_API
|
||||
GstH265BitWriterResult gst_h265_bit_writer_sei (GArray * sei_messages,
|
||||
GstH265NalUnitType nal_type,
|
||||
gboolean start_code,
|
||||
guint8 * data,
|
||||
gsize * size);
|
||||
guint * size);
|
||||
|
||||
GST_CODEC_PARSERS_API
|
||||
GstH265BitWriterResult gst_h265_bit_writer_aud (guint8 pic_type,
|
||||
gboolean start_code,
|
||||
guint8 * data,
|
||||
gsize * size);
|
||||
guint * size);
|
||||
|
||||
GST_CODEC_PARSERS_API
|
||||
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,
|
||||
gsize raw_size,
|
||||
guint8 * nal_data,
|
||||
guint32 * nal_size);
|
||||
guint * nal_size);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_H265_BIT_WRITER_H__ */
|
||||
|
|
|
@ -513,7 +513,7 @@ GST_START_TEST (test_h265_bitwriter_vps_sps_pps_slice_hdr)
|
|||
GstH265SliceHdr slice_parsed;
|
||||
guint8 header_data[2048] = { 0, };
|
||||
guint8 header_nal[2048] = { 0, };
|
||||
gsize size;
|
||||
guint size;
|
||||
guint32 nal_size;
|
||||
guint i, j;
|
||||
|
||||
|
@ -523,9 +523,9 @@ GST_START_TEST (test_h265_bitwriter_vps_sps_pps_slice_hdr)
|
|||
|
||||
nal_size = sizeof (header_nal);
|
||||
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 (nal_size < GST_ROUND_UP_8 (size) / 8);
|
||||
fail_if (nal_size < size);
|
||||
|
||||
/* Parse it again */
|
||||
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);
|
||||
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 (nal_size < GST_ROUND_UP_8 (size) / 8);
|
||||
fail_if (nal_size < size);
|
||||
|
||||
/* Parse it again */
|
||||
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);
|
||||
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 (nal_size < GST_ROUND_UP_8 (size) / 8);
|
||||
fail_if (nal_size < size);
|
||||
|
||||
/* Parse it again */
|
||||
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);
|
||||
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 (nal_size < GST_ROUND_UP_8 (size) / 8);
|
||||
fail_if (nal_size < size);
|
||||
|
||||
/* Parse it again */
|
||||
res = gst_h265_parser_identify_nalu (parser, header_nal, 0,
|
||||
|
|
Loading…
Reference in a new issue