[FFmpeg-devel] [PATCH] ALSA for libavdevice

Luca Abeni lucabe72
Thu Dec 18 13:35:37 CET 2008


Hi,

Michael Niedermayer wrote:
[...]
>>> besides this the rounding is still not correct, following is correct
>>> pkt->pts = timestamp.tv_sec * 1000000LL
>>>           + ( timestamp.tv_nsec * st->codec->sample_rate
>>>              -ts_delay * 1000000000LL + st->codec->sample_rate*500LL) / (st->codec->sample_rate * 1000LL)
>> That is true; each was correct alone, but not together. I took your formula
>> after checking there was no risk of integer overflow. I am always at loss to
>> indent such long formulas, though.
> 
> ok, if someone has tested both recording & playback (ideally with video) and
> it worked (including AV sync)

I tried to test the latest version, but it turns out that the alsa library
installed on my machine does not provide SND_PCM_TSTAMP_ENABLE and
snd_pcm_htimestamp(). I am on Ubuntu 8.04.1.
Which version of the alsa library is needed?

I am rebooting to a debian testing/unstable machine to see if it provides
a good alsa library...

Anyway, I think a lot of linux distro will see something like:
gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. -I"/home/luca/src/Video/ffmpeg" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -std=c99 -fomit-frame-pointer -g 
-Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -O3 -fno-math-errno       -c 
-o libavdevice/alsa-audio-enc.o /home/luca/src/Video/ffmpeg/libavdevice/alsa-audio-enc.c
/home/luca/src/Video/ffmpeg/libavdevice/alsa-audio-dec.c: In function ?audio_read_header?:
/home/luca/src/Video/ffmpeg/libavdevice/alsa-audio-dec.c:80: error: ?SND_PCM_TSTAMP_ENABLE? undeclared (first use in this function)
/home/luca/src/Video/ffmpeg/libavdevice/alsa-audio-dec.c:80: error: (Each undeclared identifier is reported only once
/home/luca/src/Video/ffmpeg/libavdevice/alsa-audio-dec.c:80: error: for each function it appears in.)
/home/luca/src/Video/ffmpeg/libavdevice/alsa-audio-dec.c: In function ?audio_read_packet?:
/home/luca/src/Video/ffmpeg/libavdevice/alsa-audio-dec.c:131: warning: implicit declaration of function ?snd_pcm_htimestamp?

So I guess a better test in configure has to be implemented (I do not
know the configure stuff enough, so I do not know if it's better to check
for the libasound2 version, or for the presence of SND_PCM_TSTAMP_ENABLE.

Or maybe the alsa-audio-dec.c can protect this code with a
"#ifdef SND_PCM_TSTAMP_ENABLE", falling back to the stupid pts assignment
(and printing a warning) if this constant is not defined...


				Luca




More information about the ffmpeg-devel mailing list