[Ffmpeg-devel] ffserver/ffmpeg Live Video: Anyone get it to work with sound?

Michael Niedermayer michaelni
Sat Mar 10 00:47:25 CET 2007


Hi

On Fri, Mar 09, 2007 at 10:27:32PM +0100, Luca Abeni wrote:
> Hi all,
> 
> On Fri, 2007-03-09 at 17:21 +0100, Luca Abeni wrote:
> [...]
> > > > > It might be a good idea implementing capture from
> > > > ALSA.
> > > > I have a half-implemented input/output format for
> > > > ALSA (it is
> > > > incomplete, but it works). I think I already posted
> > > > it in the past, but
> > > > I could be wrong. If someone is interested, I'll
> > > > send it this evening.
> > > > 
> > > 
> > > Yes, by all means. Again, if for no other reason but
> > > to  include it in documentation as a potential
> > > solution.
> > Ok, I'll post it this evening.
> It did not compile anymore, so I did some qick fixes to update it to svn
> head. I hope I did the porting correctly (I am not sure about the
> configure and makefile parts).
> 
> Anyway, here is the ALSA input/output format... Apply the patch, and
> copy alsa-audio.c in libavformat. Then, recompile and enjoy :)
> Something like
> ./ffmpeg -f alsa -ac 2 -i writesomethinghere test.mp3
> should work.
> 
> As you can see, the code is far from perfect (and some important parts
> are not implemented yet). But it works (at least, it works for me :)...
> To be clear: the code is not submitted for inclusion in svn, but if
> someone wants to work on alsa, this is a good starting point.
> 
> 
> 				Luca

quick and dirty review, as you said its not for svn inclusion ...

[configure/makefile stuff i dont maintain]

could you split the muxer and demuxer into seperate files?


[...]
> #ifdef WORDS_BIGENDIAN
> #define DEFAULT_CODEC_ID CODEC_ID_PCM_S16BE
> #else
> #define DEFAULT_CODEC_ID CODEC_ID_PCM_S16LE
> #endif

hmm what about introducing a CODEC_ID_PCM_S16NE (N=native)
that is CODEC_ID_PCM_S16NE is always == one of the above ...


[...]
>     int codec_id;
> } AlsaData;
> 
> static int sample_size(int codec_id)

enum codec_id

and you probably should use av_get_bits_per_sample()


[...]
>     if (res < 0) {
>         av_log(NULL, AV_LOG_ERROR, "cannot set access type (%s)\n",
>                          snd_strerror(res));
>         snd_pcm_close(h);
>         snd_pcm_hw_params_free(hw_params);
> 
>         return AVERROR_IO;
>     }
> 
>     res = snd_pcm_hw_params_set_format(h, hw_params, alsa_codec_id(s->codec_id));
>     if (res < 0) {
>         av_log(NULL, AV_LOG_ERROR, "cannot set sample format %d %d (%s)\n",
>                          s->codec_id, alsa_codec_id(s->codec_id), snd_strerror(res));
>         snd_pcm_close(h);
>         snd_pcm_hw_params_free(hw_params);

fail:
    snd_pcm_close(h);
    snd_pcm_hw_params_free(hw_params);
    return AVERROR_IO;



[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070310/691bf7c1/attachment.pgp>



More information about the ffmpeg-devel mailing list