Merge commit '0307cc2253e76772b1c645ac6117d08da87a147c'

* commit '0307cc2253e76772b1c645ac6117d08da87a147c':
  rtpdec: pass an AVFormatContext to ff_parse_fmtp()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/76/head
Michael Niedermayer 11 years ago
commit 19b9e07ef5
  1. 8
      libavformat/rtpdec.c
  2. 6
      libavformat/rtpdec.h
  3. 7
      libavformat/rtpdec_amr.c
  4. 15
      libavformat/rtpdec_h264.c
  5. 7
      libavformat/rtpdec_ilbc.c
  6. 7
      libavformat/rtpdec_latm.c
  7. 5
      libavformat/rtpdec_mpeg4.c
  8. 11
      libavformat/rtpdec_xiph.c

@ -833,8 +833,10 @@ void ff_rtp_parse_close(RTPDemuxContext *s)
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))
{
@ -859,7 +861,7 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
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;

@ -200,8 +200,10 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id,
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));

@ -139,7 +139,8 @@ static int amr_handle_packet(AVFormatContext *ctx, PayloadContext *data,
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
@ -147,7 +148,7 @@ static int amr_parse_fmtp(AVStream *stream, PayloadContext *data,
* interpret it as "1".
*/
if (!strcmp(value, "")) {
av_log(NULL, AV_LOG_WARNING, "AMR fmtp attribute %s had "
av_log(s, AV_LOG_WARNING, "AMR fmtp attribute %s had "
"nonstandard empty value\n", attr);
strcpy(value, "1");
}
@ -177,7 +178,7 @@ static int amr_parse_sdp_line(AVFormatContext *s, int st_index,
* 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");

@ -64,7 +64,8 @@ struct PayloadContext {
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)
{
@ -73,7 +74,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream,
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:
@ -83,7 +84,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream,
* 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) {
@ -104,7 +105,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream,
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;
@ -137,7 +138,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream,
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);
}
@ -157,7 +158,7 @@ static int sdp_parse_fmtp_config_h264(AVStream *stream,
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;
@ -385,7 +386,7 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
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.
}

@ -23,7 +23,8 @@
#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")) {
@ -36,7 +37,7 @@ static int ilbc_parse_fmtp(AVStream *stream, PayloadContext *data,
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);
}
}
@ -54,7 +55,7 @@ static int ilbc_parse_sdp_line(AVFormatContext *s, int st_index,
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) {

@ -142,7 +142,8 @@ end:
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;
@ -154,7 +155,7 @@ static int parse_fmtp(AVStream *stream, PayloadContext *data,
} 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");
}
@ -170,7 +171,7 @@ static int latm_parse_sdp_line(AVFormatContext *s, int st_index,
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;
}

@ -208,7 +208,8 @@ static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data,
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;
@ -246,7 +247,7 @@ static int parse_sdp_line(AVFormatContext *s, int st_index,
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;
}

@ -306,7 +306,8 @@ parse_packed_headers(const uint8_t * packed_headers,
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)
{
@ -321,7 +322,7 @@ static int xiph_parse_fmtp_pair(AVStream* stream,
} 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;
}
@ -360,12 +361,12 @@ static int xiph_parse_fmtp_pair(AVStream* stream,
(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);
@ -382,7 +383,7 @@ static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
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);
}

Loading…
Cancel
Save