summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec_h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-24 23:03:12 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-24 23:03:12 +0100
commit29f9d82d23ffc4e48c220c68c7041ca581632981 (patch)
tree4ea28e802df1b855a415754ad05cd6b5ef0c4b04 /libavformat/rtpdec_h264.c
parentdf38883607d256135082d76f22f4f93051dda690 (diff)
parent8633fb47db2ec39eb8bd1bd65302af75a94ff5d0 (diff)
Merge commit '8633fb47db2ec39eb8bd1bd65302af75a94ff5d0'
* commit '8633fb47db2ec39eb8bd1bd65302af75a94ff5d0': rtpdec_hevc: Share the implementation of parsing a=framesize with h264 Conflicts: libavformat/rtpdec_h264.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpdec_h264.c')
-rw-r--r--libavformat/rtpdec_h264.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
index 798c043afa..2fa3aeaa7a 100644
--- a/libavformat/rtpdec_h264.c
+++ b/libavformat/rtpdec_h264.c
@@ -177,6 +177,28 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
return 0;
}
+void ff_h264_parse_framesize(AVCodecContext *codec, const char *p)
+{
+ char buf1[50];
+ char *dst = buf1;
+
+ // remove the protocol identifier
+ while (*p && *p == ' ')
+ p++; // strip spaces.
+ while (*p && *p != ' ')
+ p++; // eat protocol identifier
+ while (*p && *p == ' ')
+ p++; // strip trailing spaces.
+ while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1)
+ *dst++ = *p++;
+ *dst = '\0';
+
+ // a='framesize:96 320-240'
+ // set our parameters
+ codec->width = atoi(buf1);
+ codec->height = atoi(p + 1); // skip the -
+}
+
int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, PayloadContext *data, AVPacket *pkt,
const uint8_t *buf, int len,
int skip_between, int *nal_counters,
@@ -361,34 +383,15 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
PayloadContext *h264_data, const char *line)
{
AVStream *stream;
- AVCodecContext *codec;
const char *p = line;
if (st_index < 0)
return 0;
stream = s->streams[st_index];
- codec = stream->codec;
if (av_strstart(p, "framesize:", &p)) {
- char buf1[50];
- char *dst = buf1;
-
- // remove the protocol identifier
- while (*p && *p == ' ')
- p++; // strip spaces.
- while (*p && *p != ' ')
- p++; // eat protocol identifier
- while (*p && *p == ' ')
- p++; // strip trailing spaces.
- while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1)
- *dst++ = *p++;
- *dst = '\0';
-
- // a='framesize:96 320-240'
- // set our parameters
- codec->width = atoi(buf1);
- codec->height = atoi(p + 1); // skip the -
+ ff_h264_parse_framesize(stream->codec, p);
} else if (av_strstart(p, "fmtp:", &p)) {
return ff_parse_fmtp(s, stream, h264_data, p, sdp_parse_fmtp_config_h264);
} else if (av_strstart(p, "cliprect:", &p)) {