Style enforcement
This commit is contained in:
parent
6811b54186
commit
56c21b5ba6
4 changed files with 939 additions and 1151 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,40 +1,35 @@
|
||||||
#include "ts_packet.h"
|
|
||||||
#include "adts.h"
|
#include "adts.h"
|
||||||
|
#include "h265.h"
|
||||||
|
#include "ts_packet.h"
|
||||||
|
#include <deque>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <deque>
|
|
||||||
#include "h265.h"
|
|
||||||
|
|
||||||
#include "shared_memory.h"
|
#include "shared_memory.h"
|
||||||
|
|
||||||
namespace TS {
|
namespace TS{
|
||||||
enum codecType {
|
enum codecType{H264 = 0x1B, AAC = 0x0F, AC3 = 0x81, MP3 = 0x03, H265 = 0x24, ID3 = 0x15};
|
||||||
H264 = 0x1B,
|
|
||||||
AAC = 0x0F,
|
|
||||||
AC3 = 0x81,
|
|
||||||
MP3 = 0x03,
|
|
||||||
H265 = 0x24,
|
|
||||||
ID3 = 0x15
|
|
||||||
};
|
|
||||||
|
|
||||||
class ADTSRemainder{
|
class ADTSRemainder{
|
||||||
private:
|
private:
|
||||||
char * data;
|
char *data;
|
||||||
uint32_t max;
|
uint32_t max;
|
||||||
uint32_t now;
|
uint32_t now;
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
uint32_t bpos;
|
uint32_t bpos;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setRemainder(const aac::adts & p, const void * source, const uint32_t avail, const uint32_t bPos);
|
void setRemainder(const aac::adts &p, const void *source, const uint32_t avail,
|
||||||
|
const uint32_t bPos);
|
||||||
|
|
||||||
ADTSRemainder();
|
ADTSRemainder();
|
||||||
~ADTSRemainder();
|
~ADTSRemainder();
|
||||||
uint32_t getLength();
|
uint32_t getLength();
|
||||||
uint32_t getBpos();
|
uint32_t getBpos();
|
||||||
uint32_t getTodo();
|
uint32_t getTodo();
|
||||||
char* getData();
|
char *getData();
|
||||||
|
|
||||||
void append(const char *p,uint32_t pLen);
|
void append(const char *p, uint32_t pLen);
|
||||||
bool isComplete();
|
bool isComplete();
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
@ -43,25 +38,27 @@ namespace TS {
|
||||||
public:
|
public:
|
||||||
Stream(bool _threaded = false);
|
Stream(bool _threaded = false);
|
||||||
~Stream();
|
~Stream();
|
||||||
void add(char * newPack, unsigned long long bytePos = 0);
|
void add(char *newPack, unsigned long long bytePos = 0);
|
||||||
void add(Packet & newPack, unsigned long long bytePos = 0);
|
void add(Packet &newPack, unsigned long long bytePos = 0);
|
||||||
void parse(Packet & newPack, unsigned long long bytePos);
|
void parse(Packet &newPack, unsigned long long bytePos);
|
||||||
void parse(char * newPack, unsigned long long bytePos);
|
void parse(char *newPack, unsigned long long bytePos);
|
||||||
void parse(unsigned long tid);
|
void parse(unsigned long tid);
|
||||||
void parseNal(uint32_t tid, const char *pesPayload, const char * packetPtr, bool &isKeyFrame);
|
void parseNal(uint32_t tid, const char *pesPayload, const char *packetPtr, bool &isKeyFrame);
|
||||||
bool hasPacketOnEachTrack() const;
|
bool hasPacketOnEachTrack() const;
|
||||||
bool hasPacket(unsigned long tid) const;
|
bool hasPacket(unsigned long tid) const;
|
||||||
bool hasPacket() const;
|
bool hasPacket() const;
|
||||||
void getPacket(unsigned long tid, DTSC::Packet & pack);
|
void getPacket(unsigned long tid, DTSC::Packet &pack);
|
||||||
void getEarliestPacket(DTSC::Packet & pack);
|
void getEarliestPacket(DTSC::Packet &pack);
|
||||||
void initializeMetadata(DTSC::Meta & meta, unsigned long tid = 0, unsigned long mappingId = 0);
|
void initializeMetadata(DTSC::Meta &meta, unsigned long tid = 0, unsigned long mappingId = 0);
|
||||||
void partialClear();
|
void partialClear();
|
||||||
void clear();
|
void clear();
|
||||||
void finish();
|
void finish();
|
||||||
void eraseTrack(unsigned long tid);
|
void eraseTrack(unsigned long tid);
|
||||||
bool isDataTrack(unsigned long tid);
|
bool isDataTrack(unsigned long tid);
|
||||||
void parseBitstream(uint32_t tid, const char * pesPayload, uint32_t realPayloadSize,uint64_t timeStamp, int64_t timeOffset, uint64_t bPos);
|
void parseBitstream(uint32_t tid, const char *pesPayload, uint32_t realPayloadSize,
|
||||||
|
uint64_t timeStamp, int64_t timeOffset, uint64_t bPos);
|
||||||
std::set<unsigned long> getActiveTracks();
|
std::set<unsigned long> getActiveTracks();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned long long lastPAT;
|
unsigned long long lastPAT;
|
||||||
ProgramAssociationTable associationTable;
|
ProgramAssociationTable associationTable;
|
||||||
|
@ -71,15 +68,15 @@ namespace TS {
|
||||||
std::map<unsigned long, unsigned long long> lastPMT;
|
std::map<unsigned long, unsigned long long> lastPMT;
|
||||||
std::map<unsigned long, ProgramMappingTable> mappingTable;
|
std::map<unsigned long, ProgramMappingTable> mappingTable;
|
||||||
|
|
||||||
std::map<unsigned long, std::deque<Packet> > pesStreams;
|
std::map<unsigned long, std::deque<Packet>> pesStreams;
|
||||||
std::map<unsigned long, std::deque<unsigned long long> > pesPositions;
|
std::map<unsigned long, std::deque<unsigned long long>> pesPositions;
|
||||||
std::map<unsigned long, std::deque<DTSC::Packet> > outPackets;
|
std::map<unsigned long, std::deque<DTSC::Packet>> outPackets;
|
||||||
std::map<unsigned long, DTSC::Packet> buildPacket;
|
std::map<unsigned long, DTSC::Packet> buildPacket;
|
||||||
std::map<unsigned long, unsigned long> pidToCodec;
|
std::map<unsigned long, unsigned long> pidToCodec;
|
||||||
std::map<unsigned long, aac::adts > adtsInfo;
|
std::map<unsigned long, aac::adts> adtsInfo;
|
||||||
std::map<unsigned long, std::string > spsInfo;
|
std::map<unsigned long, std::string> spsInfo;
|
||||||
std::map<unsigned long, std::string > ppsInfo;
|
std::map<unsigned long, std::string> ppsInfo;
|
||||||
std::map<unsigned long, h265::initData > hevcInfo;
|
std::map<unsigned long, h265::initData> hevcInfo;
|
||||||
std::map<unsigned long, std::string> metaInit;
|
std::map<unsigned long, std::string> metaInit;
|
||||||
std::map<unsigned long, std::string> descriptors;
|
std::map<unsigned long, std::string> descriptors;
|
||||||
std::map<unsigned long, std::string> partialBuffer;
|
std::map<unsigned long, std::string> partialBuffer;
|
||||||
|
@ -92,3 +89,4 @@ namespace TS {
|
||||||
void parsePES(unsigned long tid, bool finished = false);
|
void parsePES(unsigned long tid, bool finished = false);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,24 +1,22 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include <fstream>
|
||||||
#include <mist/dtsc.h>
|
#include <mist/dtsc.h>
|
||||||
#include <mist/nal.h>
|
#include <mist/nal.h>
|
||||||
#include <mist/ts_packet.h>
|
#include <mist/ts_packet.h>
|
||||||
#include <mist/ts_stream.h>
|
#include <mist/ts_stream.h>
|
||||||
#include <fstream>
|
|
||||||
#include <string>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
//#include <stdint.h>
|
//#include <stdint.h>
|
||||||
|
|
||||||
#define BUFFERTIME 10
|
#define BUFFERTIME 10
|
||||||
|
|
||||||
namespace Mist {
|
namespace Mist{
|
||||||
|
|
||||||
enum PlaylistType { VOD, LIVE, EVENT };
|
enum PlaylistType{VOD, LIVE, EVENT};
|
||||||
|
|
||||||
|
struct playListEntries{
|
||||||
struct playListEntries
|
|
||||||
{
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
uint64_t bytePos;
|
uint64_t bytePos;
|
||||||
float duration;
|
float duration;
|
||||||
|
@ -26,14 +24,14 @@ namespace Mist {
|
||||||
unsigned int wait;
|
unsigned int wait;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Playlist {
|
class Playlist{
|
||||||
public:
|
public:
|
||||||
Playlist(const std::string & uriSrc = "");
|
Playlist(const std::string &uriSrc = "");
|
||||||
bool atEnd() const;
|
bool atEnd() const;
|
||||||
bool isUrl() const;
|
bool isUrl() const;
|
||||||
bool reload();
|
bool reload();
|
||||||
void addEntry(const std::string & filename, float duration, uint64_t & totalBytes);
|
void addEntry(const std::string &filename, float duration, uint64_t &totalBytes);
|
||||||
bool loadURL(const std::string & loadUrl);
|
bool loadURL(const std::string &loadUrl);
|
||||||
|
|
||||||
std::string uri;
|
std::string uri;
|
||||||
std::string uri_root;
|
std::string uri_root;
|
||||||
|
@ -49,7 +47,6 @@ namespace Mist {
|
||||||
uint64_t media_sequence;
|
uint64_t media_sequence;
|
||||||
int lastFileIndex;
|
int lastFileIndex;
|
||||||
|
|
||||||
|
|
||||||
int waitTime;
|
int waitTime;
|
||||||
PlaylistType playlistType;
|
PlaylistType playlistType;
|
||||||
std::deque<playListEntries> entries;
|
std::deque<playListEntries> entries;
|
||||||
|
@ -58,22 +55,21 @@ namespace Mist {
|
||||||
unsigned int startTime;
|
unsigned int startTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct entryBuffer{
|
||||||
struct entryBuffer
|
|
||||||
{
|
|
||||||
int timestamp;
|
int timestamp;
|
||||||
playListEntries entry;
|
playListEntries entry;
|
||||||
int playlistIndex;
|
int playlistIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class inputHLS : public Input {
|
class inputHLS : public Input{
|
||||||
public:
|
public:
|
||||||
inputHLS(Util::Config * cfg);
|
inputHLS(Util::Config *cfg);
|
||||||
~inputHLS();
|
~inputHLS();
|
||||||
bool needsLock();
|
bool needsLock();
|
||||||
bool openStreamSource();
|
bool openStreamSource();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//Private Functions
|
// Private Functions
|
||||||
|
|
||||||
unsigned int startTime;
|
unsigned int startTime;
|
||||||
PlaylistType playlistType;
|
PlaylistType playlistType;
|
||||||
|
@ -83,11 +79,11 @@ namespace Mist {
|
||||||
bool endPlaylist;
|
bool endPlaylist;
|
||||||
int currentPlaylist;
|
int currentPlaylist;
|
||||||
|
|
||||||
//std::vector<playListEntries> entries;
|
// std::vector<playListEntries> entries;
|
||||||
std::vector<Playlist> playlists;
|
std::vector<Playlist> playlists;
|
||||||
//std::vector<int> pidMapping;
|
// std::vector<int> pidMapping;
|
||||||
std::map<int,int> pidMapping;
|
std::map<int, int> pidMapping;
|
||||||
std::map<int,int> pidMappingR;
|
std::map<int, int> pidMappingR;
|
||||||
|
|
||||||
std::vector<int> reloadNext;
|
std::vector<int> reloadNext;
|
||||||
|
|
||||||
|
@ -95,7 +91,7 @@ namespace Mist {
|
||||||
std::string currentFile;
|
std::string currentFile;
|
||||||
std::ifstream in;
|
std::ifstream in;
|
||||||
|
|
||||||
TS::Stream tsStream;///<Used for parsing the incoming ts stream
|
TS::Stream tsStream; ///<Used for parsing the incoming ts stream
|
||||||
|
|
||||||
Socket::Connection conn;
|
Socket::Connection conn;
|
||||||
TS::Packet tsBuf;
|
TS::Packet tsBuf;
|
||||||
|
@ -111,12 +107,12 @@ namespace Mist {
|
||||||
void getNext(bool smart = true);
|
void getNext(bool smart = true);
|
||||||
void seek(int seekTime);
|
void seek(int seekTime);
|
||||||
void trackSelect(std::string trackSpec);
|
void trackSelect(std::string trackSpec);
|
||||||
FILE * inFile;
|
FILE *inFile;
|
||||||
FILE * tsFile;
|
FILE *tsFile;
|
||||||
|
|
||||||
bool readIndex();
|
bool readIndex();
|
||||||
bool initPlaylist(const std::string & uri);
|
bool initPlaylist(const std::string &uri);
|
||||||
bool readPlaylist(const std::string & uri);
|
bool readPlaylist(const std::string &uri);
|
||||||
bool readNextFile();
|
bool readNextFile();
|
||||||
|
|
||||||
void parseStreamHeader();
|
void parseStreamHeader();
|
||||||
|
|
Loading…
Add table
Reference in a new issue