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)
70 char *attr,
char *
value)
74 assert(h264_data != NULL);
76 if (!strcmp(attr,
"packetization-mode")) {
88 "Interleaved RTP mode is not supported yet.\n");
89 }
else if (!strcmp(attr,
"profile-level-id")) {
90 if (strlen(value) == 6) {
100 profile_idc = strtol(buffer, NULL, 16);
101 buffer[0] = value[2];
102 buffer[1] = value[3];
103 profile_iop = strtol(buffer, NULL, 16);
104 buffer[0] = value[4];
105 buffer[1] = value[5];
106 level_idc = strtol(buffer, NULL, 16);
109 "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
110 profile_idc, profile_iop, level_idc);
115 }
else if (!strcmp(attr,
"sprop-parameter-sets")) {
120 char base64packet[1024];
123 char *dst = base64packet;
125 while (*value && *value !=
','
126 && (dst - base64packet) <
sizeof(base64packet) - 1) {
135 sizeof(decoded_packet));
136 if (packet_size > 0) {
142 "Unable to allocate memory for extradata!\n");
153 decoded_packet, packet_size);
189 if (type >= 1 && type <= 23)
208 int total_length = 0;
211 for (pass = 0; pass < 2; pass++) {
215 while (src_len > 2) {
216 uint16_t nal_size =
AV_RB16(src);
222 if (nal_size <= src_len) {
231 memcpy(dst, src, nal_size);
237 "nal size exceeds length: %d %d\n", nal_size, src_len);
246 "Consumed more bytes than we got! (%d)\n", src_len);
256 assert(dst - pkt->
data == total_length);
267 "Unhandled type (%d) (See RFC for implementation details\n",
279 uint8_t start_bit = fu_header >> 7;
281 uint8_t nal_type = fu_header & 0x1f;
287 reconstructed_nal = fu_indicator & 0xe0;
288 reconstructed_nal |= nal_type;
306 memcpy(pkt->
data, buf, len);
337 for (ii = 0; ii < 32; ii++) {
338 if (data->packet_types_received[ii])
340 data->packet_types_received[ii], ii);
361 const char *p = line;
367 codec = stream->
codec;
374 while (*p && *p ==
' ')
376 while (*p && *p !=
' ')
378 while (*p && *p ==
' ')
380 while (*p && *p !=
'-' && (dst - buf1) <
sizeof(buf1) - 1)
386 codec->
width = atoi(buf1);
387 codec->
height = atoi(p + 1);