52 int packet_types_received[32];
57 #define COUNT_NAL_TYPE(data, nal) data->packet_types_received[(nal) & 0x1f]++
58 #define NAL_COUNTERS data->packet_types_received
60 #define COUNT_NAL_TYPE(data, nal) do { } while (0)
61 #define NAL_COUNTERS NULL
80 profile_idc = strtol(buffer,
NULL, 16);
83 profile_iop = strtol(buffer,
NULL, 16);
86 level_idc = strtol(buffer,
NULL, 16);
89 "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
90 profile_idc, profile_iop, level_idc);
97 uint8_t **data_ptr,
int *size_ptr,
100 char base64packet[1024];
105 char *dst = base64packet;
107 while (*value && *value !=
','
108 && (dst - base64packet) <
sizeof(base64packet) - 1) {
117 sizeof(decoded_packet));
118 if (packet_size > 0) {
125 "Unable to allocate memory for extradata!\n");
133 decoded_packet, packet_size);
147 const char *attr,
const char *
value)
151 if (!strcmp(attr,
"packetization-mode")) {
163 "Interleaved RTP mode is not supported yet.\n");
164 }
else if (!strcmp(attr,
"profile-level-id")) {
165 if (strlen(value) == 6)
167 }
else if (!strcmp(attr,
"sprop-parameter-sets")) {
186 while (*p && *p ==
' ')
188 while (*p && *p !=
' ')
190 while (*p && *p ==
' ')
192 while (*p && *p !=
'-' && (dst - buf1) <
sizeof(buf1) - 1)
198 codec->
width = atoi(buf1);
199 codec->
height = atoi(p + 1);
204 int skip_between,
int *nal_counters,
208 int total_length = 0;
213 for (pass = 0; pass < 2; pass++) {
217 while (src_len > 2) {
218 uint16_t nal_size =
AV_RB16(src);
224 if (nal_size <= src_len) {
232 memcpy(dst, src, nal_size);
234 nal_counters[(*src) & nal_mask]++;
239 "nal size exceeds length: %d %d\n", nal_size, src_len);
244 src += nal_size + skip_between;
245 src_len -= nal_size + skip_between;
261 int start_bit,
const uint8_t *nal_header,
274 memcpy(pkt->
data + pos, nal_header, nal_header_len);
275 pos += nal_header_len;
277 memcpy(pkt->
data + pos, buf, len);
283 int *nal_counters,
int nal_mask)
285 uint8_t fu_indicator, fu_header, start_bit, nal_type, nal;
292 fu_indicator = buf[0];
294 start_bit = fu_header >> 7;
295 nal_type = fu_header & 0x1f;
296 nal = fu_indicator & 0xe0 | nal_type;
302 if (start_bit && nal_counters)
303 nal_counters[nal_type & nal_mask]++;
326 if (type >= 1 && type <= 23)
351 "Unhandled type (%d) (See RFC for implementation details)\n",
379 for (ii = 0; ii < 32; ii++) {
380 if (data->packet_types_received[ii])
382 data->packet_types_received[ii], ii);
391 const char *p = line;