[FFmpeg-devel] Fwd: framebuffer device demuxer
Stefano Sabatini
stefano.sabatini-lala
Mon Mar 7 18:54:52 CET 2011
On date Thursday 2011-02-10 13:19:53 +0100, Stefano Sabatini encoded:
> Updated work in progress.
>
> On date Sunday 2011-01-30 16:36:38 +0000, M?ns Rullg?rd encoded:
[...]
> > You should mmap the entire framebuffer memory (as and query the current
> > display offset in read_packet(). Yes, I know you said it wasn't ready.
>
> Done this way.
>
> Data is mapped with:
> fbdev->data = mmap(NULL, fbdev->fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->fd, 0);
>
> and visible data position updated in read_packet.
>
> I'm supposing the resolution doesn't change while grabbing.
>
> On the other hand I can't really understand the meaning of
> fbdev->varinfo.xres_virtual against fixinfo.line_length (fbdev docs
> suck and the various implementations I checked are inconsistent).
>
> What I'm doing for computing the visible data:
> pin = fbdev->data + fbdev->bytes_per_pixel *
> (fbdev->varinfo.xoffset + fbdev->varinfo.yoffset * fbdev->varinfo.xres_virtual);
>
> which is possibly wrong.
This post clarified the thing a bit:
http://old.nabble.com/Xorg-on-m68k-td15555517i20.html
That is from what I can see:
fixinfo.line_length = bytes_per_pixel * varinfo.xres_virtual + padding
padding is usually 0 so usually it is:
fixinfo.line_length = bytes_per_pixel * varinfo.xres_virtual
but it's safer to use line_length
[...]
> > > + if (delay <= 0) {
> > > + fb->time_frame += INT64_C(1000000) * av_q2d(fb->time_base);
> > > + break;
> > > + }
> > > + if (avctx->flags & AVFMT_FLAG_NONBLOCK)
> > > + return AVERROR(EAGAIN);
> > > + ts.tv_sec = delay / 1000000;
> > > + ts.tv_nsec = (delay % 1000000) * 1000;
> > > + nanosleep(&ts, NULL);
> > > + }
> >
> > This loop is weird. The correct way is something like this:
> >
> > ts = delay; /* details omitted */
> > while (nanosleep(&ts, &ts) && errno == EINTR);
>
> I kept the same logic for now.
>
> Other minor fixes: name changed again, linuxfb -> fbdev (fbdev is the
> official name), some documentation update.
Updated (ready for commit from my point of view).
--
FFmpeg = Faithful & Fundamental Magical Pitiless Earthshaking Gadget
More information about the ffmpeg-devel
mailing list