Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
2b34460c
Commit
2b34460c
authored
Feb 13, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udev: rudimentary ALSA capture support
parent
98dc7bdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
1 deletion
+82
-1
modules/services_discovery/udev.c
modules/services_discovery/udev.c
+82
-1
No files found.
modules/services_discovery/udev.c
View file @
2b34460c
...
...
@@ -33,6 +33,7 @@
#include <errno.h>
static
int
OpenV4L
(
vlc_object_t
*
);
static
int
OpenALSA
(
vlc_object_t
*
);
static
int
OpenDisc
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
int
vlc_sd_probe_Open
(
vlc_object_t
*
);
...
...
@@ -49,6 +50,15 @@ vlc_module_begin ()
set_callbacks
(
OpenV4L
,
Close
)
add_shortcut
(
"v4l"
)
add_submodule
()
set_shortname
(
N_
(
"Audio capture"
))
set_description
(
N_
(
"Audio capture (ALSA)"
))
set_category
(
CAT_PLAYLIST
)
set_subcategory
(
SUBCAT_PLAYLIST_SD
)
set_capability
(
"services_discovery"
,
0
)
set_callbacks
(
OpenALSA
,
Close
)
add_shortcut
(
"alsa"
)
add_submodule
()
set_shortname
(
N_
(
"Discs"
))
set_description
(
N_
(
"Discs"
))
...
...
@@ -75,7 +85,10 @@ static int vlc_sd_probe_Open (vlc_object_t *obj)
{
vlc_sd_probe_Add
(
probe
,
"v4l{longname=
\"
Video capture
\"
}"
,
N_
(
"Video capture"
),
SD_CAT_DEVICES
);
vlc_sd_probe_Add
(
probe
,
"disc{longname=
\"
Discs
\"
}"
,
N_
(
"Discs"
),
SD_CAT_MYCOMPUTER
);
vlc_sd_probe_Add
(
probe
,
"alsa{longname=
\"
Audio capture
\"
}"
,
N_
(
"Audio capture"
),
SD_CAT_DEVICES
);
vlc_sd_probe_Add
(
probe
,
"disc{longname=
\"
Discs
\"
}"
,
N_
(
"Discs"
),
SD_CAT_MYCOMPUTER
);
udev_monitor_unref
(
mon
);
}
udev_unref
(
udev
);
...
...
@@ -421,6 +434,74 @@ int OpenV4L (vlc_object_t *obj)
return
Open
(
obj
,
&
subsys
);
}
/*** Advanced Linux Sound Architecture support ***/
static
int
alsa_get_device
(
struct
udev_device
*
dev
,
unsigned
*
restrict
pcard
,
unsigned
*
restrict
pdevice
)
{
const
char
*
node
=
udev_device_get_devnode
(
dev
);
char
type
;
if
(
node
==
NULL
)
return
-
1
;
if
(
sscanf
(
node
,
"/dev/snd/pcmC%uD%u%c"
,
pcard
,
pdevice
,
&
type
)
<
3
)
return
-
1
;
if
(
type
!=
'c'
)
return
-
1
;
return
0
;
}
static
char
*
alsa_get_mrl
(
struct
udev_device
*
dev
)
{
/* Determine media location */
char
*
mrl
;
unsigned
card
,
device
;
if
(
alsa_get_device
(
dev
,
&
card
,
&
device
))
return
NULL
;
if
(
asprintf
(
&
mrl
,
"alsa://plughw:%u,%u"
,
card
,
device
)
==
-
1
)
mrl
=
NULL
;
return
mrl
;
}
static
char
*
alsa_get_name
(
struct
udev_device
*
dev
)
{
char
*
name
;
unsigned
card
,
device
;
if
(
alsa_get_device
(
dev
,
&
card
,
&
device
))
return
NULL
;
if
(
asprintf
(
&
name
,
_
(
"Device %u"
),
device
)
==
-
1
)
name
=
NULL
;
return
name
;
}
static
char
*
alsa_get_cat
(
struct
udev_device
*
dev
)
{
char
*
name
;
unsigned
card
,
device
;
if
(
alsa_get_device
(
dev
,
&
card
,
&
device
))
return
NULL
;
if
(
asprintf
(
&
name
,
_
(
"Card %u"
),
card
)
==
-
1
)
name
=
NULL
;
return
name
;
}
int
OpenALSA
(
vlc_object_t
*
obj
)
{
static
const
struct
subsys
subsys
=
{
"sound"
,
alsa_get_mrl
,
alsa_get_name
,
alsa_get_cat
,
ITEM_TYPE_CARD
,
};
return
Open
(
obj
,
&
subsys
);
}
/*** Discs support ***/
static
char
*
disc_get_mrl
(
struct
udev_device
*
dev
)
{
...
...
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