55 int packet_types_received[32];
60 #define COUNT_NAL_TYPE(data, nal) data->packet_types_received[(nal) & 0x1f]++
62 #define COUNT_NAL_TYPE(data, nal) do { } while (0)
69 char *attr,
char *
value)
73 assert(h264_data != NULL);
75 if (!strcmp(attr,
"packetization-mode")) {
87 "Interleaved RTP mode is not supported yet.\n");
88 }
else if (!strcmp(attr,
"profile-level-id")) {
89 if (strlen(value) == 6) {
99 profile_idc = strtol(buffer, NULL, 16);
100 buffer[0] = value[2];
101 buffer[1] = value[3];
102 profile_iop = strtol(buffer, NULL, 16);
103 buffer[0] = value[4];
104 buffer[1] = value[5];
105 level_idc = strtol(buffer, NULL, 16);
108 "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
109 profile_idc, profile_iop, level_idc);
114 }
else if (!strcmp(attr,
"sprop-parameter-sets")) {
119 char base64packet[1024];
122 char *dst = base64packet;
124 while (*value && *value !=
','
125 && (dst - base64packet) <
sizeof(base64packet) - 1) {
134 sizeof(decoded_packet));
135 if (packet_size > 0) {
141 "Unable to allocate memory for extradata!\n");
152 decoded_packet, packet_size);
188 if (type >= 1 && type <= 23)
207 int total_length = 0;
210 for (pass = 0; pass < 2; pass++) {
214 while (src_len > 2) {
215 uint16_t nal_size =
AV_RB16(src);
221 if (nal_size <= src_len) {
230 memcpy(dst, src, nal_size);
236 "nal size exceeds length: %d %d\n", nal_size, src_len);
245 "Consumed more bytes than we got! (%d)\n", src_len);
255 assert(dst - pkt->
data == total_length);
266 "Unhandled type (%d) (See RFC for implementation details\n",
278 uint8_t start_bit = fu_header >> 7;
280 uint8_t nal_type = fu_header & 0x1f;
286 reconstructed_nal = fu_indicator & 0xe0;
287 reconstructed_nal |= nal_type;
305 memcpy(pkt->
data, buf, len);
336 for (ii = 0; ii < 32; ii++) {
337 if (data->packet_types_received[ii])
339 data->packet_types_received[ii], ii);
360 const char *p = line;
366 codec = stream->
codec;
373 while (*p && *p ==
' ')
375 while (*p && *p !=
' ')
377 while (*p && *p ==
' ')
379 while (*p && *p !=
'-' && (dst - buf1) <
sizeof(buf1) - 1)
385 codec->
width = atoi(buf1);
386 codec->
height = atoi(p + 1);