ForgedInitSegment.hpp 2.85 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 * ForgedInitSegment.hpp
 *****************************************************************************
 * Copyright (C) 2015 - VideoLAN Authors
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/
#ifndef FORGEDINITSEGMENT_HPP
#define FORGEDINITSEGMENT_HPP

23 24
#include "../adaptive/playlist/Segment.h"
#include "../adaptive/playlist/Inheritables.hpp"
25 26 27 28 29 30 31

#include <vlc_codecs.h>

namespace smooth
{
    namespace playlist
    {
32 33
        using namespace adaptive::playlist;
        using namespace adaptive::http;
34 35 36 37 38 39 40 41

        class ForgedInitSegment : public InitSegment,
                                  public TimescaleAble
        {
            public:
                ForgedInitSegment(ICanonicalUrl *parent, const std::string &,
                                  uint64_t, uint64_t);
                virtual ~ForgedInitSegment();
42
                virtual SegmentChunk* toChunk(size_t, BaseRepresentation *, AbstractConnectionManager *); /* reimpl */
43 44 45 46 47 48 49 50 51 52
                void setWaveFormatEx(const std::string &);
                void setCodecPrivateData(const std::string &);
                void setChannels(uint16_t);
                void setPacketSize(uint16_t);
                void setSamplingRate(uint32_t);
                void setBitsPerSample(uint16_t);
                void setVideoSize(unsigned w, unsigned h);
                void setFourCC(const std::string &);
                void setAudioTag(uint16_t);
                void setTrackID(unsigned);
53
                void setLanguage(const std::string &);
54 55 56 57 58 59 60

            private:
                void fromWaveFormatEx(const uint8_t *p_data, size_t i_data);
                void fromVideoInfoHeader(const uint8_t *p_data, size_t i_data);
                block_t * buildMoovBox();
                std::string data;
                std::string type;
61
                std::string language;
62 63 64 65 66 67 68 69 70 71 72 73
                uint8_t *extradata;
                size_t   i_extradata;
                WAVEFORMATEX formatex;
                unsigned width, height;
                vlc_fourcc_t fourcc;
                int es_type;
                unsigned track_id;
        };
    }
}

#endif // FORGEDINITSEGMENT_HPP