54 int packet_types_received[32];
59 #define COUNT_NAL_TYPE(data, nal) data->packet_types_received[(nal) & 0x1f]++
61 #define COUNT_NAL_TYPE(data, nal) do { } while (0)
68 char *attr,
char *
value)
72 assert(h264_data !=
NULL);
74 if (!strcmp(attr,
"packetization-mode")) {
86 "Interleaved RTP mode is not supported yet.\n");
87 }
else if (!strcmp(attr,
"profile-level-id")) {
88 if (strlen(value) == 6) {
98 profile_idc = strtol(buffer,
NULL, 16);
100 buffer[1] = value[3];
101 profile_iop = strtol(buffer,
NULL, 16);
102 buffer[0] = value[4];
103 buffer[1] = value[5];
104 level_idc = strtol(buffer,
NULL, 16);
107 "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
108 profile_idc, profile_iop, level_idc);
113 }
else if (!strcmp(attr,
"sprop-parameter-sets")) {
118 char base64packet[1024];
121 char *
dst = base64packet;
123 while (*value && *value !=
','
124 && (dst - base64packet) <
sizeof(base64packet) - 1) {
133 sizeof(decoded_packet));
134 if (packet_size > 0) {
140 "Unable to allocate memory for extradata!\n");
151 decoded_packet, packet_size);
187 if (type >= 1 && type <= 23)
205 int total_length = 0;
208 for (pass = 0; pass < 2; pass++) {
212 while (src_len > 2) {
213 uint16_t nal_size =
AV_RB16(src);
219 if (nal_size <= src_len) {
228 memcpy(dst, src, nal_size);
234 "nal size exceeds length: %d %d\n", nal_size, src_len);
243 "Consumed more bytes than we got! (%d)\n", src_len);
252 assert(dst - pkt->
data == total_length);
263 "Unhandled type (%d) (See RFC for implementation details\n",
275 uint8_t start_bit = fu_header >> 7;
277 uint8_t nal_type = fu_header & 0x1f;
283 reconstructed_nal = fu_indicator & 0xe0;
284 reconstructed_nal |= nal_type;
300 memcpy(pkt->
data, buf, len);
331 for (ii = 0; ii < 32; ii++) {
332 if (data->packet_types_received[ii])
334 data->packet_types_received[ii], ii);
346 const char *p = line;
352 codec = stream->
codec;
359 while (*p && *p ==
' ')
361 while (*p && *p !=
' ')
363 while (*p && *p ==
' ')
365 while (*p && *p !=
'-' && (dst - buf1) <
sizeof(buf1) - 1)
371 codec->
width = atoi(buf1);
372 codec->
height = atoi(p + 1);