Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
5ccf7885
Commit
5ccf7885
authored
Oct 19, 2021
by
Nicolai Syvertsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement SendTag for PipeWire output plugin
parent
fd5a3b58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
PipeWireOutputPlugin.cxx
src/output/plugins/PipeWireOutputPlugin.cxx
+33
-0
No files found.
src/output/plugins/PipeWireOutputPlugin.cxx
View file @
5ccf7885
...
...
@@ -28,6 +28,7 @@
#include "util/StringCompare.hxx"
#include "util/WritableBuffer.hxx"
#include "Log.hxx"
#include "tag/Format.hxx"
#ifdef __GNUC__
#pragma GCC diagnostic push
...
...
@@ -240,6 +241,8 @@ private:
void
Drain
()
override
;
void
Cancel
()
noexcept
override
;
bool
Pause
()
noexcept
override
;
void
SendTag
(
const
Tag
&
tag
)
noexcept
override
;
};
static
constexpr
auto
stream_events
=
PipeWireOutput
::
MakeStreamEvents
();
...
...
@@ -652,6 +655,36 @@ PipeWireOutput::SetMixer(PipeWireMixer &_mixer) noexcept
// TODO: Check if context and stream is ready and trigger a volume update...
}
void
PipeWireOutput
::
SendTag
(
const
Tag
&
tag
)
noexcept
{
CheckThrowError
();
struct
spa_dict_item
items
[
3
];
uint32_t
n_items
=
0
;
const
char
*
artist
,
*
title
;
const
char
*
medianame
=
FormatTag
(
tag
,
"%artist% - %title%"
);
items
[
n_items
++
]
=
SPA_DICT_ITEM_INIT
(
PW_KEY_MEDIA_NAME
,
medianame
);
artist
=
tag
.
GetValue
(
TAG_ARTIST
);
title
=
tag
.
GetValue
(
TAG_TITLE
);
if
(
artist
!=
nullptr
)
{
items
[
n_items
++
]
=
SPA_DICT_ITEM_INIT
(
PW_KEY_MEDIA_ARTIST
,
artist
);
}
if
(
title
!=
nullptr
)
{
items
[
n_items
++
]
=
SPA_DICT_ITEM_INIT
(
PW_KEY_MEDIA_TITLE
,
title
);
}
struct
spa_dict
dict
=
SPA_DICT_INIT
(
items
,
n_items
);
auto
rc
=
pw_stream_update_properties
(
stream
,
&
dict
);
if
(
rc
<
0
)
LogWarning
(
pipewire_output_domain
,
"PipeWire: Error updating properties!
\n
"
);
}
void
pipewire_output_set_mixer
(
PipeWireOutput
&
po
,
PipeWireMixer
&
pm
)
noexcept
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment