2013-10-09 07:54:14 +00:00
|
|
|
/* GStreamer H.265 Parser
|
|
|
|
* Copyright (C) 2013 Intel Corporation
|
|
|
|
* Contact: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_H265_PARSE_H__
|
|
|
|
#define __GST_H265_PARSE_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/base/gstbaseparse.h>
|
|
|
|
#include <gst/codecparsers/gsth265parser.h>
|
2019-05-01 12:24:49 +00:00
|
|
|
#include <gst/video/video.h>
|
2019-05-08 15:06:40 +00:00
|
|
|
#include "gstvideoparseutils.h"
|
2013-10-09 07:54:14 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_TYPE_H265_PARSE \
|
|
|
|
(gst_h265_parse_get_type())
|
|
|
|
#define GST_H265_PARSE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_H265_PARSE,GstH265Parse))
|
|
|
|
#define GST_H265_PARSE_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_H265_PARSE,GstH265ParseClass))
|
|
|
|
#define GST_IS_H265_PARSE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_H265_PARSE))
|
|
|
|
#define GST_IS_H265_PARSE_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_H265_PARSE))
|
|
|
|
|
|
|
|
GType gst_h265_parse_get_type (void);
|
|
|
|
|
|
|
|
typedef struct _GstH265Parse GstH265Parse;
|
|
|
|
typedef struct _GstH265ParseClass GstH265ParseClass;
|
|
|
|
|
|
|
|
struct _GstH265Parse
|
|
|
|
{
|
|
|
|
GstBaseParse baseparse;
|
|
|
|
|
|
|
|
/* stream */
|
|
|
|
gint width, height;
|
|
|
|
gint fps_num, fps_den;
|
|
|
|
gint upstream_par_n, upstream_par_d;
|
|
|
|
gint parsed_par_n, parsed_par_d;
|
2019-03-30 00:17:08 +00:00
|
|
|
gint parsed_fps_n, parsed_fps_d;
|
2019-07-16 13:58:26 +00:00
|
|
|
GstVideoColorimetry parsed_colorimetry;
|
2013-10-09 07:54:14 +00:00
|
|
|
/* current codec_data in output caps, if any */
|
|
|
|
GstBuffer *codec_data;
|
|
|
|
/* input codec_data, if any */
|
|
|
|
GstBuffer *codec_data_in;
|
|
|
|
guint nal_length_size;
|
|
|
|
gboolean packetized;
|
|
|
|
gboolean split_packetized;
|
|
|
|
gboolean transform;
|
|
|
|
|
|
|
|
/* state */
|
|
|
|
GstH265Parser *nalparser;
|
2018-10-09 20:01:08 +00:00
|
|
|
guint in_align;
|
2018-08-13 13:23:22 +00:00
|
|
|
guint state;
|
2013-10-09 07:54:14 +00:00
|
|
|
guint align;
|
|
|
|
guint format;
|
|
|
|
gint current_off;
|
|
|
|
|
|
|
|
GstClockTime last_report;
|
|
|
|
gboolean push_codec;
|
2018-08-13 13:23:22 +00:00
|
|
|
/* The following variables have a meaning in context of "have
|
|
|
|
* VPS/SPS/PPS to push downstream", e.g. to update caps */
|
2013-10-09 07:54:14 +00:00
|
|
|
gboolean have_vps;
|
|
|
|
gboolean have_sps;
|
|
|
|
gboolean have_pps;
|
|
|
|
|
2018-11-23 02:51:04 +00:00
|
|
|
/* per frame vps/sps/pps check for periodic push codec decision */
|
|
|
|
gboolean have_vps_in_frame;
|
|
|
|
gboolean have_sps_in_frame;
|
|
|
|
gboolean have_pps_in_frame;
|
|
|
|
|
2020-03-10 08:40:28 +00:00
|
|
|
gboolean first_frame;
|
|
|
|
|
2013-10-09 07:54:14 +00:00
|
|
|
/* collected SPS and PPS NALUs */
|
|
|
|
GstBuffer *vps_nals[GST_H265_MAX_VPS_COUNT];
|
|
|
|
GstBuffer *sps_nals[GST_H265_MAX_SPS_COUNT];
|
|
|
|
GstBuffer *pps_nals[GST_H265_MAX_PPS_COUNT];
|
|
|
|
|
2019-03-30 00:17:08 +00:00
|
|
|
/* Infos we need to keep track of */
|
|
|
|
guint8 sei_pic_struct;
|
|
|
|
|
|
|
|
/* Collected TimeCode SEI */
|
|
|
|
GstH265TimeCode time_code;
|
|
|
|
|
2018-08-13 15:27:12 +00:00
|
|
|
gboolean discont;
|
2018-10-03 20:35:39 +00:00
|
|
|
gboolean marker;
|
2018-08-13 15:27:12 +00:00
|
|
|
|
2013-10-09 07:54:14 +00:00
|
|
|
/* frame parsing */
|
|
|
|
gint idr_pos, sei_pos;
|
|
|
|
gboolean update_caps;
|
|
|
|
GstAdapter *frame_out;
|
|
|
|
gboolean keyframe;
|
2019-07-10 21:40:36 +00:00
|
|
|
gboolean predicted;
|
|
|
|
gboolean bidirectional;
|
2014-11-07 14:41:15 +00:00
|
|
|
gboolean header;
|
2021-02-03 12:27:14 +00:00
|
|
|
gboolean parsed_framerate;
|
2013-10-09 07:54:14 +00:00
|
|
|
/* AU state */
|
|
|
|
gboolean picture_start;
|
|
|
|
|
2019-05-08 15:06:40 +00:00
|
|
|
GstVideoParseUserData user_data;
|
|
|
|
|
2013-10-09 07:54:14 +00:00
|
|
|
/* props */
|
2018-08-13 11:34:36 +00:00
|
|
|
gint interval;
|
2013-10-09 07:54:14 +00:00
|
|
|
|
|
|
|
GstClockTime pending_key_unit_ts;
|
|
|
|
GstEvent *force_key_unit_event;
|
2019-05-01 12:24:49 +00:00
|
|
|
|
|
|
|
GstVideoMasteringDisplayInfo mastering_display_info;
|
|
|
|
guint mastering_display_info_state;
|
|
|
|
|
|
|
|
GstVideoContentLightLevel content_light_level;
|
|
|
|
guint content_light_level_state;
|
2019-07-10 21:40:36 +00:00
|
|
|
|
|
|
|
/* For forward predicted trickmode */
|
|
|
|
gboolean discard_bidirectional;
|
2013-10-09 07:54:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstH265ParseClass
|
|
|
|
{
|
|
|
|
GstBaseParseClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|