53 int packet_types_received[32];
58#define COUNT_NAL_TYPE(data, nal) data->packet_types_received[(nal) & 0x1f]++
59#define NAL_COUNTERS data->packet_types_received
61#define COUNT_NAL_TYPE(data, nal) do { } while (0)
62#define NAL_COUNTERS NULL
90 "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
98 uint8_t **data_ptr,
int *size_ptr,
101 char base64packet[1024];
102 uint8_t decoded_packet[1024];
106 char *
dst = base64packet;
109 && (
dst - base64packet) <
sizeof(base64packet) - 1) {
118 sizeof(decoded_packet));
119 if (packet_size > 0) {
126 "Unable to allocate memory for extradata!\n");
134 decoded_packet, packet_size);
148 const char *attr,
const char *
value)
152 if (!strcmp(attr,
"packetization-mode")) {
164 "Interleaved RTP mode is not supported yet.\n");
165 }
else if (!strcmp(attr,
"profile-level-id")) {
166 if (strlen(
value) == 6)
168 }
else if (!strcmp(attr,
"sprop-parameter-sets")) {
191 while (*p && *p ==
' ')
193 while (*p && *p !=
' ')
195 while (*p && *p ==
' ')
197 while (*p && *p !=
'-' && (
dst - buf1) <
sizeof(buf1) - 1)
203 par->
width = atoi(buf1);
204 par->
height = atoi(p + 1);
208 const uint8_t *buf,
int len,
209 int skip_between,
int *nal_counters,
213 int total_length = 0;
218 for (pass = 0; pass < 2; pass++) {
219 const uint8_t *
src = buf;
222 while (src_len > 2) {
229 if (nal_size <= src_len) {
237 memcpy(
dst,
src, nal_size);
239 nal_counters[(*src) & nal_mask]++;
244 "nal size exceeds length: %d %d\n", nal_size, src_len);
249 src += nal_size + skip_between;
250 src_len -= nal_size + skip_between;
266 int start_bit,
const uint8_t *nal_header,
279 memcpy(
pkt->data +
pos, nal_header, nal_header_len);
280 pos += nal_header_len;
287 const uint8_t *buf,
int len,
288 int *nal_counters,
int nal_mask)
290 uint8_t fu_indicator, fu_header, start_bit, nal_type,
nal;
297 fu_indicator = buf[0];
299 start_bit = fu_header >> 7;
300 nal_type = fu_header & 0x1f;
301 nal = fu_indicator & 0xe0 | nal_type;
307 if (start_bit && nal_counters)
308 nal_counters[nal_type & nal_mask]++;
315 const uint8_t *buf,
int len, uint16_t seq,
382 for (ii = 0; ii < 32; ii++) {
383 if (
data->packet_types_received[ii])
385 data->packet_types_received[ii], ii);
394 const char *p =
line;
399 stream =
s->streams[st_index];
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
#define flags(name, subs,...)
static int FUNC nal(CodedBitstreamContext *ctx, RWContext *rw, LCEVCRawNAL *current, int nal_unit_type)
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index, int flush)
Parse a packet, add all split parts to parse_queue.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
Macro definitions for various function/variable attributes.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
Memory handling functions.
int ff_parse_fmtp(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *p, int(*parse_fmtp)(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *attr, const char *value))
static int h264_handle_packet_fu_a(AVFormatContext *ctx, PayloadContext *data, AVPacket *pkt, const uint8_t *buf, int len, int *nal_counters, int nal_mask)
static void parse_profile_level_id(AVFormatContext *s, PayloadContext *h264_data, const char *value)
static const uint8_t start_sequence[]
#define COUNT_NAL_TYPE(data, nal)
int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, PayloadContext *data, AVPacket *pkt, const uint8_t *buf, int len, int skip_between, int *nal_counters, int nal_mask)
static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
int ff_h264_parse_sprop_parameter_sets(AVFormatContext *s, uint8_t **data_ptr, int *size_ptr, const char *value)
static int parse_h264_sdp_line(AVFormatContext *s, int st_index, PayloadContext *h264_data, const char *line)
static void h264_close_context(PayloadContext *data)
void ff_h264_parse_framesize(AVCodecParameters *par, const char *p)
static int sdp_parse_fmtp_config_h264(AVFormatContext *s, AVStream *stream, PayloadContext *h264_data, const char *attr, const char *value)
int ff_h264_handle_frag_packet(AVPacket *pkt, const uint8_t *buf, int len, int start_bit, const uint8_t *nal_header, int nal_header_len)
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
int height
The height of the video frame in pixels.
int width
The width of the video frame in pixels.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int index
stream index in AVFormatContext
RTP/AV1 specific private data.