1 /*
2 * DASHStream.cpp
3 *****************************************************************************
4 * Copyright (C) 2015 - VideoLAN and VLC authors
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
20 #ifdef HAVE_CONFIG_H
21 # include "config.h"
22 #endif
23
24 #include "DASHStream.hpp"
25
26 using namespace dash;
27
DASHStream(demux_t * demux)28 DASHStream::DASHStream(demux_t *demux)
29 :AbstractStream(demux)
30 {
31 }
32
checkBlock(block_t * p_block,bool)33 block_t * DASHStream::checkBlock(block_t *p_block, bool)
34 {
35 return p_block;
36 }
37
newDemux(vlc_object_t * p_obj,const StreamFormat & format,es_out_t * out,AbstractSourceStream * source) const38 AbstractDemuxer *DASHStream::newDemux(vlc_object_t *p_obj, const StreamFormat &format,
39 es_out_t *out, AbstractSourceStream *source) const
40 {
41 AbstractDemuxer *ret = NULL;
42 switch((unsigned)format)
43 {
44 case StreamFormat::MP4:
45 case StreamFormat::MPEG2TS:
46 ret = AbstractStream::newDemux(p_obj, format, out, source);
47 break;
48
49 case StreamFormat::WEBM:
50 ret = new Demuxer(p_obj, "mkv", out, source);
51 break;
52
53 case StreamFormat::WEBVTT:
54 ret = new SlaveDemuxer(p_obj, "webvtt", out, source);
55 break;
56
57 case StreamFormat::TTML:
58 ret = new SlaveDemuxer(p_obj, "ttml", out, source);
59 break;
60
61 default:
62 case StreamFormat::UNSUPPORTED:
63 break;
64 }
65
66 return ret;
67 }
68
create(demux_t * realdemux,const StreamFormat & format,SegmentTracker * tracker,AbstractConnectionManager * manager) const69 AbstractStream * DASHStreamFactory::create(demux_t *realdemux, const StreamFormat &format,
70 SegmentTracker *tracker, AbstractConnectionManager *manager) const
71 {
72 AbstractStream *stream = new (std::nothrow) DASHStream(realdemux);
73 if(stream && !stream->init(format, tracker, manager))
74 {
75 delete stream;
76 return NULL;
77 }
78 return stream;
79 }
80