Go to the documentation of this file.
7 #define LOC QString("PreviewPlayer: ")
29 int& FrameWidth,
int& FrameHeight,
float& AspectRatio)
51 int& FrameWidth,
int& FrameHeight,
float& AspectRatio)
54 FrameWidth = FrameHeight = 0;
59 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Could not open file for preview.");
68 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"No video for preview in file '%1'")
77 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"Cannot generate preview for BluRay file '%1'")
84 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"Cannot generate preview for DVD file '%1'")
93 AspectRatio = 4.0F / 3.0F;
94 BufferSize = FrameWidth * FrameHeight * 4;
95 char* result =
new char[
static_cast<size_t>(BufferSize)];
96 memset(result, 0x3f,
static_cast<size_t>(BufferSize) *
sizeof(
char));
102 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Unable to initialize video for screen grab.");
116 QThread::usleep(10000);
117 if ((tries % 10) == 0)
118 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Waited 100ms for video frame");
138 memset(&retbuf, 0,
sizeof(
AVFrame));
139 copyCtx.
Copy(&retbuf, frame, result, AV_PIX_FMT_RGB32);
145 return reinterpret_cast<char*
>(result);
153 LOG(VB_PLAYBACK, LOG_ERR,
LOC +
"Screen grab requested for frame number beyond end of file.");
168 uint64_t oldnumber = Number;
172 bool started_in_break_map =
false;
175 started_in_break_map =
true;
185 if (started_in_break_map)
CommBreakMap m_commBreakMap
MythDecoderThread * m_decoderThread
MythDeintType m_deinterlaceAllowed
virtual int OpenFile(int Retries=4)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void SeekForScreenGrab(uint64_t &Number, uint64_t FrameNum, bool Absolute)
virtual uint64_t GetBookmark(void)
static const double kInaccuracyNone
MythDeintType m_deinterlaceDouble
virtual int ValidVideoFrames() const
Returns number of frames that are fully decoded.
MythVideoOutput * m_videoOutput
bool m_hasFullPositionMap
bool IsInDelete(uint64_t frame)
MythMediaBuffer * m_buffer
virtual bool InitVideo(void)
void LoadMap(PlayerContext *player_ctx, uint64_t framesPlayed)
void Filter(MythVideoFrame *Frame, FrameScanType Scan, MythVideoProfile *Profile, bool Force=false)
Deinterlace Frame if needed.
MythPreviewPlayer(PlayerContext *Context, PlayerFlags Flags=kNoFlags)
void ClearAfterSeek(bool clearvideobuffers=true)
This is to support seeking...
Handles software based deinterlacing of video frames.
static uint8_t * CreateBuffer(VideoFrameType Type, int Width, int Height)
void LoadMap(const QString &undoMessage="")
Loads the delete map from the database.
double m_videoFrameRate
Video (input) Frame Rate (often inaccurate)
bool IsInCommBreak(uint64_t frameNumber) const
PlayerContext * m_playerCtx
QSize m_videoDispDim
Video (input) width & height.
virtual MythVideoFrame * GetLastDecodedFrame()
void DoJumpToFrame(uint64_t frame, double inaccuracy)
QSize m_videoDim
Video (input) buffer width & height.
char * GetScreenGrabAtFrame(uint64_t FrameNum, bool Absolute, int &BufferSize, int &FrameWidth, int &FrameHeight, float &AspectRatio)
Returns one RGB frame grab from a video.
@ FMT_RGB32
endian dependent format, ARGB or BGRA
int Copy(AVFrame *To, const MythVideoFrame *From, unsigned char *Buffer, AVPixelFormat Fmt=AV_PIX_FMT_YUV420P)
Initialise AVFrame and copy contents of VideoFrame frame into it, performing any required conversion.
char * GetScreenGrab(std::chrono::seconds SecondsIn, int &BufferSize, int &FrameWidth, int &FrameHeight, float &AspectRatio)
Returns one RGB frame grab from a video.
MythDeintType m_deinterlaceSingle
virtual void DecoderStart(bool start_paused)
void DiscardVideoFrame(MythVideoFrame *buffer)
Places frame in the available frames queue.