Sreerenj Balachandran | d844832 | 2013-10-09 10:54:14 +0300 | [diff] [blame] | 1 | /* 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 | |
| 28 | G_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 | |
| 41 | GType gst_h265_parse_get_type (void); |
| 42 | |
| 43 | typedef struct _GstH265Parse GstH265Parse; |
| 44 | typedef struct _GstH265ParseClass GstH265ParseClass; |
| 45 | |
| 46 | struct _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 Yang | 37bb4ce | 2018-08-13 22:23:22 +0900 | [diff] [blame] | 66 | guint state; |
Sreerenj Balachandran | d844832 | 2013-10-09 10:54:14 +0300 | [diff] [blame] | 67 | guint align; |
| 68 | guint format; |
| 69 | gint current_off; |
| 70 | |
| 71 | GstClockTime last_report; |
| 72 | gboolean push_codec; |
Seungha Yang | 37bb4ce | 2018-08-13 22:23:22 +0900 | [diff] [blame] | 73 | /* The following variables have a meaning in context of "have |
| 74 | * VPS/SPS/PPS to push downstream", e.g. to update caps */ |
Sreerenj Balachandran | d844832 | 2013-10-09 10:54:14 +0300 | [diff] [blame] | 75 | 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 Yang | e47b013 | 2018-08-14 00:27:12 +0900 | [diff] [blame] | 84 | gboolean discont; |
| 85 | |
Sreerenj Balachandran | d844832 | 2013-10-09 10:54:14 +0300 | [diff] [blame] | 86 | /* frame parsing */ |
| 87 | gint idr_pos, sei_pos; |
| 88 | gboolean update_caps; |
| 89 | GstAdapter *frame_out; |
| 90 | gboolean keyframe; |
Josep Torra | 4b43e95 | 2014-11-07 15:41:15 +0100 | [diff] [blame] | 91 | gboolean header; |
Sreerenj Balachandran | d844832 | 2013-10-09 10:54:14 +0300 | [diff] [blame] | 92 | /* AU state */ |
| 93 | gboolean picture_start; |
| 94 | |
| 95 | /* props */ |
| 96 | guint interval; |
| 97 | |
Sebastian Dröge | 843de8d | 2013-12-16 10:19:36 +0100 | [diff] [blame] | 98 | gboolean sent_codec_tag; |
| 99 | |
Sreerenj Balachandran | d844832 | 2013-10-09 10:54:14 +0300 | [diff] [blame] | 100 | GstClockTime pending_key_unit_ts; |
| 101 | GstEvent *force_key_unit_event; |
| 102 | }; |
| 103 | |
| 104 | struct _GstH265ParseClass |
| 105 | { |
| 106 | GstBaseParseClass parent_class; |
| 107 | }; |
| 108 | |
| 109 | G_END_DECLS |
| 110 | #endif |