diff -Nru libvdpau-0.4.1/debian/changelog libvdpau-0.4.1/debian/changelog --- libvdpau-0.4.1/debian/changelog 2011-12-07 03:52:34.000000000 +0100 +++ libvdpau-0.4.1/debian/changelog 2012-10-23 23:05:23.000000000 +0200 @@ -1,3 +1,11 @@ +libvdpau (0.4.1-3ubuntu2) precise; urgency=low + + * Apply Stephen Warren's patch for blue tint in Adobe Flash videos + (LP: #967091). (Applied to Debian version libvdpau-0.4.1-5.1 by + Maurizio Avogadro.) + + -- Sebastian Boehm Tue, 23 Oct 2012 13:16:37 +0200 + libvdpau (0.4.1-3ubuntu1) precise; urgency=low * Merge from debian testing. Remaining changes: diff -Nru libvdpau-0.4.1/debian/libvdpau1.symbols libvdpau-0.4.1/debian/libvdpau1.symbols --- libvdpau-0.4.1/debian/libvdpau1.symbols 2011-09-09 07:07:28.000000000 +0200 +++ libvdpau-0.4.1/debian/libvdpau1.symbols 2012-10-23 23:05:23.000000000 +0200 @@ -2,4 +2,6 @@ _vdp_DRI2Connect@Base 0.4 _vdp_DRI2QueryExtension@Base 0.4 _vdp_DRI2QueryVersion@Base 0.4 + init_config@Base 0.4.1-3~ + init_fixes@Base 0.4.1-3~ vdp_device_create_x11@Base 0.2 diff -Nru libvdpau-0.4.1/debian/patches/libvdpau_flashplayer.patch libvdpau-0.4.1/debian/patches/libvdpau_flashplayer.patch --- libvdpau-0.4.1/debian/patches/libvdpau_flashplayer.patch 1970-01-01 01:00:00.000000000 +0100 +++ libvdpau-0.4.1/debian/patches/libvdpau_flashplayer.patch 2012-10-23 23:05:23.000000000 +0200 @@ -0,0 +1,243 @@ +Author: Stephen Warren +Description: Apply some fixes for Adobe Flash Player ugliness + 1) Swap U and V planes to VdpVideoSurfacePutBitsYCbCr to fix blue-tinged + videos. + . + 2) Disable VdpPresentationQueueSetBackgroundColor, so that Flash doesn't + set the background to pure black or pure white, which would cause the + VDPAU image to bleed through to other parts of the desktop with those + very common colors. + . + These workarounds are only enabled when running under Flash player, and + may be individually controlled via /etc/vdpau_wrapper.cfg, should they + ever need to be disabled. + . + Note that this code stores the VDPAU backend function pointers as global + variables, which is technically incorrect. However, the likelihood of + any known VDPAU implementation ever returning different values for these + pointers within a single process is zero. If this becomes a problem, a + has table of VdpDevice to the stored pointers should be implemented. + . + Signed-off-by: Stephen Warren +Origin: other, http://lists.freedesktop.org/archives/vdpau/2012-May/000022.html +Forwarded: not-needed +Reviewed-By: Maurizio Avogadro +Last-Update: 2012-05-09 + +--- libvdpau-0.4.1.orig/src/Makefile.am ++++ libvdpau-0.4.1/src/Makefile.am +@@ -1,6 +1,7 @@ + AM_CFLAGS = \ + -I$(top_srcdir)/include \ + -DVDPAU_MODULEDIR="\"$(moduledir)\"" \ ++ -DVDPAU_SYSCONFDIR="\"$(sysconfdir)\"" \ + $(X11_CFLAGS) \ + $(XEXT_CFLAGS) + +@@ -27,3 +28,6 @@ libvdpauincludedir = $(includedir)/vdpau + libvdpauinclude_HEADERS = \ + $(top_srcdir)/include/vdpau/vdpau.h \ + $(top_srcdir)/include/vdpau/vdpau_x11.h ++ ++libvdpausysconfdir=$(sysconfdir) ++dist_libvdpausysconf_DATA = vdpau_wrapper.cfg +--- libvdpau-0.4.1.orig/src/vdpau_wrapper.c ++++ libvdpau-0.4.1/src/vdpau_wrapper.c +@@ -222,6 +222,163 @@ static void _vdp_close_driver(void) + _vdp_imp_device_create_x11_proc = NULL; + } + ++static VdpGetProcAddress * _imp_get_proc_address; ++static VdpVideoSurfacePutBitsYCbCr * _imp_vid_put_bits_y_cb_cr; ++static VdpPresentationQueueSetBackgroundColor * _imp_pq_set_bg_color; ++static int _inited_fixes; ++static int _running_under_flash; ++static int _enable_flash_uv_swap = 1; ++static int _disable_flash_pq_bg_color = 1; ++ ++static VdpStatus vid_put_bits_y_cb_cr_swapped( ++ VdpVideoSurface surface, ++ VdpYCbCrFormat source_ycbcr_format, ++ void const * const * source_data, ++ uint32_t const * source_pitches ++) ++{ ++ void const * data_reordered[3]; ++ void const * const * data; ++ ++ if (source_ycbcr_format == VDP_YCBCR_FORMAT_YV12) { ++ data_reordered[0] = source_data[0]; ++ data_reordered[1] = source_data[2]; ++ data_reordered[2] = source_data[1]; ++ /* ++ * source_pitches[1] and source_pitches[2] should be equal, ++ * so no need to re-order. ++ */ ++ data = data_reordered; ++ } ++ else { ++ data = source_data; ++ } ++ ++ return _imp_vid_put_bits_y_cb_cr( ++ surface, ++ source_ycbcr_format, ++ data, ++ source_pitches ++ ); ++} ++ ++static VdpStatus pq_set_bg_color_noop( ++ VdpPresentationQueue presentation_queue, ++ VdpColor * const background_color ++) ++{ ++ return VDP_STATUS_OK; ++} ++ ++static VdpStatus vdp_wrapper_get_proc_address( ++ VdpDevice device, ++ VdpFuncId function_id, ++ /* output parameters follow */ ++ void * * function_pointer ++) ++{ ++ VdpStatus status; ++ ++ status = _imp_get_proc_address(device, function_id, function_pointer); ++ if (status != VDP_STATUS_OK) { ++ return status; ++ } ++ ++ if (_running_under_flash) { ++ switch (function_id) { ++ case VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR: ++ if (_enable_flash_uv_swap) { ++ _imp_vid_put_bits_y_cb_cr = *function_pointer; ++ *function_pointer = vid_put_bits_y_cb_cr_swapped; ++ } ++ break; ++ case VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR: ++ if (_disable_flash_pq_bg_color) { ++ _imp_pq_set_bg_color = *function_pointer; ++ *function_pointer = pq_set_bg_color_noop; ++ } ++ break; ++ default: ++ break; ++ } ++ } ++ ++ return VDP_STATUS_OK; ++} ++ ++static void init_running_under_flash(void) ++{ ++ FILE *fp; ++ char buffer[1024]; ++ int ret, i; ++ ++ fp = fopen("/proc/self/cmdline", "r"); ++ if (!fp) { ++ return; ++ } ++ ret = fread(buffer, 1, sizeof(buffer) - 1, fp); ++ fclose(fp); ++ if (ret < 0) { ++ return; ++ } ++ /* ++ * Sometimes the file contains null between arguments. Wipe these out so ++ * strstr doesn't stop early. ++ */ ++ for (i = 0; i < ret; i++) { ++ if (buffer[i] == '\0') { ++ buffer[i] = 'x'; ++ } ++ } ++ buffer[ret] = '\0'; ++ ++ if (strstr(buffer, "libflashplayer") != NULL) { ++ _running_under_flash = 1; ++ } ++} ++ ++void init_config(void) ++{ ++ FILE *fp; ++ char buffer[1024]; ++ int ret; ++ ++ fp = fopen(VDPAU_SYSCONFDIR "/vdpau_wrapper.cfg", "r"); ++ if (!fp) { ++ return; ++ } ++ ++ while (fgets(buffer, sizeof(buffer), fp) != NULL) { ++ char * equals = strchr(buffer, '='); ++ char * param; ++ ++ if (equals == NULL) { ++ continue; ++ } ++ ++ *equals = '\0'; ++ param = equals + 1; ++ ++ if (!strcmp(buffer, "enable_flash_uv_swap")) { ++ _enable_flash_uv_swap = atoi(param); ++ } ++ else if (!strcmp(buffer, "disable_flash_pq_bg_color")) { ++ _disable_flash_pq_bg_color = atoi(param); ++ } ++ } ++} ++ ++void init_fixes(void) ++{ ++ if (_inited_fixes) { ++ return; ++ } ++ _inited_fixes = 1; ++ ++ init_running_under_flash(); ++ init_config(); ++} ++ + VdpStatus vdp_device_create_x11( + Display * display, + int screen, +@@ -232,6 +389,8 @@ VdpStatus vdp_device_create_x11( + { + VdpStatus status; + ++ init_fixes(); ++ + if (!_vdp_imp_device_create_x11_proc) { + status = _vdp_open_driver(display, screen); + if (status != VDP_STATUS_OK) { +@@ -240,10 +399,17 @@ VdpStatus vdp_device_create_x11( + } + } + +- return _vdp_imp_device_create_x11_proc( ++ status = _vdp_imp_device_create_x11_proc( + display, + screen, + device, +- get_proc_address ++ &_imp_get_proc_address + ); ++ if (status != VDP_STATUS_OK) { ++ return status; ++ } ++ ++ *get_proc_address = vdp_wrapper_get_proc_address; ++ ++ return VDP_STATUS_OK; + } +--- /dev/null ++++ libvdpau-0.4.1/src/vdpau_wrapper.cfg +@@ -0,0 +1,2 @@ ++enable_flash_uv_swap=1 ++disable_flash_pq_bg_color=1 diff -Nru libvdpau-0.4.1/debian/patches/series libvdpau-0.4.1/debian/patches/series --- libvdpau-0.4.1/debian/patches/series 2011-09-09 07:07:28.000000000 +0200 +++ libvdpau-0.4.1/debian/patches/series 2012-10-23 23:05:23.000000000 +0200 @@ -2,3 +2,4 @@ link-with-libx11.patch simplify-dlopen-path-length-error-handling.patch vdpau-module-searchpath.patch +libvdpau_flashplayer.patch diff -Nru libvdpau-0.4.1/debian/rules libvdpau-0.4.1/debian/rules --- libvdpau-0.4.1/debian/rules 2011-09-09 07:07:28.000000000 +0200 +++ libvdpau-0.4.1/debian/rules 2012-10-23 23:05:23.000000000 +0200 @@ -33,7 +33,7 @@ override_dh_auto_configure: $(EXTRA_CONFIGURE) dh_testdir LDFLAGS="-Wl,--as-needed" ./configure \ - --prefix=/usr --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ + --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ $(CONFIGURE_OPTIONS) configure32: @@ -41,7 +41,7 @@ mkdir debian/32 cd debian/32 && \ CC="$(CC) -m32" CXX="$(CXX) -m32" LDFLAGS="-Wl,--as-needed" \ - ../../configure --prefix=/usr --libdir=/usr/lib32 \ + ../../configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib32 \ $(CONFIGURE_OPTIONS) override_dh_auto_build: $(EXTRA_BUILD)