739d012953350ce436bbacd338d0a9333cbd0fe2
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / gst-libs / gst / codecparsers / gsth264bitwriter.h
1 /* GStreamer
2  *  Copyright (C) 2020 Intel Corporation
3  *     Author: He Junyan <junyan.he@intel.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the0
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __GST_H264_BIT_WRITER_H__
22 #define __GST_H264_BIT_WRITER_H__
23
24 #include <gst/codecparsers/codecparsers-prelude.h>
25 #include <gst/codecparsers/gsth264parser.h>
26
27 G_BEGIN_DECLS
28
29 /**
30  * GstH264BitWriterResult:
31  * @GST_H264_BIT_WRITER_OK: The writing succeeded
32  * @GST_H264_BIT_WRITER_INVALID_DATA: The input data to write is invalid
33  * @GST_H264_BIT_WRITER_NO_MORE_SPACE: The output does not have enough size
34  * @GST_H264_BIT_WRITER_ERROR: An general error occurred when writing
35  *
36  * The result of writing H264 data into bit stream.
37  *
38  * Since: 1.22
39  */
40 typedef enum
41 {
42   GST_H264_BIT_WRITER_OK,
43   GST_H264_BIT_WRITER_INVALID_DATA,
44   GST_H264_BIT_WRITER_NO_MORE_SPACE,
45   GST_H264_BIT_WRITER_ERROR
46 } GstH264BitWriterResult;
47
48 GST_CODEC_PARSERS_API
49 GstH264BitWriterResult     gst_h264_bit_writer_sps       (const GstH264SPS * sps,
50                                                           gboolean start_code,
51                                                           guint8 * data,
52                                                           gsize * size);
53 GST_CODEC_PARSERS_API
54 GstH264BitWriterResult     gst_h264_bit_writer_pps       (const GstH264PPS * pps,
55                                                           gboolean start_code,
56                                                           guint8 * data,
57                                                           gsize * size);
58 GST_CODEC_PARSERS_API
59 GstH264BitWriterResult     gst_h264_bit_writer_slice_hdr (const GstH264SliceHdr * slice,
60                                                           gboolean start_code,
61                                                           GstH264NalUnitType nal_type,
62                                                           gboolean is_ref,
63                                                           guint8 * data,
64                                                           gsize * size);
65 GST_CODEC_PARSERS_API
66 GstH264BitWriterResult     gst_h264_bit_writer_sei       (GArray * sei_messages,
67                                                           gboolean start_code,
68                                                           guint8 * data,
69                                                           gsize * size);
70 GST_CODEC_PARSERS_API
71 GstH264BitWriterResult     gst_h264_bit_writer_aud       (guint8 primary_pic_type,
72                                                           gboolean start_code,
73                                                           guint8 * data,
74                                                           gsize * size);
75 GST_CODEC_PARSERS_API
76 GstH264BitWriterResult     gst_h264_bit_writer_convert_to_nal (guint nal_prefix_size,
77                                                                gboolean packetized,
78                                                                gboolean has_startcode,
79                                                                gboolean add_trailings,
80                                                                const guint8 * raw_data,
81                                                                gsize raw_size,
82                                                                guint8 * nal_data,
83                                                                guint32 * nal_size);
84
85 G_END_DECLS
86
87 #endif /* __GST_H264_BIT_WRITER_H__ */