You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
2.7 KiB
130 lines
2.7 KiB
#ifndef PLAYERCORE_H
|
|
#define PLAYERCORE_H
|
|
|
|
#include <QSemaphore>
|
|
#include <QObject>
|
|
#include <QQueue>
|
|
#include <QImage>
|
|
|
|
#include "model/ultrasoundModule/UsPacket.h"
|
|
#include "model/player/core/QueueReader.h"
|
|
#include "model/player/core/QueueWriter.h"
|
|
#include "model/player/type/EDirection.h"
|
|
#include "model/player/metadata/PlayerMetadata.h"
|
|
#include "model/ultrasoundModule/metadata/HardwareMetadata.h"
|
|
#include "model/evocator/metadata/EvocatorMetadata.h"
|
|
#include "model/evocator/dto/CineDisplayParameters.h"
|
|
|
|
#define TIMES_OF_FPS 4
|
|
|
|
class PlayerCore : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
static QMutex _locker;
|
|
QList<QQueue<UsPacket> > _buffer;
|
|
int _playerBufferSize;
|
|
int _currentSecond;
|
|
int _currentIndex;
|
|
int _subClipStart;
|
|
int _countOfFrame;
|
|
int _subClipEnd;
|
|
int _start = 0;
|
|
int _end;
|
|
int _step;
|
|
int _fps;
|
|
int _delay;
|
|
int _maxSecond;
|
|
float _bSpeed;
|
|
bool _playOriginal;
|
|
bool _resume;
|
|
bool _repeat;
|
|
bool _play;
|
|
bool _startOfPlay;
|
|
bool _fetchImage;
|
|
EDirection::eDirection _playDirection;
|
|
PlayerMetadata _metadata;
|
|
UsPacket* _playerBuffer;
|
|
QSemaphore _usedCells;
|
|
QSemaphore _freeCells;
|
|
QueueWriter _writer;
|
|
QueueReader _reader;
|
|
|
|
void play();
|
|
void stop();
|
|
void pause();
|
|
int calculateDelay(float speed);
|
|
void clearBuffer();
|
|
void setWriterIndexToFirst();
|
|
bool checkBufferHasData();
|
|
bool checkCurrntIndesIsInBorders(bool includeStartEnd);
|
|
|
|
void setStartAndEnd(int start, int end);
|
|
|
|
void continuePlaying();
|
|
|
|
void continuePlaySubClip();
|
|
|
|
void findIndexForContinuePlaySubClip();
|
|
|
|
public:
|
|
float speedResource[4] = { 0.50F, 1.0F, 1.5F, 2.0F};
|
|
PlayerCore();
|
|
|
|
~PlayerCore();
|
|
|
|
void setPlayDirection(EDirection::eDirection playDirection);
|
|
void setBuffer(QList<QQueue<UsPacket> > buffer);
|
|
void setPlayOriginal(bool playOriginal);
|
|
void setSubClipStart(int input, int currentIndex);
|
|
void setSubClipEnd(int input, int currentIndex);
|
|
void setPlay(bool playInput);
|
|
void setResume(bool resume);
|
|
void setRepeat(bool repeat);
|
|
void fetchImage(int index);
|
|
void crawl(int diff);
|
|
void setBSpeed(int speed);
|
|
bool connection();
|
|
|
|
void preparePlayOriginalClip();
|
|
|
|
void preparePlaySubClip();
|
|
|
|
void initWriter();
|
|
|
|
void initReader();
|
|
|
|
void initPlayerParams(QList<QQueue<UsPacket> > buffer);
|
|
|
|
void updateStep();
|
|
|
|
void stopAndClearBuffer();
|
|
|
|
bool getPlay() const;
|
|
|
|
int getSubClipEnd() const;
|
|
|
|
int getSubClipStart() const;
|
|
|
|
bool getPlayOriginal() const;
|
|
|
|
bool getRepeat() const;
|
|
|
|
float getBSpeed() const;
|
|
|
|
void clearPlayerBuffer();
|
|
|
|
signals:
|
|
void sendOutputPacket(const UsPacket& output);
|
|
void sendPlaySituation(const bool& play);
|
|
|
|
//uncrustify off
|
|
public slots:
|
|
//uncrustify on
|
|
void getOutputPacket(const UsPacket& output);
|
|
void restartWriter();
|
|
void restartReader();
|
|
};
|
|
|
|
#endif //PLAYERCORE_H
|
|
|