Board index » cppbuilder » AVI==>pFrame=?=>TBitmap

AVI==>pFrame=?=>TBitmap

Hi,
I have an AVI video stream (PGETFRAME  pUncompressStream).
AVIStreamGetFrame(...) give me a packed DIB (void *pDIB) .
How can i retrieve a TBitmap  (or TImage or other  from pDIB without
write data on hard disk ?

//....
 /*Returns a pointer to the frame data if successful or NULL otherwise.
    The frame data is returned as a packed DIB.*/
    void *pDIB;
    PGETFRAME  pUncompressStream;
    pDIB = malloc(dimensionDIB+sizeof(BITMAPFILEHEADER ));
//....
    pDIB= AVIStreamGetFrame(pUncompressStream,FrameIndex);
//....

                                                Many Thanks for your
help,
                                                            Gianpaolo

 

Re:AVI==>pFrame=?=>TBitmap


Hi there!
I'm not sure if i know what you want, but if you want a *.bmp from an
*.avi  I think you
can show the avi on  a Panel with TMediaPlayer and then use the
Panel->Canvas to bet a *.bmp.
Quote
Gianpaolo wrote:
> Hi,
> I have an AVI video stream (PGETFRAME  pUncompressStream).
> AVIStreamGetFrame(...) give me a packed DIB (void *pDIB) .
> How can i retrieve a TBitmap  (or TImage or other  from pDIB without
> write data on hard disk ?

> //....
>  /*Returns a pointer to the frame data if successful or NULL otherwise.
>     The frame data is returned as a packed DIB.*/
>     void *pDIB;
>     PGETFRAME  pUncompressStream;
>     pDIB = malloc(dimensionDIB+sizeof(BITMAPFILEHEADER ));
> //....
>     pDIB= AVIStreamGetFrame(pUncompressStream,FrameIndex);
> //....

>                                                 Many Thanks for your
> help,
>                                                             Gianpaolo

Re:AVI==>pFrame=?=>TBitmap


Thank Stefan for your answer,
but i don't need to display all frames.
I need to display a  frame only if the user want it.
I have a DIB in memory and i perform some operations on pixels, like
Histogram, Difference,...
I perform this operations on many AVI.
When user say "Give me AVI #3 - frame #17", i display it.
How can i do it faster than write DIB on disk, pass from ClipBoard or
TMediaPlayer?

Gianpaolo

Quote
Stefan Jansson wrote:
> Hi there!
> I'm not sure if i know what you want, but if you want a *.bmp from an
> *.avi  I think you
> can show the avi on  a Panel with TMediaPlayer and then use the
> Panel->Canvas to bet a *.bmp.

> Gianpaolo wrote:

> > Hi,
> > I have an AVI video stream (PGETFRAME  pUncompressStream).
> > AVIStreamGetFrame(...) give me a packed DIB (void *pDIB) .
> > How can i retrieve a TBitmap  (or TImage or other  from pDIB without
> > write data on hard disk ?

> > //....
> >  /*Returns a pointer to the frame data if successful or NULL otherwise.
> >     The frame data is returned as a packed DIB.*/
> >     void *pDIB;
> >     PGETFRAME  pUncompressStream;
> >     pDIB = malloc(dimensionDIB+sizeof(BITMAPFILEHEADER ));
> > //....
> >     pDIB= AVIStreamGetFrame(pUncompressStream,FrameIndex);
> > //....

> >                                                 Many Thanks for your
> > help,
> >                                                             Gianpaolo

Re:AVI==>pFrame=?=>TBitmap


On Tue, 27 Oct 1998 19:17:51 +0100, Gianpaolo <g...@altavista.net>
wrote:

Quote
>Thank Stefan for your answer,
>but i don't need to display all frames.
>I need to display a  frame only if the user want it.
>I have a DIB in memory and i perform some operations on pixels, like
>Histogram, Difference,...
>I perform this operations on many AVI.
>When user say "Give me AVI #3 - frame #17", i display it.
>How can i do it faster than write DIB on disk, pass from ClipBoard or
>TMediaPlayer?

You can use DrawDibOpen, DrawDibDraw, DrawDibClose to
this effect. They take care of uncompressing the image.
To display the thing in a window, I use a Timage->Canvas->Handle
to provide a hdc for the api, Timage->ClientRect for dest
dimensions, and 0,0,-1,-1 for source dimensions.
HTH
Gerard

Re:AVI==>pFrame=?=>TBitmap


Many, Many , Many Thanks for your answer.
The system work really good.
(I use TBitmap->Canvas->Handle because i don't need to display
the image.)

Bye Bye
Gianpaolo

Quote
gerard patel wrote:
> You can use DrawDibOpen, DrawDibDraw, DrawDibClose to
> this effect. They take care of uncompressing the image.
> To display the thing in a window, I use a Timage->Canvas->Handle
> to provide a hdc for the api, Timage->ClientRect for dest
> dimensions, and 0,0,-1,-1 for source dimensions.
> HTH
> Gerard

Other Threads