8#include <libavformat/avformat.h>
9#include <libavcodec/avcodec.h>
10#include <libavutil/error.h>
11#include <libswresample/swresample.h>
12#include <libavutil/imgutils.h>
17#include "concurrentqueue.h"
38 virtual bool accept(AVPacket *pkt, std::atomic<bool> &interrupt) = 0;
71 virtual int skip(
const std::function<
bool(qreal)> &predicate) = 0;
112 auto *videoCodecPara =
stream->codecpar;
113 if (!(
codec =
const_cast<AVCodec *
>(avcodec_find_decoder(videoCodecPara->codec_id)))) {
114 throw std::runtime_error(
"Cannot find valid video decode codec.");
117 throw std::runtime_error(
"Cannot find valid video decode codec context.");
119 if (avcodec_parameters_to_context(
codecCtx, videoCodecPara) < 0) {
120 throw std::runtime_error(
"Cannot initialize videoCodecCtx.");
123 throw std::runtime_error(
"Cannot open codec.");
125 if (!(
frameBuf = av_frame_alloc())) {
126 throw std::runtime_error(
"Cannot alloc frame buf.");
Definition: frame.hpp:145
Definition: decoders.hpp:105
AVCodec * codec
Definition: decoders.hpp:107
AVFrame * frameBuf
Definition: decoders.hpp:110
AVCodecContext * codecCtx
Definition: decoders.hpp:109
~DecoderContext()
Definition: decoders.hpp:130
AVStream * stream
Definition: decoders.hpp:108
DecoderContext(AVStream *vs)
Definition: decoders.hpp:111
Definition: decoders.hpp:22
virtual bool accept(AVPacket *pkt, std::atomic< bool > &interrupt)=0
virtual void setFollower(IDemuxDecoder *follower)
Definition: decoders.hpp:84
virtual VideoFrameRef getPicture()=0
DecoderType
Definition: decoders.hpp:28
virtual void setEnable(bool b)=0
virtual qreal viewFront()=0
virtual void setStart(qreal secs)
Definition: decoders.hpp:94
virtual qreal getLastPts()
Definition: decoders.hpp:88
virtual void pushFrameStack()
Definition: decoders.hpp:86
virtual PonyAudioFormat getInputFormat()=0
virtual void flushFFmpegBuffers()=0
virtual ~IDemuxDecoder()=default
virtual int skip(const std::function< bool(qreal)> &predicate)=0
virtual void clearFrameStack()
Definition: decoders.hpp:92
virtual double duration()=0
virtual AudioFrame getSample()=0
virtual qreal nextSegment()
Definition: decoders.hpp:96
virtual void setOutputFormat(const PonyAudioFormat &format)=0
constexpr auto Common
Definition: decoders.hpp:141
constexpr auto Video
Definition: decoders.hpp:140
constexpr auto Audio
Definition: decoders.hpp:139
#define INCLUDE_FFMPEG_END
Definition: ponyplayer.h:26
#define NOT_IMPLEMENT_YET
Definition: ponyplayer.h:39