Use it for logging, instead of NULL or the stream codec context.
av_free(s);
}
-int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
- int (*parse_fmtp)(AVStream *stream,
+int ff_parse_fmtp(AVFormatContext *s,
+ AVStream *stream, PayloadContext *data, const char *p,
+ int (*parse_fmtp)(AVFormatContext *s,
+ AVStream *stream,
PayloadContext *data,
char *attr, char *value))
{
while (ff_rtsp_next_attr_and_value(&p,
attr, sizeof(attr),
value, value_size)) {
- res = parse_fmtp(stream, data, attr, value);
+ res = parse_fmtp(s, stream, data, attr, value);
if (res < 0 && res != AVERROR_PATCHWELCOME) {
av_free(value);
return res;
int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size,
char *value, int value_size);
-int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
- int (*parse_fmtp)(AVStream *stream,
+int ff_parse_fmtp(AVFormatContext *s,
+ AVStream *stream, PayloadContext *data, const char *p,
+ int (*parse_fmtp)(AVFormatContext *s,
+ AVStream *stream,
PayloadContext *data,
char *attr, char *value));
return 0;
}
-static int amr_parse_fmtp(AVStream *stream, PayloadContext *data,
+static int amr_parse_fmtp(AVFormatContext *s,
+ AVStream *stream, PayloadContext *data,
char *attr, char *value)
{
/* Some AMR SDP configurations contain "octet-align", without
* interpret it as "1".
*/
if (!strcmp(value, "")) {
- av_log(NULL, AV_LOG_WARNING, "AMR fmtp attribute %s had "
- "nonstandard empty value\n", attr);
+ av_log(s, AV_LOG_WARNING, "AMR fmtp attribute %s had "
+ "nonstandard empty value\n", attr);
strcpy(value, "1");
}
if (!strcmp(attr, "octet-align"))
* separated key/value pairs.
*/
if (av_strstart(line, "fmtp:", &p)) {
- ret = ff_parse_fmtp(s->streams[st_index], data, p, amr_parse_fmtp);
+ ret = ff_parse_fmtp(s, s->streams[st_index], data, p, amr_parse_fmtp);
if (!data->octet_align || data->crc ||
data->interleaving || data->channels != 1) {
av_log(s, AV_LOG_ERROR, "Unsupported RTP/AMR configuration!\n");
static const uint8_t start_sequence[] = { 0, 0, 0, 1 };
-static int sdp_parse_fmtp_config_h264(AVStream *stream,
+static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
+ AVStream *stream,
PayloadContext *h264_data,
char *attr, char *value)
{
assert(h264_data != NULL);
if (!strcmp(attr, "packetization-mode")) {
- av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value));
+ av_log(s, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value));
h264_data->packetization_mode = atoi(value);
/*
* Packetization Mode:
* and 29 (FU-B) are allowed.
*/
if (h264_data->packetization_mode > 1)
- av_log(codec, AV_LOG_ERROR,
+ av_log(s, AV_LOG_ERROR,
"Interleaved RTP mode is not supported yet.\n");
} else if (!strcmp(attr, "profile-level-id")) {
if (strlen(value) == 6) {
buffer[1] = value[5];
level_idc = strtol(buffer, NULL, 16);
- av_log(codec, AV_LOG_DEBUG,
+ av_log(s, AV_LOG_DEBUG,
"RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
profile_idc, profile_iop, level_idc);
h264_data->profile_idc = profile_idc;
codec->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
if (!dest) {
- av_log(codec, AV_LOG_ERROR,
+ av_log(s, AV_LOG_ERROR,
"Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM);
}
codec->extradata_size += sizeof(start_sequence) + packet_size;
}
}
- av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!\n",
+ av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!\n",
codec->extradata, codec->extradata_size);
}
return 0;
codec->width = atoi(buf1);
codec->height = atoi(p + 1); // skip the -
} else if (av_strstart(p, "fmtp:", &p)) {
- return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264);
+ return ff_parse_fmtp(s, stream, h264_data, p, sdp_parse_fmtp_config_h264);
} else if (av_strstart(p, "cliprect:", &p)) {
// could use this if we wanted.
}
#include "rtpdec_formats.h"
#include "libavutil/avstring.h"
-static int ilbc_parse_fmtp(AVStream *stream, PayloadContext *data,
+static int ilbc_parse_fmtp(AVFormatContext *s,
+ AVStream *stream, PayloadContext *data,
char *attr, char *value)
{
if (!strcmp(attr, "mode")) {
stream->codec->block_align = 50;
break;
default:
- av_log(NULL, AV_LOG_ERROR, "Unsupported iLBC mode %d\n", mode);
+ av_log(s, AV_LOG_ERROR, "Unsupported iLBC mode %d\n", mode);
return AVERROR(EINVAL);
}
}
st = s->streams[st_index];
if (av_strstart(line, "fmtp:", &p)) {
- int ret = ff_parse_fmtp(st, data, p, ilbc_parse_fmtp);
+ int ret = ff_parse_fmtp(s, st, data, p, ilbc_parse_fmtp);
if (ret < 0)
return ret;
if (!st->codec->block_align) {
return ret;
}
-static int parse_fmtp(AVStream *stream, PayloadContext *data,
+static int parse_fmtp(AVFormatContext *s,
+ AVStream *stream, PayloadContext *data,
char *attr, char *value)
{
int res;
} else if (!strcmp(attr, "cpresent")) {
int cpresent = atoi(value);
if (cpresent != 0)
- avpriv_request_sample(NULL,
+ avpriv_request_sample(s,
"RTP MP4A-LATM with in-band configuration");
}
return 0;
if (av_strstart(line, "fmtp:", &p))
- return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp);
+ return ff_parse_fmtp(s, s->streams[st_index], data, p, parse_fmtp);
return 0;
}
return 0;
}
-static int parse_fmtp(AVStream *stream, PayloadContext *data,
+static int parse_fmtp(AVFormatContext *s,
+ AVStream *stream, PayloadContext *data,
char *attr, char *value)
{
AVCodecContext *codec = stream->codec;
return 0;
if (av_strstart(line, "fmtp:", &p))
- return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp);
+ return ff_parse_fmtp(s, s->streams[st_index], data, p, parse_fmtp);
return 0;
}
return 0;
}
-static int xiph_parse_fmtp_pair(AVStream* stream,
+static int xiph_parse_fmtp_pair(AVFormatContext *s,
+ AVStream* stream,
PayloadContext *xiph_data,
char *attr, char *value)
{
} else if (!strcmp(value, "YCbCr-4:4:4")) {
codec->pix_fmt = AV_PIX_FMT_YUV444P;
} else {
- av_log(codec, AV_LOG_ERROR,
+ av_log(s, AV_LOG_ERROR,
"Unsupported pixel format %s\n", attr);
return AVERROR_INVALIDDATA;
}
(decoded_packet, decoded_packet + packet_size, codec,
xiph_data);
} else {
- av_log(codec, AV_LOG_ERROR,
+ av_log(s, AV_LOG_ERROR,
"Out of memory while decoding SDP configuration.\n");
result = AVERROR(ENOMEM);
}
} else {
- av_log(codec, AV_LOG_ERROR, "Packet too large\n");
+ av_log(s, AV_LOG_ERROR, "Packet too large\n");
result = AVERROR_INVALIDDATA;
}
av_free(decoded_packet);
return 0;
if (av_strstart(line, "fmtp:", &p)) {
- return ff_parse_fmtp(s->streams[st_index], data, p,
+ return ff_parse_fmtp(s, s->streams[st_index], data, p,
xiph_parse_fmtp_pair);
}