summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-09 23:40:09 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-09 23:40:13 +0200
commit19b9e07ef5fdd8558735538a04fac7f428df190c (patch)
tree00cb7526992d731ba21897a88188f7a41433f161
parentf233666880afd1f2c0b9902c762df7a8733510a8 (diff)
parent0307cc2253e76772b1c645ac6117d08da87a147c (diff)
downloadffmpeg-19b9e07ef5fdd8558735538a04fac7f428df190c.tar.gz
Merge commit '0307cc2253e76772b1c645ac6117d08da87a147c'
* commit '0307cc2253e76772b1c645ac6117d08da87a147c': rtpdec: pass an AVFormatContext to ff_parse_fmtp() Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rtpdec.c8
-rw-r--r--libavformat/rtpdec.h6
-rw-r--r--libavformat/rtpdec_amr.c9
-rw-r--r--libavformat/rtpdec_h264.c15
-rw-r--r--libavformat/rtpdec_ilbc.c7
-rw-r--r--libavformat/rtpdec_latm.c7
-rw-r--r--libavformat/rtpdec_mpeg4.c5
-rw-r--r--libavformat/rtpdec_xiph.c11
8 files changed, 39 insertions, 29 deletions
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index ed118b0485..64a1c27f8d 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.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;
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 7e356c048d..7b41cc4b5a 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -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));
diff --git a/libavformat/rtpdec_amr.c b/libavformat/rtpdec_amr.c
index 211cf1798f..31acfe7edc 100644
--- a/libavformat/rtpdec_amr.c
+++ b/libavformat/rtpdec_amr.c
@@ -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,8 +148,8 @@ 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 "
- "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"))
@@ -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");
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index 1ca78bc81c..51704aaf73 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -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.
}
diff --git a/libavformat/rtpdec_ilbc.c b/libavformat/rtpdec_ilbc.c
index 2bd86147de..aa1579fa63 100644
--- a/libavformat/rtpdec_ilbc.c
+++ b/libavformat/rtpdec_ilbc.c
@@ -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) {
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index fdeff3a151..389648253a 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -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;
}
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index 0ea5594c06..53921f2e97 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -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;
}
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 43f72a2305..dc34f9e224 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -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);
}