[FFmpeg-devel] [PATCH] avdevice: add fbdev output device

Lukasz M lukasz.m.luki at gmail.com
Tue Oct 22 11:52:04 CEST 2013


>
> > > > +    //TODO: add mapping between formats
> > >
> > > what do you exactly mean (this is useful for the archive)?
> >
> >
> > I edited this comment to "Consider"
> > I mean that fbdev_enc require the same pixel format as current
> > configuration of system framebuffer, which may vary even for the same
> > hardware.
> > This means there is few formats that can be valid, but there is only one
> at
> > a time.
>
> > Simple conversions like rgba -> bgra can be done by replacing memcpy with
> > copying byte by byte with proper mapping between input and output
> offsets.
> > I guess there is already pixel conversion inside ffmpeg binary and this
> > would be second one which is bad and I haven't do that yet, but on other
> > hand it may be helpful in some cases.
>
> Definitively it should be avoided, libswscale is meant for such
> conversions.


OK, I removed this comment.


> >
>
> > BTW, Wouldn't it be good idea to extend AVOutputFormat with information
> > about supported pixel/sample formats?
> > That would allow to guess correct formats without user interaction.
>
> Pixel and sample formats are specified (statically) in the codec
> description.


It is offtopic, I will probably come back with it later as RFC or something.
In general I mean that codec may support all formats but output device only
few of them.
If device provide list of supported formats aside the codec formats list,
then proper format
may be chosen without user intaraction and without "guessing" basing on
both list.
I haven't analyse code so these are just simple thoughts, not sure it is
applicable.


>
> > +static int fbdev_write_packet(AVFormatContext *h, AVPacket *pkt)
> > +{
> > +    FBDevContext *fbdev = h->priv_data;
> > +    uint8_t *pin, *pout;
> > +    enum AVPixelFormat pix_fmt;
> > +    int disp_height;
> > +    int bytes_to_copy;
> > +    int src_line_size = fbdev->width * fbdev->bytes_per_pixel;
> > +
> > +    if (fbdev->index != pkt->stream_index)
> > +        return 0;
> > +
>
> > +    if (ioctl(fbdev->fd, FBIOGET_VSCREENINFO, &fbdev->varinfo) < 0)
> > +        av_log(h, AV_LOG_WARNING,
> > +               "Error refreshing variable info: %s\n", strerror(errno));
> > +
> > +    pix_fmt = get_pixfmt_from_fb_varinfo(&fbdev->varinfo);
>
> Is this supposed to change midstream? Otherwise you could just use
> fbdev->pix_fmt.
>

Yes, format may change at any time. I triggered that change with fbset
-depth 16 (from 32)

Rest of remarks fixed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avdevice-add-fbdev-output-device.patch
Type: text/x-patch
Size: 13878 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131022/646c50f1/attachment.bin>


More information about the ffmpeg-devel mailing list