blob: 7e266a6a15e5bab208697be71b74c31ac8dd0634 [file] [log] [blame]
Sreerenj Balachandrand8448322013-10-09 10:54:14 +03001/* GStreamer H.265 Parser
2 * Copyright (C) 2013 Intel Corporation
3 * Contact: Sreerenj Balachandran <sreerenj.balachandran@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 the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __GST_H265_PARSE_H__
22#define __GST_H265_PARSE_H__
23
24#include <gst/gst.h>
25#include <gst/base/gstbaseparse.h>
26#include <gst/codecparsers/gsth265parser.h>
27
28G_BEGIN_DECLS
29
30#define GST_TYPE_H265_PARSE \
31 (gst_h265_parse_get_type())
32#define GST_H265_PARSE(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_H265_PARSE,GstH265Parse))
34#define GST_H265_PARSE_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_H265_PARSE,GstH265ParseClass))
36#define GST_IS_H265_PARSE(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_H265_PARSE))
38#define GST_IS_H265_PARSE_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_H265_PARSE))
40
41GType gst_h265_parse_get_type (void);
42
43typedef struct _GstH265Parse GstH265Parse;
44typedef struct _GstH265ParseClass GstH265ParseClass;
45
46struct _GstH265Parse
47{
48 GstBaseParse baseparse;
49
50 /* stream */
51 gint width, height;
52 gint fps_num, fps_den;
53 gint upstream_par_n, upstream_par_d;
54 gint parsed_par_n, parsed_par_d;
55 /* current codec_data in output caps, if any */
56 GstBuffer *codec_data;
57 /* input codec_data, if any */
58 GstBuffer *codec_data_in;
59 guint nal_length_size;
60 gboolean packetized;
61 gboolean split_packetized;
62 gboolean transform;
63
64 /* state */
65 GstH265Parser *nalparser;
Seungha Yang37bb4ce2018-08-13 22:23:22 +090066 guint state;
Sreerenj Balachandrand8448322013-10-09 10:54:14 +030067 guint align;
68 guint format;
69 gint current_off;
70
71 GstClockTime last_report;
72 gboolean push_codec;
Seungha Yang37bb4ce2018-08-13 22:23:22 +090073 /* The following variables have a meaning in context of "have
74 * VPS/SPS/PPS to push downstream", e.g. to update caps */
Sreerenj Balachandrand8448322013-10-09 10:54:14 +030075 gboolean have_vps;
76 gboolean have_sps;
77 gboolean have_pps;
78
79 /* collected SPS and PPS NALUs */
80 GstBuffer *vps_nals[GST_H265_MAX_VPS_COUNT];
81 GstBuffer *sps_nals[GST_H265_MAX_SPS_COUNT];
82 GstBuffer *pps_nals[GST_H265_MAX_PPS_COUNT];
83
Seungha Yange47b0132018-08-14 00:27:12 +090084 gboolean discont;
85
Sreerenj Balachandrand8448322013-10-09 10:54:14 +030086 /* frame parsing */
87 gint idr_pos, sei_pos;
88 gboolean update_caps;
89 GstAdapter *frame_out;
90 gboolean keyframe;
Josep Torra4b43e952014-11-07 15:41:15 +010091 gboolean header;
Sreerenj Balachandrand8448322013-10-09 10:54:14 +030092 /* AU state */
93 gboolean picture_start;
94
95 /* props */
96 guint interval;
97
Sebastian Dröge843de8d2013-12-16 10:19:36 +010098 gboolean sent_codec_tag;
99
Sreerenj Balachandrand8448322013-10-09 10:54:14 +0300100 GstClockTime pending_key_unit_ts;
101 GstEvent *force_key_unit_event;
102};
103
104struct _GstH265ParseClass
105{
106 GstBaseParseClass parent_class;
107};
108
109G_END_DECLS
110#endif