[FFmpeg-devel] [PATCH 7/7] avformat/rtsp: parse lang attribute in SDP

Michael Niedermayer michaelni at gmx.at
Fri Feb 13 00:59:48 CET 2015


On Thu, Feb 12, 2015 at 10:52:27PM +0100, Thomas Volkert wrote:
> On 02/08/2015 10:22 PM, Gilles Chanteperdrix wrote:
> >---
> >  libavformat/rtsp.c | 12 ++++++++++++
> >  libavformat/rtsp.h |  2 ++
> >  2 files changed, 14 insertions(+)
> >
> >diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> >index 77407dd..3a68020 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 a9f2f1e..3cfcfb6 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 -
> 
> LGTM.

applied

thanks

[...]

--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150213/26c35088/attachment.asc>


More information about the ffmpeg-devel mailing list