-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add base AudioReader class for audio backends * Add PipeWire audio backend * Drop video frames before receiving first audio frame Should help with audio/video sync. * pulse: add get_time_base() * add setting for default audio backend and improve selection logic --------- Co-authored-by: Ilia Bozhinov <ammen99@gmail.com>
- Loading branch information
Showing
14 changed files
with
499 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "audio.hpp" | ||
#include "config.h" | ||
|
||
#ifdef HAVE_PULSE | ||
#include "pulse.hpp" | ||
#endif | ||
|
||
#ifdef HAVE_PIPEWIRE | ||
#include "pipewire.hpp" | ||
#endif | ||
|
||
AudioReader *AudioReader::create(AudioReaderParams params) | ||
{ | ||
#ifdef HAVE_PIPEWIRE | ||
if (params.audio_backend == "pipewire") { | ||
AudioReader *pw = new PipeWireReader; | ||
pw->params = params; | ||
if (pw->init()) | ||
return pw; | ||
delete pw; | ||
} | ||
#endif | ||
#ifdef HAVE_PULSE | ||
if (params.audio_backend == "pulse") { | ||
AudioReader *pa = new PulseReader; | ||
pa->params = params; | ||
if (pa->init()) | ||
return pa; | ||
delete pa; | ||
} | ||
#endif | ||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef AUDIO_HPP | ||
#define AUDIO_HPP | ||
|
||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include "config.h" | ||
#include <string> | ||
|
||
struct AudioReaderParams | ||
{ | ||
size_t audio_frame_size; | ||
uint32_t sample_rate; | ||
/* Can be NULL */ | ||
char *audio_source; | ||
|
||
std::string audio_backend = DEFAULT_AUDIO_BACKEND; | ||
}; | ||
|
||
class AudioReader | ||
{ | ||
public: | ||
virtual ~AudioReader() {} | ||
virtual bool init() = 0; | ||
virtual void start() = 0; | ||
AudioReaderParams params; | ||
static AudioReader *create(AudioReaderParams params); | ||
virtual uint64_t get_time_base() const { return 0; } | ||
}; | ||
|
||
#endif /* end of include guard: AUDIO_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.