28 #define RTP_HEVC_PAYLOAD_HEADER_SIZE 2
29 #define RTP_HEVC_FU_HEADER_SIZE 1
30 #define RTP_HEVC_DONL_FIELD_SIZE 2
31 #define HEVC_SPECIFIED_NAL_UNIT_TYPES 48
54 av_dlog(ctx,
"hevc_init() for stream %d\n", st_index);
67 char *attr,
char *
value)
71 if (!strcmp(attr,
"profile-id")) {
98 if (!strcmp(attr,
"sprop-max-don-diff")) {
101 av_dlog(s,
"Found sprop-max-don-diff in SDP, DON field usage is: %d\n",
106 if (!strcmp(attr,
"sprop-depack-buf-nalus")) {
109 av_dlog(s,
"Found sprop-depack-buf-nalus in SDP, DON field usage is: %d\n",
128 const char *sdp_line_ptr = line;
133 current_stream = ctx->
streams[st_index];
134 codec = current_stream->
codec;
136 if (
av_strstart(sdp_line_ptr,
"framesize:", &sdp_line_ptr)) {
137 char str_video_width[50];
138 char *str_video_width_ptr = str_video_width;
145 while (*sdp_line_ptr && *sdp_line_ptr ==
' ')
148 while (*sdp_line_ptr && *sdp_line_ptr !=
' ')
151 while (*sdp_line_ptr && *sdp_line_ptr ==
' ')
154 while (*sdp_line_ptr && *sdp_line_ptr !=
'-' &&
155 (str_video_width_ptr - str_video_width) <
sizeof(str_video_width) - 1)
156 *str_video_width_ptr++ = *sdp_line_ptr++;
158 *str_video_width_ptr =
'\0';
161 codec->
width = atoi(str_video_width);
163 codec->
height = atoi(sdp_line_ptr + 1);
164 }
else if (
av_strstart(sdp_line_ptr,
"fmtp:", &sdp_line_ptr)) {
165 return ff_parse_fmtp(ctx, current_stream, hevc_data, sdp_line_ptr,
178 int tid, lid, nal_type;
179 int first_fragment, last_fragment, fu_type;
203 nal_type = (buf[0] >> 1) & 0x3f;
204 lid = ((buf[0] << 5) & 0x20) | ((buf[1] >> 3) & 0x1f);
253 "Too short RTP/HEVC packet, got %d bytes of NAL unit type %d\n",
287 first_fragment = buf[0] & 0x80;
288 last_fragment = buf[0] & 0x40;
289 fu_type = buf[0] & 0x3f;
301 av_dlog(ctx,
" FU type %d with %d bytes\n", fu_type, len);
304 new_nal_header[0] = (rtp_pl[0] & 0x81) | (fu_type << 1);
305 new_nal_header[1] = rtp_pl[1];
308 if (first_fragment) {
309 if (!last_fragment) {
328 memcpy(pkt->
data, buf, len);
333 "Too short RTP/HEVC packet, got %d bytes of NAL unit type %d\n",