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")) {
169 if (*value == 0 || value[strlen(value) - 1] ==
',') {
190 while (*p && *p ==
' ')
192 while (*p && *p !=
' ')
194 while (*p && *p ==
' ')
196 while (*p && *p !=
'-' && (dst - buf1) <
sizeof(buf1) - 1)
202 par->
width = atoi(buf1);
203 par->
height = atoi(p + 1);
208 int skip_between,
int *nal_counters,
212 int total_length = 0;
217 for (pass = 0; pass < 2; pass++) {
221 while (src_len > 2) {
222 uint16_t nal_size =
AV_RB16(src);
228 if (nal_size <= src_len) {
236 memcpy(dst, src, nal_size);
238 nal_counters[(*src) & nal_mask]++;
243 "nal size exceeds length: %d %d\n", nal_size, src_len);
248 src += nal_size + skip_between;
249 src_len -= nal_size + skip_between;
265 int start_bit,
const uint8_t *nal_header,
278 memcpy(pkt->
data + pos, nal_header, nal_header_len);
279 pos += nal_header_len;
281 memcpy(pkt->
data + pos, buf, len);
287 int *nal_counters,
int nal_mask)
289 uint8_t fu_indicator, fu_header, start_bit, nal_type, nal;
296 fu_indicator = buf[0];
298 start_bit = fu_header >> 7;
299 nal_type = fu_header & 0x1f;
300 nal = fu_indicator & 0xe0 | nal_type;
306 if (start_bit && nal_counters)
307 nal_counters[nal_type & nal_mask]++;
330 if (type >= 1 && type <= 23)
381 for (ii = 0; ii < 32; ii++) {
382 if (data->packet_types_received[ii])
384 data->packet_types_received[ii], ii);
393 const char *p = line;
const RTPDynamicProtocolHandler ff_h264_dynamic_handler
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
RTP/JPEG specific private data.
int index
stream index in AVFormatContext
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)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
This struct describes the properties of an encoded stream.
Macro definitions for various function/variable attributes.
AVStream ** streams
A list of all streams in the file.
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)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void h264_close_context(PayloadContext *data)
static int sdp_parse_fmtp_config_h264(AVFormatContext *s, AVStream *stream, PayloadContext *h264_data, const char *attr, const char *value)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int parse_h264_sdp_line(AVFormatContext *s, int st_index, PayloadContext *h264_data, const char *line)
int extradata_size
Size of the extradata content in bytes.
void ff_h264_parse_framesize(AVCodecParameters *par, const char *p)
GLsizei GLboolean const GLfloat * value
#define COUNT_NAL_TYPE(data, nal)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static void parse_profile_level_id(AVFormatContext *s, PayloadContext *h264_data, const char *value)
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))
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
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)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
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 const uint8_t start_sequence[]
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
This structure stores compressed data.