[FFmpeg-devel] [PATCH 1/4] lavd: pulse audio encoder

Lukasz M lukasz.m.luki at gmail.com
Mon Oct 7 16:18:53 CEST 2013


>
> > +static av_cold int pulse_write_header(AVFormatContext *h)
> > +{
> > +    PulseData *s = h->priv_data;
> > +    AVStream *st = h->streams[0];
> > +    int ret;
> > +    pa_sample_spec ss = { codec_id_to_pulse_format(st->codec->codec_id),
> > +                          st->codec->sample_rate,
> > +                          st->codec->channels };
> > +    pa_buffer_attr attr = { -1, -1, -1, -1, -1 };
> > +    const char *stream_name = s->stream_name;
> > +
> > +    if (!stream_name)
> > +        stream_name = h->filename;
> > +
> > +    s->pa = pa_simple_new(s->server,                 // Server
> > +                          s->name,                   // Application name
> > +                          PA_STREAM_PLAYBACK,
> > +                          s->device,                 // Device
> > +                          stream_name,               // Description of
> a stream
> > +                          &ss,                       // Sample format
> > +                          NULL,                      // Use default
> channel map
> > +                          &attr,                     // Buffering
> attributes
> > +                          &ret);                     // Result
> > +
> > +    if (!s->pa) {
> > +        av_log(s, AV_LOG_ERROR, "pa_simple_new failed: %s\n",
> pa_strerror(ret));
> > +        return AVERROR(EIO);
> > +    }
> > +
> > +    avpriv_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
> > +
> > +    return 0;
>
> Not sure if you should check the number and type of the streams. What
> happens if you send two audio streams, or one video stream?


I'm not sure neither. I will add a check for that and will use first audio
stream in case there is more - this wont hurt.
I assume playing more than one stream simultaneously is not really good use
case, but possible in this encoder.
Note: This issue impacts also other encoders available in libavdevice.


More information about the ffmpeg-devel mailing list