[vlc-commits] demux: adaptative: pass language to stream & es
Francois Cartegnie
git at videolan.org
Sat Jul 25 22:30:45 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jul 25 19:34:52 2015 +0200| [50390eee195615e6b2656efa486f844ab6f2b9cd] | committer: Francois Cartegnie
demux: adaptative: pass language to stream & es
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=50390eee195615e6b2656efa486f844ab6f2b9cd
---
modules/demux/adaptative/Streams.cpp | 23 +++++++++++++++++++++--
modules/demux/adaptative/Streams.hpp | 4 ++++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/modules/demux/adaptative/Streams.cpp b/modules/demux/adaptative/Streams.cpp
index 33fa5ba..17b4af6 100644
--- a/modules/demux/adaptative/Streams.cpp
+++ b/modules/demux/adaptative/Streams.cpp
@@ -86,6 +86,12 @@ void Stream::updateFormat(StreamFormat &newformat)
output = streamOutputFactory->create(p_demux, format);
if(!output)
throw VLC_EGENERIC;
+ output->setLanguage(language);
+}
+
+void Stream::setLanguage(const std::string &lang)
+{
+ language = lang;
}
bool Stream::isEOF() const
@@ -318,6 +324,11 @@ AbstractStreamOutput::AbstractStreamOutput(demux_t *demux, const StreamFormat &f
format = format_;
}
+void AbstractStreamOutput::setLanguage(const std::string &lang)
+{
+ language = lang;
+}
+
const StreamFormat & AbstractStreamOutput::getStreamFormat() const
{
return format;
@@ -633,13 +644,21 @@ es_out_id_t * BaseStreamOutput::esOutAdd(const es_format_t *p_fmt)
if(!p_es)
{
- p_es = realdemux->out->pf_add(realdemux->out, p_fmt);
+ es_format_t fmtcpy;
+ es_format_Init(&fmtcpy, p_fmt->i_cat, p_fmt->i_codec);
+ es_format_Copy(&fmtcpy, p_fmt);
+ if(!fmtcpy.psz_language && !language.empty())
+ fmtcpy.psz_language = strdup(language.c_str());
+ if(!fmtcpy.psz_description && !description.empty())
+ fmtcpy.psz_description = strdup(description.c_str());
+ p_es = realdemux->out->pf_add(realdemux->out, &fmtcpy);
if(p_es)
{
- Demuxed *pair = new (std::nothrow) Demuxed(p_es, p_fmt);
+ Demuxed *pair = new (std::nothrow) Demuxed(p_es, &fmtcpy);
if(pair)
queues.push_back(pair);
}
+ es_format_Clean(&fmtcpy);
}
vlc_mutex_unlock(&lock);
diff --git a/modules/demux/adaptative/Streams.hpp b/modules/demux/adaptative/Streams.hpp
index b567ccd..70af790 100644
--- a/modules/demux/adaptative/Streams.hpp
+++ b/modules/demux/adaptative/Streams.hpp
@@ -68,6 +68,7 @@ namespace adaptative
void create(AbstractAdaptationLogic *, SegmentTracker *,
const AbstractStreamOutputFactory *);
void updateFormat(StreamFormat &);
+ void setLanguage(const std::string &);
bool isEOF() const;
mtime_t getPCR() const;
mtime_t getFirstDTS() const;
@@ -95,6 +96,7 @@ namespace adaptative
SegmentChunk *currentChunk;
bool disabled;
bool eof;
+ std::string language;
const AbstractStreamOutputFactory *streamOutputFactory;
};
@@ -105,6 +107,7 @@ namespace adaptative
AbstractStreamOutput(demux_t *, const StreamFormat &);
virtual ~AbstractStreamOutput();
+ void setLanguage(const std::string &);
const StreamFormat & getStreamFormat() const;
virtual void pushBlock(block_t *, bool) = 0;
virtual mtime_t getPCR() const;
@@ -123,6 +126,7 @@ namespace adaptative
demux_t *realdemux;
mtime_t pcr;
int group;
+ std::string language;
private:
StreamFormat format;
More information about the vlc-commits
mailing list