Skip to content

Commit

Permalink
ytdl: WIP: virtual InputStream::GetURI()
Browse files Browse the repository at this point in the history
See MusicPlayerDaemon#19 for details. Also note the lack of synchronization for now.
  • Loading branch information
arcnmx authored and Rio6 committed Oct 30, 2020
1 parent bc72b44 commit 905a6ab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/input/InputStream.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public:
*
* No lock necessary for this method.
*/
const char *GetURI() const noexcept {
virtual const char *GetURI() const noexcept {
return uri.c_str();
}

Expand Down
10 changes: 10 additions & 0 deletions src/input/ProxyInputStream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ ProxyInputStream::CopyAttributes()
}
}

const char*
ProxyInputStream::GetURI() const noexcept
{
if (input) {
return input->GetURI();
} else {
return InputStream::GetURI();
}
}

void
ProxyInputStream::Check()
{
Expand Down
1 change: 1 addition & 0 deletions src/input/ProxyInputStream.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public:
ProxyInputStream &operator=(const ProxyInputStream &) = delete;

/* virtual methods from InputStream */
const char *GetURI() const noexcept;
void Check() override;
void Update() noexcept override;
void Seek(std::unique_lock<Mutex> &lock,
Expand Down
8 changes: 8 additions & 0 deletions src/input/plugins/YtdlInputStream.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ YtdlInputStream::YtdlInputStream(const char *_uri, Mutex &_mutex, EventLoop &eve
YtdlInputStream::~YtdlInputStream() noexcept {
}

const char *YtdlInputStream::GetURI() const noexcept {
if (inner != nullptr) {
return inner->GetURI();
} else {
return InputStream::GetURI();
}
}

void YtdlInputStream::SyncFields() noexcept {
seekable = inner->IsSeekable();
offset = inner->GetOffset();
Expand Down
1 change: 1 addition & 0 deletions src/input/plugins/YtdlInputStream.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public:
virtual void Check();
virtual void Update() noexcept;
virtual void Seek(std::unique_lock<Mutex> &lock, offset_type by_offset);
virtual const char *GetURI() const noexcept;

gcc_pure
virtual bool IsEOF() const noexcept;
Expand Down

0 comments on commit 905a6ab

Please sign in to comment.