[FFmpeg-devel] Fwd: framebuffer device demuxer

Michael Niedermayer michaelni
Tue Mar 8 16:04:20 CET 2011


On Mon, Mar 07, 2011 at 06:54:52PM +0100, Stefano Sabatini wrote:
> 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).

ok here too, ill push it later if you dont.
also you could add support for returning the buffer without memcpy
and this will need some kind of thread support to work reliable

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110308/1b964c80/attachment.pgp>



More information about the ffmpeg-devel mailing list