55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#ifndef B6199A70_B55C_41FF_ABDD_96D9A657AA29
|
|
#define B6199A70_B55C_41FF_ABDD_96D9A657AA29
|
|
/*
|
|
*******************************************************************************
|
|
* INCLUDE
|
|
*******************************************************************************
|
|
*/
|
|
#include "../core/Demuxer.h"
|
|
extern "C"
|
|
{
|
|
#include <libavcodec/avcodec.h>
|
|
#include <libavcodec/bsf.h>
|
|
#include <libavformat/avformat.h>
|
|
#include <libavutil/pixdesc.h>
|
|
}
|
|
|
|
namespace Video
|
|
{
|
|
namespace FFmpeg
|
|
{
|
|
/*
|
|
*******************************************************************************
|
|
* CLASS DECLARE
|
|
*******************************************************************************
|
|
*/
|
|
class DemuxHandler: public Core::DemuxHandler
|
|
{
|
|
public:
|
|
DemuxHandler(const std::string& url);
|
|
~DemuxHandler();
|
|
|
|
public:
|
|
void run(Core::VideoEncoder::Ptr pVideoEncoder, Core::AudioEncoder::Ptr pAudioEncoder, const Post& post,
|
|
std::atomic<bool>& isCancelled) override;
|
|
|
|
protected:
|
|
PROPERTY_DECLARE(AnchorTime, uint64_t, 0, protected, protected)
|
|
|
|
protected:
|
|
int openCodec(AVMediaType type, int& index, AVCodecContext** pCodecCtx);
|
|
void adjustTimestamp(AVPacket* pPacket, AVRational& timebase);
|
|
void updateTimeline(uint64_t ts);
|
|
void seek(uint64_t) override;
|
|
|
|
private:
|
|
AVFormatContext* _pFormatCtx;
|
|
std::atomic<bool> _seekReqeust;
|
|
int64_t _seekTo;
|
|
|
|
protected:
|
|
static int interruptCallback(void* pCtx);
|
|
};
|
|
}
|
|
}
|
|
#endif
|