MP4/WS protocol support.
Approx. 10% of code originally written by Roxlu, but keeping it split up during cleanup before merge proved practically impossible, so it's all merged into a single commit.
This commit is contained in:
parent
6276d03522
commit
9417fa8dc2
3 changed files with 564 additions and 16 deletions
|
@ -15,6 +15,9 @@ namespace Mist{
|
|||
uint64_t time;
|
||||
uint64_t byteOffset; // Stores relative bpos for fragmented MP4
|
||||
uint64_t index;
|
||||
size_t sampleSize;
|
||||
uint16_t sampleDuration;
|
||||
uint16_t sampleOffset;
|
||||
};
|
||||
|
||||
class SortSet{
|
||||
|
@ -95,22 +98,34 @@ namespace Mist{
|
|||
uint64_t endFragmentTime); // this builds the moof box for fragmented MP4
|
||||
|
||||
void findSeekPoint(uint64_t byteStart, uint64_t &seekPoint, uint64_t headerSize);
|
||||
|
||||
void appendSinglePacketMoof(Util::ResizeablePointer& moofOut, size_t extraBytes = 0);
|
||||
size_t fragmentHeaderSize(std::deque<size_t>& sortedTracks, std::set<keyPart>& trunOrder, uint64_t startFragmentTime, uint64_t endFragmentTime);
|
||||
void onHTTP();
|
||||
void sendNext();
|
||||
void sendHeader();
|
||||
bool doesWebsockets() { return true; }
|
||||
void onWebsocketConnect();
|
||||
void onWebsocketFrame();
|
||||
void onIdle();
|
||||
virtual bool onFinish();
|
||||
|
||||
protected:
|
||||
void sendWebsocketCodecData(const std::string& type);
|
||||
bool handleWebsocketSeek(JSON::Value& command);
|
||||
bool handleWebsocketSetSpeed(JSON::Value& command);
|
||||
bool stayLive;
|
||||
double target_rate; ///< Target playback speed rate (1.0 = normal, 0 = auto)
|
||||
|
||||
uint64_t fileSize;
|
||||
uint64_t byteStart;
|
||||
uint64_t byteEnd;
|
||||
int64_t leftOver;
|
||||
uint64_t currPos;
|
||||
uint64_t seekPoint;
|
||||
uint64_t forwardTo;
|
||||
|
||||
uint64_t nextHeaderTime;
|
||||
uint64_t headerSize;
|
||||
size_t prevVidTrack;
|
||||
|
||||
// variables for standard MP4
|
||||
std::set<keyPart> sortSet; // needed for unfragmented MP4, remembers the order of keyparts
|
||||
|
@ -135,6 +150,7 @@ namespace Mist{
|
|||
std::map<size_t, fragSet> currentPartSet;
|
||||
|
||||
std::string protectionHeader(size_t idx);
|
||||
Util::ResizeablePointer webBuf;
|
||||
};
|
||||
}// namespace Mist
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue