4#include <boost/filesystem.hpp>
17 Mp4ReaderSourceProps(std::string _videoPath,
bool _parseFS, uint16_t _reInitInterval,
bool _direction,
bool _readLoop,
bool _giveLiveTS,
int _parseFSTimeoutDuration = 15,
bool _bFramesEnabled =
false) :
ModuleProps()
30 auto errMsg =
"incorrect prop reInitInterval <" + std::to_string(
reInitInterval) +
">";
31 throw AIPException(AIP_FATAL, errMsg);
34 if (_readLoop && (_reInitInterval || _parseFS))
36 auto errMsg =
"Incorrect parameters. Looping can not be coupled with retry feature or disk parsing. loop <" + std::to_string(_readLoop) +
37 "> reInitInterval <" + std::to_string(
reInitInterval) +
"> parseFS <" + std::to_string(_parseFS) +
">";
38 throw AIPException(AIP_FATAL, errMsg);
40 auto canonicalVideoPath = boost::filesystem::canonical(_videoPath);
46 if (_reInitInterval < 0)
48 throw AIPException(AIP_FATAL,
"reInitInterval must be 0 or more seconds");
57 skipDir = boost::filesystem::path(
videoPath).parent_path().parent_path().parent_path().string();
61 skipDir = boost::filesystem::path(canonicalVideoPath).string();
76 std::string
skipDir =
"./data/Mp4_videos";
90 template <
class Archive>
91 void serialize(Archive& ar,
const unsigned int version)
93 ar& boost::serialization::base_object<ModuleProps>(*
this);
121 bool randomSeek(uint64_t skipTS,
bool forceReopen =
false);
145 boost::shared_ptr<Mp4ReaderDetailAbs>
mDetail;
CommandType
Definition Command.h:9
ModuleProps()
Definition Module.h:40
virtual size_t getSerializeSize()
Definition Module.h:101
Module(Kind nature, string name, ModuleProps _props)
Definition Module.cpp:144
Definition Mp4ReaderSource.cpp:18
Definition Mp4ReaderSource.cpp:1148
Definition Mp4ReaderSource.cpp:1134
Definition Mp4ReaderSource.h:10
bool bFramesEnabled
Definition Mp4ReaderSource.h:82
std::string videoPath
Definition Mp4ReaderSource.h:77
bool readLoop
Definition Mp4ReaderSource.h:85
bool direction
Definition Mp4ReaderSource.h:81
Mp4ReaderSourceProps()
Definition Mp4ReaderSource.h:12
size_t biggerMetadataFrameSize
Definition Mp4ReaderSource.h:79
bool giveLiveTS
Definition Mp4ReaderSource.h:86
std::string skipDir
Definition Mp4ReaderSource.h:76
uint16_t reInitInterval
Definition Mp4ReaderSource.h:83
bool parseFS
Definition Mp4ReaderSource.h:80
size_t getSerializeSize()
Definition Mp4ReaderSource.h:71
void setMaxFrameSizes(size_t _maxImgFrameSize, size_t _maxMetadataFrameSize)
Definition Mp4ReaderSource.h:65
Mp4ReaderSourceProps(std::string _videoPath, bool _parseFS, uint16_t _reInitInterval, bool _direction, bool _readLoop, bool _giveLiveTS, int _parseFSTimeoutDuration=15, bool _bFramesEnabled=false)
Definition Mp4ReaderSource.h:17
size_t biggerFrameSize
Definition Mp4ReaderSource.h:78
friend class boost::serialization::access
Definition Mp4ReaderSource.h:88
int parseFSTimeoutDuration
Definition Mp4ReaderSource.h:84
void serialize(Archive &ar, const unsigned int version)
Definition Mp4ReaderSource.h:91
void setPlaybackSpeed(float _playbckSpeed)
Definition Mp4ReaderSource.cpp:1706
bool changePlayback(float speed, bool direction)
Definition Mp4ReaderSource.cpp:1670
bool getVideoRangeFromCache(std::string videoPath, uint64_t &start_ts, uint64_t &end_ts)
Definition Mp4ReaderSource.cpp:1583
bool refreshCache()
Definition Mp4ReaderSource.cpp:1542
double getOpenVideoDurationInSecs()
Definition Mp4ReaderSource.cpp:1574
std::string getOpenVideoPath()
Definition Mp4ReaderSource.cpp:1547
Mp4ReaderSourceProps props
Definition Mp4ReaderSource.h:146
bool validateOutputPins()
Definition Mp4ReaderSource.cpp:1624
bool handlePropsChange(frame_sp &frame)
Definition Mp4ReaderSource.cpp:1656
bool init()
Definition Mp4ReaderSource.cpp:1483
boost::shared_ptr< Mp4ReaderDetailAbs > mDetail
Definition Mp4ReaderSource.h:145
bool handlePausePlay(float speed, bool direction) override
Definition Mp4ReaderSource.cpp:1692
bool randomSeek(uint64_t skipTS, bool forceReopen=false)
Definition Mp4ReaderSource.cpp:1700
std::string metadataFramePinId
Definition Mp4ReaderSource.h:144
uint32_t mHeight
Definition Mp4ReaderSource.h:143
void setProps(Mp4ReaderSourceProps &props)
Definition Mp4ReaderSource.cpp:1665
Mp4ReaderSourceProps getProps()
Definition Mp4ReaderSource.cpp:1651
bool handleCommand(Command::CommandType type, frame_sp &fame)
Definition Mp4ReaderSource.cpp:1676
std::map< std::string, std::pair< uint64_t, uint64_t > > getCacheSnapShot()
Definition Mp4ReaderSource.cpp:1537
std::string encodedImagePinId
Definition Mp4ReaderSource.h:141
void setImageMetadata(std::string &pinId, framemetadata_sp &metadata)
Definition Mp4ReaderSource.cpp:1530
bool term()
Definition Mp4ReaderSource.cpp:1588
Mp4ReaderSource(Mp4ReaderSourceProps _props)
Definition Mp4ReaderSource.cpp:1476
virtual ~Mp4ReaderSource()
Definition Mp4ReaderSource.cpp:1481
int32_t getOpenVideoFrameCount()
Definition Mp4ReaderSource.cpp:1556
bool produce()
Definition Mp4ReaderSource.cpp:1616
std::string h264ImagePinId
Definition Mp4ReaderSource.h:140
void getResolution(uint32_t &width, uint32_t &height)
Definition Mp4ReaderSource.h:128
double getOpenVideoFPS()
Definition Mp4ReaderSource.cpp:1565
std::string addOutPutPin(framemetadata_sp &metadata)
Definition Mp4ReaderSource.cpp:1595
uint32_t mWidth
Definition Mp4ReaderSource.h:142