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 const gchar *stream_format; 60 GstH265StreamFormat output_format; /* bytestream, hvc1 or hev1 */ 61 gboolean byte_stream; 62 63 GstBuffer *codec_data; 64 GstAdapter *adapter; 65 gboolean wait_start; 66 67 /* nal merging */ 68 gboolean merge; 69 GstAdapter *picture_adapter; 70 gboolean picture_start; 71 GstClockTime last_ts; 72 gboolean last_keyframe; 73 74 /* Work around broken payloaders wrt. Fragmentation Units */ 75 guint8 current_fu_type; 76 guint16 last_fu_seqnum; 77 GstClockTime fu_timestamp; 78 gboolean fu_marker; 79 80 /* misc */ 81 GPtrArray *vps; 82 GPtrArray *sps; 83 GPtrArray *pps; 84 gboolean new_codec_data; 85 86 /* downstream allocator */ 87 GstAllocator *allocator; 88 GstAllocationParams params; 89 }; 90 91 struct _GstRtpH265DepayClass 92 { 93 GstRTPBaseDepayloadClass parent_class; 94 }; 95 96 typedef struct 97 { 98 GstElement *element; 99 GstBuffer *outbuf; 100 GQuark copy_tag; 101 } CopyMetaData; 102 103 typedef struct 104 { 105 GstElement *element; 106 GQuark keep_tag; 107 } DropMetaData; 108 109 GType gst_rtp_h265_depay_get_type (void); 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__ */ 116