load also rgba images correctly

git-svn-id: svn://code.dyne.org/veejay/trunk@896 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2007-03-31 22:31:07 +00:00
parent 6aa3f817f5
commit a546965dc2

View File

@@ -67,7 +67,6 @@ extern int get_ffmpeg_pixfmt(int id);
extern uint8_t *vj_perform_get_preview_buffer(); extern uint8_t *vj_perform_get_preview_buffer();
static VJFrame *open_pixbuf( const char *filename, int dst_w, int dst_h, int dst_fmt, static VJFrame *open_pixbuf( const char *filename, int dst_w, int dst_h, int dst_fmt,
uint8_t *dY, uint8_t *dU, uint8_t *dV ) uint8_t *dY, uint8_t *dU, uint8_t *dV )
{ {
@@ -81,16 +80,24 @@ static VJFrame *open_pixbuf( const char *filename, int dst_w, int dst_h, int dst
/* convert image to veejay frame in proper dimensions, free image */ /* convert image to veejay frame in proper dimensions, free image */
int img_fmt = PIX_FMT_RGB24;
if( gdk_pixbuf_get_has_alpha( image ))
img_fmt = PIX_FMT_RGBA;
VJFrame *dst = yuv_yuv_template( dY, dU, dV, dst_w, dst_h, dst_fmt ); VJFrame *dst = yuv_yuv_template( dY, dU, dV, dst_w, dst_h, dst_fmt );
VJFrame *src = yuv_rgb_template( VJFrame *src = yuv_rgb_template(
(uint8_t*) gdk_pixbuf_get_pixels( image ), (uint8_t*) gdk_pixbuf_get_pixels( image ),
gdk_pixbuf_get_width( image ), gdk_pixbuf_get_width( image ),
gdk_pixbuf_get_height( image ), gdk_pixbuf_get_height( image ),
PIX_FMT_RGB24 img_fmt // PIX_FMT_RGB24
); );
int stride = gdk_pixbuf_get_rowstride(image);
veejay_msg(VEEJAY_MSG_DEBUG,"Image is %dx%d (dst fmt=%d), scaling to %dx%d", if( stride != src->stride[0] )
src->width,src->height,dst_fmt,dst->width,dst->height ); src->stride[0] = stride;
veejay_msg(VEEJAY_MSG_DEBUG,"Image is %dx%d (src=%d, stride=%d, dstfmt=%d), scaling to %dx%d",
src->width,src->height,img_fmt, stride,dst_fmt,dst->width,dst->height );
yuv_convert_any( src, dst, src->format, dst->format ); yuv_convert_any( src, dst, src->format, dst->format );