[pulseaudio-discuss] [PATCH 1/3] alsa-util: Add a function to read ELD info
Thomas Martitz
kugel at rockbox.org
Sat Feb 16 07:12:56 PST 2013
Am 15.02.2013 23:08, schrieb Tanu Kaskinen:
> On Fri, 2013-02-15 at 13:42 +0100, David Henningsson wrote:
>> Currently, this function only reads the monitor name, but could
>> be extended to read e g supported formats as well.
>>
>> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
>> ---
>> src/modules/alsa/alsa-util.c | 55 ++++++++++++++++++++++++++++++++++++++++++
>> src/modules/alsa/alsa-util.h | 7 ++++++
>> 2 files changed, 62 insertions(+)
>>
>> diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
>> index 114ab27..7cc9492 100644
>> --- a/src/modules/alsa/alsa-util.c
>> +++ b/src/modules/alsa/alsa-util.c
>> @@ -1574,3 +1574,58 @@ snd_mixer_t *pa_alsa_open_mixer_for_pcm(snd_pcm_t *pcm, char **ctl_device, snd_h
>> snd_mixer_close(m);
>> return NULL;
>> }
>> +
>> +bool pa_alsa_get_hdmi_eld(snd_hctl_t *hctl, int device, pa_hdmi_eld_t *eld) {
>> +
> The function could start with a comment containing a link to a
> specification of the ELD data format. I didn't manage to find such
> document (it doesn't help that I couldn't even figure out what the
> acronym stands for), so I can't check whether the parsing code is
> correct.
>
>> + int err;
>> + snd_ctl_elem_id_t *id;
>> + snd_hctl_elem_t *elem;
>> + snd_ctl_elem_info_t *info;
>> + snd_ctl_elem_value_t *value;
>> + unsigned char *elddata;
> Usually uint8_t is used as the type for binary data.
>
>> + unsigned int eldsize, mnl;
>> +
>> + pa_assert(eld != NULL);
>> +
>> + /* See if we can find the ELD control */
>> + snd_ctl_elem_id_alloca(&id);
> This allocates memory, right? It's never freed.
>
alloca()-related functions allocate on the stack which is automatically
freed when the function returns. The memory needn't be freed manually.
Best regards.
More information about the pulseaudio-discuss
mailing list