diff options
author | Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> | 2015-02-08 22:22:45 +0100 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2015-02-21 23:37:24 +0200 |
commit | 4438d1c6ede3190d7920513272fb9dc5371648f2 (patch) | |
tree | 0a4a89a0e14fc8d1df7ea03254c5d042ae52779b | |
parent | 1ec28a66f2c853a7e4aeb21495c0b4d9478f17db (diff) | |
download | ffmpeg-4438d1c6ede3190d7920513272fb9dc5371648f2.tar.gz |
rtsp: parse lang attribute in SDP
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r-- | libavformat/rtsp.c | 12 | ||||
-rw-r--r-- | libavformat/rtsp.h | 2 | ||||
-rw-r--r-- | libavformat/version.h | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 2200f6ec07..ce5039ac87 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -470,6 +470,8 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, handler->init(s, st->index, rtsp_st->dynamic_protocol_context); } + if (rt->default_lang[0]) + av_dict_set(&st->metadata, "language", rt->default_lang, 0); } /* put a default control url */ av_strlcpy(rtsp_st->control_url, rt->control_uri, @@ -533,6 +535,16 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, /* AV_NOPTS_VALUE means live broadcast (and can't seek) */ s->duration = (end == AV_NOPTS_VALUE) ? AV_NOPTS_VALUE : end - start; + } else if (av_strstart(p, "lang:", &p)) { + if (s->nb_streams > 0) { + get_word(buf1, sizeof(buf1), &p); + rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; + if (rtsp_st->stream_index >= 0) { + st = s->streams[rtsp_st->stream_index]; + av_dict_set(&st->metadata, "language", buf1, 0); + } + } else + get_word(rt->default_lang, sizeof(rt->default_lang), &p); } else if (av_strstart(p, "IsRealDataType:integer;",&p)) { if (atoi(p) == 1) rt->transport = RTSP_TRANSPORT_RDT; diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index e83ad54909..83255a3c67 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -395,6 +395,8 @@ typedef struct RTSPState { * Size of RTP packet reordering queue. */ int reordering_queue_size; + + char default_lang[4]; } RTSPState; #define RTSP_FLAG_FILTER_SRC 0x1 /**< Filter incoming UDP packets - diff --git a/libavformat/version.h b/libavformat/version.h index 427565fdfa..2310681ccb 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,7 +31,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 56 #define LIBAVFORMAT_VERSION_MINOR 12 -#define LIBAVFORMAT_VERSION_MICRO 0 +#define LIBAVFORMAT_VERSION_MICRO 1 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ |