diff options
author | Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org> | 2015-02-08 22:22:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-13 00:49:08 +0100 |
commit | c7ad1f562b0fe46b77a8a9987a0d3512fc8197ea (patch) | |
tree | 20a4f4e4c89807568142030afbf9aff13fc2d680 | |
parent | af940e6cb1212d4338e55c03498ef5ae40e6e749 (diff) | |
download | ffmpeg-c7ad1f562b0fe46b77a8a9987a0d3512fc8197ea.tar.gz |
avformat/rtsp: parse lang attribute in SDP
Reviewed-by: Thomas Volkert <silvo@gmx.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/rtsp.c | 12 | ||||
-rw-r--r-- | libavformat/rtsp.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 23cf07ca3b..2197671782 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -477,6 +477,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, @@ -540,6 +542,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 a9f2f1e125..3cfcfb6d00 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -405,6 +405,8 @@ typedef struct RTSPState { * User-Agent string */ char *user_agent; + + char default_lang[4]; } RTSPState; #define RTSP_FLAG_FILTER_SRC 0x1 /**< Filter incoming UDP packets - |