ASAPCabinetFE
 
Loading...
Searching...
No Matches
dummy_player.h
1#ifndef DUMMY_VIDEO_PLAYER_H
2#define DUMMY_VIDEO_PLAYER_H
3
4#include "render/ivideo_player.h" // Include the interface definition
5#include <iostream> // For std::cout
6#include <string> // For std::string
7
16public:
21 DummyVideoPlayer() : m_isPlaying(false), m_volume(1.0f), m_isMuted(false) {
22 std::cout << "[DummyVideoPlayer] Constructor called." << std::endl;
23 }
24
29 ~DummyVideoPlayer() override {
30 std::cout << "[DummyVideoPlayer] Destructor called." << std::endl;
31 }
32
42 bool setup(SDL_Renderer* renderer, const std::string& path, int width, int height) override {
43 std::cout << "Renderer: " << renderer << "[DummyVideoPlayer] setup() called with path: " << path
44 << ", width: " << width << ", height: " << height << std::endl;
45 // In a real implementation, you'd check if renderer is valid, load the video, etc.
46 // For dummy, we just assume success.
47 return true;
48 }
49
54 void play() override {
55 m_isPlaying = true;
56 std::cout << "[DummyVideoPlayer] play() called. Video is now playing." << std::endl;
57 }
58
63 void stop() override {
64 m_isPlaying = false;
65 std::cout << "[DummyVideoPlayer] stop() called. Video is now stopped." << std::endl;
66 }
67
72 void update() override {
73 if (m_isPlaying) {
74 // Simulate frame progression or other updates
75 std::cout << "[DummyVideoPlayer] update() called. (Video playing)" << std::endl;
76 } else {
77 std::cout << "[DummyVideoPlayer] update() called. (Video stopped)" << std::endl;
78 }
79 }
80
86 SDL_Texture* getTexture() const override {
87 std::cout << "[DummyVideoPlayer] getTexture() called. Returning nullptr." << std::endl;
88 return nullptr; // No actual texture in dummy player
89 }
90
96 bool isPlaying() const override {
97 // std::cout << "[DummyVideoPlayer] isPlaying() called. Current state: " << (m_isPlaying ? "true" : "false") << std::endl;
98 return m_isPlaying;
99 }
100
106 void setVolume(float volume) override {
107 m_volume = volume;
108 std::cout << "[DummyVideoPlayer] setVolume() called. Volume set to: " << volume << std::endl;
109 }
110
116 void setMute(bool mute) override {
117 m_isMuted = mute;
118 std::cout << "[DummyVideoPlayer] setMute() called. Mute state set to: " << (mute ? "true" : "false") << std::endl;
119 }
120
121private:
122 bool m_isPlaying;
123 float m_volume;
124 bool m_isMuted;
125};
126
127#endif // DUMMY_VIDEO_PLAYER_H
A dummy implementation of the IVideoPlayer interface for testing and debugging.
Definition dummy_player.h:15
void setVolume(float volume) override
DUMMY: Sets the volume for the video's audio track. Logs the desired volume.
Definition dummy_player.h:106
DummyVideoPlayer()
Constructor for DummyVideoPlayer. Initializes the playing state to false.
Definition dummy_player.h:21
void stop() override
DUMMY: Stops the video playback. Sets m_isPlaying to false and logs the action.
Definition dummy_player.h:63
SDL_Texture * getTexture() const override
DUMMY: Retrieves the current video texture. Always returns nullptr as no actual texture is created.
Definition dummy_player.h:86
~DummyVideoPlayer() override
Destructor. Logs the destruction of the dummy player.
Definition dummy_player.h:29
void setMute(bool mute) override
DUMMY: Sets the mute state for the video's audio track. Logs the mute state.
Definition dummy_player.h:116
void update() override
DUMMY: Updates the video state. Logs an update message if the video is playing.
Definition dummy_player.h:72
bool setup(SDL_Renderer *renderer, const std::string &path, int width, int height) override
DUMMY: Sets up the video player. Logs the setup parameters and always returns true.
Definition dummy_player.h:42
bool isPlaying() const override
DUMMY: Checks if the video is currently playing. Returns the internal m_isPlaying state.
Definition dummy_player.h:96
void play() override
DUMMY: Starts video playback. Sets m_isPlaying to true and logs the action.
Definition dummy_player.h:54
Interface for a video player.
Definition ivideo_player.h:19