Skip to content

Conversation

Copy link

Copilot AI commented Dec 29, 2025

Replaces SDL_mixer audio backend with GStreamer while maintaining full API compatibility with existing MusicPlayerComponent and all playback controls.

Core Changes

GStreamer Pipeline Integration

  • Replaced Mix_Music* with GStreamer playbin element
  • Added createPipeline() / destroyPipeline() lifecycle management
  • Implemented busCallback() for EOS and error handling

Playback Methods

  • playMusic(): Uses gst_element_set_state(GST_STATE_PLAYING) + URI setting
  • pause/resumeMusic(): State transitions via GST_STATE_PAUSED
  • stopMusic(): Sets GST_STATE_NULL
  • Seek support via gst_element_seek_simple()

Volume Control

  • setGstVolume() wraps playbin volume property
  • Maintains 0-128 range for API compatibility (normalized to 0.0-1.0 for GStreamer)
  • Threaded fadeToVolume() now modulates GStreamer volume

Position Queries

  • getCurrent() / getDuration(): Use gst_element_query_position/duration()
  • Returns values in seconds (converted from GST_FORMAT_TIME)

State Queries

  • isPlaying() / isPaused(): Query GstState via gst_element_get_state()

Unchanged

  • All public method signatures
  • Track metadata and album art extraction (ID3 parsing)
  • Playlist management (M3U, folder loading)
  • Shuffle/loop/fade modes
  • Audio visualization infrastructure

Example Usage

// API remains identical - existing code works unchanged
musicPlayer->playMusic(0);           // Play first track
musicPlayer->setVolume(64);          // 50% volume
musicPlayer->nextTrack(1500);        // Fade to next track
double pos = musicPlayer->getCurrent(); // Get position in seconds
Original prompt

convert MusicPlayer class to gstreamer, maintaining compatibility with existing API (especially calls from MusicPlayerComponent, controls like nextTrack prevTrack pause etc.)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ibility

Co-authored-by: inigomonyota <96964704+inigomonyota@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert MusicPlayer class to use GStreamer Convert MusicPlayer from SDL_mixer to GStreamer backend Dec 29, 2025
Copilot AI requested a review from inigomonyota December 29, 2025 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants