DirectFB - Home of the pragmatist Roadmap

[directfb-users] Displaying buffer contents
Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[directfb-users] Displaying buffer contents


I wrote a small app to display video picture that i get via H261
protocol (-> openh323 library). Via the openh323 library i get a
pointer (void*) to the image data (if i understand everything
correct, the image data is in RGB-24 format -- with a line like
"P6 <width> <height> 0x255" prepended to the buffer i get a valid
PPM file).

Now i want to display this buffer with DirectFB in a window
surface. I have not found an ImageProvider for PPM, so i tried a
quick and ugly hack like this:

  DFBResult rc;

  DFBRectangle rect = {0, 0, 0, 0};
  IDirectFBSurface* dst;
  IDirectFBSurface_data* dst_data;
  CoreSurface* dst_surface;

  dst = paintarea->get_surface().get();
  rc = DFB_OK;
  dst_data = (IDirectFBSurface_data*) dst->priv;
  if (!dst_data) rc = DFB_DEAD;
  trace("  got surface data: " << DirectFBErrorString(rc));
  rc = DFB_OK;
  dst_surface = dst_data->surface;
  if (!dst_surface) rc = DFB_DESTROYED;
  trace("  got core surface: " << DirectFBErrorString(rc));
  rc = dst->GetSize(dst, &rect.w, &rect.h);
  trace("  got dst size: " << DirectFBErrorString(rc));
  void* d;
  int pitch;
  rc = dst->Lock(dst, DSLF_WRITE, &d, &pitch);
  trace("  locked surface: " << DirectFBErrorString(rc));
  dfb_scale_linear_32((__u32*)pic, width, height, d, pitch, &rect, dst_surface);
  trace("  copied pic");
  trace("  unlocked surface");

(Mainly copied from the PNG ImageProvider.) The problem: When
dfb_scale_linear_32 is called, i get a segmentation fault (signal
11, invalid address):
(!) [ 1532:    7.792] --> Caught signal 11 (at 0x43abe000, invalid address) <--

(-) DirectFB stack trace of pid 1532
    '-> dfb_scale_linear_32()
      '-> dfb_copy_buffer_32()

BTW: To compile the hack, i used includes from
directfb-internal. But some files try to include <config.h> that
is only available in the DirectFB source directory but not in the
installed include-tree. Here is the file list:

./core/fusion/shmalloc.h:#include <config.h>
./core/coredefs.h:#include <config.h>
./misc/mem.h:#include <config.h>
./misc/util.h:#include <config.h>
./misc/memcpy.h:#include <config.h>

This way development of code that uses internal information (like
a new ImageProvider) is impossible outside the original DirectFB
source tree. Is this the intended behaviour?

Until the next mail...,

Info: To unsubscribe send a mail to with 
"unsubscribe directfb-users" as subject.

Home | Main Index | Thread Index / Development / Old Archives