Author: alexlan
Update of /cvs/free/rpms/xbmc/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv7931
Modified Files:
xbmc.spec
Added Files:
xbmc-10.1-libpng-1.5.patch xbmc-support_newer_libbluray.patch
Log Message:
Add patch for newer libbluray support (thanks Xavier Bachelot)
Add patch for libpng 1.5 support (from gentoo)
xbmc-10.1-libpng-1.5.patch:
ximapng.cpp | 294 ++++++++++++++++++++++++++++++++++++++++++++++++------------
ximapng.h | 5 +
2 files changed, 241 insertions(+), 58 deletions(-)
--- NEW FILE xbmc-10.1-libpng-1.5.patch ---
fix building with newer libpng. patch by Ian Stakenvicius.
https://bugs.gentoo.org/380127
--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.h
+++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.h
@@ -69,8 +69,13 @@
static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
{
+#if PNG_LIBPNG_VER > 10399
+ strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
+ longjmp(png_jmpbuf(png_ptr), 1);
+#else
strncpy((char*)png_ptr->error_ptr,error_msg,255);
longjmp(png_ptr->jmpbuf, 1);
+#endif
}
};
--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
@@ -15,7 +15,11 @@
void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
{
strcpy(info.szLastError,message);
+#if PNG_LIBPNG_VER > 10399
+ longjmp(png_jmpbuf(png_ptr), 1);
+#else
longjmp(png_ptr->jmpbuf, 1);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
#if CXIMAGE_SUPPORT_DECODE
@@ -62,7 +66,11 @@
/* Set error handling if you are using the setjmp/longjmp method (this is
* the normal method of doing things with libpng). REQUIRED unless you
* set up your own error handlers in the png_create_read_struct() earlier. */
+#if PNG_LIBPNG_VER > 10399
+ if (setjmp(png_jmpbuf(png_ptr))) {
+#else
if (setjmp(png_ptr->jmpbuf)) {
+#endif
/* Free all of the memory associated with the png_ptr and info_ptr */
delete [] row_pointers;
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
@@ -70,16 +78,35 @@
/* read the file information */
png_read_info(png_ptr, info_ptr);
+ png_uint_32 _width,_height;
+ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
+#if PNG_LIBPNG_VER > 10399
+ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
+ &_interlace_type,&_compression_type,&_filter_type);
+#else
+ _width=info_ptr->width;
+ _height=info_ptr->height;
+ _bit_depth=info_ptr->bit_depth;
+ _color_type=info_ptr->color_type;
+ _interlace_type=info_ptr->interlace_type;
+ _compression_type=info_ptr->compression_type;
+ _filter_type=info_ptr->filter_type;
+#endif
+
if (info.nEscape == -1){
- head.biWidth = info_ptr->width;
- head.biHeight= info_ptr->height;
+ head.biWidth = _width;
+ head.biHeight= _height;
info.dwType = CXIMAGE_FORMAT_PNG;
+#if PNG_LIBPNG_VER > 10399
+ longjmp(png_jmpbuf(png_ptr), 1);
+#else
longjmp(png_ptr->jmpbuf, 1);
+#endif
}
/* calculate new number of channels */
int channels=0;
- switch(info_ptr->color_type){
+ switch(_color_type){
case PNG_COLOR_TYPE_GRAY:
case PNG_COLOR_TYPE_PALETTE:
channels = 1;
@@ -101,71 +128,108 @@
break;
default:
strcpy(info.szLastError,"unknown PNG color type");
+#if PNG_LIBPNG_VER > 10399
+ longjmp(png_jmpbuf(png_ptr), 1);
+#else
longjmp(png_ptr->jmpbuf, 1);
+#endif
}
//find the right pixel depth used for cximage
+#if PNG_LIBPNG_VER > 10399
+ int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr);
+#else
int pixel_depth = info_ptr->pixel_depth;
+#endif
if (channels == 1 && pixel_depth>8) pixel_depth=8;
if (channels == 2) pixel_depth=8;
if (channels >= 3) pixel_depth=24;
- if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
+ if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){
+#if PNG_LIBPNG_VER > 10399
+ longjmp(png_jmpbuf(png_ptr), 1);
+#else
longjmp(png_ptr->jmpbuf, 1);
+#endif
}
/* get metrics */
- switch (info_ptr->phys_unit_type)
+ png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit;
+ int _phys_unit_type;
+#if PNG_LIBPNG_VER > 10399
+ png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type);
+#else
+ _x_pixels_per_unit=info_ptr->x_pixels_per_unit;
+ _y_pixels_per_unit=info_ptr->y_pixels_per_unit;
+ _phys_unit_type=info_ptr->phys_unit_type;
+#endif
+ switch (_phys_unit_type)
{
case PNG_RESOLUTION_UNKNOWN:
- SetXDPI(info_ptr->x_pixels_per_unit);
- SetYDPI(info_ptr->y_pixels_per_unit);
+ SetXDPI(_x_pixels_per_unit);
+ SetYDPI(_y_pixels_per_unit);
break;
case PNG_RESOLUTION_METER:
- SetXDPI((long)floor(info_ptr->x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
- SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
break;
}
- if (info_ptr->num_palette>0){
- SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
- SetClrImportant(info_ptr->num_palette);
- } else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+ int _num_palette;
+ png_colorp _palette;
+#if PNG_LIBPNG_VER > 10399
+ png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
+#else
+ _num_palette=info_ptr->num_palette;
+ _palette=info_ptr->palette;
+#endif
+ if (_num_palette>0){
+ SetPalette((rgb_color*)_palette,_num_palette);
+ SetClrImportant(_num_palette);
+ } else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
SetPaletteColor(0,0,0,0);
SetPaletteColor(1,85,85,85);
SetPaletteColor(2,170,170,170);
SetPaletteColor(3,255,255,255);
} else SetGrayPalette(); //<DP> needed for grayscale PNGs
- int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
+ int nshift = max(0,(_bit_depth>>3)-1)<<3;
- if (info_ptr->num_trans!=0){ //palette transparency
- if (info_ptr->num_trans==1){
- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
+ png_bytep _trans_alpha;
+ int _num_trans;
+ png_color_16p _trans_color;
+#if PNG_LIBPNG_VER > 10399
+ png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
+#else
+ _num_trans=info_ptr->num_trans;
+#endif
+ if (_num_trans!=0){ //palette transparency
+ if (_num_trans==1){
+ if (_color_type == PNG_COLOR_TYPE_PALETTE){
#if PNG_LIBPNG_VER > 10399
- info.nBkgndIndex = info_ptr->trans_color.index;
+ info.nBkgndIndex = _trans_color->index;
#else
info.nBkgndIndex = info_ptr->trans_values.index;
#endif
} else{
#if PNG_LIBPNG_VER > 10399
- info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
+ info.nBkgndIndex = _trans_color->gray>>nshift;
#else
info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
#endif
}
}
- if (info_ptr->num_trans>1){
+ if (_num_trans>1){
RGBQUAD* pal=GetPalette();
if (pal){
DWORD ip;
- for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
+ for (ip=0;ip<min(head.biClrUsed,(unsigned long)_num_trans);ip++)
#if PNG_LIBPNG_VER > 10399
- pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
+ pal[ip].rgbReserved=_trans_alpha[ip];
#else
pal[ip].rgbReserved=info_ptr->trans[ip];
#endif
- for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
+ for (ip=_num_trans;ip<head.biClrUsed;ip++){
pal[ip].rgbReserved=255;
}
info.bAlphaPaletteEnabled=true;
@@ -174,14 +238,12 @@
}
if (channels == 3){ //check RGB binary transparency
- png_bytep trans;
- int num_trans;
- png_color_16 *image_background;
- if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
&image_background)){
-#if PNG_LIBPNG_VER > 10399
- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift);
- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_color.blue>>nshift);
+ /* seems unnecessary to call again, but the conditional must be important so... */
+ if
(png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color)){
+#if PNG_LIBPNG_VER > 10399
+ info.nBkgndColor.rgbRed = (BYTE)(_trans_color->red>>nshift);
+ info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift);
+ info.nBkgndColor.rgbBlue = (BYTE)(_trans_color->blue>>nshift);
#else
info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_values.red>>nshift);
info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
@@ -202,15 +264,24 @@
}
// <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
- if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
+ if (_color_type & PNG_COLOR_MASK_COLOR){
png_set_bgr(png_ptr);
}
// <vho> - handle cancel
- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
+ if (info.nEscape)
+#if PNG_LIBPNG_VER > 10399
+ longjmp(png_jmpbuf(png_ptr), 1);
+#else
+ longjmp(png_ptr->jmpbuf, 1);
+#endif
// row_bytes is the width x number of channels x (bit-depth / 8)
+#if PNG_LIBPNG_VER > 10399
+ row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
+#else
row_pointers = new BYTE[info_ptr->rowbytes + 8];
+#endif
// turn on interlace handling
int number_passes = png_set_interlace_handling(png_ptr);
@@ -221,8 +292,12 @@
SetCodecOption(0);
}
- int chan_offset = info_ptr->bit_depth >> 3;
+ int chan_offset = _bit_depth >> 3;
+#if PNG_LIBPNG_VER > 10399
+ int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3;
+#else
int pixel_offset = info_ptr->pixel_depth >> 3;
+#endif
for (int pass=0; pass < number_passes; pass++) {
iter.Upset();
@@ -230,7 +305,12 @@
do {
// <vho> - handle cancel
- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
+ if (info.nEscape)
+#if PNG_LIBPNG_VER > 10399
+ longjmp(png_jmpbuf(png_ptr), 1);
+#else
+ longjmp(png_ptr->jmpbuf, 1);
+#endif
#if CXIMAGE_SUPPORT_ALPHA // <vho>
if (AlphaIsValid()) {
@@ -241,7 +321,7 @@
BYTE* prow= iter.GetRow(ay);
//recover data from previous scan
- if (info_ptr->interlace_type && pass>0 && pass!=7){
+ if (_interlace_type && pass>0 && pass!=7){
for(ax=0;ax<head.biWidth;ax++){
long px = ax * pixel_offset;
if (channels == 2){
@@ -278,10 +358,14 @@
#endif // CXIMAGE_SUPPORT_ALPHA // vho
{
//recover data from previous scan
- if (info_ptr->interlace_type && pass>0){
+ if (_interlace_type && pass>0){
+#if PNG_LIBPNG_VER > 10399
+ iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
+#else
iter.GetRow(row_pointers, info_ptr->rowbytes);
+#endif
//re-expand buffer for images with bit depth > 8
- if (info_ptr->bit_depth > 8){
+ if (_bit_depth > 8){
for(long ax=(head.biWidth*channels-1);ax>=0;ax--)
row_pointers[ax*chan_offset] = row_pointers[ax];
}
@@ -291,15 +375,19 @@
png_read_row(png_ptr, row_pointers, NULL);
//shrink 16 bit depth images down to 8 bits
- if (info_ptr->bit_depth > 8){
+ if (_bit_depth > 8){
for(long ax=0;ax<(head.biWidth*channels);ax++)
row_pointers[ax] = row_pointers[ax*chan_offset];
}
//copy the pixels
+#if PNG_LIBPNG_VER > 10399
+ iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
+#else
iter.SetRow(row_pointers, info_ptr->rowbytes);
+#endif
//<DP> expand 2 bpp images only in the last pass
- if (info_ptr->bit_depth==2 && pass==(number_passes-1))
+ if (_bit_depth==2 && pass==(number_passes-1))
expand2to4bpp(iter.GetRow());
//go on
@@ -361,9 +449,13 @@
/* Set error handling. REQUIRED if you aren't supplying your own
* error hadnling functions in the png_create_write_struct() call.
*/
+#if PNG_LIBPNG_VER > 10399
+ if (setjmp(png_jmpbuf(png_ptr))){
+#else
if (setjmp(png_ptr->jmpbuf)){
/* If we get here, we had a problem reading the file */
if (info_ptr->palette) free(info_ptr->palette);
+#endif
png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr);
cx_throw("Error saving PNG file");
}
@@ -372,9 +464,23 @@
//png_init_io(png_ptr, hFile);
// use custom I/O functions
-
png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
+ png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
/* set the file information here */
+#if PNG_LIBPNG_VER > 10399
+ /* use variables to hold the values so it isnt necessary to png_get them later */
+ png_uint_32 _width,_height;
+ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
+ png_byte _channels,_pixel_depth;
+
+ _width = GetWidth();
+ _height = GetHeight();
+ _pixel_depth = (BYTE)GetBpp();
+ _channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
+ _bit_depth = (BYTE)(GetBpp()/_channels);
+ _compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
+ _filter_type = PNG_FILTER_TYPE_DEFAULT;
+#else
info_ptr->width = GetWidth();
info_ptr->height = GetHeight();
info_ptr->pixel_depth = (BYTE)GetBpp();
@@ -382,13 +488,22 @@
info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
info_ptr->compression_type = info_ptr->filter_type = 0;
info_ptr->valid = 0;
+#endif
switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
case 1:
+#if PNG_LIBPNG_VER > 10399
+ _interlace_type = PNG_INTERLACE_ADAM7;
+#else
info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
+#endif
break;
default:
+#if PNG_LIBPNG_VER > 10399
+ _interlace_type = PNG_INTERLACE_NONE;
+#else
info_ptr->interlace_type = PNG_INTERLACE_NONE;
+#endif
}
/* set compression level */
@@ -398,22 +513,47 @@
if (GetNumColors()){
if (bGrayScale){
+#if PNG_LIBPNG_VER > 10399
+ _color_type = PNG_COLOR_TYPE_GRAY;
+#else
info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
+#endif
} else {
+#if PNG_LIBPNG_VER > 10399
+ _color_type = PNG_COLOR_TYPE_PALETTE;
+#else
info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
+#endif
}
} else {
+#if PNG_LIBPNG_VER > 10399
+ _color_type = PNG_COLOR_TYPE_RGB;
+#else
info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+#endif
}
#if CXIMAGE_SUPPORT_ALPHA
if (AlphaIsValid()){
+#if PNG_LIBPNG_VER > 10399
+ _color_type |= PNG_COLOR_MASK_ALPHA;
+ _channels++;
+ _bit_depth = 8;
+ _pixel_depth += 8;
+#else
info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
info_ptr->channels++;
info_ptr->bit_depth = 8;
info_ptr->pixel_depth += 8;
+#endif
}
#endif
+#if PNG_LIBPNG_VER > 10399
+ /* set the header here, since we're done modifying these values */
+ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type,
+ _compression_type,_filter_type);
+#endif
+
/* set background */
png_color_16 image_background={ 0, 255, 255, 255, 0 };
RGBQUAD tc = GetTransColor();
@@ -427,22 +567,24 @@
/* set metrics */
png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter,
PNG_RESOLUTION_METER);
+#if PNG_LIBPNG_VER <= 10399
png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height,
info_ptr->bit_depth,
info_ptr->color_type, info_ptr->interlace_type,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+#endif
//<DP> simple transparency
if (info.nBkgndIndex >= 0){
- info_ptr->num_trans = 1;
- info_ptr->valid |= PNG_INFO_tRNS;
#if PNG_LIBPNG_VER > 10399
- info_ptr->trans_alpha = trans;
- info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
- info_ptr->trans_color.red = tc.rgbRed;
- info_ptr->trans_color.green = tc.rgbGreen;
- info_ptr->trans_color.blue = tc.rgbBlue;
- info_ptr->trans_color.gray = info_ptr->trans_color.index;
+ png_color_16 _trans_color;
+ _trans_color.index = (BYTE)info.nBkgndIndex;
+ _trans_color.red = tc.rgbRed;
+ _trans_color.green = tc.rgbGreen;
+ _trans_color.blue = tc.rgbBlue;
+ _trans_color.gray = _trans_color.index;
#else
+ info_ptr->num_trans = 1;
+ info_ptr->valid |= PNG_INFO_tRNS;
info_ptr->trans = trans;
info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
info_ptr->trans_values.red = tc.rgbRed;
@@ -454,34 +596,53 @@
// the transparency indexes start from 0 for non grayscale palette
if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
SwapIndex(0,(BYTE)info.nBkgndIndex);
+
+#if PNG_LIBPNG_VER > 10399
+ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color);
+#endif
}
/* set the palette if there is one */
+#if PNG_LIBPNG_VER > 10399
+ png_colorp _palette;
+#endif
if (GetPalette()){
+#if PNG_LIBPNG_VER <= 10399
if (!bGrayScale){
info_ptr->valid |= PNG_INFO_PLTE;
}
+#endif
int nc = GetClrImportant();
if (nc==0) nc = GetNumColors();
+ // copy the palette colors
+#if PNG_LIBPNG_VER > 10399
+ _palette = new png_color[nc];
+#else
+ info_ptr->palette = new png_color[nc];
+ info_ptr->num_palette = (png_uint_16) nc;
+#endif
+ for (int i=0; i<nc; i++)
+#if PNG_LIBPNG_VER > 10399
+ GetPaletteColor(i, &_palette[i].red, &_palette[i].green,
&_palette[i].blue);
+
+ png_set_PLTE(png_ptr,info_ptr,_palette,nc);
+#else
+ GetPaletteColor(i, &info_ptr->palette[i].red,
&info_ptr->palette[i].green, &info_ptr->palette[i].blue);
+#endif
+
if (info.bAlphaPaletteEnabled){
for(WORD ip=0; ip<nc;ip++)
trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
- info_ptr->num_trans = (WORD)nc;
- info_ptr->valid |= PNG_INFO_tRNS;
#if PNG_LIBPNG_VER > 10399
- info_ptr->trans_alpha = trans;
+ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL);
#else
+ info_ptr->num_trans = (WORD)nc;
+ info_ptr->valid |= PNG_INFO_tRNS;
info_ptr->trans = trans;
#endif
}
-
- // copy the palette colors
- info_ptr->palette = new png_color[nc];
- info_ptr->num_palette = (png_uint_16) nc;
- for (int i=0; i<nc; i++)
- GetPaletteColor(i, &info_ptr->palette[i].red,
&info_ptr->palette[i].green, &info_ptr->palette[i].blue);
}
#if CXIMAGE_SUPPORT_ALPHA // <vho>
@@ -495,8 +656,12 @@
} } }
#endif // CXIMAGE_SUPPORT_ALPHA // <vho>
+#if PNG_LIBPNG_VER > 10399
+ int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8));
+#else
int row_size = max(info.dwEffWidth,
info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
info_ptr->rowbytes = row_size;
+#endif
BYTE *row_pointers = new BYTE[row_size];
/* write the file information */
@@ -514,7 +679,11 @@
if (AlphaIsValid()){
for (long ax=head.biWidth-1; ax>=0;ax--){
c = BlindGetPixelColor(ax,ay);
+#if PNG_LIBPNG_VER > 10399
+ int px = ax * _channels;
+#else
int px = ax * info_ptr->channels;
+#endif
if (!bGrayScale){
row_pointers[px++]=c.rgbRed;
row_pointers[px++]=c.rgbGreen;
@@ -529,7 +698,11 @@
#endif //CXIMAGE_SUPPORT_ALPHA // <vho>
{
iter.GetRow(row_pointers, row_size);
+#if PNG_LIBPNG_VER > 10399
+ if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
+#else
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
+#endif
RGBtoBGR(row_pointers, row_size);
png_write_row(png_ptr, row_pointers);
}
@@ -546,9 +719,14 @@
png_write_end(png_ptr, info_ptr);
/* if you malloced the palette, free it here */
+#if PNG_LIBPNG_VER > 10399
+ if (_palette){
+ delete [] (_palette);
+#else
if (info_ptr->palette){
delete [] (info_ptr->palette);
info_ptr->palette = NULL;
+#endif
}
/* clean up after the write, and free any memory allocated */
xbmc-support_newer_libbluray.patch:
configure.in | 37 ++++
xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp | 80 ++++++++--
2 files changed, 103 insertions(+), 14 deletions(-)
--- NEW FILE xbmc-support_newer_libbluray.patch ---
diff -Naur xbmc-10.1.orig/configure.in xbmc-10.1/configure.in
--- xbmc-10.1.orig/configure.in 2011-12-14 21:34:38.000000000 +0100
+++ xbmc-10.1/configure.in 2011-12-14 21:36:57.000000000 +0100
@@ -56,6 +56,17 @@
fi
])
+# Function to push and pop libs and includes for a command
+AC_DEFUN([XB_PUSH_FLAGS], [
+ SAVE_LIBS="$LIBS"
+ SAVE_INCLUDES="$INCLUDES"
+ LIBS="[$2]"
+ INCLUDES="[$1]"
+ [$3]
+ LIBS="$SAVE_LIBS"
+ INCLUDES="$SAVE_INCLUDES"
+])
+
# General message strings
configure_debug="ERROR: this is a configure debug statement"
missing_library="Could not find a required library. Please see the README for your
platform."
@@ -614,6 +625,32 @@
fi;
AC_DEFINE([HAVE_LIBBLURAY], 1, [System has libbluray library])
AC_SUBST([HAVE_LIBBLURAY], 1)
+
+ XB_PUSH_FLAGS(
+ [$LIBBLURAY_CFLAGS]
+ , [$LIBBLURAY_LIBS]
+
+ , AC_MSG_CHECKING([libbluray version])
+ AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM(
+ [#include <libbluray/bluray.h>]
+ ,[bd_get_playlist_info(0, 0)])
+ ,[AC_MSG_RESULT(version has old angle api)
+ AC_DEFINE([HAVE_LIBBLURAY_NOANGLE],[],[System has an old api libbluray
without angle support])]
+ ,[AC_MSG_RESULT(normal)]
+ )
+
+ AC_MSG_CHECKING([for libbluray log control])
+ AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [#include <libbluray/bluray.h>
+ #include <libbluray/log_control.h>]
+ ,[bd_set_debug_mask(0)])
+ , AC_MSG_RESULT(yes)
+ ,[AC_MSG_RESULT(no)
+ AC_DEFINE([HAVE_LIBBLURAY_NOLOGCONTROL],[],[System has an old api libbluray
without log support])]
+ )
+ )
],[
# AC_DEFINE([HAVE_LIBBLURAY], 0, [System has libbluray library])
AC_SUBST([HAVE_LIBBLURAY], 0)
diff -Naur xbmc-10.1.orig/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp
xbmc-10.1/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp
---
xbmc-10.1.orig/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp 2011-03-05
04:33:37.000000000 +0100
+++ xbmc-10.1/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamBluray.cpp 2011-12-14
21:36:49.000000000 +0100
@@ -34,15 +34,18 @@
{
#include <libbluray/bluray.h>
#include <libbluray/filesystem.h>
+#ifndef HAVE_LIBBLURAY_NOLOGCONTROL
+#include <libbluray/log_control.h>
+#endif
}
class DllLibblurayInterface
{
public:
virtual ~DllLibblurayInterface() {};
- virtual uint32_t bd_get_titles(BLURAY *bd, uint8_t flags)=0;
- virtual BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx)=0;
- virtual BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist)=0;
+ virtual uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t
min_title_length)=0;
+ virtual BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned
angle)=0;
+ virtual BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned
angle)=0;
virtual void bd_free_title_info(BLURAY_TITLE_INFO *title_info)=0;
virtual BLURAY *bd_open(const char* device_path, const char* keyfile_path)=0;
virtual void bd_close(BLURAY *bd)=0;
@@ -64,15 +67,26 @@
virtual uint64_t bd_tell_time(BLURAY *bd)=0;
virtual BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p)=0;
virtual BD_DIR_OPEN bd_register_dir(BD_DIR_OPEN p)=0;
+
+#ifndef HAVE_LIBBLURAY_NOLOGCONTROL
+ virtual void bd_set_debug_handler(BD_LOG_FUNC)=0;
+ virtual void bd_set_debug_mask(uint32_t mask)=0;
+ virtual uint32_t bd_get_debug_mask(void)=0;
+#endif
};
class DllLibbluray : public DllDynamic, DllLibblurayInterface
{
DECLARE_DLL_WRAPPER(DllLibbluray, DLL_PATH_LIBBLURAY)
-
- DEFINE_METHOD2(uint32_t, bd_get_titles, (BLURAY *p1, uint8_t p2))
- DEFINE_METHOD2(BLURAY_TITLE_INFO*, bd_get_title_info, (BLURAY *p1, uint32_t p2))
- DEFINE_METHOD2(BLURAY_TITLE_INFO*, bd_get_playlist_info, (BLURAY *p1, uint32_t p2))
+#ifdef HAVE_LIBBBLURAY_HAVE_LIBBLURAY_NOANGLE
+ DEFINE_METHOD3(uint32_t, bd_get_titles, (BLURAY *p1, uint8_t p2))
+ DEFINE_METHOD3(BLURAY_TITLE_INFO*, bd_get_title_info, (BLURAY *p1, uint32_t p2))
+ DEFINE_METHOD3(BLURAY_TITLE_INFO*, bd_get_playlist_info, (BLURAY *p1, uint32_t p2))
+#else
+ DEFINE_METHOD3(uint32_t, bd_get_titles, (BLURAY *p1, uint8_t p2,
uint32_t p3))
+ DEFINE_METHOD3(BLURAY_TITLE_INFO*, bd_get_title_info, (BLURAY *p1, uint32_t p2,
unsigned p3))
+ DEFINE_METHOD3(BLURAY_TITLE_INFO*, bd_get_playlist_info, (BLURAY *p1, uint32_t p2,
unsigned p3))
+#endif
DEFINE_METHOD1(void, bd_free_title_info, (BLURAY_TITLE_INFO *p1))
DEFINE_METHOD2(BLURAY*, bd_open, (const char* p1, const
char* p2))
DEFINE_METHOD1(void, bd_close, (BLURAY *p1))
@@ -95,10 +109,22 @@
DEFINE_METHOD1(BD_FILE_OPEN, bd_register_file, (BD_FILE_OPEN p1))
DEFINE_METHOD1(BD_DIR_OPEN, bd_register_dir, (BD_DIR_OPEN p1))
+#ifndef HAVE_LIBBLURAY_NOLOGCONTROL
+ DEFINE_METHOD1(void, bd_set_debug_handler, (BD_LOG_FUNC p1))
+ DEFINE_METHOD1(void, bd_set_debug_mask, (uint32_t p1))
+ DEFINE_METHOD0(uint32_t, bd_get_debug_mask)
+#endif
+
BEGIN_METHOD_RESOLVE()
- RESOLVE_METHOD_RENAME(bd_get_titles, bd_get_titles)
- RESOLVE_METHOD_RENAME(bd_get_title_info, bd_get_title_info)
- RESOLVE_METHOD_RENAME(bd_get_playlist_info, bd_get_playlist_info)
+#ifdef HAVE_LIBBBLURAY_HAVE_LIBBLURAY_NOANGLE
+ RESOLVE_METHOD_RENAME(bd_get_titles, bd_get_titles_noangle)
+ RESOLVE_METHOD_RENAME(bd_get_title_info, bd_get_title_info_noangle)
+ RESOLVE_METHOD_RENAME(bd_get_playlist_info, bd_get_playlist_info_noangle)
+#else
+ RESOLVE_METHOD(bd_get_titles)
+ RESOLVE_METHOD(bd_get_title_info)
+ RESOLVE_METHOD(bd_get_playlist_info)
+#endif
RESOLVE_METHOD_RENAME(bd_free_title_info, bd_free_title_info)
RESOLVE_METHOD_RENAME(bd_open, bd_open)
RESOLVE_METHOD_RENAME(bd_close, bd_close)
@@ -120,7 +146,21 @@
RESOLVE_METHOD_RENAME(bd_tell_time, bd_tell_time)
RESOLVE_METHOD_RENAME(bd_register_file, bd_register_file)
RESOLVE_METHOD_RENAME(bd_register_dir, bd_register_dir)
+#ifndef HAVE_LIBBLURAY_NOLOGCONTROL
+ RESOLVE_METHOD(bd_set_debug_handler)
+ RESOLVE_METHOD(bd_set_debug_mask)
+ RESOLVE_METHOD(bd_get_debug_mask)
+#endif
END_METHOD_RESOLVE()
+
+#ifdef HAVE_LIBBBLURAY_HAVE_LIBBLURAY_NOANGLE
+ uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length)
+ {return bd_get_titles_noangle(bd, flags); }
+ BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned angle)
+ {return bd_get_title_info_noangle(bd, title_idx); }
+ BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned angle)
+ {return bd_get_playlist_info_noangle(bd, playlist); }
+#endif
};
@@ -250,6 +290,14 @@
return dir;
}
+
+#ifndef HAVE_LIBBLURAY_NOLOGCONTROL
+static void bluray_logger(const char* msg)
+{
+ CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Logger - %s", msg);
+}
+#endif
+
CDVDInputStreamBluray::CDVDInputStreamBluray() :
CDVDInputStream(DVDSTREAM_TYPE_BLURAY)
{
@@ -290,6 +338,10 @@
m_dll->bd_register_dir(dir_open);
m_dll->bd_register_file(file_open);
+#ifndef HAVE_LIBBLURAY_NOLOGCONTROL
+ m_dll->bd_set_debug_handler(bluray_logger);
+ m_dll->bd_set_debug_mask(DBG_CRIT);
+#endif
CLog::Log(LOGDEBUG, "CDVDInputStreamBluray::Open - opening %s",
strPath.c_str());
m_bd = m_dll->bd_open(strPath.c_str(), NULL);
@@ -303,12 +355,12 @@
CStdString filename = CUtil::GetFileName(strFile);
if(filename.Equals("index.bdmv"))
{
- int titles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT);
+ int titles = m_dll->bd_get_titles(m_bd, TITLES_RELEVANT, 0);
BLURAY_TITLE_INFO *t, *s = NULL;
for(int i=0; i < titles; i++)
{
- t = m_dll->bd_get_title_info(m_bd, i);;
+ t = m_dll->bd_get_title_info(m_bd, i, 0);
if(!t)
{
CLog::Log(LOGDEBUG, "get_main_title - unable to get title %d", i);
@@ -324,7 +376,7 @@
}
else if(CUtil::GetExtension(filename).Equals(".mpls"))
{
- int titles = m_dll->bd_get_titles(m_bd, TITLES_ALL);
+ int titles = m_dll->bd_get_titles(m_bd, TITLES_ALL, 0);
do
{
if(titles < 0)
@@ -345,7 +397,7 @@
BLURAY_TITLE_INFO *t;
for(int i=0; i < titles; i++)
{
- t = m_dll->bd_get_title_info(m_bd, i);;
+ t = m_dll->bd_get_title_info(m_bd, i, 0);
if(!t)
{
CLog::Log(LOGDEBUG, "get_playlist_title - unable to get title %d",
i);
Index: xbmc.spec
===================================================================
RCS file: /cvs/free/rpms/xbmc/devel/xbmc.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- xbmc.spec 23 Nov 2011 19:23:03 -0000 1.32
+++ xbmc.spec 14 Dec 2011 23:58:52 -0000 1.33
@@ -5,7 +5,7 @@
Name: xbmc
Version: 10.1
-Release: 7%{?dist}
+Release: 8%{?dist}
URL:
http://www.xbmc.org/
Source0: %{name}-%{DIRVERSION}-patched.tar.xz
@@ -48,6 +48,16 @@
# (committed to git upstream:
http://trac.xbmc.org/ticket/11383)
Patch7: xbmc-Dharma-10.1-gcc-4.6-fixes-0.1.patch
+# upstream patches for newer libbluray support
+# commit 8c1504d0a647271ee48ff83c6eac2cd4b7670df0
+# commit e41dd86046cabe84493453c6588baaf5279710fd
+# commit d17f271d6489cc76494fbc4f3e8017a97d947af4
+Patch8: xbmc-support_newer_libbluray.patch
+
+# libpng 1.5 patch from gentoo
+#
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-tv/xbmc/fil...
+Patch9: xbmc-10.1-libpng-1.5.patch
+
ExcludeArch: ppc64
Buildroot: %{_tmppath}/%{name}-%{version}
Summary: Media center
@@ -128,7 +138,7 @@
BuildRequires: gettext
%endif
BuildRequires: librtmp-devel
-BuildRequires: libbluray-devel
+BuildRequires: libbluray-devel >= 0.2.1
# VAAPI currently not working, comment-out
#BuildRequires: libva-freeworld-devel
@@ -163,6 +173,8 @@
%patch5 -p0
%patch6 -p0
%patch7 -p1
+%patch8 -p1
+%patch9 -p1
# Prevent rerunning the autotools.
touch -r xbmc/screensavers/rsxs-0.9/aclocal.m4 \
@@ -234,6 +246,10 @@
%{_datadir}/icons/hicolor/*/*/*.png
%changelog
+* Wed Dec 14 2011 Xavier Bachelot <xavier(a)bachelot.org> - 10.1-8
+- Add patch for newer libbluray support.
+- Add patch for libpng 1.5 support.
+
* Wed Nov 23 2011 Nicolas Chauvet <kwizart(a)gmail.com> - 10.1-7
- Rebuilt for libcdio