|
| double | GetGridOpacity () const |
| | Gets the current opacity value for the background grid effect.
|
| |
| double | GetScanlineOpacity () const |
| | Gets the current opacity value for the scanline effect.
|
| |
| void | ReleaseResources () |
| | Stops the decoder thread, waits for it to finish, releases its resources, and resets the pointer. Ensures proper cleanup of the VideoDecoder instance.
|
| |
| void | SetGridOpacity (const double opacity) |
| | Sets the opacity for the background grid effect. Triggers an update() to repaint the widget.
|
| |
| void | SetScanlineOpacity (const double opacity) |
| | Sets the opacity for the scanline effect. Triggers an update() to repaint the widget.
|
| |
| | VideoPlayer (const QByteArray &video_data, const QString &mime_type, QWidget *parent=nullptr) |
| | Constructs a VideoPlayerOverlay dialog. Initializes the cyberpunk UI elements, sets window properties (title, size, style), creates timers for UI updates and effects, connects signals for controls, and schedules the player initialization.
|
| |
| | ~VideoPlayer () override |
| | Destructor. Stops timers and ensures decoder resources are released by calling ReleaseResources().
|
| |
|
| void | AdjustVolume (int volume) const |
| | Adjusts the playback volume via the VideoDecoder. Also updates the volume icon based on the new volume level.
|
| |
| void | HandleError (const QString &message) const |
| | Slot connected to the decoder's error signal. Logs the error and displays it in the status_label_ and video_label_.
|
| |
| void | HandleVideoInfo (int width, int height, double fps, double duration) |
| | Slot connected to the decoder's videoInfo signal. Stores video dimensions, duration, FPS. Sets the progress slider range. Updates info labels (resolution, bitrate, FPS, codec). Adjusts an update timer interval. Enables the HUD display. Extracts the first frame for a thumbnail.
|
| |
| void | InitializePlayer () |
| | Initializes the VideoDecoder instance and connects its signals. Creates the decoder, connects signals for frames, errors, info, finish, and position. Starts the decoder thread. Called automatically after a short delay.
|
| |
| void | OnSliderPressed () |
| | Slot called when the user presses the progress slider. Remembers the playback state, pauses playback temporarily, and updates the status label.
|
| |
| void | OnSliderReleased () |
| | Slot called when the user releases the progress slider. Performs the seek operation based on the slider's final position. Resumes playback if it was active before seeking. Updates status label.
|
| |
| void | SeekVideo (int position) const |
| | Initiates a seek operation in the VideoDecoder. Converts the slider position (milliseconds) to seconds before calling decoder_->Seek().
|
| |
| void | ToggleMute () |
| | Toggles the mute state. If currently unmuted, mutes and remembers the last volume. If muted, restores the last volume.
|
| |
| void | TogglePlayback () |
| | Toggles the playback state (play/pause) or resets if finished. If finished, resets the decoder. Otherwise, calls Pause() on the decoder. Updates button text and status label accordingly. Triggers UI animations.
|
| |
| void | TriggerGlitch () |
| | Slot called periodically by glitch_timer_. Sets a random intensity for the glitch effect applied in UpdateFrame() and schedules the next glitch event.
|
| |
| void | UpdateFrame (const QImage &frame) |
| | Slot connected to the decoder's frameReady signal. Displays the received video frame in the video_label_. Handles scaling, letterboxing, scanline effects, optional HUD elements (corners, timestamp, frame counter), and glitch effects.
|
| |
| void | UpdateSliderPosition (double position) const |
| | Slot connected to the decoder's positionChanged signal. Updates the progress slider's position and the time label display based on the decoder's current playback position. Blocks slider signals during update to prevent feedback loops.
|
| |
| void | UpdateTimeLabel (int position) const |
| | Slot called when the progress slider's value changes (e.g., user dragging). Updates the time label display based on the slider's current position (without seeking yet).
|
| |
| void | UpdateUI () |
| | Slot called periodically by update_timer_. Updates UI elements like pulsing effects (scanline/grid opacity) and occasionally updates the status label with random "technical" info. Triggers widget repaint.
|
| |
| void | UpdateVolumeIcon (float volume) const |
| | Updates the volume button icon based on the current volume level. Shows different icons for muted, low volume, and high volume.
|
| |
|
| QLabel * | bitrate_label_ |
| | Label displaying estimated video bitrate.
|
| |
| QLabel * | codec_label_ |
| | Label displaying detected video codec information.
|
| |
| double | current_glitch_intensity_ = 0.0 |
| | Current intensity level for the random glitch effect.
|
| |
| std::shared_ptr< VideoDecoder > | decoder_ |
| | Shared pointer to the VideoDecoder instance responsible for decoding and playback.
|
| |
| QLabel * | fps_label_ |
| | Label displaying video frames per second.
|
| |
| int | frame_counter_ = 0 |
| | Counter for the frame number displayed in the HUD.
|
| |
| QTimer * | glitch_timer_ |
| | Timer for triggering random glitch effects.
|
| |
| double | grid_opacity_ |
| | Current opacity value for the background grid effect (property).
|
| |
| int | last_volume_ = 100 |
| | Stores the volume level before muting.
|
| |
| CyberPushButton * | play_button_ |
| | Custom button for play/pause/replay control.
|
| |
| bool | playback_finished_ = false |
| | Flag indicating if playback has reached the end.
|
| |
| bool | playback_started_ = false |
| | Flag indicating if the decoder has started processing (video info received).
|
| |
| CyberSlider * | progress_slider_ |
| | Custom slider for displaying and seeking playback progress.
|
| |
| QLabel * | resolution_label_ |
| | Label displaying video resolution.
|
| |
| double | scanline_opacity_ |
| | Current opacity value for the scanline effect (property).
|
| |
| bool | show_hud_ = false |
| | Flag indicating whether to draw the HUD elements (corners, etc.). Enabled after video info is ready.
|
| |
| bool | slider_dragging_ = false |
| | Flag indicating if the user is currently dragging the progress slider.
|
| |
| QLabel * | status_label_ |
| | Label displaying playback status (Initializing, Ready, Playing, Paused, Error, Finished).
|
| |
| QImage | thumbnail_frame_ |
| | Stores the first frame extracted from the video, used as a thumbnail/fallback.
|
| |
| QLabel * | time_label_ |
| | Label displaying current time / total duration (MM:SS / MM:SS).
|
| |
| TranslationManager * | translator_ = nullptr |
| | Pointer to the translation manager for handling UI translations.
|
| |
| QTimer * | update_timer_ |
| | Timer for triggering periodic UI updates (pulsing effects, status).
|
| |
| QByteArray | video_data_ |
| | Stores the raw video data passed in the constructor.
|
| |
| double | video_duration_ = 0 |
| | Total duration of the video in seconds. Set by HandleVideoInfo.
|
| |
| double | video_fps_ = 60.0 |
| | Video frame rate in frames per second. Set by HandleVideoInfo.
|
| |
| int | video_height_ = 0 |
| | Original height of the video in pixels. Set by HandleVideoInfo.
|
| |
| QLabel * | video_label_ |
| | QLabel used to display the video frames.
|
| |
| int | video_width_ = 0 |
| | Original width of the video in pixels. Set by HandleVideoInfo.
|
| |
| CyberPushButton * | volume_button_ |
| | Custom button for toggling mute. Icon changes based on volume.
|
| |
| CyberSlider * | volume_slider_ |
| | Custom slider for controlling playback volume.
|
| |
| bool | was_playing_ = false |
| | Stores whether playback was active before the user started dragging the slider.
|
| |
A QDialog overlay for playing videos with a cyberpunk aesthetic.
This class provides a full-featured video player in a separate dialog window. It uses VideoDecoder for decoding and playback, includes custom cyberpunk-styled UI controls (buttons, sliders), displays video information (codec, resolution, etc.), and incorporates visual effects like scanlines, grid overlays, and random glitches. It handles playback control (play/pause, seek, volume), manages decoder resources, and provides visual feedback on the player's status.
| VideoPlayer::VideoPlayer |
( |
const QByteArray & | video_data, |
|
|
const QString & | mime_type, |
|
|
QWidget * | parent = nullptr ) |
|
explicit |
Constructs a VideoPlayerOverlay dialog. Initializes the cyberpunk UI elements, sets window properties (title, size, style), creates timers for UI updates and effects, connects signals for controls, and schedules the player initialization.
- Parameters
-
| video_data | The raw video data to be played. |
| mime_type | The MIME type of the video data (currently unused). |
| parent | Optional parent widget. |
| void VideoPlayer::UpdateFrame |
( |
const QImage & | frame | ) |
|
|
privateslot |
Slot connected to the decoder's frameReady signal. Displays the received video frame in the video_label_. Handles scaling, letterboxing, scanline effects, optional HUD elements (corners, timestamp, frame counter), and glitch effects.
- Parameters
-
| frame | The newly decoded video frame. |