[FFmpeg-devel] [PATCH] Add support for sndio to libavdevice

Stefano Sabatini stefano.sabatini-lala
Wed Aug 11 10:31:09 CEST 2010


On date Tuesday 2010-08-10 21:45:50 -0400, Brad encoded:
> On Tuesday 10 August 2010 16:21:47 Stefano Sabatini wrote:
> > > +    if (is_output)
> > > +        par.pchan = s->channels;
> > > +    else
> > > +        par.rchan = s->channels;
> >
> > par.pchan = is_output ? ...
> > -3 lines
> 
> re-read it. its not pchan in both cases on the left hand side. its playback 
> channels vs recording channels.

Yes, I'm stupid.
 
> > > +AVInputFormat sndio_demuxer = {
> > > +    "sndio",
> > > +    NULL_IF_CONFIG_SMALL("sndio audio capture"),
> > > +    sizeof(AudioData),
> > > +    NULL,
> > > +    audio_read_header,
> > > +    audio_read_packet,
> > > +    audio_read_close,
> > > +    .flags = AVFMT_NOFILE,
> > > +};
> >
> > Possibly always use designated inited fields, I mean:
> > .name      = ...
> > .long_name = ...
> > .init      = ...
> > .blah      = ...
> > ...
> Show me an example of this already in the tree.

Check how it is done for filters for example, do as you prefer anyway
since I know the other devices are not like that.

> > > +/* XXX: we make the assumption that the soundcard accepts this format */
> > > +/* XXX: find better solution with "preinit" method, needed also in
> > > +        other formats */
> > > +#if HAVE_BIGENDIAN
> > > +#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16BE
> > > +#else
> > > +#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16LE
> > > +#endif
> >
> > possibly better not add a level of indirection, do this in the device
> > definition, also we may define a macro (e.g. in
> > libavformat/internal.h) for this if it is used in other parts of FFmpeg:
> 
> This was copied from ALSA and the macro would be useful for
> a few sound backends.

Same here, do as you prefer, a further patch implementing the macro
would be nice though.

Regards.
-- 
FFmpeg = Fast & Fabulous Merciful Purposeless Ecstatic Gymnast



More information about the ffmpeg-devel mailing list