[FFmpeg-devel] [PATCH] lavd/alsa: implement get_device_list callbacks
Michael Niedermayer
michaelni at gmx.at
Sun Oct 26 23:27:46 CET 2014
On Fri, Oct 24, 2014 at 10:07:23PM +0200, Lukasz Marek wrote:
> On 23.10.2014 14:28, Nicolas George wrote:
> >Le primidi 1er brumaire, an CCXXIII, Lukasz Marek a écrit :
> >>It gives the same list as aplay -L (upper case). For example (ffmpeg will
> >>display it in different way, but the content is the same)
> >
> >I thought for a time that "dmix:CARD=PCH,DEV=0" had placeholders: PCH needed
> >to be replaced by an actual parameter, but I see now that I am wrong.
> >
> >If all the listed device names are actually valid as is, then it should be
> >ok.
> >
> >Is the doc clear enough that the list is not exhaustive, and that an
> >application should leave the user enter a free-form device name?
>
> Yes.
>
> >>default
> >> Playback/recording through the PulseAudio sound server
> >For some reason (probably my strange ALSA config), I do not have that entry
> >in the output of aplay -L. Maybe "default" needs a special case.
>
> According to this
> http://www.alsa-project.org/main/index.php/Asoundrc
> "The keyword default is defined in the ALSA lib API and will always
> access hw:0,0 — the default device on the default soundcard.
> Specifying the !default name supersedes the one defined in the ALSA
> lib API."
>
> I have pulse-alsa.conf instaled from pulseaudio deb, that is
> included in alsa config:
>
> pcm.!default {
> type pulse
> hint {
> show on
> description "Playback/recording through the PulseAudio sound
> server"
> }
> }
>
> ctl.!default {
> type pulse
> }
>
> So everything seems to be OK.
>
> Updated patch is attached.
>
> alsa-audio-common.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> alsa-audio-dec.c | 6 ++++
> alsa-audio-enc.c | 6 ++++
> alsa-audio.h | 2 +
> 4 files changed, 90 insertions(+)
> 065a0165efbe9da625feb164bb8a4d4e1be0796c 0002-lavd-alsa-implement-get_device_list-callbacks.patch
> From b88dc6133a958a6ecc0fe806739f3b688499f619 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> Date: Tue, 26 Aug 2014 20:30:35 +0200
> Subject: [PATCH 2/2] lavd/alsa: implement get_device_list callbacks
>
> ---
> libavdevice/alsa-audio-common.c | 76 +++++++++++++++++++++++++++++++++++++++++
> libavdevice/alsa-audio-dec.c | 6 ++++
> libavdevice/alsa-audio-enc.c | 6 ++++
> libavdevice/alsa-audio.h | 2 ++
> 4 files changed, 90 insertions(+)
>
> diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c
> index 4e63397..60839f4 100644
> --- a/libavdevice/alsa-audio-common.c
> +++ b/libavdevice/alsa-audio-common.c
> @@ -343,3 +343,79 @@ int ff_alsa_extend_reorder_buf(AlsaData *s, int min_size)
> s->reorder_buf_size = size;
> return 0;
> }
> +
> +/* ported from alsa-utils/aplay.c */
> +int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stream_type)
> +{
> + int ret = 0;
> + void **hints, **n;
> + char *name = NULL, *descr = NULL, *io = NULL, *tmp;
> + AVDeviceInfo *new_device = NULL;
> + const char *filter = stream_type == SND_PCM_STREAM_PLAYBACK ? "Output" : "Input";
> +
> + if (snd_device_name_hint(-1, "pcm", &hints) < 0)
> + return AVERROR_EXTERNAL;
> + n = hints;
> + while (*n) {
> + tmp = snd_device_name_get_hint(*n, "NAME");
> + name = av_strdup(tmp);
> + if (tmp && !name) {
> + ret = AVERROR(ENOMEM);
> + goto fail;
> + }
> + free(tmp);
> + tmp = snd_device_name_get_hint(*n, "DESC");
> + descr = av_strdup(tmp);
> + if (tmp && !descr) {
> + ret = AVERROR(ENOMEM);
> + goto fail;
> + }
> + free(tmp);
> + tmp = snd_device_name_get_hint(*n, "IOID");
> + io = av_strdup(tmp);
> + if (tmp && !io) {
> + ret = AVERROR(ENOMEM);
> + goto fail;
> + }
> + free(tmp);
doesnt mem leak in case of the goto fails ?
i dont see where its freed
no further comments from me
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 1
"Used only once" - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141026/fabcd03e/attachment.asc>
More information about the ffmpeg-devel
mailing list