demux: adaptive: merge toChunk/getChunk
[vlc.git] / modules / demux / smooth / playlist / ForgedInitSegment.hpp
1 /*
2  * ForgedInitSegment.hpp
3  *****************************************************************************
4  * Copyright (C) 2015 - VideoLAN 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 #ifndef FORGEDINITSEGMENT_HPP
21 #define FORGEDINITSEGMENT_HPP
22
23 #include "../adaptive/playlist/Segment.h"
24 #include "../adaptive/playlist/Inheritables.hpp"
25
26 #include <vlc_codecs.h>
27
28 namespace smooth
29 {
30     namespace playlist
31     {
32         using namespace adaptive::playlist;
33         using namespace adaptive::http;
34
35         class ForgedInitSegment : public InitSegment,
36                                   public TimescaleAble
37         {
38             public:
39                 ForgedInitSegment(ICanonicalUrl *parent, const std::string &,
40                                   uint64_t, uint64_t);
41                 virtual ~ForgedInitSegment();
42                 virtual SegmentChunk* toChunk(size_t, BaseRepresentation *, HTTPConnectionManager *); /* reimpl */
43                 void setWaveFormatEx(const std::string &);
44                 void setCodecPrivateData(const std::string &);
45                 void setChannels(uint16_t);
46                 void setPacketSize(uint16_t);
47                 void setSamplingRate(uint32_t);
48                 void setBitsPerSample(uint16_t);
49                 void setVideoSize(unsigned w, unsigned h);
50                 void setFourCC(const std::string &);
51                 void setAudioTag(uint16_t);
52                 void setTrackID(unsigned);
53                 void setLanguage(const std::string &);
54
55             private:
56                 void fromWaveFormatEx(const uint8_t *p_data, size_t i_data);
57                 void fromVideoInfoHeader(const uint8_t *p_data, size_t i_data);
58                 block_t * buildMoovBox();
59                 std::string data;
60                 std::string type;
61                 std::string language;
62                 uint8_t *extradata;
63                 size_t   i_extradata;
64                 WAVEFORMATEX formatex;
65                 unsigned width, height;
66                 vlc_fourcc_t fourcc;
67                 int es_type;
68                 unsigned track_id;
69         };
70     }
71 }
72
73 #endif // FORGEDINITSEGMENT_HPP