id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
750,425
|
readyforsendinterface.h
|
shiretu_crtmpserver/sources/thelib/include/utils/readyforsendinterface.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _READYFORSENDINTERFACE_H
#define _READYFORSENDINTERFACE_H
class DLLEXP ReadyForSendInterface {
public:
/*!
* @brief keep the compiler happy about destructor
*/
virtual ~ReadyForSendInterface() {
}
/*!
* @brief This function will be called by the framework when the I/O layer
* can do more I/O on the same handler which was previously used to do
* output
*/
virtual void ReadyForSend() = 0;
};
#endif /* _READYFORSENDINTERFACE_H */
| 1,236
|
C++
|
.h
| 35
| 33.142857
| 75
| 0.747069
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,426
|
udpsenderprotocol.h
|
shiretu_crtmpserver/sources/thelib/include/utils/udpsenderprotocol.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _UDPSENDERPROTOCOL_H
#define _UDPSENDERPROTOCOL_H
#include "protocols/udpprotocol.h"
class ReadyForSendInterface;
class UDPSenderProtocol
: public UDPProtocol {
private:
sockaddr_in _destAddress;
SOCKET _fd;
ReadyForSendInterface *_pReadyForSend;
string _bindIp;
uint16_t _bindPort;
public:
UDPSenderProtocol();
virtual ~UDPSenderProtocol();
virtual void SetIOHandler(IOHandler *pCarrier);
virtual void ReadyForSend();
static UDPSenderProtocol *GetInstance(string bindIp, uint16_t bindPort,
string targetIp, uint16_t targetPort, uint16_t ttl, uint16_t tos,
ReadyForSendInterface *pReadyForSend);
void ResetReadyForSendInterface();
uint16_t GetUdpBindPort();
virtual bool SendChunked(uint8_t *pData, uint32_t dataLength,
uint32_t maxChunkSize);
virtual bool SendBlock(uint8_t *pData, uint32_t dataLength);
};
#endif /* _UDPSENDERPROTOCOL_H */
| 1,655
|
C++
|
.h
| 45
| 34.688889
| 72
| 0.779513
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,427
|
mediaframe.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mediaframe.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MEDIAFRAME_H
#define _MEDIAFRAME_H
#include "common.h"
#define MEDIAFRAME_TYPE_AUDIO 0
#define MEDIAFRAME_TYPE_VIDEO 1
#define MEDIAFRAME_TYPE_DATA 2
typedef struct _MediaFrame {
uint64_t start;
uint64_t length;
uint8_t type;
bool isKeyFrame;
double pts;
double dts;
double cts;
bool isBinaryHeader;
operator string() {
return format("s: %16"PRIx64"; l: %6"PRIx64"; t: %"PRIu8"; kf: %"PRIu8"; pts: %8.2f; dts: %8.2f; cts: %6.2f; bh: %"PRIu8,
start, length, type, isKeyFrame, pts, dts, cts, isBinaryHeader);
};
} MediaFrame;
#endif /* _MEDIAFRAME_H */
| 1,356
|
C++
|
.h
| 39
| 32.74359
| 123
| 0.732824
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,428
|
streammetadataresolver.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/streammetadataresolver.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _STREAMMETADATARESOLVER_H
#define _STREAMMETADATARESOLVER_H
#include "common.h"
#include "protocols/timer/basetimerprotocol.h"
class StreamCapabilities;
class MetadataStats
: public Variant {
private:
Variant _dummy;
public:
VARIANT_COPY_CONSTRUCTORS(MetadataStats);
VARIANT_GETSET(string, mediaFullPath, "");
VARIANT_GETSET(uint64_t, openCount, 0);
VARIANT_GETSET(uint64_t, servedBytesCount, 0);
VARIANT_GETSET(Variant, lastAccessTime, _dummy);
void Init() {
mediaFullPath("");
openCount(0);
servedBytesCount(0);
}
};
class Storage
: public Variant {
public:
VARIANT_COPY_CONSTRUCTORS(Storage);
VARIANT_GETSET(string, name, "");
VARIANT_GETSET(string, mediaFolder, "");
VARIANT_GETSET(string, metaFolder, "");
VARIANT_GETSET(bool, enableStats, false);
VARIANT_GETSET(bool, keyframeSeek, false);
VARIANT_GETSET(string, description, "");
VARIANT_GETSET(int32_t, clientSideBuffer, 0);
VARIANT_GETSET(uint32_t, seekGranularity, 0);
VARIANT_GETSET(bool, externalSeekGenerator, false);
};
class PublicMetadata
: public Variant {
public:
VARIANT_COPY_CONSTRUCTORS(PublicMetadata);
VARIANT_GETSET(double, startTimestamp, 0);
VARIANT_GETSET(double, endTimestamp, 0);
VARIANT_GETSET(double, duration, 0);
VARIANT_GETSET(string, server, "");
VARIANT_GETSET(double, bandwidth, 0);
VARIANT_GETSET(uint32_t, audioFramesCount, 0);
VARIANT_GETSET(uint32_t, videoFramesCount, 0);
VARIANT_GETSET(uint32_t, totalFramesCount, 0);
VARIANT_GETSET(uint64_t, fileSize, 0);
VARIANT_GETSET(string, mediaFullPath, "");
};
class Metadata
: public Variant {
private:
Storage _dummy1;
PublicMetadata _dummy2;
public:
VARIANT_COPY_CONSTRUCTORS(Metadata);
VARIANT_GETSET(string, originalStreamName, "");
VARIANT_GETSET(string, type, "");
VARIANT_GETSET(string, completeFileName, "");
VARIANT_GETSET(string, fileName, "");
VARIANT_GETSET(string, extension, "");
VARIANT_GETSET(string, computedCompleteFileName, "");
VARIANT_GETSET(string, mediaFullPath, "");
VARIANT_GETSET(Storage&, storage, _dummy1);
VARIANT_GETSET(string, hash, "");
VARIANT_GETSET(string, seekFileFullPath, "");
VARIANT_GETSET(string, metaFileFullPath, "");
VARIANT_GETSET(string, statsFileFullPath, "");
VARIANT_GETSET(PublicMetadata&, publicMetadata, _dummy2);
};
enum StatsOperation {
STATS_OPERATION_INCREMENT_OPEN_COUNT = 0,
STATS_OPERATION_INCREMENT_SERVED_BYTES_COUNT
};
class StreamMetadataResolver;
class StreamMetadataResolverTimer
: public BaseTimerProtocol {
private:
StreamMetadataResolver *_pResolver;
struct statsOperation {
string mediaFullPath;
string statsFile;
StatsOperation operation;
uint64_t value;
};
vector<statsOperation> _operations1;
vector<statsOperation> _operations2;
vector<statsOperation> *_pAcceptQueue;
vector<statsOperation> *_pWorkQueue;
public:
StreamMetadataResolverTimer(StreamMetadataResolver *pResolver);
virtual ~StreamMetadataResolverTimer();
void ResetStreamManager();
virtual bool TimePeriodElapsed();
void EnqueueOperation(string &mediaFullPath, string &statsFile,
StatsOperation operation, uint64_t value);
};
class StreamMetadataResolver {
private:
StreamCapabilities *_pCapabilities;
map<string, Storage *> _storagesByMediaFolder;
vector<Storage *> _storagesByOrder;
map<string, pair<double, uint64_t> > _badFiles;
map<string, bool> _badStatsFiles;
Variant _storages;
bool _silence;
uint32_t _statsTimerId;
string _recordedStreamsStorage;
public:
StreamMetadataResolver();
virtual ~StreamMetadataResolver();
/*!
* @brief used to silence all logging messages. Useful for external seek
* generators who needs to be silent
*/
void SetSilence(bool silence);
/*!
* @brief This will initialize the StreamMetadataResolver instance
*
* @param configuration - the storage node from the configuration file
*/
bool Initialize(Variant &configuration);
/*!
* @brief This will initialize a storage location
*
* @param name - the name of the storage location
*
* @param config - all the parameters associated with the storage
*
* @param result - If successful, it will contain the normalized storage
*
* @retuns true on success, false on errors
*/
bool InitializeStorage(string name, Variant &config, Storage &result);
/*!
* @brief removes a storage from the list of storages
*
* @param mediaFolder - the media folder for the storage that needs to be
* removed
*
* @param removedStorage - if the storage is found and removed, it is also
* copied into this variable. useful to see what was the exact storage that
* was removed
*/
void RemoveStorage(string mediaFolder, Storage &removedStorage);
/*!
* @brief This function can be used to resolve complete metadata for a
* a given stream name
*
* @param streamName - This designates the stream for which the metadata
* needs to be constructed. It has the following forms:<br>
* 1. streamName<br>
* 2. /path/to/file.mp4 or c:\\path\\to\\file.mp4<br>
* The main difference between them is that #1 is a real stream name while
* #2 is a path to a file. If the streamName is not a real absolute path
* than is considered to be a stream name and adheres to the Adobe naming
* convention (mp4:test.mp4, mp3:test, test, etc)
*
* @param result - This is where all the metadata will be deposited. It can
* be pre-populated with other custom data/keys. However, if a naming
* collision is encountered (existing key), the existing key will be
* overwritten. It is best to adopt the sub-nodes technique to store custom
* properties into this rather than have them stored directly into the root
*
* @returns returns true if the operation succeeded or false if it failed
*
* @discussion This function will always try to deep-resolve the metadata.
* That means it will also create *.seek and *.meta files if needed. Those
* files are not created if they are newer than the media files. If this
* files are older than the media files, that means the media file is a
* different file and the seek/meta files are outdated.
*/
bool ResolveMetadata(string streamName, Metadata &result);
/*!
* @brief This function can be used to resolve stream name metadata for a
* a given stream name
*
* @param streamName - This designates the stream for which the metadata
* needs to be constructed. It has the following forms:<br>
* 1. streamName<br>
* 2. /path/to/file.mp4 or c:\\path\\to\\file.mp4<br>
* The main difference between them is that #1 is a real stream name while
* #2 is a path to a file. If the streamName is not a real absolute path
* than is considered to be a stream name and adheres to the Adobe naming
* convention (mp4:test.mp4, mp3:test, test, etc)
*
* @param result - This is where all the metadata will be deposited. It can
* be pre-populated with other custom data/keys. However, if a naming
* collision is encountered (existing key), the existing key will be
* overwritten. It is best to adopt the sub-nodes technique to store custom
* properties into this rather than have them stored directly into the root
*
* @returns returns true if the operation succeeded or false if it failed
*/
bool ResolveStreamName(string streamName, Metadata &result);
/*!
* @brief this function cycles over all files in all storages and builds the
* appropriate seek/meta files
*/
void GenerateMetaFiles();
/*!
* @brief this will return the full list of storages
*/
Variant &GetAllStorages();
/*
* @brief this will increment the open count on the stats
*/
void UpdateStats(string mediaFullPath, string statsFile,
StatsOperation operation, uint64_t value);
/*!
* @brief returns the default location for the recorded streams.
* To be used inside protocols like RTMP where publishing is also requiring
* recording on the fly
*/
string GetRecordedStreamsStorage();
private:
void SetRecordedSteramsStorage(Variant &value);
void UpdateStats(MetadataStats &stats, StatsOperation operation, uint64_t value);
void EnqueueStatsOperation(string &mediaFullPath, string &statsFile,
StatsOperation operation, uint64_t value);
bool ResolveStorage(Metadata &result);
bool ComputeSeekMetaPaths(Metadata &result);
bool ComputeSeekMeta(Metadata &result);
bool LoadSeekMeta(Metadata &result);
void DeleteAllMetaFiles(Metadata &result);
};
#endif /* _STREAMMETADATARESOLVER_H */
| 9,148
|
C++
|
.h
| 246
| 34.841463
| 82
| 0.765634
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,429
|
basemediadocument.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/basemediadocument.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BASEMEDIADOCUMENT_H
#define _BASEMEDIADOCUMENT_H
#include "common.h"
#include "mediaformats/readers/mediaframe.h"
#include "mediaformats/readers/mediafile.h"
#include "streaming/streamcapabilities.h"
#include "mediaformats/readers/streammetadataresolver.h"
class BaseMediaDocument {
protected:
MediaFile _mediaFile;
vector<MediaFrame> _frames;
uint32_t _audioSamplesCount;
uint32_t _videoSamplesCount;
Metadata &_metadata;
string _mediaFilePath;
string _seekFilePath;
string _metaFilePath;
bool _keyframeSeek;
uint32_t _seekGranularity;
StreamCapabilities _streamCapabilities;
public:
BaseMediaDocument(Metadata &metadata);
virtual ~BaseMediaDocument();
/*!
@brief This functions do things like opening the media file, building frames, saving the meta, etc.
*/
bool Process();
/*!
@brief Returns the meta data
*/
Variant GetMetadata();
/*!
@brief Returns the media file
*/
MediaFile &GetMediaFile();
protected:
static bool CompareFrames(const MediaFrame &frame1, const MediaFrame &frame2);
virtual bool ParseDocument() = 0;
virtual bool BuildFrames() = 0;
virtual Variant GetPublicMeta() = 0;
private:
bool SaveSeekFile();
bool SaveMetaFile();
};
#endif /* _BASEMEDIADOCUMENT_H */
| 2,010
|
C++
|
.h
| 63
| 29.888889
| 101
| 0.772845
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,430
|
mediafile.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mediafile.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MEDIAFILE_H
#define _MEDIAFILE_H
#include "common.h"
//#define MediaFile File
#ifdef HAS_MMAP
#define MediaFile MmapFile
#else
#define MediaFile File
#endif /* HAS_MMAP */
MediaFile* GetFile(string filePath, uint32_t windowSize);
void ReleaseFile(MediaFile *pFile);
bool GetFile(string filePath, uint32_t windowSize, MediaFile &mediaFile);
#endif /* _MEDIAFILE_H */
| 1,154
|
C++
|
.h
| 31
| 35.483871
| 73
| 0.760072
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,431
|
flvdocument.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/flv/flvdocument.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_FLV
#ifndef _FLVDOCUMENT
#define _FLVDOCUMENT
#include "common.h"
#include "mediaformats/readers/basemediadocument.h"
class FLVDocument
: public BaseMediaDocument {
private:
Variant _rtmpMetadata;
public:
FLVDocument(Metadata &metadata);
virtual ~FLVDocument();
protected:
virtual bool ParseDocument();
virtual bool BuildFrames();
virtual Variant GetPublicMeta();
};
#endif /* _FLVDOCUMENT */
#endif /* HAS_MEDIA_FLV */
| 1,221
|
C++
|
.h
| 37
| 31.243243
| 72
| 0.764207
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,432
|
id3parser.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp3/id3parser.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP3
#ifndef _ID3PARSER_H
#define _ID3PARSER_H
#include "common.h"
#include "mediaformats/readers/mediafile.h"
class ID3Parser {
protected:
bool _unsynchronisation;
bool _compression;
bool _extendedHeader;
bool _experimentalIndicator;
bool _footerPresent;
Variant _metadata;
uint32_t _majorVersion;
uint32_t _minorVersion;
public:
ID3Parser(uint32_t majorVersion, uint32_t minorVersion);
virtual ~ID3Parser();
Variant GetMetadata();
bool Parse(MediaFile &file);
private:
bool ParseTags(IOBuffer &buffer);
bool ReadStringWithSize(IOBuffer &buffer, Variant &value, uint32_t size, bool hasEncoding);
bool ReadStringNullTerminated(IOBuffer &buffer, Variant &value, bool unicode);
bool ParseTextTag(IOBuffer &buffer, Variant &tag);
bool ParseUSLT(IOBuffer &buffer, Variant &tag);
bool ParseAPIC(IOBuffer &buffer, Variant &tag);
bool ParseCOMM(IOBuffer &buffer, Variant &tag);
bool ParseUrlTag(IOBuffer &buffer, Variant &tag);
bool ParseWXXX(IOBuffer &buffer, Variant &tag);
bool ParseTXXX(IOBuffer &buffer, Variant &tag);
};
#endif /* _ID3PARSER_H */
#endif /* HAS_MEDIA_MP3 */
| 1,891
|
C++
|
.h
| 52
| 34.480769
| 92
| 0.769231
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,433
|
mp3document.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp3/mp3document.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP3
#ifndef _MP3DOCUMENT_H
#define _MP3DOCUMENT_H
#include "mediaformats/readers/basemediadocument.h"
class MP3Document
: public BaseMediaDocument {
private:
//ver/layer/bitRateIndex
static int32_t _bitRates[4][4][16];
static int32_t _samplingRates[4][4];
static string _versionNames[4];
static string _layerNames[4];
static map<uint8_t, map<uint8_t, map<uint8_t, map<uint8_t, map<uint8_t, uint64_t > > > > > _frameSizes;
Variant _tags;
bool _capabilitiesInitialized;
public:
MP3Document(Metadata &metadata);
virtual ~MP3Document();
protected:
virtual bool ParseDocument();
virtual bool BuildFrames();
virtual Variant GetPublicMeta();
private:
bool FindFrameData();
bool ParseMetadata();
void InitFrameSizes();
};
#endif /* _MP3DOCUMENT_H */
#endif /* HAS_MEDIA_MP3 */
| 1,580
|
C++
|
.h
| 47
| 31.808511
| 104
| 0.75589
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,434
|
atomstts.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomstts.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSTTS_H
#define _ATOMSTTS_H
#include "mediaformats/readers/mp4/versionedatom.h"
typedef struct _STTSEntry {
uint32_t count;
uint32_t delta;
} STTSEntry;
class AtomSTTS
: public VersionedAtom {
private:
vector<STTSEntry> _sttsEntries;
vector<uint32_t> _normalizedEntries;
public:
AtomSTTS(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSTTS();
vector<uint32_t> GetEntries();
protected:
virtual bool ReadData();
};
#endif /* _ATOMSTTS_H */
#endif /* HAS_MEDIA_MP4 */
| 1,325
|
C++
|
.h
| 40
| 31.275
| 80
| 0.75646
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,435
|
atomminf.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomminf.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMINF_H
#define _ATOMMINF_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomSMHD;
class AtomDINF;
class AtomSTBL;
class AtomVMHD;
class AtomHDLR;
class AtomMINF
: public BoxAtom {
private:
AtomSMHD *_pSMHD;
AtomDINF *_pDINF;
AtomSTBL *_pSTBL;
AtomVMHD *_pVMHD;
AtomHDLR *_pHDLR;
public:
AtomMINF(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMINF();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMMINF_H */
#endif /* HAS_MEDIA_MP4 */
| 1,328
|
C++
|
.h
| 43
| 29.093023
| 80
| 0.75646
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,436
|
atomstsz.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomstsz.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSTSZ_H
#define _ATOMSTSZ_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomSTSZ
: public VersionedAtom {
private:
uint32_t _sampleSize;
uint32_t _sampleCount;
vector<uint64_t> _entries;
public:
AtomSTSZ(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSTSZ();
vector<uint64_t> GetEntries();
protected:
virtual bool ReadData();
};
#endif /* _ATOMSTSZ_H */
#endif /* HAS_MEDIA_MP4 */
| 1,253
|
C++
|
.h
| 37
| 32
| 80
| 0.752688
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,437
|
atomtrun.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomtrun.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMTRUN_H
#define _ATOMTRUN_H
#include "mediaformats/readers/mp4/versionedatom.h"
typedef struct _TRUNSample {
uint32_t duration;
uint32_t size;
uint32_t flags;
uint32_t compositionTimeOffset;
int64_t absoluteOffset;
_TRUNSample() {
duration = size = flags = compositionTimeOffset = 0;
absoluteOffset = 0;
}
operator string() {
return format("duration: %u; size: %u; flags: %u; CTO: %u",
duration, size, flags, compositionTimeOffset);
}
} TRUNSample;
class AtomTRUN
: public VersionedAtom {
private:
uint32_t _sampleCount;
int32_t _dataOffset;
uint32_t _firstSampleFlags;
vector<TRUNSample *> _samples;
public:
AtomTRUN(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomTRUN();
bool HasDataOffset();
bool HasFirstSampleFlags();
bool HasSampleDuration();
bool HasSampleSize();
bool HasSampleFlags();
bool HasSampleCompositionTimeOffsets();
uint32_t GetDataOffset();
vector<TRUNSample *> &GetSamples();
protected:
virtual bool ReadData();
};
#endif /* _ATOMTRUN_H */
#endif /* HAS_MEDIA_MP4 */
| 1,879
|
C++
|
.h
| 60
| 29.216667
| 80
| 0.750966
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,438
|
atomtrex.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomtrex.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMTREX_H
#define _ATOMTREX_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomTREX
: public VersionedAtom {
private:
uint32_t _trackID;
uint32_t _defaultSampleDescriptionIndex;
uint32_t _defaultSampleDuration;
uint32_t _defaultSampleSize;
uint32_t _defaultSampleFlags;
public:
AtomTREX(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomTREX();
uint32_t GetTrackID();
uint32_t GetDefaultSampleDescriptionIndex();
uint32_t GetDefaultSampleDuration();
uint32_t GetDefaultSampleSize();
uint32_t GetDefaultSampleFlags();
protected:
virtual bool ReadData();
};
#endif /* _ATOMTREX_H */
#endif /* HAS_MEDIA_MP4 */
| 1,484
|
C++
|
.h
| 43
| 32.534884
| 80
| 0.766713
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,439
|
atommdhd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommdhd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMDHD_H
#define _ATOMMDHD_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomMDHD
: public VersionedAtom {
private:
uint64_t _creationTime;
uint64_t _modificationTime;
uint32_t _timeScale;
uint64_t _duration;
uint16_t _language;
uint16_t _quality;
public:
AtomMDHD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMDHD();
uint32_t GetTimeScale();
protected:
virtual bool ReadData();
private:
bool ReadDataVersion0();
bool ReadDataVersion1();
};
#endif /* _ATOMMDHD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,371
|
C++
|
.h
| 43
| 30.023256
| 80
| 0.757002
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,440
|
atomtraf.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomtraf.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMTRAF_H
#define _ATOMTRAF_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomTFHD;
class AtomTRUN;
class AtomTRAF
: public BoxAtom {
private:
AtomTFHD *_pTFHD;
vector<AtomTRUN *> _runs;
public:
AtomTRAF(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomTRAF();
uint32_t GetId();
vector<AtomTRUN *> &GetRuns();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMTRAF_H */
#endif /* HAS_MEDIA_MP4 */
| 1,286
|
C++
|
.h
| 39
| 31.025641
| 80
| 0.746172
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,441
|
atomctts.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomctts.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMCTTS_H
#define _ATOMCTTS_H
#include "mediaformats/readers/mp4/versionedatom.h"
typedef struct _CTTSEntry {
uint32_t sampleCount;
int32_t sampleOffset;
} CTTSEntry;
class AtomCTTS
: public VersionedAtom {
private:
vector<CTTSEntry> _entries;
vector<int32_t> _normalizedEntries;
public:
AtomCTTS(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomCTTS();
vector<int32_t> GetEntries();
protected:
virtual bool ReadData();
};
#endif /* _ATOMCTTS_H */
#endif /* HAS_MEDIA_MP4 */
| 1,330
|
C++
|
.h
| 40
| 31.425
| 80
| 0.757599
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,442
|
atomtkhd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomtkhd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMTKHD_H
#define _ATOMTKHD_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomTKHD
: public VersionedAtom {
private:
uint64_t _creationTime;
uint64_t _modificationTime;
uint32_t _trackId;
uint8_t _reserved1[4];
uint64_t _duration;
uint8_t _reserved2[8];
uint16_t _layer;
uint16_t _alternateGroup;
uint16_t _volume;
uint8_t _reserved3[2];
uint8_t _matrixStructure[36];
uint32_t _trackWidth;
uint32_t _trackHeight;
public:
AtomTKHD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomTKHD();
uint32_t GetTrackId();
uint32_t GetWidth();
uint32_t GetHeight();
protected:
virtual bool ReadData();
};
#endif /* _ATOMTKHD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,523
|
C++
|
.h
| 49
| 29.204082
| 80
| 0.751875
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,443
|
atomabst.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomabst.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMABST_H
#define _ATOMABST_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomABST
: public VersionedAtom {
private:
uint32_t _bootstrapInfoVersion;
uint8_t _profile;
bool _live;
bool _update;
uint32_t _timeScale;
uint64_t _currentMediaTime;
uint64_t _smpteTimeCodeOffset;
string _movieIdentifier;
uint8_t _serverEntryCount;
vector<string> _serverEntryTable;
uint8_t _qualityEntryCount;
vector<string> _qualityEntryTable;
string _drmData;
string _metaData;
uint8_t _segmentRunTableCount;
vector<BaseAtom*> _segmentRunTableEntries;
uint8_t _fragmentRunTableCount;
vector<BaseAtom*> _fragmentRunTableEntries;
public:
AtomABST(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomABST();
virtual string Hierarchy(uint32_t indent);
protected:
virtual bool ReadData();
};
#endif /* _ATOMABST_H */
#endif /* HAS_MEDIA_MP4 */
| 1,694
|
C++
|
.h
| 52
| 30.75
| 80
| 0.772894
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,444
|
atomasrt.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomasrt.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMASRT_H
#define _ATOMASRT_H
#include "mediaformats/readers/mp4/versionedatom.h"
struct SEGMENTRUNENTRY {
uint32_t firstSegment;
uint32_t fragmentsPerSegment;
};
class AtomASRT
: public VersionedAtom {
private:
uint8_t _qualityEntryCount;
vector<string> _qualitySegmentUrlModifiers;
uint32_t _segmentRunEntryCount;
vector<SEGMENTRUNENTRY> _segmentRunEntryTable;
public:
AtomASRT(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomASRT();
protected:
virtual bool ReadData();
};
#endif /* _ATOMASRT_H */
#endif /* HAS_MEDIA_MP4 */
| 1,382
|
C++
|
.h
| 41
| 31.926829
| 80
| 0.769288
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,445
|
atomedts.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomedts.h
|
/*
* Copyright (c) 2009, Gavriloaie Eugen-Andrei (shiretu@gmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* *Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* *Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* *Neither the name of the DEVSS nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ATOMEDTS_H
#define _ATOMEDTS_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomELST;
class AtomEDTS
: public BoxAtom {
private:
AtomELST *_pELST;
public:
AtomEDTS(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomEDTS();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMEDTS_H */
| 1,954
|
C++
|
.h
| 43
| 43.55814
| 80
| 0.782563
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,446
|
atommvhd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommvhd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMVHD_H
#define _ATOMMVHD_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomMVHD
: public VersionedAtom {
private:
uint64_t _creationTime;
uint64_t _modificationTime;
uint32_t _timeScale;
uint64_t _duration;
uint32_t _preferredRate;
uint16_t _preferredVolume;
uint8_t _reserved[10];
uint32_t _matrixStructure[9];
uint32_t _previewTime;
uint32_t _previewDuration;
uint32_t _posterTime;
uint32_t _selectionTime;
uint32_t _selectionDuration;
uint32_t _currentTime;
uint32_t _nextTrakId;
public:
AtomMVHD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMVHD();
protected:
virtual bool ReadData();
};
#endif /* _ATOMMVHD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,529
|
C++
|
.h
| 48
| 29.979167
| 80
| 0.761194
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,447
|
atomdata.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomdata.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMDATA_H
#define _ATOMDATA_H
#include "mediaformats/readers/mp4/baseatom.h"
class AtomDATA
: public BaseAtom {
private:
uint32_t _type;
uint32_t _unknown;
string _dataString;
vector<uint16_t> _dataUI16;
vector<uint8_t> _dataUI8;
string _dataImg;
public:
AtomDATA(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomDATA();
Variant GetVariant();
virtual bool Read();
string Hierarchy(uint32_t indent);
};
#endif /* _ATOMDATA_H */
#endif /* HAS_MEDIA_MP4 */
| 1,314
|
C++
|
.h
| 40
| 30.9
| 80
| 0.749407
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,448
|
atomafrt.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomafrt.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMAFRT_H
#define _ATOMAFRT_H
#include "mediaformats/readers/mp4/versionedatom.h"
struct FRAGMENTRUNENTRY {
uint32_t firstFragment;
uint64_t firstFragmentTimestamp;
uint32_t fragmentDuration;
uint8_t discontinuityIndicator;
};
class AtomAFRT
: public VersionedAtom {
private:
uint32_t _timeScale;
uint8_t _qualityEntryCount;
vector<string> _qualitySegmentUrlModifiers;
uint32_t _fragmentRunEntryCount;
vector<FRAGMENTRUNENTRY> _fragmentRunEntryTable;
public:
AtomAFRT(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomAFRT();
protected:
virtual bool ReadData();
};
#endif /* _ATOMAFRT_H */
#endif /* HAS_MEDIA_MP4 */
| 1,473
|
C++
|
.h
| 44
| 31.681818
| 80
| 0.77442
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,449
|
versionedboxatom.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/versionedboxatom.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _VERSIONEDBOXATOM_H
#define _VERSIONEDBOXATOM_H
#include "mediaformats/readers/mp4/boxatom.h"
class VersionedBoxAtom
: public BoxAtom {
protected:
uint8_t _version;
uint8_t _flags[3];
public:
VersionedBoxAtom(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~VersionedBoxAtom();
protected:
virtual bool Read();
virtual bool ReadData() = 0;
};
#endif /* _VERSIONEDBOXATOM_H */
#endif /* HAS_MEDIA_MP4 */
| 1,250
|
C++
|
.h
| 36
| 32.833333
| 88
| 0.75539
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,450
|
atomsmhd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomsmhd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSMHD_H
#define _ATOMSMHD_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomSMHD
: public VersionedAtom {
private:
uint16_t _balance;
uint16_t _reserved;
public:
AtomSMHD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSMHD();
protected:
virtual bool ReadData();
};
#endif /* _ATOMSMHD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,187
|
C++
|
.h
| 35
| 32.057143
| 80
| 0.751965
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,451
|
atomavcc.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomavcc.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMAVCC_H
#define _ATOMAVCC_H
#include "mediaformats/readers/mp4/baseatom.h"
typedef struct _AVCCParameter {
uint16_t size;
uint8_t *pData;
} AVCCParameter;
class AtomAVCC
: public BaseAtom {
private:
uint8_t _configurationVersion;
uint8_t _profile;
uint8_t _profileCompatibility;
uint8_t _level;
uint8_t _naluLengthSize;
vector<AVCCParameter> _seqParameters;
vector<AVCCParameter> _picParameters;
public:
AtomAVCC(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomAVCC();
uint64_t GetExtraDataStart();
uint64_t GetExtraDataLength();
virtual bool Read();
virtual string Hierarchy(uint32_t indent);
};
#endif /* _ATOMAVCC_H */
#endif /* HAS_MEDIA_MP4 */
| 1,514
|
C++
|
.h
| 46
| 31.043478
| 80
| 0.762491
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,452
|
atomco64.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomco64.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMCO64_H
#define _ATOMCO64_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomCO64
: public VersionedAtom {
private:
vector<uint64_t> _entries;
public:
AtomCO64(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomCO64();
vector<uint64_t> GetEntries();
protected:
virtual bool ReadData();
};
#endif /* _ATOMCO64_H */
#endif /* HAS_MEDIA_MP4 */
| 1,206
|
C++
|
.h
| 35
| 32.6
| 80
| 0.751718
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,453
|
ignoredatom.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/ignoredatom.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _IGNOREDATOM_H
#define _IGNOREDATOM_H
#include "mediaformats/readers/mp4/baseatom.h"
class IgnoredAtom
: public BaseAtom {
public:
IgnoredAtom(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~IgnoredAtom();
virtual bool IsIgnored();
virtual bool Read();
virtual string Hierarchy(uint32_t indent);
};
#endif /* _IGNOREDATOM_H */
#endif /* HAS_MEDIA_MP4 */
| 1,202
|
C++
|
.h
| 33
| 34.484848
| 83
| 0.753661
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,454
|
atomnull.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomnull.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMNULL_H
#define _ATOMNULL_H
#include "mediaformats/readers/mp4/baseatom.h"
class AtomNULL
: public BaseAtom {
public:
AtomNULL(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomNULL();
virtual bool IsIgnored();
virtual bool Read();
string Hierarchy(uint32_t indent);
};
#endif /* _ATOMNULL_H */
#endif /* HAS_MEDIA_MP4 */
| 1,176
|
C++
|
.h
| 33
| 33.69697
| 80
| 0.748899
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,455
|
atomtrak.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomtrak.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMTRAK_H
#define _ATOMTRAK_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomTKHD;
class AtomMDIA;
class AtomHDLR;
class AtomMINF;
class AtomDINF;
class AtomSTBL;
class AtomUDTA;
class AtomMETA;
class AtomEDTS;
class AtomTRAK
: public BoxAtom {
private:
AtomTKHD *_pTKHD;
AtomMDIA *_pMDIA;
AtomHDLR *_pHDLR;
AtomMINF *_pMINF;
AtomDINF *_pDINF;
AtomSTBL *_pSTBL;
AtomUDTA *_pUDTA;
AtomMETA *_pMETA;
AtomEDTS *_pEDTS;
public:
AtomTRAK(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomTRAK();
uint32_t GetId();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMTRAK_H */
#endif /* HAS_MEDIA_MP4 */
| 1,485
|
C++
|
.h
| 52
| 26.846154
| 80
| 0.758766
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,456
|
atomilst.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomilst.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMILST_H
#define _ATOMILST_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomILST
: public BoxAtom {
private:
Variant _metadata;
public:
AtomILST(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomILST();
Variant &GetMetadata();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMILST_H */
#endif /* HAS_MEDIA_MP4 */
| 1,195
|
C++
|
.h
| 35
| 32.342857
| 80
| 0.753033
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,457
|
atommoov.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommoov.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMOOV_H
#define _ATOMMOOV_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomMVEX;
class AtomMVHD;
class AtomTRAK;
class AtomUDTA;
class AtomMETA;
class AtomMOOV
: public BoxAtom {
private:
AtomMVEX *_pMVEX;
AtomMVHD *_pMVHD;
vector<AtomTRAK *> _tracks;
AtomUDTA *_pUDTA;
AtomMETA *_pMETA;
public:
AtomMOOV(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMOOV();
vector<AtomTRAK *> GetTracks();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMMOOV_H */
#endif /* HAS_MEDIA_MP4 */
| 1,371
|
C++
|
.h
| 44
| 29.363636
| 80
| 0.755118
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,458
|
atommetafield.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommetafield.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMETAFIELD_H
#define _ATOMMETAFIELD_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomDATA;
class AtomMetaField
: public BaseAtom {
private:
string _name;
Variant _value;
public:
AtomMetaField(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMetaField();
string &GetName();
Variant &GetValue();
virtual bool Read();
string Hierarchy(uint32_t indent);
private:
bool ReadSimpleString();
};
#endif /* _ATOMMETAFIELD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,311
|
C++
|
.h
| 40
| 30.925
| 85
| 0.756928
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,459
|
atomstsc.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomstsc.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSTSC_H
#define _ATOMSTSC_H
#include "mediaformats/readers/mp4/versionedatom.h"
typedef struct _STSCEntry {
uint32_t firstChunk;
uint32_t samplesPerChunk;
uint32_t sampleDescriptionIndex;
} STSCEntry;
class AtomSTSC
: public VersionedAtom {
private:
vector<STSCEntry> _stscEntries;
vector<uint32_t> _normalizedEntries;
public:
AtomSTSC(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSTSC();
vector<uint32_t> GetEntries(uint32_t totalChunksCount);
protected:
virtual bool ReadData();
};
#endif /* _ATOMSTSC_H */
#endif /* HAS_MEDIA_MP4 */
| 1,399
|
C++
|
.h
| 41
| 32.268293
| 80
| 0.765185
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,460
|
boxatom.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/boxatom.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _BOXATOM_H
#define _BOXATOM_H
#include "mediaformats/readers/mp4/baseatom.h"
class BoxAtom
: public BaseAtom {
private:
vector<BaseAtom *> _subAtoms;
public:
BoxAtom(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~BoxAtom();
virtual bool Read();
virtual string Hierarchy(uint32_t indent);
BaseAtom * GetPath(uint8_t depth, ...);
virtual BaseAtom * GetPath(vector<uint32_t> path);
protected:
virtual bool AtomCreated(BaseAtom *pAtom) = 0;
};
#endif /* _BOXATOM_H */
#endif /* HAS_MEDIA_MP4 */
| 1,344
|
C++
|
.h
| 38
| 33.447368
| 79
| 0.74788
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,461
|
atomstss.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomstss.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSTSS_H
#define _ATOMSTSS_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomSTSS
: public VersionedAtom {
private:
vector<uint32_t> _entries;
public:
AtomSTSS(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSTSS();
vector<uint32_t> GetEntries();
protected:
virtual bool ReadData();
};
#endif /* _ATOMSTSS_H */
#endif /* HAS_MEDIA_MP4 */
| 1,206
|
C++
|
.h
| 35
| 32.6
| 80
| 0.751718
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,462
|
atommvex.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommvex.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMVEX_H
#define _ATOMMVEX_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomTREX;
class AtomMVEX
: public BoxAtom {
private:
map<uint32_t, AtomTREX *> _trex;
public:
AtomMVEX(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMVEX();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMMVEX_H */
#endif /* HAS_MEDIA_MP4 */
| 1,207
|
C++
|
.h
| 35
| 32.514286
| 80
| 0.746998
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,463
|
mp4document.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/mp4document.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _MP4DOCUMENT_H
#define _MP4DOCUMENT_H
#include "common.h"
#include "mediaformats/readers/basemediadocument.h"
#define A_NULL (0x00000000)
#define A_____ (0x2d2d2d2d)
#define A_MP3 (0x2e6d7033)
#define A_ALLF (0x416c6c46)
#define A_FLLA (0x466c6c41)
#define A_OLES (0x4f6c6553)
#define A_SELO (0x53656c4f)
#define A_WLOC (0x574c4f43)
#define A_AART (0x61415254)
#define A_ABST (0x61627374)
#define A_AFRA (0x61667261)
#define A_AFRT (0x61667274)
#define A_ALIS (0x616c6973)
#define A_ASRT (0x61737274)
#define A_AVC1 (0x61766331)
#define A_AVCC (0x61766343)
#define A_BTRT (0x62747274)
#define A_CHAN (0x6368616e)
#define A_CHAN (0x6368616e)
#define A_CO64 (0x636f3634)
#define A_COLR (0x636f6c72)
#define A_COVR (0x636f7672)
#define A_CPIL (0x6370696c)
#define A_CSLG (0x63736c67)
#define A_CTTS (0x63747473)
#define A_DATA (0x64617461)
#define A_DESC (0x64657363)
#define A_DINF (0x64696e66)
#define A_DISK (0x6469736b)
#define A_DREF (0x64726566)
#define A_EDTS (0x65647473)
#define A_ELST (0x656c7374)
#define A_ESDS (0x65736473)
#define A_FREE (0x66726565)
#define A_FTYP (0x66747970)
#define A_GMHD (0x676d6864)
#define A_GNRE (0x676e7265)
#define A_GSHH (0x67736868)
#define A_GSPM (0x6773706d)
#define A_GSPU (0x67737075)
#define A_GSSD (0x67737364)
#define A_GSST (0x67737374)
#define A_GSTD (0x67737464)
#define A_HDLR (0x68646c72)
#define A_HINF (0x68696e66)
#define A_HINV (0x68696e76)
#define A_HNTI (0x686e7469)
#define A_ILST (0x696c7374)
#define A_IODS (0x696f6473)
#define A_LOAD (0x6c6f6164)
#define A_MDAT (0x6d646174)
#define A_MDHD (0x6d646864)
#define A_MDIA (0x6d646961)
#define A_META (0x6d657461)
#define A_MFHD (0x6d666864)
#define A_MINF (0x6d696e66)
#define A_MOOF (0x6d6f6f66)
#define A_MOOV (0x6d6f6f76)
#define A_MP4A (0x6d703461)
#define A_MVEX (0x6d766578)
#define A_MVHD (0x6d766864)
#define A_NAME (0x6e616d65)
#define A_PASP (0x70617370)
#define A_PGAP (0x70676170)
#define A_RTP (0x72747020)
#define A_SDTP (0x73647470)
#define A_SKIP (0x736b6970)
#define A_SMHD (0x736d6864)
#define A_SOAA (0x736f6161)
#define A_SOAL (0x736f616c)
#define A_SOAR (0x736f6172)
#define A_SOCO (0x736f636f)
#define A_SONM (0x736f6e6d)
#define A_SOSN (0x736f736e)
#define A_SOUN (0x736f756e)
#define A_STBL (0x7374626c)
#define A_STCO (0x7374636f)
#define A_STPS (0x73747073)
#define A_STSC (0x73747363)
#define A_STSD (0x73747364)
#define A_STSS (0x73747373)
#define A_STSZ (0x7374737a)
#define A_STTS (0x73747473)
#define A_TAPT (0x74617074)
#define A_TFHD (0x74666864)
#define A_TKHD (0x746b6864)
#define A_TMCD (0x746d6364)
#define A_TMPO (0x746d706f)
#define A_TRAF (0x74726166)
#define A_TRAK (0x7472616b)
#define A_TREF (0x74726566)
#define A_TREX (0x74726578)
#define A_TRKN (0x74726b6e)
#define A_TRUN (0x7472756e)
#define A_TVEN (0x7476656e)
#define A_TVES (0x74766573)
#define A_TVSH (0x74767368)
#define A_TVSN (0x7476736e)
#define A_UDTA (0x75647461)
#define A_URL (0x75726c20)
#define A_UUID (0x75756964)
#define A_VIDE (0x76696465)
#define A_VMHD (0x766d6864)
#define A_WAVE (0x77617665)
#define A_WIDE (0x77696465)
#define A__ART1 (0xa9415254)
#define A__ALB (0xa9616c62)
#define A__ARG (0xa9617267)
#define A__ARK (0xa961726b)
#define A__ART2 (0xa9617274)
#define A__CMT (0xa9636d74)
#define A__COK (0xa9636f6b)
#define A__COM (0xa9636f6d)
#define A__CPY (0xa9637079)
#define A__DAY (0xa9646179)
#define A__DES (0xa9646573)
#define A__DIR (0xa9646972)
#define A__ED1 (0xa9656431)
#define A__ED2 (0xa9656432)
#define A__ED3 (0xa9656433)
#define A__ED4 (0xa9656434)
#define A__ED5 (0xa9656435)
#define A__ED6 (0xa9656436)
#define A__ED7 (0xa9656437)
#define A__ED8 (0xa9656438)
#define A__ED9 (0xa9656439)
#define A__FMT (0xa9666d74)
#define A__GEN (0xa967656e)
#define A__GRP (0xa9677270)
#define A__INF (0xa9696e66)
#define A__ISR (0xa9697372)
#define A__LAB (0xa96c6162)
#define A__LAL (0xa96c616c)
#define A__LYR (0xa96c7972)
#define A__MAK (0xa96d616b)
#define A__MAL (0xa96d616c)
#define A__MOD (0xa96d6f64)
#define A__NAK (0xa96e616b)
#define A__NAM (0xa96e616d)
#define A__PDK (0xa970646b)
#define A__PHG (0xa9706867)
#define A__PRD (0xa9707264)
#define A__PRF (0xa9707266)
#define A__PRK (0xa970726b)
#define A__PRL (0xa970726c)
#define A__PRT (0xa9707274)
#define A__REQ (0xa9726571)
#define A__SNK (0xa9736e6b)
#define A__SNM (0xa9736e6d)
#define A__SRC (0xa9737263)
#define A__SWF (0xa9737766)
#define A__SWK (0xa973776b)
#define A__SWR (0xa9737772)
#define A__TOO (0xa9746f6f)
#define A__WRT (0xa9777274)
#define A__XYZ (0xa978797a)
class BaseAtom;
class AtomFTYP;
class AtomMOOV;
class AtomMOOF;
class AtomTRAK;
class AtomTRAF;
class AtomAFRA;
class AtomABST;
class MP4Document
: public BaseMediaDocument {
private:
vector<BaseAtom *> _allAtoms;
vector<BaseAtom *> _topAtoms;
AtomFTYP *_pFTYP;
AtomMOOV *_pMOOV;
AtomAFRA *_pAFRA;
AtomABST *_pABST;
vector<AtomMOOF*> _moof;
public:
MP4Document(Metadata &metadata);
virtual ~MP4Document();
void AddAtom(BaseAtom *pAtom);
BaseAtom * ReadAtom(BaseAtom *pParentAtom);
protected:
virtual bool ParseDocument();
virtual bool BuildFrames();
virtual Variant GetPublicMeta();
private:
string Hierarchy();
AtomTRAK * GetTRAK(bool audio);
AtomTRAF * GetTRAF(AtomMOOF *pMOOF, bool audio);
bool BuildMOOVFrames(bool audio);
bool BuildMOOFFrames(AtomMOOF *pMOOF, bool audio);
};
#endif /* _MP4DOCUMENT_H */
#endif /* HAS_MEDIA_MP4 */
| 6,142
|
C++
|
.h
| 215
| 27.367442
| 72
| 0.765878
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,464
|
atomafra.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomafra.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMAFRA_H
#define _ATOMAFRA_H
#include "mediaformats/readers/mp4/versionedatom.h"
struct AFRAENTRY {
uint64_t time;
uint64_t offset;
};
struct GLOBALAFRAENTRY {
uint64_t time;
uint32_t segment;
uint32_t fragment;
uint64_t afraOffset;
uint64_t offsetFromAfra;
};
class AtomAFRA
: public VersionedAtom {
private:
uint8_t _flags;
uint32_t _timeScale;
uint32_t _entryCount;
uint32_t _globalEntryCount;
vector<AFRAENTRY> _localAccessEntries;
vector<GLOBALAFRAENTRY> _globalAccessEntries;
public:
AtomAFRA(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomAFRA();
protected:
virtual bool ReadData();
};
#endif /* _ATOMAFRA_H */
#endif /* HAS_MEDIA_MP4 */
| 1,509
|
C++
|
.h
| 50
| 28.4
| 80
| 0.763937
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,465
|
atomhdlr.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomhdlr.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMHDLR_H
#define _ATOMHDLR_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomHDLR
: public VersionedAtom {
private:
uint32_t _componentType;
uint32_t _componentSubType;
uint32_t _componentManufacturer;
uint32_t _componentFlags;
uint32_t _componentFlagsMask;
string _componentName;
public:
AtomHDLR(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomHDLR();
uint32_t GetComponentSubType();
virtual string Hierarchy(uint32_t indent);
protected:
virtual bool ReadData();
};
#endif /* _ATOMHDLR_H */
#endif /* HAS_MEDIA_MP4 */
| 1,393
|
C++
|
.h
| 41
| 32.121951
| 80
| 0.764487
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,466
|
atomdinf.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomdinf.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMDINF_H
#define _ATOMDINF_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomDREF;
class AtomDINF
: public BoxAtom {
private:
AtomDREF *_pDREF;
public:
AtomDINF(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomDINF();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMDINF_H */
#endif /* HAS_MEDIA_MP4 */
| 1,187
|
C++
|
.h
| 35
| 32.085714
| 80
| 0.752838
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,467
|
atommdia.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommdia.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMDIA_H
#define _ATOMMDIA_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomMDHD;
class AtomHDLR;
class AtomMINF;
class AtomDINF;
class AtomSTBL;
class AtomMDIA
: public BoxAtom {
private:
AtomMDHD *_pMDHD;
AtomHDLR *_pHDLR;
AtomMINF *_pMINF;
AtomDINF *_pDINF;
AtomSTBL *_pSTBL;
public:
AtomMDIA(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMDIA();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMMDIA_H */
#endif /* HAS_MEDIA_MP4 */
| 1,328
|
C++
|
.h
| 43
| 29.093023
| 80
| 0.75646
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,468
|
atomurl.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomurl.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMURL_H
#define _ATOMURL_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomURL
: public VersionedAtom {
private:
string _location;
public:
AtomURL(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomURL();
protected:
virtual bool ReadData();
};
#endif /* _ATOMURL_H */
#endif /* HAS_MEDIA_MP4 */
| 1,158
|
C++
|
.h
| 34
| 32.235294
| 79
| 0.751342
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,469
|
atomudta.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomudta.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMUDTA_H
#define _ATOMUDTA_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomUDTA
: public BoxAtom {
private:
Variant _metadata;
public:
AtomUDTA(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomUDTA();
Variant &GetMetadata();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMUDTA_H */
#endif /* HAS_MEDIA_MP4 */
| 1,195
|
C++
|
.h
| 35
| 32.342857
| 80
| 0.753033
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,470
|
atomavc1.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomavc1.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMAVC1_H
#define _ATOMAVC1_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomAVCC;
class AtomAVC1
: public BoxAtom {
private:
AtomAVCC *_pAVCC;
public:
AtomAVC1(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomAVC1();
protected:
virtual bool Read();
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMAVC1_H */
#endif /* HAS_MEDIA_MP4 */
| 1,209
|
C++
|
.h
| 36
| 31.75
| 80
| 0.75279
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,471
|
atomesds.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomesds.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMESDS_H
#define _ATOMESDS_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomESDS
: public VersionedAtom {
private:
uint16_t _MP4ESDescrTag_ID;
uint8_t _MP4ESDescrTag_Priority;
uint8_t _MP4DecConfigDescrTag_ObjectTypeID;
uint8_t _MP4DecConfigDescrTag_StreamType;
uint32_t _MP4DecConfigDescrTag_BufferSizeDB;
uint32_t _MP4DecConfigDescrTag_MaxBitRate;
uint32_t _MP4DecConfigDescrTag_AvgBitRate;
uint64_t _extraDataStart;
uint64_t _extraDataLength;
bool _isMP3;
#ifdef DEBUG_ESDS_ATOM
uint8_t _objectType;
uint8_t _sampleRate;
uint8_t _channels;
uint8_t _extObjectType;
uint8_t _sbr;
uint8_t _extSampleRate;
#endif /* DEBUG_ESDS_ATOM */
public:
AtomESDS(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomESDS();
bool IsMP3();
uint64_t GetExtraDataStart();
uint64_t GetExtraDataLength();
protected:
virtual bool ReadData();
private:
bool ReadTagLength(uint32_t &length);
bool ReadTagAndLength(uint8_t &tagType, uint32_t &length);
bool ReadESDescrTag();
bool ReadDecoderConfigDescriptorTag();
};
#endif /* _ATOMESDS_H */
#endif /* HAS_MEDIA_MP4 */
| 1,930
|
C++
|
.h
| 59
| 30.864407
| 80
| 0.773605
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,472
|
atomstbl.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomstbl.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSTBL_H
#define _ATOMSTBL_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomSTSD;
class AtomSTTS;
class AtomSTSC;
class AtomSTSZ;
class AtomSTCO;
class AtomCO64;
class AtomCTTS;
class AtomSTSS;
class AtomSTBL
: public BoxAtom {
private:
AtomSTSD *_pSTSD;
AtomSTTS *_pSTTS;
AtomSTSC *_pSTSC;
AtomSTSZ *_pSTSZ;
AtomSTCO *_pSTCO;
AtomCO64 *_pCO64;
AtomCTTS *_pCTTS;
AtomSTSS *_pSTSS;
public:
AtomSTBL(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSTBL();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMSTBL_H */
#endif /* HAS_MEDIA_MP4 */
| 1,434
|
C++
|
.h
| 49
| 27.489796
| 80
| 0.758721
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,473
|
atommoof.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommoof.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMOOF_H
#define _ATOMMOOF_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomMFHD;
class AtomTRAF;
class AtomMOOF
: public BoxAtom {
private:
AtomMFHD *_pMFHD;
map<uint32_t, AtomTRAF *> _trafs;
public:
AtomMOOF(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMOOF();
map<uint32_t, AtomTRAF *> &GetTrafs();
protected:
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMMOOF_H */
#endif /* HAS_MEDIA_MP4 */
| 1,282
|
C++
|
.h
| 38
| 31.815789
| 80
| 0.745763
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,474
|
atomvmhd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomvmhd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMVMHD_H
#define _ATOMVMHD_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomVMHD
: public VersionedAtom {
private:
uint16_t _graphicsMode;
uint8_t _opcolor[6];
public:
AtomVMHD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomVMHD();
protected:
virtual bool ReadData();
};
#endif /* _ATOMVMHD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,192
|
C++
|
.h
| 35
| 32.228571
| 80
| 0.75152
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,475
|
atomdref.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomdref.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMDREF_H
#define _ATOMDREF_H
#include "mediaformats/readers/mp4/versionedboxatom.h"
class AtomURL;
class AtomDREF
: public VersionedBoxAtom {
private:
vector<AtomURL *> _urls;
public:
AtomDREF(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomDREF();
protected:
virtual bool ReadData();
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMDREF_H */
#endif /* HAS_MEDIA_MP4 */
| 1,238
|
C++
|
.h
| 36
| 32.527778
| 80
| 0.755444
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,476
|
atomwave.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomwave.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMWAVE_H
#define _ATOMWAVE_H
#include "mediaformats/readers/mp4/boxatom.h"
class AtomMP4A;
class AtomESDS;
class AtomWAVE
: public BoxAtom {
private:
AtomMP4A *_pMP4A;
AtomESDS *_pESDS;
public:
AtomWAVE(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomWAVE();
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMWAVE_H */
#endif /* HAS_MEDIA_MP4 */
| 1,212
|
C++
|
.h
| 36
| 31.805556
| 80
| 0.752568
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,477
|
versionedatom.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/versionedatom.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _VERSIONEDATOM_H
#define _VERSIONEDATOM_H
#include "mediaformats/readers/mp4/baseatom.h"
class VersionedAtom
: public BaseAtom {
protected:
uint8_t _version;
uint8_t _flags[3];
public:
VersionedAtom(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~VersionedAtom();
bool Read();
virtual string Hierarchy(uint32_t indent);
protected:
virtual bool ReadData() = 0;
};
#endif /* _VERSIONEDATOM_H */
#endif /* HAS_MEDIA_MP4 */
| 1,268
|
C++
|
.h
| 37
| 32.432432
| 85
| 0.753469
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,478
|
atommp4a.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommp4a.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMP4A_H
#define _ATOMMP4A_H
class AtomESDS;
class AtomWAVE;
class AtomCHAN;
#include "mediaformats/readers/mp4/boxatom.h"
class AtomMP4A
: public BoxAtom {
protected:
AtomESDS *_pESDS;
AtomWAVE *_pWAVE;
AtomCHAN *_pCHAN;
public:
AtomMP4A(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMP4A();
protected:
virtual bool Read();
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMMP4A_H */
#endif /* HAS_MEDIA_MP4 */
| 1,280
|
C++
|
.h
| 40
| 30.225
| 80
| 0.755069
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,479
|
atomftyp.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomftyp.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMFTYP_H
#define _ATOMFTYP_H
#include "mediaformats/readers/mp4/baseatom.h"
class AtomFTYP
: public BaseAtom {
private:
uint32_t _majorBrand;
uint32_t _minorVersion;
vector<uint32_t> _compatibleBrands;
public:
AtomFTYP(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomFTYP();
virtual bool Read();
virtual string Hierarchy(uint32_t indent);
};
#endif /* _ATOMFTYP_H */
#endif /* HAS_MEDIA_MP4 */
| 1,251
|
C++
|
.h
| 36
| 32.833333
| 80
| 0.753107
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,480
|
atommfhd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommfhd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMFHD_H
#define _ATOMMFHD_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomMFHD
: public VersionedAtom {
private:
int32_t _sequenceNumber;
public:
AtomMFHD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMFHD();
protected:
virtual bool ReadData();
};
#endif /* _ATOMMFHD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,175
|
C++
|
.h
| 34
| 32.617647
| 80
| 0.74934
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,481
|
atomelst.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomelst.h
|
/*
* Copyright (c) 2009, Gavriloaie Eugen-Andrei (shiretu@gmail.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* *Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* *Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* *Neither the name of the DEVSS nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _ATOMELST_H
#define _ATOMELST_H
#include "mediaformats/readers/mp4/versionedatom.h"
typedef struct _ELSTEntry {
union {
struct {
uint64_t segmentDuration;
uint64_t mediaTime;
} _64;
struct {
uint32_t segmentDuration;
uint32_t mediaTime;
} _32;
} value;
uint16_t mediaRateInteger;
uint16_t mediaRateFraction;
} ELSTEntry;
class AtomELST
: public VersionedAtom {
private:
vector<ELSTEntry> _entries;
public:
AtomELST(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomELST();
protected:
virtual bool ReadData();
};
#endif /* _ATOMELST_H */
| 2,207
|
C++
|
.h
| 56
| 37.232143
| 80
| 0.776636
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,482
|
atomstsd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomstsd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSTSD_H
#define _ATOMSTSD_H
#include "mediaformats/readers/mp4/versionedboxatom.h"
class AtomAVC1;
class AtomMP4A;
class AtomSTSD
: public VersionedBoxAtom {
private:
AtomAVC1 *_pAVC1;
AtomMP4A *_pMP4A;
public:
AtomSTSD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSTSD();
protected:
virtual bool ReadData();
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMSTSD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,268
|
C++
|
.h
| 38
| 31.5
| 80
| 0.757576
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,483
|
atomuuid.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomuuid.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ATOMUUID_H
#define _ATOMUUID_H
#include "mediaformats/readers/mp4/baseatom.h"
class AtomUUID
: public BaseAtom {
private:
Variant _metadata;
public:
AtomUUID(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomUUID();
virtual bool Read();
string Hierarchy(uint32_t indent);
Variant &GetMetadata();
};
#endif /* _ATOMUUID_H */
| 1,153
|
C++
|
.h
| 33
| 33.030303
| 80
| 0.75292
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,484
|
atommeta.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atommeta.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMMETA_H
#define _ATOMMETA_H
#include "mediaformats/readers/mp4/versionedboxatom.h"
class AtomHDLR;
class AtomILST;
class AtomMETA
: public VersionedBoxAtom {
private:
AtomHDLR *_pHDLR;
AtomILST *_pILST;
public:
AtomMETA(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomMETA();
virtual bool Read();
protected:
virtual bool ReadData();
virtual bool AtomCreated(BaseAtom *pAtom);
};
#endif /* _ATOMMETA_H */
#endif /* HAS_MEDIA_MP4 */
| 1,290
|
C++
|
.h
| 39
| 31.205128
| 80
| 0.756844
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,485
|
atomtfhd.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomtfhd.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMTFHD_H
#define _ATOMTFHD_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomTFHD
: public VersionedAtom {
private:
int32_t _trackID;
int64_t _baseDataOffset;
int32_t _sampleDescriptionIndex;
int32_t _defaultSampleDuration;
int32_t _defaultSampleSize;
int32_t _defaultSampleFlags;
public:
AtomTFHD(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomTFHD();
uint32_t GetTrackId();
int64_t GetBaseDataOffset();
bool HasBaseDataOffset();
bool HasSampleDescriptionIndex();
bool HasDefaultSampleDuration();
bool HasDefaultSampleSize();
bool HasDefaultSampleFlags();
bool DurationIsEmpty();
protected:
virtual bool ReadData();
};
#endif /* _ATOMTFHD_H */
#endif /* HAS_MEDIA_MP4 */
| 1,557
|
C++
|
.h
| 47
| 31.148936
| 80
| 0.766113
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,486
|
atomstco.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/mp4/atomstco.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_MP4
#ifndef _ATOMSTCO_H
#define _ATOMSTCO_H
#include "mediaformats/readers/mp4/versionedatom.h"
class AtomSTCO
: public VersionedAtom {
private:
vector<uint64_t> _entries;
public:
AtomSTCO(MP4Document *pDocument, uint32_t type, uint64_t size, uint64_t start);
virtual ~AtomSTCO();
vector<uint64_t> GetEntries();
protected:
virtual bool ReadData();
};
#endif /* _ATOMSTCO_H */
#endif /* HAS_MEDIA_MP4 */
| 1,206
|
C++
|
.h
| 35
| 32.6
| 80
| 0.751718
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,487
|
tsparsereventsink.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tsparsereventsink.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSPARSEREVENTSINK_H
#define _TSPARSEREVENTSINK_H
#include "common.h"
#include "mediaformats/readers/ts/tsstreaminfo.h"
#include "mediaformats/readers/ts/pidtypes.h"
class TSPacketPAT;
class TSPacketPMT;
class BaseAVContext;
class BaseInStream;
class TSParserEventsSink {
public:
virtual ~TSParserEventsSink() {
}
virtual BaseInStream *GetInStream() = 0;
virtual void SignalResetChunkSize() = 0;
virtual void SignalPAT(TSPacketPAT *pPAT) = 0;
virtual void SignalPMT(TSPacketPMT *pPMT) = 0;
virtual void SignalPMTComplete() = 0;
virtual bool SignalStreamsPIDSChanged(map<uint16_t, TSStreamInfo> &streams) = 0;
virtual bool SignalStreamPIDDetected(TSStreamInfo &streamInfo,
BaseAVContext *pContext, PIDType type, bool &ignore) = 0;
virtual void SignalUnknownPIDDetected(TSStreamInfo &streamInfo) = 0;
virtual bool FeedData(BaseAVContext *pContext, uint8_t *pData,
uint32_t dataLength, double pts, double dts, bool isAudio) = 0;
};
#endif /* _TSPARSEREVENTSINK_H */
#endif /* HAS_MEDIA_TS */
| 1,815
|
C++
|
.h
| 46
| 37.543478
| 81
| 0.772856
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,488
|
tsframereader.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tsframereader.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSFRAMEREADER_H
#define _TSFRAMEREADER_H
#include "mediaformats/readers/ts/tsparser.h"
#include "mediaformats/readers/ts/tsparsereventsink.h"
#include "mediaformats/readers/mediafile.h"
#include "mediaformats/readers/mediaframe.h"
#include "streaming/streamcapabilities.h"
class TSFrameReaderInterface;
class BaseInStream;
class TSFrameReader
: public TSParser, TSParserEventsSink {
private:
MediaFile *_pFile;
bool _freeFile;
uint8_t _chunkSizeDetectionCount;
uint8_t _chunkSize;
uint32_t _defaultBlockSize;
bool _chunkSizeErrors;
IOBuffer _chunkBuffer;
bool _frameAvailable;
StreamCapabilities _streamCapabilities;
bool _eof;
TSFrameReaderInterface *_pInterface;
public:
TSFrameReader(TSFrameReaderInterface *pInterface);
virtual ~TSFrameReader();
bool SetFile(string filePath);
bool IsEOF();
bool Seek(uint64_t offset);
bool ReadFrame();
virtual BaseInStream *GetInStream();
virtual void SignalResetChunkSize();
virtual void SignalPAT(TSPacketPAT *pPAT);
virtual void SignalPMT(TSPacketPMT *pPMT);
virtual void SignalPMTComplete();
virtual bool SignalStreamsPIDSChanged(map<uint16_t, TSStreamInfo> &streams);
virtual bool SignalStreamPIDDetected(TSStreamInfo &streamInfo,
BaseAVContext *pContext, PIDType type, bool &ignore);
virtual void SignalUnknownPIDDetected(TSStreamInfo &streamInfo);
virtual bool FeedData(BaseAVContext *pContext, uint8_t *pData,
uint32_t dataLength, double pts, double dts, bool isAudio);
private:
void FreeFile();
bool DetermineChunkSize();
bool TestChunkSize(uint8_t chunkSize);
bool GetByteAt(uint64_t offset, uint8_t &byte);
};
#endif /* _TSFRAMEREADER_H */
#endif /* HAS_MEDIA_TS */
| 2,464
|
C++
|
.h
| 68
| 34.308824
| 77
| 0.79254
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,489
|
tsframereaderinterface.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tsframereaderinterface.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSFRAMEREADERINTERFACE_H
#define _TSFRAMEREADERINTERFACE_H
#include "common.h"
class BaseInStream;
class TSFrameReaderInterface {
public:
virtual ~TSFrameReaderInterface() {
}
virtual BaseInStream *GetInStream() = 0;
virtual bool SignalFrame(uint8_t *pData, uint32_t dataLength, double pts,
double dts, bool isAudio) = 0;
};
#endif /* _TSFRAMEREADERINTERFACE_H */
#endif /* HAS_MEDIA_TS */
| 1,207
|
C++
|
.h
| 33
| 34.606061
| 74
| 0.75729
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,490
|
pidtypes.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/pidtypes.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _PIDTYPES_H
#define _PIDTYPES_H
#include "common.h"
//iso13818-1 page 37/174
//Table 2-3 – PID table
//WARN: This are not the values from the table. This are types-over-types
enum PIDType {
PID_TYPE_UNKNOWN,
PID_TYPE_PAT,
PID_TYPE_PMT,
PID_TYPE_NIT,
PID_TYPE_CAT,
PID_TYPE_TSDT,
PID_TYPE_RESERVED,
PID_TYPE_AUDIOSTREAM,
PID_TYPE_VIDEOSTREAM,
PID_TYPE_NULL
};
#endif /* _PIDTYPES_H */
#endif /* HAS_MEDIA_TS */
| 1,230
|
C++
|
.h
| 39
| 29.666667
| 73
| 0.742399
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,491
|
tspacketpat.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tspacketpat.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSPACKETPAT_H
#define _TSPACKETPAT_H
#include "common.h"
//iso13818-1.pdf page 61/174
//Table 2-25 – Program association section
class TSPacketPAT {
private:
//fields
uint8_t _tableId;
bool _sectionSyntaxIndicator;
bool _reserved1;
uint8_t _reserved2;
uint16_t _sectionLength;
uint16_t _transportStreamId;
uint8_t _reserved3;
uint8_t _versionNumber;
bool _currentNextIndicator;
uint8_t _sectionNumber;
uint8_t _lastSectionNumber;
uint32_t _crc;
//internal variables
uint32_t _patStart;
uint32_t _patLength;
uint32_t _entriesCount;
map<uint16_t, uint16_t> _networkPids;
map<uint16_t, uint16_t> _programPids;
public:
TSPacketPAT();
virtual ~TSPacketPAT();
operator string();
bool Read(uint8_t *pBuffer, uint32_t &cursor, uint32_t maxCursor);
map<uint16_t, uint16_t> &GetPMTs();
map<uint16_t, uint16_t> &GetNITs();
uint32_t GetCRC();
static uint32_t PeekCRC(uint8_t *pBuffer, uint32_t cursor, uint32_t maxCursor);
};
#endif /* _TSPACKETPAT_H */
#endif /* HAS_MEDIA_TS */
| 1,810
|
C++
|
.h
| 57
| 29.789474
| 80
| 0.752009
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,492
|
tsdocument.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tsdocument.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSDOCUMENT_H
#define _TSDOCUMENT_H
#include "common.h"
#include "mediaformats/readers/basemediadocument.h"
#include "mediaformats/readers/ts/tsparsereventsink.h"
class TSParser;
class BaseInStream;
class TSDocument
: public BaseMediaDocument, TSParserEventsSink {
private:
uint8_t _chunkSizeDetectionCount;
uint8_t _chunkSize;
TSParser *_pParser;
bool _chunkSizeErrors;
uint64_t _lastOffset;
public:
TSDocument(Metadata &metadata);
virtual ~TSDocument();
virtual BaseInStream *GetInStream();
virtual void SignalResetChunkSize();
virtual void SignalPAT(TSPacketPAT *pPAT);
virtual void SignalPMT(TSPacketPMT *pPMT);
virtual void SignalPMTComplete();
virtual bool SignalStreamsPIDSChanged(map<uint16_t, TSStreamInfo> &streams);
virtual bool SignalStreamPIDDetected(TSStreamInfo &streamInfo,
BaseAVContext *pContext, PIDType type, bool &ignore);
virtual void SignalUnknownPIDDetected(TSStreamInfo &streamInfo);
virtual bool FeedData(BaseAVContext *pContext, uint8_t *pData,
uint32_t dataLength, double pts, double dts, bool isAudio);
protected:
virtual bool ParseDocument();
virtual bool BuildFrames();
virtual Variant GetPublicMeta();
private:
void AddFrame(double pts, double dts, uint8_t frameType);
bool DetermineChunkSize();
bool GetByteAt(uint64_t offset, uint8_t &byte);
bool TestChunkSize(uint8_t chunkSize);
};
#endif /* _TSDOCUMENT_H */
#endif /* HAS_MEDIA_TS */
| 2,208
|
C++
|
.h
| 60
| 34.916667
| 77
| 0.786081
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,493
|
tsboundscheck.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tsboundscheck.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSBOUNDSCHECK_H
#define _TSBOUNDSCHECK_H
#define TS_CHECK_BOUNDS(size) if((cursor+(size))>(maxCursor)){ FATAL("Bounds error: cursor: %u; size: %u; maxCursor: %u",(uint32_t)cursor,(uint32_t)(size),(uint32_t)maxCursor);return false;}
#endif /* _TSBOUNDSCHECK_H */
#endif /* HAS_MEDIA_TS */
| 1,095
|
C++
|
.h
| 24
| 43.708333
| 190
| 0.736398
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,494
|
tspacketheader.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tspacketheader.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSPACKETHEADER_H
#define _TSPACKETHEADER_H
#include "common.h"
//iso13818-1.pdf page 36/174
//Table 2-2 – Transport packet of this Recommendation | International Standard
#define TS_TRANSPORT_PACKET_PID(x) ((uint16_t)(((x)>>8)&0x00001fff))
#define TS_TRANSPORT_PACKET_HAS_ADAPTATION_FIELD(x) ((bool)(((x)&(0x00000020))!=0))
#define TS_TRANSPORT_PACKET_HAS_PAYLOAD(x) ((bool)(((x)&(0x00000010))!=0))
#define TS_TRANSPORT_PACKET_IS_PAYLOAD_START(x) ((bool)(((x)&(0x00400000))!=0))
#endif /* _TSPACKETHEADER_H */
#endif /* HAS_MEDIA_TS */
| 1,352
|
C++
|
.h
| 30
| 43.333333
| 83
| 0.730448
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,495
|
streamdescriptors.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/streamdescriptors.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _STREAMDESCRIPTORS_H
#define _STREAMDESCRIPTORS_H
#include "common.h"
//frame rates
//ISO13818-2 table 6-4 (61/255)
#define FRAME_RATE_CODE_FORBIDEN 0
//23, 976
#define FRAME_RATE_CODE_24_PARTIAL 1
#define FRAME_RATE_CODE_24 2
#define FRAME_RATE_CODE_25 3
//29, 97
#define FRAME_RATE_CODE_30_PARTIAL 4
#define FRAME_RATE_CODE_30 5
#define FRAME_RATE_CODE_50 6
//59, 94
#define FRAME_RATE_CODE_60_PARTIAL 7
#define FRAME_RATE_CODE_60 8
//data stream alignaments
//ISO13818-1 Table 2-47 : Video stream alignment values (85/174)
#define DATA_STREAM_ALIGNMENT_SLICE 1
#define DATA_STREAM_ALIGNMENT_VIDEO_ACCESS_UNIT 2
#define DATA_STREAM_ALIGNMENT_GOP_SEQ 3
#define DATA_STREAM_ALIGNMENT_SEQ 4
//udio types values
//ISO13818-1 Table 2-53 : Audio type values (88/174)
#define AUDIO_TYPE_UNDEFINED 0x00
#define AUDIO_TYPE_CLEAN_EFFECTS 0x01
#define AUDIO_TYPE_HEARING_IMPAIRED 0x02
#define AUDIO_TYPE_VISUALY_IMPAIRED 0x03
//descriptors types
//ISO13818-1 Table 2-39 : Program and program element descriptors (81/174)
#define DESCRIPTOR_TYPE_USER_PRIVATE 255
#define DESCRIPTOR_TYPE_VIDEO 2
#define DESCRIPTOR_TYPE_REGISTRATION 5
#define DESCRIPTOR_TYPE_DATA_STREAM_ALIGNMENT 6
#define DESCRIPTOR_TYPE_ISO_639_LANGUAGE 10
#define DESCRIPTOR_TYPE_SMOOTHING_BUFFER 16
#define DESCRIPTOR_TYPE_IOD_DESCRIPTOR 29
#define DESCRIPTOR_TYPE_FMC_DESCRIPTOR 31
struct StreamDescriptor {
uint8_t type;
uint8_t length;
union {
struct {
uint32_t maximum_bitrate;
} maximum_bitrate_descriptor;
} payload;
operator string() {
return format("type: %hhu; length: %hhu", type, length);
};
};
bool ReadStreamDescriptor(StreamDescriptor &descriptor,
uint8_t *pBuffer, uint32_t &cursor, uint32_t maxCursor);
#endif /* _STREAMDESCRIPTORS_H */
#endif /* HAS_MEDIA_TS */
| 2,574
|
C++
|
.h
| 74
| 33.121622
| 74
| 0.775855
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,496
|
avcontext.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/avcontext.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _AVCONTEXT_H
#define _AVCONTEXT_H
#include "common.h"
class StreamCapabilities;
class TSParserEventsSink;
class BaseInStream;
class BaseAVContext {
public:
struct {
double time;
uint64_t lastRaw;
uint32_t rollOverCount;
} _pts, _dts;
int8_t _sequenceNumber;
uint64_t _droppedPacketsCount;
uint64_t _droppedBytesCount;
uint64_t _packetsCount;
uint64_t _bytesCount;
IOBuffer _bucket;
StreamCapabilities *_pStreamCapabilities;
TSParserEventsSink *_pEventsSink;
public:
BaseAVContext();
virtual ~BaseAVContext();
virtual void Reset();
void DropPacket();
virtual bool HandleData() = 0;
bool FeedData(uint8_t *pData, uint32_t dataLength, double pts, double dts,
bool isAudio);
BaseInStream *GetInStream();
private:
void InternalReset();
};
class H264AVContext
: public BaseAVContext {
private:
IOBuffer _SPS;
IOBuffer _PPS;
vector<IOBuffer *> _backBuffers;
vector<IOBuffer *> _backBuffersCache;
double _backBuffersPts;
double _backBuffersDts;
public:
H264AVContext();
virtual ~H264AVContext();
virtual void Reset();
virtual bool HandleData();
private:
void EmptyBackBuffers();
void DiscardBackBuffers();
void InsertBackBuffer(uint8_t *pBuffer, int32_t length);
bool ProcessNal(uint8_t *pBuffer, int32_t length, double pts, double dts);
void InitializeCapabilities(uint8_t *pData, uint32_t length);
void InternalReset();
};
class AACAVContext
: public BaseAVContext {
private:
double _lastSentTimestamp;
double _samplingRate;
bool _initialMarkerFound;
uint32_t _markerRetryCount;
public:
AACAVContext();
virtual ~AACAVContext();
virtual void Reset();
virtual bool HandleData();
private:
void InitializeCapabilities(uint8_t *pData, uint32_t length);
void InternalReset();
};
#endif /* _AVCONTEXT_H */
#endif /* HAS_MEDIA_TS */
| 2,580
|
C++
|
.h
| 92
| 26.206522
| 75
| 0.774285
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,497
|
tspacketpmt.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tspacketpmt.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSPACKETPMT_H
#define _TSPACKETPMT_H
#include "common.h"
#include "mediaformats/readers/ts/streamdescriptors.h"
#include "mediaformats/readers/ts/tsstreaminfo.h"
//Table 2-29 : Stream type assignments
/*
0x00 ITU-T | ISO/IEC Reserved
0x01 ISO/IEC 11172 Video
0x02 ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or ISO/IEC 11172-2 constrained parameter video stream
0x03 ISO/IEC 11172 Audio
0x04 ISO/IEC 13818-3 Audio
0x05 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private_sections
0x06 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data
0x07 ISO/IEC 13522 MHEG
0x08 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A DSM-CC
0x09 ITU-T Rec. H.222.1
0x0a ISO/IEC 13818-6 type A
0x0b ISO/IEC 13818-6 type B
0x0c ISO/IEC 13818-6 type C
0x0d ISO/IEC 13818-6 type D
0x0e ITU-T Rec. H.222.0 | ISO/IEC 13818-1 auxiliary
0x0f ISO/IEC 13818-7 Audio with ADTS transport syntax
0x10 ISO/IEC 14496-2 Visual
0x11 ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1
0x12 ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in PES packets
0x13 ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections.
0x14 ISO/IEC 13818-6 Synchronized Download Protocol
0x15-0x7f ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
*/
#define TS_STREAMTYPE_VIDEO_MPEG1 0x01
#define TS_STREAMTYPE_VIDEO_MPEG2 0x02
#define TS_STREAMTYPE_VIDEO_MPEG4 0x10
#define TS_STREAMTYPE_VIDEO_H264 0x1b
#define TS_STREAMTYPE_VIDEO_VC1 0xea
#define TS_STREAMTYPE_VIDEO_DIRAC 0xd1
#define TS_STREAMTYPE_AUDIO_MPEG1 0x03
#define TS_STREAMTYPE_AUDIO_MPEG2 0x04
#define TS_STREAMTYPE_AUDIO_AAC 0x0f
#define TS_STREAMTYPE_AUDIO_AC3 0x81
#define TS_STREAMTYPE_AUDIO_DTS 0x8a
#define TS_STREAMTYPE_UNDEFINED 0x8a
//2.4.4.8
//iso13818-1.pdf page 64/174
//Table 2-28‚ Transport Stream program map section
class TSPacketPMT {
private:
//fields
uint8_t _tableId;
bool _sectionSyntaxIndicator;
bool _reserved1;
uint8_t _reserved2;
uint16_t _sectionLength;
uint16_t _programNumber;
uint8_t _reserved3;
uint8_t _versionNumber;
bool _currentNextIndicator;
uint8_t _sectionNumber;
uint8_t _lastSectionNumber;
uint8_t _reserved4;
uint16_t _pcrPid;
uint8_t _reserved5;
uint16_t _programInfoLength;
uint32_t _crc;
//internal variables
vector<StreamDescriptor> _programInfoDescriptors;
map<uint16_t, TSStreamInfo> _streams;
public:
TSPacketPMT();
virtual ~TSPacketPMT();
operator string();
uint16_t GetProgramNumber();
uint32_t GetCRC();
map<uint16_t, TSStreamInfo> & GetStreamsInfo();
bool Read(uint8_t *pBuffer, uint32_t &cursor, uint32_t maxCursor);
static uint32_t PeekCRC(uint8_t *pBuffer, uint32_t cursor, uint32_t maxCursor);
uint32_t GetBandwidth();
};
#endif /* _TSPACKETPMT_H */
#endif /* HAS_MEDIA_TS */
| 3,659
|
C++
|
.h
| 99
| 35.323232
| 100
| 0.761287
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,498
|
tsparser.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tsparser.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSPARSER_H
#define _TSPARSER_H
#include "common.h"
#include "mediaformats/readers/ts/piddescriptor.h"
class TSParserEventsSink;
#define TS_CHUNK_188 188
#define TS_CHUNK_204 204
#define TS_CHUNK_208 208
class TSParser {
private:
TSParserEventsSink *_pEventSink;
uint32_t _chunkSize;
map<uint16_t, PIDDescriptor *> _pidMapping;
map<uint16_t, uint16_t> _unknownPids;
uint64_t _totalParsedBytes;
public:
TSParser(TSParserEventsSink *pEventSink);
virtual ~TSParser();
void SetChunkSize(uint32_t chunkSize);
bool ProcessPacket(uint32_t packetHeader, IOBuffer &buffer,
uint32_t maxCursor);
bool ProcessBuffer(IOBuffer &buffer, bool chunkByChunk);
uint64_t GetTotalParsedBytes();
private:
void FreePidDescriptor(PIDDescriptor *pPIDDescriptor);
bool ProcessPidTypePAT(uint32_t packetHeader, PIDDescriptor &pidDescriptor,
uint8_t *pBuffer, uint32_t &cursor, uint32_t maxCursor);
bool ProcessPidTypePMT(uint32_t packetHeader, PIDDescriptor &pidDescriptor,
uint8_t *pBuffer, uint32_t &cursor, uint32_t maxCursor);
bool ProcessPidTypeAV(PIDDescriptor *pPIDDescriptor, uint8_t *pData,
uint32_t length, bool packetStart, int8_t sequenceNumber);
};
#endif /* _TSPARSER_H */
#endif /* HAS_MEDIA_TS */
| 2,022
|
C++
|
.h
| 53
| 36.169811
| 76
| 0.777664
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,499
|
tsstreaminfo.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/tsstreaminfo.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _TSSTREAMINFO_H
#define _TSSTREAMINFO_H
#include "common.h"
#include "mediaformats/readers/ts/streamdescriptors.h"
struct TSStreamInfo {
uint8_t streamType; //Table 2-29 : Stream type assignments
uint16_t elementaryPID;
uint16_t esInfoLength;
vector<StreamDescriptor> esDescriptors;
TSStreamInfo() {
streamType = 0;
elementaryPID = 0;
esInfoLength = 0;
}
operator string() {
return toString(0);
}
string toString(int32_t indent) {
string result = format("%sstreamType: 0x%02"PRIx8"; elementaryPID: %hu; esInfoLength: %hu; descriptors count: %"PRIz"u\n",
STR(string(indent, '\t')),
streamType, elementaryPID, esInfoLength, esDescriptors.size());
for (uint32_t i = 0; i < esDescriptors.size(); i++) {
result += format("%s%s", STR(string(indent + 1, '\t')), STR(esDescriptors[i]));
if (i != esDescriptors.size() - 1)
result += "\n";
}
return result;
}
};
#endif /* _TSSTREAMINFO_H */
#endif /* HAS_MEDIA_TS */
| 1,759
|
C++
|
.h
| 50
| 32.82
| 124
| 0.720917
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,500
|
piddescriptor.h
|
shiretu_crtmpserver/sources/thelib/include/mediaformats/readers/ts/piddescriptor.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAS_MEDIA_TS
#ifndef _PIDDESCRIPTOR_H
#define _PIDDESCRIPTOR_H
#include "common.h"
#include "mediaformats/readers/ts/pidtypes.h"
class BaseAVContext;
struct PIDDescriptor {
PIDType type;
uint16_t pid;
uint32_t crc;
BaseAVContext *pAVContext;
};
#endif /* _PIDDESCRIPTOR_H */
#endif /* HAS_MEDIA_TS */
| 1,091
|
C++
|
.h
| 32
| 32.25
| 72
| 0.754036
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,501
|
netio.h
|
shiretu_crtmpserver/sources/thelib/include/netio/netio.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NETIO_H
#define _NETIO_H
#include "netio/iohandlertype.h"
#include "netio/fdstats.h"
#ifdef NET_KQUEUE
#include "netio/kqueue/iohandler.h"
#include "netio/kqueue/iohandlermanager.h"
#include "netio/kqueue/iohandlermanagertoken.h"
#include "netio/kqueue/iotimer.h"
#include "netio/kqueue/tcpacceptor.h"
#include "netio/kqueue/tcpcarrier.h"
#include "netio/kqueue/udpcarrier.h"
#include "netio/kqueue/tcpconnector.h"
#ifdef HAS_KQUEUE_TIMERS
#define NETWORK_REACTOR "kqueue with EVFILT_TIMER support"
#else /* HAS_KQUEUE_TIMERS */
#define NETWORK_REACTOR "kqueue without EVFILT_TIMER support"
#endif /* HAS_KQUEUE_TIMERS */
#endif
#ifdef NET_EPOLL
#include "netio/epoll/iohandler.h"
#include "netio/epoll/iohandlermanager.h"
#include "netio/epoll/iohandlermanagertoken.h"
#include "netio/epoll/iotimer.h"
#include "netio/epoll/tcpacceptor.h"
#include "netio/epoll/tcpcarrier.h"
#include "netio/epoll/udpcarrier.h"
#include "netio/epoll/tcpconnector.h"
#ifdef HAS_EPOLL_TIMERS
#define NETWORK_REACTOR "epoll with timerfd_XXXX support"
#else /* HAS_EPOLL_TIMERS */
#define NETWORK_REACTOR "epoll without timerfd_XXXX support"
#endif /* HAS_EPOLL_TIMERS */
#endif
#ifdef NET_SELECT
#include "netio/select/iohandler.h"
#include "netio/select/iohandlermanager.h"
#include "netio/select/iotimer.h"
#include "netio/select/tcpacceptor.h"
#include "netio/select/tcpcarrier.h"
#include "netio/select/udpcarrier.h"
#include "netio/select/tcpconnector.h"
#define NETWORK_REACTOR "select"
#endif
#endif /* _NETIO_H */
| 2,294
|
C++
|
.h
| 63
| 35
| 72
| 0.779928
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,502
|
fdstats.h
|
shiretu_crtmpserver/sources/thelib/include/netio/fdstats.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _FDSTATS_H
#define _FDSTATS_H
#include "common.h"
#include "netio/iohandlertype.h"
#ifdef GLOBALLY_ACCOUNT_BYTES
#define ADD_IN_BYTES_MANAGED(t,b) IOHandlerManager::AddInBytesManaged(t,b)
#define ADD_OUT_BYTES_MANAGED(t,b) IOHandlerManager::AddOutBytesManaged(t,b)
#define ADD_IN_BYTES_RAWUDP(b) IOHandlerManager::AddInBytesRawUdp(b)
#define ADD_OUT_BYTES_RAWUDP(b) IOHandlerManager::AddOutBytesRawUdp(b)
#else
#define ADD_IN_BYTES_MANAGED(t,b)
#define ADD_OUT_BYTES_MANAGED(t,b)
#define ADD_IN_BYTES_RAWUDP(b)
#define ADD_OUT_BYTES_RAWUDP(b)
#endif /* GLOBALLY_ACCOUNT_BYTES */
class DLLEXP BaseFdStats {
private:
int64_t _current;
int64_t _max;
int64_t _total;
#ifdef GLOBALLY_ACCOUNT_BYTES
uint64_t _inBytes;
uint64_t _outBytes;
#endif /* GLOBALLY_ACCOUNT_BYTES */
public:
BaseFdStats();
virtual ~BaseFdStats();
void Reset();
inline void Increment() {
o_assert(_current >= 0);
o_assert(_max >= 0);
_current++;
_max = _max < _current ? _current : _max;
_total++;
o_assert(_current >= 0);
o_assert(_max >= 0);
}
inline void Decrement() {
o_assert(_current >= 0);
o_assert(_max >= 0);
_current--;
o_assert(_current >= 0);
o_assert(_max >= 0);
}
#ifdef GLOBALLY_ACCOUNT_BYTES
inline void AddInBytes(uint64_t bytes) {
_inBytes += bytes;
}
inline void AddOutBytes(uint64_t bytes) {
_outBytes += bytes;
}
#endif /* GLOBALLY_ACCOUNT_BYTES */
int64_t Current();
int64_t Max();
int64_t Total();
#ifdef GLOBALLY_ACCOUNT_BYTES
uint64_t InBytes();
uint64_t OutBytes();
#endif /* GLOBALLY_ACCOUNT_BYTES */
void ResetMax();
void ResetTotal();
#ifdef GLOBALLY_ACCOUNT_BYTES
void ResetInBytes();
void ResetOutBytes();
void ResetInOutBytes();
#endif /* GLOBALLY_ACCOUNT_BYTES */
operator string();
Variant ToVariant();
};
class DLLEXP FdStats {
private:
BaseFdStats _managedTcp;
BaseFdStats _managedTcpAcceptors;
BaseFdStats _managedTcpConnectors;
BaseFdStats _managedUdp;
BaseFdStats _managedNonTcpUdp;
BaseFdStats _rawUdp;
int64_t _max;
double _lastUpdateSpeedsTime;
uint64_t _lastInBytes;
uint64_t _lastOutBytes;
double _inSpeed;
double _outSpeed;
public:
FdStats();
virtual ~FdStats();
void Reset();
int64_t Current();
int64_t Max();
int64_t Total();
#ifdef GLOBALLY_ACCOUNT_BYTES
uint64_t InBytes();
uint64_t OutBytes();
double InSpeed();
double OutSpeed();
#endif /* GLOBALLY_ACCOUNT_BYTES */
void ResetMax();
void ResetTotal();
#ifdef GLOBALLY_ACCOUNT_BYTES
void ResetInBytes();
void ResetOutBytes();
void ResetInOutBytes();
#endif /* GLOBALLY_ACCOUNT_BYTES */
BaseFdStats &GetManagedTcp();
BaseFdStats &GetManagedTcpAcceptors();
BaseFdStats &GetManagedTcpConnectors();
BaseFdStats &GetManagedUdp();
BaseFdStats &GetManagedNonTcpUdp();
BaseFdStats &GetRawUdp();
inline void RegisterManaged(IOHandlerType type) {
AccountManaged(type, true);
}
inline void UnRegisterManaged(IOHandlerType type) {
AccountManaged(type, false);
}
#ifdef GLOBALLY_ACCOUNT_BYTES
inline void AddInBytesManaged(IOHandlerType type, uint64_t bytes) {
GetManaged(type)->AddInBytes(bytes);
}
inline void AddOutBytesManaged(IOHandlerType type, uint64_t bytes) {
GetManaged(type)->AddOutBytes(bytes);
}
#endif /* GLOBALLY_ACCOUNT_BYTES */
inline void RegisterRawUdp() {
AccountRawUdp(true);
}
inline void UnRegisterRawUdp() {
AccountRawUdp(false);
}
#ifdef GLOBALLY_ACCOUNT_BYTES
inline void AddInBytesRawUdp(uint64_t bytes) {
_rawUdp.AddInBytes(bytes);
}
inline void AddOutBytesRawUdp(uint64_t bytes) {
_rawUdp.AddOutBytes(bytes);
}
inline void UpdateSpeeds() {
double now;
GETCLOCKS(now, double);
uint64_t nowInBytes = InBytes();
uint64_t nowOutBytes = OutBytes();
if (_lastUpdateSpeedsTime > 0) {
double period = now - _lastUpdateSpeedsTime;
if (period > 0) {
double inBytes = (double) (nowInBytes - _lastInBytes);
double outBytes = (double) (nowOutBytes - _lastOutBytes);
if (inBytes > 0)
_inSpeed = inBytes / (period / (double) CLOCKS_PER_SECOND);
if (outBytes > 0)
_outSpeed = outBytes / (period / (double) CLOCKS_PER_SECOND);
}
} else {
_inSpeed = 0;
_outSpeed = 0;
}
_lastInBytes = nowInBytes;
_lastOutBytes = nowOutBytes;
_lastUpdateSpeedsTime = now;
}
#endif /* GLOBALLY_ACCOUNT_BYTES */
operator string();
Variant ToVariant();
private:
inline BaseFdStats *GetManaged(IOHandlerType type) {
switch (type) {
case IOHT_ACCEPTOR:
{
return &_managedTcpAcceptors;
}
case IOHT_TCP_CONNECTOR:
{
return &_managedTcpConnectors;
}
case IOHT_TCP_CARRIER:
{
return &_managedTcp;
}
case IOHT_UDP_CARRIER:
{
return &_managedUdp;
}
case IOHT_INBOUNDNAMEDPIPE_CARRIER:
case IOHT_TIMER:
case IOHT_STDIO:
default:
{
return &_managedNonTcpUdp;
}
}
}
inline void AccountManaged(IOHandlerType type, bool increment) {
BaseFdStats *pFdStats = GetManaged(type);
if (increment)
pFdStats->Increment();
else
pFdStats->Decrement();
int64_t current = Current();
_max = _max < current ? current : _max;
}
inline void AccountRawUdp(bool increment) {
if (increment)
_rawUdp.Increment();
else
_rawUdp.Decrement();
int64_t current = Current();
_max = _max < current ? current : _max;
}
};
#endif /* _FDSTATS_H */
| 6,057
|
C++
|
.h
| 227
| 24.180617
| 76
| 0.729418
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,503
|
tcpacceptor.h
|
shiretu_crtmpserver/sources/thelib/include/netio/kqueue/tcpacceptor.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_KQUEUE
#ifndef _TCPACCEPTOR_H
#define _TCPACCEPTOR_H
#include "netio/kqueue/iohandler.h"
class BaseClientApplication;
class TCPAcceptor
: public IOHandler {
private:
sockaddr_in _address;
vector<uint64_t> _protocolChain;
BaseClientApplication *_pApplication;
Variant _parameters;
bool _enabled;
uint32_t _acceptedCount;
uint32_t _droppedCount;
string _ipAddress;
uint16_t _port;
public:
TCPAcceptor(string ipAddress, uint16_t port, Variant parameters,
vector<uint64_t>/*&*/ protocolChain);
virtual ~TCPAcceptor();
bool Bind();
void SetApplication(BaseClientApplication *pApplication);
bool StartAccept();
virtual bool SignalOutputData();
virtual bool OnEvent(struct kevent &event);
virtual bool OnConnectionAvailable(struct kevent &event);
bool Accept();
bool Drop();
Variant & GetParameters();
BaseClientApplication *GetApplication();
vector<uint64_t> &GetProtocolChain();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
bool Enable();
void Enable(bool enabled);
private:
bool IsAlive();
};
#endif /* _TCPACCEPTOR_H */
#endif /* NET_KQUEUE */
| 1,882
|
C++
|
.h
| 58
| 30.5
| 72
| 0.768044
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,504
|
tcpcarrier.h
|
shiretu_crtmpserver/sources/thelib/include/netio/kqueue/tcpcarrier.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_KQUEUE
#ifndef _TCPCARRIER_H
#define _TCPCARRIER_H
#include "netio/kqueue/iohandler.h"
class TCPCarrier
: public IOHandler {
private:
bool _writeDataEnabled;
bool _enableWriteDataCalled;
sockaddr_in _farAddress;
string _farIp;
uint16_t _farPort;
sockaddr_in _nearAddress;
string _nearIp;
uint16_t _nearPort;
uint64_t _rx;
uint64_t _tx;
int32_t _ioAmount;
int _lastRecvError;
int _lastSendError;
public:
TCPCarrier(int32_t fd);
virtual ~TCPCarrier();
virtual bool OnEvent(struct kevent &event);
virtual bool SignalOutputData();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
sockaddr_in &GetFarEndpointAddress();
string GetFarEndpointAddressIp();
uint16_t GetFarEndpointPort();
sockaddr_in &GetNearEndpointAddress();
string GetNearEndpointAddressIp();
uint16_t GetNearEndpointPort();
private:
bool GetEndpointsInfo();
};
#endif /* _TCPCARRIER_H */
#endif /* NET_KQUEUE */
| 1,705
|
C++
|
.h
| 55
| 29.090909
| 72
| 0.767357
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,505
|
iotimer.h
|
shiretu_crtmpserver/sources/thelib/include/netio/kqueue/iotimer.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_KQUEUE
#ifndef _IOTIMER_H
#define _IOTIMER_H
#include "netio/kqueue/iohandler.h"
class IOTimer
: public IOHandler {
private:
static int32_t _idGenerator;
public:
IOTimer();
virtual ~IOTimer();
virtual bool SignalOutputData();
virtual bool OnEvent(struct kevent &event);
bool EnqueueForTimeEvent(uint32_t seconds);
bool EnqueueForHighGranularityTimeEvent(uint32_t milliseconds);
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
};
#endif /* _TIMERIO_H */
#endif /* NET_KQUEUE */
| 1,292
|
C++
|
.h
| 37
| 33.054054
| 72
| 0.760417
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,506
|
iohandlermanager.h
|
shiretu_crtmpserver/sources/thelib/include/netio/kqueue/iohandlermanager.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_KQUEUE
#ifndef _IOHANDLERMANAGER_H
#define _IOHANDLERMANAGER_H
#include "common.h"
#include "netio/kqueue/iohandlermanagertoken.h"
#include "netio/fdstats.h"
class IOHandler;
class IOHandlerManager {
private:
static vector<IOHandlerManagerToken *> _tokensVector1;
static vector<IOHandlerManagerToken *> _tokensVector2;
static vector<IOHandlerManagerToken *> *_pAvailableTokens;
static vector<IOHandlerManagerToken *> *_pRecycledTokens;
static map<uint32_t, IOHandler *> _activeIOHandlers;
static map<uint32_t, IOHandler *> _deadIOHandlers;
static int32_t _kq;
static struct kevent *_pDetectedEvents;
static struct kevent *_pPendingEvents;
static int32_t _pendingEventsCount;
static int32_t _eventsSize;
static FdStats _fdStats;
#ifndef HAS_KQUEUE_TIMERS
static struct timespec _timeout;
static TimersManager *_pTimersManager;
static struct kevent _dummy;
#endif /* HAS_KQUEUE_TIMERS */
private:
static void SetupToken(IOHandler *pIOHandler);
static void FreeToken(IOHandler *pIOHandler);
static bool RegisterEvent(int32_t fd, int16_t filter,
uint16_t flags, uint32_t fflags, uint32_t data,
IOHandlerManagerToken *pToken, bool ignoreError = false);
public:
static map<uint32_t, IOHandler *> & GetActiveHandlers();
static map<uint32_t, IOHandler *> & GetDeadHandlers();
static FdStats &GetStats(bool updateSpeeds);
static void Initialize();
static void Start();
static void SignalShutdown();
static void ShutdownIOHandlers();
static void Shutdown();
static void RegisterIOHandler(IOHandler *pIOHandler);
static void UnRegisterIOHandler(IOHandler *pIOHandler);
static int CreateRawUDPSocket();
static void CloseRawUDPSocket(int socket);
#ifdef GLOBALLY_ACCOUNT_BYTES
static void AddInBytesManaged(IOHandlerType type, uint64_t bytes);
static void AddOutBytesManaged(IOHandlerType type, uint64_t bytes);
static void AddInBytesRawUdp(uint64_t bytes);
static void AddOutBytesRawUdp(uint64_t bytes);
#endif /* GLOBALLY_ACCOUNT_BYTES */
static bool EnableReadData(IOHandler *pIOHandler);
static bool DisableReadData(IOHandler *pIOHandler, bool ignoreError = false);
static bool EnableWriteData(IOHandler *pIOHandler);
static bool DisableWriteData(IOHandler *pIOHandler, bool ignoreError = false);
static bool EnableAcceptConnections(IOHandler *pIOHandler);
static bool DisableAcceptConnections(IOHandler *pIOHandler, bool ignoreError = false);
static bool EnableTimer(IOHandler *pIOHandler, uint32_t seconds);
static bool EnableHighGranularityTimer(IOHandler *pIOHandler, uint32_t milliseconds);
static bool DisableTimer(IOHandler *pIOHandler, bool ignoreError = false);
static bool Pulse();
static void EnqueueForDelete(IOHandler *pIOHandler);
static uint32_t DeleteDeadHandlers();
private:
#ifndef HAS_KQUEUE_TIMERS
static bool ProcessTimer(TimerEvent &event);
#endif /* HAS_KQUEUE_TIMERS */
static inline void ResizeEvents();
};
#endif /* _IOHANDLERMANAGER_H */
#endif /* NET_KQUEUE */
| 3,726
|
C++
|
.h
| 89
| 39.977528
| 87
| 0.796363
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,507
|
iohandler.h
|
shiretu_crtmpserver/sources/thelib/include/netio/kqueue/iohandler.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_KQUEUE
#ifndef _IOHANDLER_H
#define _IOHANDLER_H
#include "common.h"
#include "netio/kqueue/iohandlermanagertoken.h"
#include "netio/iohandlertype.h"
class BaseProtocol;
class IOHandler {
protected:
static uint32_t _idGenerator;
uint32_t _id;
int32_t _inboundFd;
int32_t _outboundFd;
BaseProtocol *_pProtocol;
IOHandlerType _type;
private:
IOHandlerManagerToken *_pToken;
public:
IOHandler(int32_t inboundFd, int32_t outboundFd, IOHandlerType type);
virtual ~IOHandler();
void SetIOHandlerManagerToken(IOHandlerManagerToken *pToken);
IOHandlerManagerToken * GetIOHandlerManagerToken();
uint32_t GetId();
int32_t GetInboundFd();
int32_t GetOutboundFd();
IOHandlerType GetType();
void SetProtocol(BaseProtocol *pPotocol);
BaseProtocol *GetProtocol();
virtual bool SignalOutputData() = 0;
virtual bool OnEvent(struct kevent &event) = 0;
static string IOHTToString(IOHandlerType type);
virtual void GetStats(Variant &info, uint32_t namespaceId = 0) = 0;
};
#endif /* _IOHANDLER_H */
#endif /* NET_KQUEUE */
| 1,815
|
C++
|
.h
| 53
| 32.396226
| 72
| 0.77208
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,508
|
tcpconnector.h
|
shiretu_crtmpserver/sources/thelib/include/netio/kqueue/tcpconnector.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_KQUEUE
#ifndef _TCPCONNECTOR_H
#define _TCPCONNECTOR_H
#include "netio/kqueue/iohandler.h"
#include "protocols/baseprotocol.h"
#include "protocols/protocolfactorymanager.h"
#include "netio/kqueue/iohandlermanager.h"
#include "netio/kqueue/tcpcarrier.h"
template<class T>
class TCPConnector
: public IOHandler {
private:
string _ip;
uint16_t _port;
vector<uint64_t> _protocolChain;
bool _closeSocket;
Variant _customParameters;
bool _success;
public:
TCPConnector(int32_t fd, string ip, uint16_t port,
vector<uint64_t>& protocolChain, const Variant& customParameters)
: IOHandler(fd, fd, IOHT_TCP_CONNECTOR) {
_ip = ip;
_port = port;
_protocolChain = protocolChain;
_closeSocket = true;
_customParameters = customParameters;
_success = false;
}
virtual ~TCPConnector() {
if (!_success) {
T::SignalProtocolCreated(NULL, _customParameters);
}
if (_closeSocket) {
CLOSE_SOCKET(_inboundFd);
}
}
virtual bool SignalOutputData() {
ASSERT("Operation not supported");
return false;
}
virtual bool OnEvent(struct kevent &event) {
IOHandlerManager::EnqueueForDelete(this);
if (((event.flags & EV_ERROR) != 0) ||
((event.flags & EV_EOF) != 0)) {
DEBUG("***CONNECT ERROR: Unable to connect to: %s:%hu", STR(_ip),
_port);
_closeSocket = true;
return false;
}
BaseProtocol *pProtocol = ProtocolFactoryManager::CreateProtocolChain(
_protocolChain, _customParameters);
if (pProtocol == NULL) {
FATAL("Unable to create protocol chain");
_closeSocket = true;
return false;
}
TCPCarrier *pTCPCarrier = new TCPCarrier(_inboundFd);
pTCPCarrier->SetProtocol(pProtocol->GetFarEndpoint());
pProtocol->GetFarEndpoint()->SetIOHandler(pTCPCarrier);
if (!T::SignalProtocolCreated(pProtocol, _customParameters)) {
FATAL("Unable to signal protocol created");
delete pProtocol;
_closeSocket = true;
return false;
}
_success = true;
INFO("Outbound connection established: %s", STR(*pProtocol));
_closeSocket = false;
return true;
}
static bool Connect(string ip, uint16_t port,
vector<uint64_t>& protocolChain, Variant customParameters) {
int32_t fd = (int32_t) socket(PF_INET, SOCK_STREAM, 0);
if ((fd < 0) || (!setFdCloseOnExec(fd))) {
T::SignalProtocolCreated(NULL, customParameters);
int err = errno;
FATAL("Unable to create fd: (%d) %s", err, strerror(err));
return 0;
}
if (!setFdOptions(fd, false)) {
CLOSE_SOCKET(fd);
T::SignalProtocolCreated(NULL, customParameters);
FATAL("Unable to set socket options");
return false;
}
TCPConnector<T> *pTCPConnector = new TCPConnector(fd, ip, port,
protocolChain, customParameters);
if (!pTCPConnector->Connect()) {
IOHandlerManager::EnqueueForDelete(pTCPConnector);
FATAL("Unable to connect");
return false;
}
return true;
}
bool Connect() {
sockaddr_in address;
address.sin_family = PF_INET;
address.sin_addr.s_addr = inet_addr(STR(_ip));
if (address.sin_addr.s_addr == INADDR_NONE) {
FATAL("Unable to translate string %s to a valid IP address", STR(_ip));
return 0;
}
address.sin_port = EHTONS(_port); //----MARKED-SHORT----
if (!IOHandlerManager::EnableWriteData(this)) {
FATAL("Unable to enable reading data");
return false;
}
if (connect(_inboundFd, (sockaddr *) & address, sizeof (address)) != 0) {
int err = errno;
if (err != EINPROGRESS) {
FATAL("Unable to connect to %s:%hu (%d) %s", STR(_ip), _port,
err, strerror(err));
_closeSocket = true;
return false;
}
}
_closeSocket = false;
return true;
}
virtual void GetStats(Variant &info, uint32_t namespaceId = 0) {
}
};
#endif /* _TCPCONNECTOR_H */
#endif /* NET_KQUEUE */
| 4,508
|
C++
|
.h
| 143
| 28.447552
| 75
| 0.711747
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,509
|
udpcarrier.h
|
shiretu_crtmpserver/sources/thelib/include/netio/kqueue/udpcarrier.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_KQUEUE
#ifndef _UDPCARRIER_H
#define _UDPCARRIER_H
#include "netio/kqueue/iohandler.h"
class UDPCarrier
: public IOHandler {
private:
sockaddr_in _peerAddress;
sockaddr_in _nearAddress;
string _nearIp;
uint16_t _nearPort;
uint64_t _rx;
uint64_t _tx;
Variant _parameters;
int32_t _ioAmount;
private:
UDPCarrier(int32_t fd);
public:
virtual ~UDPCarrier();
virtual bool OnEvent(struct kevent &event);
virtual bool SignalOutputData();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
Variant &GetParameters();
void SetParameters(Variant parameters);
bool StartAccept();
string GetFarEndpointAddress();
uint16_t GetFarEndpointPort();
string GetNearEndpointAddress();
uint16_t GetNearEndpointPort();
static UDPCarrier* Create(string bindIp, uint16_t bindPort, uint16_t ttl,
uint16_t tos, string ssmIp);
static UDPCarrier* Create(string bindIp, uint16_t bindPort,
BaseProtocol *pProtocol, uint16_t ttl, uint16_t tos, string ssmIp);
private:
bool Setup(Variant &settings);
bool GetEndpointsInfo();
};
#endif /* _UDPCARRIER_H */
#endif /* NET_KQUEUE */
| 1,885
|
C++
|
.h
| 57
| 31.035088
| 74
| 0.765419
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,510
|
tcpacceptor.h
|
shiretu_crtmpserver/sources/thelib/include/netio/select/tcpacceptor.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#ifndef _TCPACCEPTOR_H
#define _TCPACCEPTOR_H
#include "netio/select/iohandler.h"
#include "protocols/baseprotocol.h"
class BaseClientApplication;
class DLLEXP TCPAcceptor
: public IOHandler {
private:
sockaddr_in _address;
vector<uint64_t> _protocolChain;
BaseClientApplication *_pApplication;
Variant _parameters;
bool _enabled;
uint32_t _acceptedCount;
uint32_t _droppedCount;
string _ipAddress;
uint16_t _port;
public:
TCPAcceptor(string ipAddress, uint16_t port, Variant parameters,
vector<uint64_t>/*&*/ protocolChain);
virtual ~TCPAcceptor();
bool Bind();
void SetApplication(BaseClientApplication *pApplication);
bool StartAccept();
virtual bool SignalOutputData();
virtual bool OnEvent(select_event &event);
virtual bool OnConnectionAvailable(select_event &event);
bool Accept();
bool Drop();
Variant & GetParameters();
BaseClientApplication *GetApplication();
vector<uint64_t> &GetProtocolChain();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
bool Enable();
void Enable(bool enabled);
private:
bool IsAlive();
};
#endif /* _TCPACCEPTOR_H */
#endif /* NET_SELECT */
| 1,923
|
C++
|
.h
| 59
| 30.661017
| 72
| 0.769272
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,511
|
tcpcarrier.h
|
shiretu_crtmpserver/sources/thelib/include/netio/select/tcpcarrier.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#ifndef _TCPCARRIER_H
#define _TCPCARRIER_H
#include "netio/select/iohandler.h"
class BaseProtocol;
class DLLEXP TCPCarrier
: public IOHandler {
private:
bool _writeDataEnabled;
bool _enableWriteDataCalled;
sockaddr_in _farAddress;
string _farIp;
uint16_t _farPort;
sockaddr_in _nearAddress;
string _nearIp;
uint16_t _nearPort;
int32_t _sendBufferSize;
int32_t _recvBufferSize;
uint64_t _rx;
uint64_t _tx;
int32_t _ioAmount;
int _lastRecvError;
int _lastSendError;
public:
TCPCarrier(int32_t fd);
virtual ~TCPCarrier();
virtual bool OnEvent(select_event &event);
virtual bool SignalOutputData();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
sockaddr_in &GetFarEndpointAddress();
string GetFarEndpointAddressIp();
uint16_t GetFarEndpointPort();
sockaddr_in &GetNearEndpointAddress();
string GetNearEndpointAddressIp();
uint16_t GetNearEndpointPort();
private:
bool GetEndpointsInfo();
};
#endif /* _TCPCARRIER_H */
#endif /* NET_SELECT */
| 1,784
|
C++
|
.h
| 58
| 28.844828
| 72
| 0.769948
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,512
|
iotimer.h
|
shiretu_crtmpserver/sources/thelib/include/netio/select/iotimer.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#ifndef _IOTIMER_H
#define _IOTIMER_H
#include "netio/select/iohandler.h"
class DLLEXP IOTimer
: public IOHandler {
private:
static int32_t _idGenerator;
public:
IOTimer();
virtual ~IOTimer();
virtual bool SignalOutputData();
virtual bool OnEvent(select_event &event);
bool EnqueueForTimeEvent(uint32_t seconds);
bool EnqueueForHighGranularityTimeEvent(uint32_t milliseconds);
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
};
#endif /* _TIMERIO_H */
#endif /* NET_SELECT */
| 1,298
|
C++
|
.h
| 37
| 33.216216
| 72
| 0.760766
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,513
|
iohandlermanager.h
|
shiretu_crtmpserver/sources/thelib/include/netio/select/iohandlermanager.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#ifndef _IOHANDLERMANAGER_H
#define _IOHANDLERMANAGER_H
#include "common.h"
#include "netio/fdstats.h"
class IOHandler;
class DLLEXP IOHandlerManager {
static map<uint32_t, IOHandler *> _activeIOHandlers;
static map<uint32_t, IOHandler *> _deadIOHandlers;
static fd_set _readFds;
static fd_set _writeFds;
static fd_set _readFdsCopy;
static fd_set _writeFdsCopy;
static select_event _currentEvent;
static struct timeval _timeout;
static TimersManager *_pTimersManager;
static map<int32_t, map<uint32_t, uint8_t> > _fdState;
static bool _isShuttingDown;
static FdStats _fdStats;
public:
static map<uint32_t, IOHandler *> & GetActiveHandlers();
static map<uint32_t, IOHandler *> & GetDeadHandlers();
static FdStats &GetStats(bool updateSpeeds);
/*!
@brief Initializes the handler manager.
*/
static void Initialize();
static void Start();
/*!
@brief Sets the shutdown signal to true.
*/
static void SignalShutdown();
/*!
@brief Enqueues all active handlers for delete
*/
static void ShutdownIOHandlers();
/*!
@brief Shuts down the IO handlers by deleting the TimersManager
*/
static void Shutdown();
/*!
@brief Registers the IO handler. It is considered active once successfully registered.
@param pIOHandler: Pointer to the IO handler to be registered
@discussion If the IO handler being registered is already active, this function will do nothing but display a log message about it.
*/
static void RegisterIOHandler(IOHandler *pIOHandler);
/*!
@brief Erases the IO handler.
@param pIOHandler: Pointer to the IO handler to be erased.
@discussion: When this function runs, it disables this IO handler's timer and prohibits read/write data and connection acceptance.
*/
static void UnRegisterIOHandler(IOHandler *pIOHandler);
static int CreateRawUDPSocket();
static void CloseRawUDPSocket(int socket);
#ifdef GLOBALLY_ACCOUNT_BYTES
static void AddInBytesManaged(IOHandlerType type, uint64_t bytes);
static void AddOutBytesManaged(IOHandlerType type, uint64_t bytes);
static void AddInBytesRawUdp(uint64_t bytes);
static void AddOutBytesRawUdp(uint64_t bytes);
#endif /* GLOBALLY_ACCOUNT_BYTES */
/*!
@brief Enables the IO handler to read data.
@discussion This assigns a FDSTATE_READ_ENABLED to the inbound file descriptor's state
*/
static bool EnableReadData(IOHandler *pIOHandler);
/*!
@brief Prohibits the IO handler to read data
*/
static bool DisableReadData(IOHandler *pIOHandler);
/*!
@brief Enables the IO handler to write data.
@discussion This assigns a FDSTATE_WRITE_ENABLED to the inbound file descriptor's state
*/
static bool EnableWriteData(IOHandler *pIOHandler);
/*!
@brief Prohibits the IO handler to write data
*/
static bool DisableWriteData(IOHandler *pIOHandler);
/*!
@brief Enables the IO handler to accept connections
@discussion This assigns a FDSTATE_READ_ENABLED to the outbound file descriptor's state
*/
static bool EnableAcceptConnections(IOHandler *pIOHandler);
/*!
@brief Prohibits the IO handler to accept connections
*/
static bool DisableAcceptConnections(IOHandler *pIOHandler);
/*!
@brief Adds a timer event to the TimersManager.
@param pIOHandler: The function uses this IO handler's id to set the value of the event's id.
@param seconds: The timer's period is set to seconds
*/
static bool EnableTimer(IOHandler *pIOHandler, uint32_t seconds);
/*!
@brief Adds a timer event to the TimersManager.
@param pIOHandler: The function uses this IO handler's id to set the value of the event's id.
@param milliseconds: The timer's period is set to milliseconds
*/
static bool EnableHighGranularityTimer(IOHandler *pIOHandler, uint32_t milliseconds);
/*!
@brief Removes the timer to the TimersManager
*/
static bool DisableTimer(IOHandler *pIOHandler);
static bool Pulse();
/*!
@brief Enqueues the IO handler for delete by treating it as a dead handler
*/
static void EnqueueForDelete(IOHandler *pIOHandler);
/*!
@brief Erases all dead IO handlers
*/
static uint32_t DeleteDeadHandlers();
private:
static bool UpdateFdSets(int32_t fd);
static bool ProcessTimer(TimerEvent &event);
};
#endif /* _IOHANDLERMANAGER_H */
#endif /* NET_SELECT */
| 5,043
|
C++
|
.h
| 136
| 34.654412
| 133
| 0.76983
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,514
|
iohandler.h
|
shiretu_crtmpserver/sources/thelib/include/netio/select/iohandler.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#ifndef _IOHANDLER_H
#define _IOHANDLER_H
#include "common.h"
#include "netio/iohandlertype.h"
class BaseProtocol;
/*!
@class IOHandler
*/
class DLLEXP IOHandler {
protected:
static uint32_t _idGenerator;
uint32_t _id;
int32_t _inboundFd;
int32_t _outboundFd;
BaseProtocol *_pProtocol;
IOHandlerType _type;
public:
IOHandler(int32_t inboundFd, int32_t outboundFd, IOHandlerType type);
virtual ~IOHandler();
/*!
@brief Returns the id of the IO handler.
*/
uint32_t GetId();
/*!
@brief Returns the id of the inbound file descriptor
*/
int32_t GetInboundFd();
/*!
@brief Returns the id of the outbound file descriptor
*/
int32_t GetOutboundFd();
/*!
@brief Returns the IOHandler type
*/
IOHandlerType GetType();
/*!
@brief Sets the protocol for the IO handler
@param pProtocol
*/
void SetProtocol(BaseProtocol *pPotocol);
/*!
@brief Gets the protocol of the IO handler
*/
BaseProtocol *GetProtocol();
virtual bool SignalOutputData() = 0;
virtual bool OnEvent(select_event &event) = 0;
/*!
@brief Returns the string value of the IO handler type
@param type: Type of IO handler. E.g. acceptor, tct carrier, udp carrier, etc.
*/
static string IOHTToString(IOHandlerType type);
virtual void GetStats(Variant &info, uint32_t namespaceId = 0) = 0;
};
#endif /* _IOHANDLER_H */
#endif /* NET_SELECT */
| 2,156
|
C++
|
.h
| 74
| 26.918919
| 80
| 0.739845
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,515
|
tcpconnector.h
|
shiretu_crtmpserver/sources/thelib/include/netio/select/tcpconnector.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#ifndef _TCPCONNECTOR_H
#define _TCPCONNECTOR_H
#include "netio/select/iohandler.h"
#include "protocols/baseprotocol.h"
#include "protocols/protocolfactorymanager.h"
#include "netio/select/iohandlermanager.h"
#include "netio/select/tcpcarrier.h"
template<class T>
class DLLEXP TCPConnector
: public IOHandler {
private:
string _ip;
uint16_t _port;
vector<uint64_t> _protocolChain;
bool _closeSocket;
Variant _customParameters;
bool _success;
public:
TCPConnector(int32_t fd, string ip, uint16_t port,
vector<uint64_t>& protocolChain, const Variant& customParameters)
: IOHandler(fd, fd, IOHT_TCP_CONNECTOR) {
_ip = ip;
_port = port;
_protocolChain = protocolChain;
_closeSocket = true;
_customParameters = customParameters;
_success = false;
}
virtual ~TCPConnector() {
if (!_success) {
T::SignalProtocolCreated(NULL, _customParameters);
}
if (_closeSocket) {
CLOSE_SOCKET(_inboundFd);
}
}
virtual bool SignalOutputData() {
ASSERT("Operation not supported");
return false;
}
virtual bool OnEvent(select_event &event) {
IOHandlerManager::EnqueueForDelete(this);
WARN("THIS IS NOT COMPLETELY IMPLEMENTED");
BaseProtocol *pProtocol = ProtocolFactoryManager::CreateProtocolChain(
_protocolChain, _customParameters);
if (pProtocol == NULL) {
FATAL("Unable to create protocol chain");
_closeSocket = true;
return false;
}
TCPCarrier *pTCPCarrier = new TCPCarrier(_inboundFd);
pTCPCarrier->SetProtocol(pProtocol->GetFarEndpoint());
pProtocol->GetFarEndpoint()->SetIOHandler(pTCPCarrier);
if (!T::SignalProtocolCreated(pProtocol, _customParameters)) {
FATAL("Unable to signal protocol created");
delete pProtocol;
_closeSocket = true;
return false;
}
_success = true;
INFO("Outbound connection established: %s", STR(*pProtocol));
_closeSocket = false;
return true;
}
static bool Connect(string ip, uint16_t port,
vector<uint64_t>& protocolChain, Variant customParameters) {
int32_t fd = (int32_t) socket(PF_INET, SOCK_STREAM, 0);
if ((fd < 0) || (!setFdCloseOnExec(fd))) {
int err = LASTSOCKETERROR;
T::SignalProtocolCreated(NULL, customParameters);
FATAL("Unable to create fd: %d", err);
return 0;
}
if (!setFdOptions(fd, false)) {
CLOSE_SOCKET(fd);
T::SignalProtocolCreated(NULL, customParameters);
FATAL("Unable to set socket options");
return false;
}
TCPConnector<T> *pTCPConnector = new TCPConnector(fd, ip, port,
protocolChain, customParameters);
if (!pTCPConnector->Connect()) {
IOHandlerManager::EnqueueForDelete(pTCPConnector);
FATAL("Unable to connect");
return false;
}
return true;
}
bool Connect() {
sockaddr_in address;
address.sin_family = PF_INET;
address.sin_addr.s_addr = inet_addr(STR(_ip));
if (address.sin_addr.s_addr == INADDR_NONE) {
FATAL("Unable to translate string %s to a valid IP address", STR(_ip));
return 0;
}
address.sin_port = EHTONS(_port); //----MARKED-SHORT----
if (!IOHandlerManager::EnableWriteData(this)) {
FATAL("Unable to enable reading data");
return false;
}
if (connect(_inboundFd, (sockaddr *) & address, sizeof (address)) != 0) {
int err = LASTSOCKETERROR;
if (err != SOCKERROR_EINPROGRESS) {
FATAL("Unable to connect to %s:%hu %d", STR(_ip), _port, err);
_closeSocket = true;
return false;
}
}
_closeSocket = false;
return true;
}
virtual void GetStats(Variant &info, uint32_t namespaceId = 0) {
}
};
#endif /* _TCPCONNECTOR_H */
#endif /* NET_SELECT */
| 4,338
|
C++
|
.h
| 136
| 28.911765
| 75
| 0.724047
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,516
|
udpcarrier.h
|
shiretu_crtmpserver/sources/thelib/include/netio/select/udpcarrier.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_SELECT
#ifndef _UDPCARRIER_H
#define _UDPCARRIER_H
#include "netio/select/iohandler.h"
class DLLEXP UDPCarrier
: public IOHandler {
private:
sockaddr_in _peerAddress;
sockaddr_in _nearAddress;
string _nearIp;
uint16_t _nearPort;
uint64_t _rx;
uint64_t _tx;
Variant _parameters;
int32_t _ioAmount;
private:
UDPCarrier(int32_t fd);
public:
virtual ~UDPCarrier();
virtual bool OnEvent(select_event &event);
virtual bool SignalOutputData();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
Variant &GetParameters();
void SetParameters(Variant parameters);
bool StartAccept();
string GetFarEndpointAddress();
uint16_t GetFarEndpointPort();
string GetNearEndpointAddress();
uint16_t GetNearEndpointPort();
static UDPCarrier* Create(string bindIp, uint16_t bindPort, uint16_t ttl,
uint16_t tos, string ssmIp);
static UDPCarrier* Create(string bindIp, uint16_t bindPort,
BaseProtocol *pProtocol, uint16_t ttl, uint16_t tos, string ssmIp);
private:
bool Setup(Variant &settings);
bool GetEndpointsInfo();
};
#endif /* _UDPCARRIER_H */
#endif /* NET_SELECT */
| 1,890
|
C++
|
.h
| 57
| 31.140351
| 74
| 0.765642
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,517
|
tcpacceptor.h
|
shiretu_crtmpserver/sources/thelib/include/netio/epoll/tcpacceptor.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_EPOLL
#ifndef _TCPACCEPTOR_H
#define _TCPACCEPTOR_H
#include "netio/epoll/iohandler.h"
class BaseClientApplication;
class TCPAcceptor
: public IOHandler {
private:
sockaddr_in _address;
vector<uint64_t> _protocolChain;
BaseClientApplication *_pApplication;
Variant _parameters;
bool _enabled;
uint32_t _acceptedCount;
uint32_t _droppedCount;
string _ipAddress;
uint16_t _port;
public:
TCPAcceptor(string ipAddress, uint16_t port, Variant parameters,
vector<uint64_t>/*&*/ protocolChain);
virtual ~TCPAcceptor();
bool Bind();
void SetApplication(BaseClientApplication *pApplication);
bool StartAccept();
virtual bool SignalOutputData();
virtual bool OnEvent(struct epoll_event &event);
virtual bool OnConnectionAvailable(struct epoll_event &event);
bool Accept();
bool Drop();
Variant & GetParameters();
BaseClientApplication *GetApplication();
vector<uint64_t> &GetProtocolChain();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
bool Enable();
void Enable(bool enabled);
private:
bool IsAlive();
};
#endif /* _TCPACCEPTOR_H */
#endif /* NET_EPOLL */
| 1,889
|
C++
|
.h
| 58
| 30.62069
| 72
| 0.767838
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,518
|
tcpcarrier.h
|
shiretu_crtmpserver/sources/thelib/include/netio/epoll/tcpcarrier.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_EPOLL
#ifndef _TCPCARRIER_H
#define _TCPCARRIER_H
#include "netio/epoll/iohandler.h"
class TCPCarrier
: public IOHandler {
private:
bool _writeDataEnabled;
bool _enableWriteDataCalled;
sockaddr_in _farAddress;
string _farIp;
uint16_t _farPort;
sockaddr_in _nearAddress;
string _nearIp;
uint16_t _nearPort;
int32_t _sendBufferSize;
int32_t _recvBufferSize;
uint64_t _rx;
uint64_t _tx;
int32_t _ioAmount;
int _lastRecvError;
int _lastSendError;
public:
TCPCarrier(int32_t fd);
virtual ~TCPCarrier();
virtual bool OnEvent(struct epoll_event &event);
virtual bool SignalOutputData();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
sockaddr_in &GetFarEndpointAddress();
string GetFarEndpointAddressIp();
uint16_t GetFarEndpointPort();
sockaddr_in &GetNearEndpointAddress();
string GetNearEndpointAddressIp();
uint16_t GetNearEndpointPort();
private:
bool GetEndpointsInfo();
};
#endif /* _TCPCARRIER_H */
#endif /* NET_EPOLL */
| 1,759
|
C++
|
.h
| 57
| 28.947368
| 72
| 0.768005
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,519
|
iotimer.h
|
shiretu_crtmpserver/sources/thelib/include/netio/epoll/iotimer.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_EPOLL
#ifndef _IOTIMER_H
#define _IOTIMER_H
#include "netio/epoll/iohandler.h"
class IOTimer
: public IOHandler {
private:
#ifndef HAS_EPOLL_TIMERS
static int32_t _idGenerator;
#else /* */
uint64_t _count;
#endif /* HAS_EPOLL_TIMERS */
public:
IOTimer();
virtual ~IOTimer();
virtual bool SignalOutputData();
virtual bool OnEvent(struct epoll_event &eventWrapper);
bool EnqueueForTimeEvent(uint32_t seconds);
bool EnqueueForHighGranularityTimeEvent(uint32_t milliseconds);
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
};
#endif /* _TIMERIO_H */
#endif /* NET_EPOLL */
| 1,387
|
C++
|
.h
| 41
| 32.02439
| 72
| 0.755788
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,520
|
iohandlermanager.h
|
shiretu_crtmpserver/sources/thelib/include/netio/epoll/iohandlermanager.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_EPOLL
#ifndef _IOHANDLERMANAGER_H
#define _IOHANDLERMANAGER_H
#include "common.h"
#include "netio/epoll/iohandlermanagertoken.h"
#include "netio/fdstats.h"
class IOHandler;
#define EPOLL_QUERY_SIZE 1024
class IOHandlerManager {
private:
static int32_t _eq;
static map<uint32_t, IOHandler *> _activeIOHandlers;
static map<uint32_t, IOHandler *> _deadIOHandlers;
static struct epoll_event _query[EPOLL_QUERY_SIZE];
static vector<IOHandlerManagerToken *> _tokensVector1;
static vector<IOHandlerManagerToken *> _tokensVector2;
static vector<IOHandlerManagerToken *> *_pAvailableTokens;
static vector<IOHandlerManagerToken *> *_pRecycledTokens;
static int32_t _nextWaitPeriod;
#ifndef HAS_EPOLL_TIMERS
static TimersManager *_pTimersManager;
#endif /* HAS_EPOLL_TIMERS */
static struct epoll_event _dummy;
static FdStats _fdStats;
public:
static map<uint32_t, IOHandler *> & GetActiveHandlers();
static map<uint32_t, IOHandler *> & GetDeadHandlers();
static FdStats &GetStats(bool updateSpeeds);
static void Initialize();
static void Start();
static void SignalShutdown();
static void ShutdownIOHandlers();
static void Shutdown();
static void RegisterIOHandler(IOHandler *pIOHandler);
static void UnRegisterIOHandler(IOHandler *pIOHandler);
static int CreateRawUDPSocket();
static void CloseRawUDPSocket(int socket);
#ifdef GLOBALLY_ACCOUNT_BYTES
static void AddInBytesManaged(IOHandlerType type, uint64_t bytes);
static void AddOutBytesManaged(IOHandlerType type, uint64_t bytes);
static void AddInBytesRawUdp(uint64_t bytes);
static void AddOutBytesRawUdp(uint64_t bytes);
#endif /* GLOBALLY_ACCOUNT_BYTES */
static bool EnableReadData(IOHandler *pIOHandler);
static bool DisableReadData(IOHandler *pIOHandler, bool ignoreError = false);
static bool EnableWriteData(IOHandler *pIOHandler);
static bool DisableWriteData(IOHandler *pIOHandler, bool ignoreError = false);
static bool EnableAcceptConnections(IOHandler *pIOHandler);
static bool DisableAcceptConnections(IOHandler *pIOHandler, bool ignoreError = false);
static bool EnableTimer(IOHandler *pIOHandler, uint32_t seconds);
static bool EnableHighGranularityTimer(IOHandler *pIOHandler, uint32_t milliseconds);
static bool DisableTimer(IOHandler *pIOHandler, bool ignoreError = false);
static void EnqueueForDelete(IOHandler *pIOHandler);
static uint32_t DeleteDeadHandlers();
static bool Pulse();
private:
static void SetupToken(IOHandler *pIOHandler);
static void FreeToken(IOHandler *pIOHandler);
#ifndef HAS_EPOLL_TIMERS
static bool ProcessTimer(TimerEvent &event);
#endif /* HAS_EPOLL_TIMERS */
};
#endif /* _IOHANDLERMANAGER_H */
#endif /* NET_EPOLL */
| 3,448
|
C++
|
.h
| 82
| 40.207317
| 87
| 0.796247
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,521
|
iohandler.h
|
shiretu_crtmpserver/sources/thelib/include/netio/epoll/iohandler.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_EPOLL
#ifndef _IOHANDLER_H
#define _IOHANDLER_H
#include "common.h"
#include "netio/epoll/iohandlermanagertoken.h"
#include "netio/iohandlertype.h"
class BaseProtocol;
class IOHandler {
protected:
static uint32_t _idGenerator;
uint32_t _id;
int32_t _inboundFd;
int32_t _outboundFd;
BaseProtocol *_pProtocol;
IOHandlerType _type;
private:
IOHandlerManagerToken *_pToken;
public:
IOHandler(int32_t inboundFd, int32_t outboundFd, IOHandlerType type);
virtual ~IOHandler();
void SetIOHandlerManagerToken(IOHandlerManagerToken *pToken);
IOHandlerManagerToken * GetIOHandlerManagerToken();
uint32_t GetId();
int32_t GetInboundFd();
int32_t GetOutboundFd();
IOHandlerType GetType();
void SetProtocol(BaseProtocol *pPotocol);
BaseProtocol *GetProtocol();
virtual bool SignalOutputData() = 0;
virtual bool OnEvent(struct epoll_event &event) = 0;
static string IOHTToString(IOHandlerType type);
virtual void GetStats(Variant &info, uint32_t namespaceId = 0) = 0;
};
#endif /* _IOHANDLER_H */
#endif /* NET_EPOLL */
| 1,817
|
C++
|
.h
| 53
| 32.433962
| 72
| 0.77177
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,522
|
tcpconnector.h
|
shiretu_crtmpserver/sources/thelib/include/netio/epoll/tcpconnector.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_EPOLL
#ifndef _TCPCONNECTOR_H
#define _TCPCONNECTOR_H
#include "netio/epoll/iohandler.h"
#include "protocols/baseprotocol.h"
#include "netio/epoll/iohandlermanager.h"
#include "protocols/protocolfactorymanager.h"
#include "tcpcarrier.h"
template<class T>
class TCPConnector
: public IOHandler {
private:
string _ip;
uint16_t _port;
vector<uint64_t> _protocolChain;
bool _closeSocket;
Variant _customParameters;
bool _success;
public:
TCPConnector(int32_t fd, string ip, uint16_t port,
vector<uint64_t>& protocolChain, const Variant& customParameters)
: IOHandler(fd, fd, IOHT_TCP_CONNECTOR) {
_ip = ip;
_port = port;
_protocolChain = protocolChain;
_closeSocket = true;
_customParameters = customParameters;
_success = false;
}
virtual ~TCPConnector() {
if (!_success) {
T::SignalProtocolCreated(NULL, _customParameters);
}
if (_closeSocket) {
CLOSE_SOCKET(_inboundFd);
}
}
virtual bool SignalOutputData() {
ASSERT("Operation not supported");
return false;
}
virtual bool OnEvent(epoll_event &event) {
IOHandlerManager::EnqueueForDelete(this);
if ((event.events & EPOLLERR) != 0) {
DEBUG("***CONNECT ERROR: Unable to connect to: %s:%hu", STR(_ip),
_port);
_closeSocket = true;
return false;
}
BaseProtocol *pProtocol = ProtocolFactoryManager::CreateProtocolChain(
_protocolChain, _customParameters);
if (pProtocol == NULL) {
FATAL("Unable to create protocol chain");
_closeSocket = true;
return false;
}
TCPCarrier *pTCPCarrier = new TCPCarrier(_inboundFd);
pTCPCarrier->SetProtocol(pProtocol->GetFarEndpoint());
pProtocol->GetFarEndpoint()->SetIOHandler(pTCPCarrier);
if (!T::SignalProtocolCreated(pProtocol, _customParameters)) {
FATAL("Unable to signal protocol created");
delete pProtocol;
_closeSocket = true;
return false;
}
_success = true;
INFO("Outbound connection established: %s", STR(*pProtocol));
_closeSocket = false;
//Log Outbound Connection Event
// EventLogger * pEvtLog = pProtocol->GetEventLogger();
// if (pEvtLog != NULL) {
// pEvtLog->LogOutboundConnectionStart(pTCPCarrier->GetFarEndpointAddressIp(),
// pTCPCarrier->GetFarEndpointPort(), STR(*pProtocol));
// pTCPCarrier->SetEventLogger(pEvtLog);
// }
return true;
}
static bool Connect(string ip, uint16_t port,
vector<uint64_t>& protocolChain, Variant customParameters) {
int32_t fd = (int32_t) socket(PF_INET, SOCK_STREAM, 0);
if ((fd < 0) || (!setFdCloseOnExec(fd))) {
T::SignalProtocolCreated(NULL, customParameters);
int err = errno;
FATAL("Unable to create fd: (%d) %s", err, strerror(err));
return 0;
}
if (!setFdOptions(fd, false)) {
CLOSE_SOCKET(fd);
T::SignalProtocolCreated(NULL, customParameters);
FATAL("Unable to set socket options");
return false;
}
TCPConnector<T> *pTCPConnector = new TCPConnector(fd, ip, port,
protocolChain, customParameters);
if (!pTCPConnector->Connect()) {
IOHandlerManager::EnqueueForDelete(pTCPConnector);
FATAL("Unable to connect");
return false;
}
return true;
}
bool Connect() {
sockaddr_in address;
address.sin_family = PF_INET;
address.sin_addr.s_addr = inet_addr(STR(_ip));
if (address.sin_addr.s_addr == INADDR_NONE) {
FATAL("Unable to translate string %s to a valid IP address", STR(_ip));
return 0;
}
address.sin_port = EHTONS(_port); //----MARKED-SHORT----
if (!IOHandlerManager::EnableWriteData(this)) {
FATAL("Unable to enable reading data");
return false;
}
if (connect(_inboundFd, (sockaddr *) & address, sizeof (address)) != 0) {
int err = errno;
if (err != EINPROGRESS) {
FATAL("Unable to connect to %s:%hu (%d) %s", STR(_ip), _port,
err, strerror(err));
_closeSocket = true;
return false;
}
}
_closeSocket = false;
return true;
}
virtual void GetStats(Variant &info, uint32_t namespaceId = 0) {
}
};
#endif /* _TCPCONNECTOR_H */
#endif /* NET_EPOLL */
| 4,771
|
C++
|
.h
| 149
| 28.95302
| 82
| 0.713227
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,523
|
udpcarrier.h
|
shiretu_crtmpserver/sources/thelib/include/netio/epoll/udpcarrier.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef NET_EPOLL
#ifndef _UDPCARRIER_H
#define _UDPCARRIER_H
#include "netio/epoll/iohandler.h"
class BaseProtocol;
class UDPCarrier
: public IOHandler {
private:
sockaddr_in _peerAddress;
sockaddr_in _nearAddress;
string _nearIp;
uint16_t _nearPort;
uint64_t _rx;
uint64_t _tx;
Variant _parameters;
int32_t _ioAmount;
private:
UDPCarrier(int32_t fd);
public:
virtual ~UDPCarrier();
virtual bool OnEvent(struct epoll_event &event);
virtual bool SignalOutputData();
virtual void GetStats(Variant &info, uint32_t namespaceId = 0);
Variant &GetParameters();
void SetParameters(Variant parameters);
bool StartAccept();
string GetFarEndpointAddress();
uint16_t GetFarEndpointPort();
string GetNearEndpointAddress();
uint16_t GetNearEndpointPort();
static UDPCarrier* Create(string bindIp, uint16_t bindPort, uint16_t ttl,
uint16_t tos, string ssmIp);
static UDPCarrier* Create(string bindIp, uint16_t bindPort,
BaseProtocol *pProtocol, uint16_t ttl, uint16_t tos, string ssmIp);
private:
bool Setup(Variant &settings);
bool GetEndpointsInfo();
};
#endif /* _UDPCARRIER_H */
#endif /* NET_EPOLL */
| 1,907
|
C++
|
.h
| 58
| 30.862069
| 74
| 0.766467
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
750,524
|
basetestssuite.h
|
shiretu_crtmpserver/sources/tests/include/basetestssuite.h
|
/*
* Copyright (c) 2010,
* Gavriloaie Eugen-Andrei (shiretu@gmail.com)
*
* This file is part of crtmpserver.
* crtmpserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* crtmpserver 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with crtmpserver. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BASETESTSSUITE_H
#define _BASETESTSSUITE_H
#include <assert.h>
#define __TESTS_VALIDATE_FROMAT_SPECIFIERS(...) \
do { \
char ___tempLocation[1024]; \
snprintf(___tempLocation,1023,__VA_ARGS__); \
}while (0)
#define TS_PRINT(...) do{__TESTS_VALIDATE_FROMAT_SPECIFIERS(__VA_ARGS__);printf(__VA_ARGS__);}while(0)
#define TS_ASSERT_NO_INCREMENT(x) \
do { \
if(!(x)) { \
TS_PRINT("Test failed. %s:%d\n",__FILE__,__LINE__); \
exit(-1); \
} \
} while(0)
#define TS_ASSERT(x) \
do { \
if(!(x)) { \
TS_PRINT("Test %s failed. %s:%d\n",#x,__FILE__,__LINE__); \
exit(-1); \
} else { \
_testsCount++; \
} \
} while(0)
#define EXECUTE_SUITE(x) \
do { \
TS_PRINT("Executing %s... ",#x); \
int before = BaseTestsSuite::_testsCount; \
x().Run(); \
int testsCount = BaseTestsSuite::_testsCount - before; \
TS_PRINT("%d tests completed successfuly\n", testsCount); \
} while(0)
class BaseTestsSuite {
public:
static int _testsCount;
public:
BaseTestsSuite();
virtual ~BaseTestsSuite();
virtual void Run() = 0;
};
#endif /* _BASETESTSSUITE_H */
| 1,932
|
C++
|
.h
| 60
| 28.833333
| 102
| 0.653391
|
shiretu/crtmpserver
| 134
| 66
| 8
|
GPL-3.0
|
9/20/2024, 9:41:57 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.