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 GstClockTime fu_timestamp; 77 gboolean fu_marker; 78 79 /* misc */ 80 GPtrArray *vps; 81 GPtrArray *sps; 82 GPtrArray *pps; 83 gboolean new_codec_data; 84 85 /* downstream allocator */ 86 GstAllocator *allocator; 87 GstAllocationParams params; 88 }; 89 90 struct _GstRtpH265DepayClass 91 { 92 GstRTPBaseDepayloadClass parent_class; 93 }; 94 95 typedef struct 96 { 97 GstElement *element; 98 GstBuffer *outbuf; 99 GQuark copy_tag; 100 } CopyMetaData; 101 102 typedef struct 103 { 104 GstElement *element; 105 GQuark keep_tag; 106 } DropMetaData; 107 108 GType gst_rtp_h265_depay_get_type (void); 109 110 gboolean gst_rtp_h265_depay_plugin_init (GstPlugin * plugin); 111 112 gboolean gst_rtp_h265_add_vps_sps_pps (GstElement * rtph265, GPtrArray * vps, 113 GPtrArray * sps, GPtrArray * pps, GstBuffer * nal); 114 115 G_END_DECLS 116 #endif /* __GST_RTP_H265_DEPAY_H__ */ 117