rtph265depay: try to negotiate an allocator with downstream
[platform/upstream/gst-plugins-good.git] / gst / rtp / gstrtph265depay.h
1 /* GStreamer
2  * Copyright (C) <2006> Wim Taymans <wim.taymans@gmail.com>
3  * Copyright (C) <2014> Jurgen Slowack <jurgenslowack@gmail.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_RTP_H265_DEPAY_H__
22 #define __GST_RTP_H265_DEPAY_H__
23
24 #include <gst/gst.h>
25 #include <gst/base/gstadapter.h>
26 #include <gst/rtp/gstrtpbasedepayload.h>
27 #include "gstrtph265types.h"
28
29 G_BEGIN_DECLS
30 #define GST_TYPE_RTP_H265_DEPAY \
31   (gst_rtp_h265_depay_get_type())
32 #define GST_RTP_H265_DEPAY(obj) \
33   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_H265_DEPAY,GstRtpH265Depay))
34 #define GST_RTP_H265_DEPAY_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_H265_DEPAY,GstRtpH265DepayClass))
36 #define GST_IS_RTP_H265_DEPAY(obj) \
37   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_H265_DEPAY))
38 #define GST_IS_RTP_H265_DEPAY_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_H265_DEPAY))
40 typedef struct _GstRtpH265Depay GstRtpH265Depay;
41 typedef struct _GstRtpH265DepayClass GstRtpH265DepayClass;
42
43 #define GST_H265_VPS_NUT 32
44 #define GST_H265_SPS_NUT 33
45 #define GST_H265_PPS_NUT 34
46
47 typedef enum
48 {
49   GST_H265_STREAM_FORMAT_UNKNOWN,
50   GST_H265_STREAM_FORMAT_BYTESTREAM,
51   GST_H265_STREAM_FORMAT_HVC1,
52   GST_H265_STREAM_FORMAT_HEV1
53 } GstH265StreamFormat;
54
55 struct _GstRtpH265Depay
56 {
57   GstRTPBaseDepayload depayload;
58
59   gchar *stream_format;
60   gboolean byte_stream;
61
62   GstBuffer *codec_data;
63   GstAdapter *adapter;
64   gboolean wait_start;
65
66   /* nal merging */
67   gboolean merge;
68   GstAdapter *picture_adapter;
69   gboolean picture_start;
70   GstClockTime last_ts;
71   gboolean last_keyframe;
72
73   /* Work around broken payloaders wrt. Fragmentation Units */
74   guint8 current_fu_type;
75   GstClockTime fu_timestamp;
76   gboolean fu_marker;
77
78   /* misc */
79   GPtrArray *vps;
80   GPtrArray *sps;
81   GPtrArray *pps;
82   gboolean new_codec_data;
83
84   /* downstream allocator */
85   GstAllocator *allocator;
86   GstAllocationParams params;
87 };
88
89 struct _GstRtpH265DepayClass
90 {
91   GstRTPBaseDepayloadClass parent_class;
92 };
93
94 typedef struct
95 {
96   GstElement *element;
97   GstBuffer *outbuf;
98   GQuark copy_tag;
99 } CopyMetaData;
100
101 typedef struct
102 {
103   GstElement *element;
104   GQuark keep_tag;
105 } DropMetaData;
106
107 GType gst_rtp_h265_depay_get_type (void);
108
109 gboolean gst_rtp_h265_depay_plugin_init (GstPlugin * plugin);
110
111 gboolean gst_rtp_h265_add_vps_sps_pps (GstElement * rtph265, GPtrArray * vps,
112     GPtrArray * sps, GPtrArray * pps, GstBuffer * nal);
113
114 G_END_DECLS
115 #endif /* __GST_RTP_H265_DEPAY_H__ */