Commit 50390eee authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: pass language to stream & es

parent ee31841e
...@@ -86,6 +86,12 @@ void Stream::updateFormat(StreamFormat &newformat) ...@@ -86,6 +86,12 @@ void Stream::updateFormat(StreamFormat &newformat)
output = streamOutputFactory->create(p_demux, format); output = streamOutputFactory->create(p_demux, format);
if(!output) if(!output)
throw VLC_EGENERIC; throw VLC_EGENERIC;
output->setLanguage(language);
}
void Stream::setLanguage(const std::string &lang)
{
language = lang;
} }
bool Stream::isEOF() const bool Stream::isEOF() const
...@@ -318,6 +324,11 @@ AbstractStreamOutput::AbstractStreamOutput(demux_t *demux, const StreamFormat &f ...@@ -318,6 +324,11 @@ AbstractStreamOutput::AbstractStreamOutput(demux_t *demux, const StreamFormat &f
format = format_; format = format_;
} }
void AbstractStreamOutput::setLanguage(const std::string &lang)
{
language = lang;
}
const StreamFormat & AbstractStreamOutput::getStreamFormat() const const StreamFormat & AbstractStreamOutput::getStreamFormat() const
{ {
return format; return format;
...@@ -633,13 +644,21 @@ es_out_id_t * BaseStreamOutput::esOutAdd(const es_format_t *p_fmt) ...@@ -633,13 +644,21 @@ es_out_id_t * BaseStreamOutput::esOutAdd(const es_format_t *p_fmt)
if(!p_es) 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) if(p_es)
{ {
Demuxed *pair = new (std::nothrow) Demuxed(p_es, p_fmt); Demuxed *pair = new (std::nothrow) Demuxed(p_es, &fmtcpy);
if(pair) if(pair)
queues.push_back(pair); queues.push_back(pair);
} }
es_format_Clean(&fmtcpy);
} }
vlc_mutex_unlock(&lock); vlc_mutex_unlock(&lock);
......
...@@ -68,6 +68,7 @@ namespace adaptative ...@@ -68,6 +68,7 @@ namespace adaptative
void create(AbstractAdaptationLogic *, SegmentTracker *, void create(AbstractAdaptationLogic *, SegmentTracker *,
const AbstractStreamOutputFactory *); const AbstractStreamOutputFactory *);
void updateFormat(StreamFormat &); void updateFormat(StreamFormat &);
void setLanguage(const std::string &);
bool isEOF() const; bool isEOF() const;
mtime_t getPCR() const; mtime_t getPCR() const;
mtime_t getFirstDTS() const; mtime_t getFirstDTS() const;
...@@ -95,6 +96,7 @@ namespace adaptative ...@@ -95,6 +96,7 @@ namespace adaptative
SegmentChunk *currentChunk; SegmentChunk *currentChunk;
bool disabled; bool disabled;
bool eof; bool eof;
std::string language;
const AbstractStreamOutputFactory *streamOutputFactory; const AbstractStreamOutputFactory *streamOutputFactory;
}; };
...@@ -105,6 +107,7 @@ namespace adaptative ...@@ -105,6 +107,7 @@ namespace adaptative
AbstractStreamOutput(demux_t *, const StreamFormat &); AbstractStreamOutput(demux_t *, const StreamFormat &);
virtual ~AbstractStreamOutput(); virtual ~AbstractStreamOutput();
void setLanguage(const std::string &);
const StreamFormat & getStreamFormat() const; const StreamFormat & getStreamFormat() const;
virtual void pushBlock(block_t *, bool) = 0; virtual void pushBlock(block_t *, bool) = 0;
virtual mtime_t getPCR() const; virtual mtime_t getPCR() const;
...@@ -123,6 +126,7 @@ namespace adaptative ...@@ -123,6 +126,7 @@ namespace adaptative
demux_t *realdemux; demux_t *realdemux;
mtime_t pcr; mtime_t pcr;
int group; int group;
std::string language;
private: private:
StreamFormat format; StreamFormat format;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment