| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <cstdint> |
| 24 |
#include <memory> |
| 25 |
#include <string> |
| 26 |
#include <vector> |
| 27 |
|
| 28 |
#include "smacker.h" |
| 29 |
|
| 30 |
namespace fheroes2 |
| 31 |
{ |
| 32 |
class Image; |
| 33 |
} |
| 34 |
|
| 35 |
class SMKVideoSequence final |
| 36 |
{ |
| 37 |
public: |
| 38 |
explicit SMKVideoSequence( const std::string & filePath ); |
| 39 |
~SMKVideoSequence() = default; |
| 40 |
|
| 41 |
SMKVideoSequence( const SMKVideoSequence & ) = delete; |
| 42 |
SMKVideoSequence & operator=( const SMKVideoSequence & ) = delete; |
| 43 |
|
| 44 |
void resetFrame(); |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
void getCurrentFrame( fheroes2::Image & image, int32_t x, int32_t y, int32_t & width, int32_t & height, std::vector<uint8_t> & palette ) const; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
void getNextFrame( fheroes2::Image & image, const int32_t x, const int32_t y, int32_t & width, int32_t & height, std::vector<uint8_t> & palette ) |
| 53 |
{ |
| 54 |
getCurrentFrame( image, x, y, width, height, palette ); |
| 55 |
skipFrame(); |
| 56 |
} |
| 57 |
|
| 58 |
void skipFrame(); |
| 59 |
|
| 60 |
std::vector<uint8_t> getCurrentPalette() const; |
| 61 |
|
| 62 |
const std::vector<std::vector<uint8_t>> & getAudioChannels() const |
| 63 |
{ |
| 64 |
return _audioChannel; |
| 65 |
} |
| 66 |
|
| 67 |
int32_t width() const |
| 68 |
{ |
| 69 |
return _width; |
| 70 |
} |
| 71 |
|
| 72 |
int32_t height() const |
| 73 |
{ |
| 74 |
return _height; |
| 75 |
} |
| 76 |
|
| 77 |
double microsecondsPerFrame() const |
| 78 |
{ |
| 79 |
return _microsecondsPerFrame; |
| 80 |
} |
| 81 |
|
| 82 |
unsigned long frameCount() const |
| 83 |
{ |
| 84 |
return _frameCount; |
| 85 |
} |
| 86 |
|
| 87 |
unsigned long getCurrentFrameId() const |
| 88 |
{ |
| 89 |
return _currentFrameId; |
| 90 |
} |
| 91 |
|
| 92 |
private: |
| 93 |
std::vector<std::vector<uint8_t>> _audioChannel; |
| 94 |
int32_t _width{ 0 }; |
| 95 |
int32_t _height{ 0 }; |
| 96 |
int32_t _heightScaleFactor{ 1 }; |
| 97 |
double _microsecondsPerFrame{ 0 }; |
| 98 |
unsigned long _frameCount{ 0 }; |
| 99 |
unsigned long _currentFrameId{ 0 }; |
| 100 |
|
| 101 |
std::unique_ptr<struct smk_t, void ( * )( struct smk_t * )> _videoFile{ nullptr, smk_close }; |
| 102 |
}; |