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
87c9856b
Commit
87c9856b
authored
Feb 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/alsa: use the EventLoop& passed to init() instead of io_thread_get()
parent
835136dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
AlsaInputPlugin.cxx
src/input/plugins/AlsaInputPlugin.cxx
+16
-6
No files found.
src/input/plugins/AlsaInputPlugin.cxx
View file @
87c9856b
...
@@ -39,7 +39,6 @@
...
@@ -39,7 +39,6 @@
#include "Log.hxx"
#include "Log.hxx"
#include "event/MultiSocketMonitor.hxx"
#include "event/MultiSocketMonitor.hxx"
#include "event/DeferredMonitor.hxx"
#include "event/DeferredMonitor.hxx"
#include "IOThread.hxx"
#include <alsa/asoundlib.h>
#include <alsa/asoundlib.h>
...
@@ -107,7 +106,8 @@ public:
...
@@ -107,7 +106,8 @@ public:
snd_pcm_close
(
capture_handle
);
snd_pcm_close
(
capture_handle
);
}
}
static
InputStream
*
Create
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
);
static
InputStream
*
Create
(
EventLoop
&
event_loop
,
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
);
protected
:
protected
:
/* virtual methods from AsyncInputStream */
/* virtual methods from AsyncInputStream */
...
@@ -146,7 +146,8 @@ private:
...
@@ -146,7 +146,8 @@ private:
};
};
inline
InputStream
*
inline
InputStream
*
AlsaInputStream
::
Create
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
AlsaInputStream
::
Create
(
EventLoop
&
event_loop
,
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
{
{
const
char
*
device
=
StringAfterPrefix
(
uri
,
"alsa://"
);
const
char
*
device
=
StringAfterPrefix
(
uri
,
"alsa://"
);
if
(
device
==
nullptr
)
if
(
device
==
nullptr
)
...
@@ -165,7 +166,7 @@ AlsaInputStream::Create(const char *uri, Mutex &mutex, Cond &cond)
...
@@ -165,7 +166,7 @@ AlsaInputStream::Create(const char *uri, Mutex &mutex, Cond &cond)
snd_pcm_t
*
handle
=
OpenDevice
(
device
,
rate
,
format
,
channels
);
snd_pcm_t
*
handle
=
OpenDevice
(
device
,
rate
,
format
,
channels
);
int
frame_size
=
snd_pcm_format_width
(
format
)
/
8
*
channels
;
int
frame_size
=
snd_pcm_format_width
(
format
)
/
8
*
channels
;
return
new
AlsaInputStream
(
io_thread_get
()
,
return
new
AlsaInputStream
(
event_loop
,
uri
,
mutex
,
cond
,
uri
,
mutex
,
cond
,
device
,
handle
,
frame_size
);
device
,
handle
,
frame_size
);
}
}
...
@@ -386,15 +387,24 @@ AlsaInputStream::OpenDevice(const char *device,
...
@@ -386,15 +387,24 @@ AlsaInputStream::OpenDevice(const char *device,
/*######################### Plugin Functions ##############################*/
/*######################### Plugin Functions ##############################*/
static
EventLoop
*
alsa_input_event_loop
;
static
void
alsa_input_init
(
EventLoop
&
event_loop
,
const
ConfigBlock
&
)
{
alsa_input_event_loop
=
&
event_loop
;
}
static
InputStream
*
static
InputStream
*
alsa_input_open
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
alsa_input_open
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
{
{
return
AlsaInputStream
::
Create
(
uri
,
mutex
,
cond
);
return
AlsaInputStream
::
Create
(
*
alsa_input_event_loop
,
uri
,
mutex
,
cond
);
}
}
const
struct
InputPlugin
input_plugin_alsa
=
{
const
struct
InputPlugin
input_plugin_alsa
=
{
"alsa"
,
"alsa"
,
nullptr
,
alsa_input_init
,
nullptr
,
nullptr
,
alsa_input_open
,
alsa_input_open
,
};
};
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