diff --git a/README.md b/README.md index d777faa..7878ec9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # libvdpau +VDPAU is the Video Decode and Presentation API for UNIX. It provides an interface to video decode acceleration and presentation hardware present in modern GPUs. + diff --git a/libvdpau-0.4.1-track_dynamic_library_handles_and_free_them_on_exit.patch b/libvdpau-0.4.1-track_dynamic_library_handles_and_free_them_on_exit.patch new file mode 100644 index 0000000..e32fc12 --- /dev/null +++ b/libvdpau-0.4.1-track_dynamic_library_handles_and_free_them_on_exit.patch @@ -0,0 +1,179 @@ +From 4262513e67c3572ed19bd796ec6180cdde7ccb7e Mon Sep 17 00:00:00 2001 +From: Kiran Pawar +Date: Fri, 05 Aug 2011 06:15:18 +0000 +Subject: vdpau_wrapper.c: Track dynamic library handles and free them on exit using __attribute__((destructor)) + +Signed-off-by: Kiran Pawar +Tested-by: Aaron Plattner +Signed-off-by: Aaron Plattner +--- +diff --git a/src/vdpau_wrapper.c b/src/vdpau_wrapper.c +index f504775..23de3d4 100644 +--- a/src/vdpau_wrapper.c ++++ b/src/vdpau_wrapper.c +@@ -40,6 +40,17 @@ typedef void SetDllHandle( + void * driver_dll_handle + ); + ++static void * _vdp_backend_dll; ++static void * _vdp_trace_dll; ++static void * _vdp_driver_dll; ++static VdpDeviceCreateX11 * _vdp_imp_device_create_x11_proc; ++ ++#if defined(__GNUC__) ++ ++static void _vdp_close_driver(void) __attribute__((destructor)); ++ ++#endif ++ + #if DEBUG + + static void _vdp_wrapper_error_breakpoint(char const * file, int line, char const * function) +@@ -87,23 +98,16 @@ static char * _vdp_get_driver_name_from_dri2( + return driver_name; + } + +-VdpStatus vdp_device_create_x11( ++static VdpStatus _vdp_open_driver( + Display * display, +- int screen, +- /* output parameters follow */ +- VdpDevice * device, +- VdpGetProcAddress * * get_proc_address +-) ++ int screen) + { + char const * vdpau_driver; + char * vdpau_driver_dri2 = NULL; + char vdpau_driver_lib[PATH_MAX]; +- void * backend_dll; + char const * vdpau_trace; + char const * func_name; + +- VdpDeviceCreateX11 * vdp_imp_device_create_x11; +- + vdpau_driver = getenv("VDPAU_DRIVER"); + if (!vdpau_driver) { + vdpau_driver = vdpau_driver_dri2 = +@@ -125,13 +129,13 @@ VdpStatus vdp_device_create_x11( + return VDP_STATUS_NO_IMPLEMENTATION; + } + +- backend_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL); +- if (!backend_dll) { ++ _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL); ++ if (!_vdp_driver_dll) { + /* Try again using the old path, which is guaranteed to fit in PATH_MAX + * if the complete path fit above. */ + snprintf(vdpau_driver_lib, sizeof(vdpau_driver_lib), DRIVER_LIB_FORMAT, + "", vdpau_driver, ""); +- backend_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL); ++ _vdp_driver_dll = dlopen(vdpau_driver_lib, RTLD_NOW | RTLD_GLOBAL); + } + + if (vdpau_driver_dri2) { +@@ -139,26 +143,28 @@ VdpStatus vdp_device_create_x11( + vdpau_driver_dri2 = NULL; + } + +- if (!backend_dll) { ++ if (!_vdp_driver_dll) { + fprintf(stderr, "Failed to open VDPAU backend %s\n", dlerror()); + _VDP_ERROR_BREAKPOINT(); + return VDP_STATUS_NO_IMPLEMENTATION; + } + ++ _vdp_backend_dll = _vdp_driver_dll; ++ + vdpau_trace = getenv("VDPAU_TRACE"); + if (vdpau_trace && atoi(vdpau_trace)) { +- void * trace_dll; + SetDllHandle * set_dll_handle; + +- trace_dll = dlopen(VDPAU_MODULEDIR "/libvdpau_trace.so.1", RTLD_NOW | RTLD_GLOBAL); +- if (!trace_dll) { ++ _vdp_trace_dll = dlopen(VDPAU_MODULEDIR "/libvdpau_trace.so.1", ++ RTLD_NOW | RTLD_GLOBAL); ++ if (!_vdp_trace_dll) { + fprintf(stderr, "Failed to open VDPAU trace library %s\n", dlerror()); + _VDP_ERROR_BREAKPOINT(); + return VDP_STATUS_NO_IMPLEMENTATION; + } + + set_dll_handle = (SetDllHandle*)dlsym( +- trace_dll, ++ _vdp_trace_dll, + "vdp_trace_set_backend_handle" + ); + if (!set_dll_handle) { +@@ -167,9 +173,9 @@ VdpStatus vdp_device_create_x11( + return VDP_STATUS_NO_IMPLEMENTATION; + } + +- set_dll_handle(backend_dll); ++ set_dll_handle(_vdp_backend_dll); + +- backend_dll = trace_dll; ++ _vdp_backend_dll = _vdp_trace_dll; + + func_name = "vdp_trace_device_create_x11"; + } +@@ -177,17 +183,52 @@ VdpStatus vdp_device_create_x11( + func_name = "vdp_imp_device_create_x11"; + } + +- vdp_imp_device_create_x11 = (VdpDeviceCreateX11*)dlsym( +- backend_dll, ++ _vdp_imp_device_create_x11_proc = (VdpDeviceCreateX11*)dlsym( ++ _vdp_backend_dll, + func_name + ); +- if (!vdp_imp_device_create_x11) { ++ if (!_vdp_imp_device_create_x11_proc) { + fprintf(stderr, "%s\n", dlerror()); + _VDP_ERROR_BREAKPOINT(); + return VDP_STATUS_NO_IMPLEMENTATION; + } + +- return vdp_imp_device_create_x11( ++ return VDP_STATUS_OK; ++} ++ ++static void _vdp_close_driver(void) ++{ ++ if (_vdp_driver_dll) { ++ dlclose(_vdp_driver_dll); ++ _vdp_driver_dll = NULL; ++ } ++ if (_vdp_trace_dll) { ++ dlclose(_vdp_trace_dll); ++ _vdp_trace_dll = NULL; ++ } ++ _vdp_backend_dll = NULL; ++ _vdp_imp_device_create_x11_proc = NULL; ++} ++ ++VdpStatus vdp_device_create_x11( ++ Display * display, ++ int screen, ++ /* output parameters follow */ ++ VdpDevice * device, ++ VdpGetProcAddress * * get_proc_address ++) ++{ ++ VdpStatus status; ++ ++ if (!_vdp_imp_device_create_x11_proc) { ++ status = _vdp_open_driver(display, screen); ++ if (status != VDP_STATUS_OK) { ++ _vdp_close_driver(); ++ return status; ++ } ++ } ++ ++ return _vdp_imp_device_create_x11_proc( + display, + screen, + device, +-- +cgit v0.9.0.2-2-gbebe diff --git a/libvdpau.spec b/libvdpau.spec new file mode 100644 index 0000000..553331b --- /dev/null +++ b/libvdpau.spec @@ -0,0 +1,118 @@ +Name: libvdpau +Version: 0.7 +Release: 1mamba +Summary: Video Decode and Presentation API for UNIX +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://freedesktop.org/wiki/Software/VDPAU +Source: http://people.freedesktop.org/~aplattner/vdpau/libvdpau-%{version}.tar.gz +Patch0: %{name}-0.4.1-track_dynamic_library_handles_and_free_them_on_exit.patch +License: MIT +BuildRequires: doxygen +BuildRequires: graphviz +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libgcc +BuildRequires: libpthread-stubs-devel +BuildRequires: libstdc++6-devel +#BuildRequires: libvdpau-Mesa +BuildRequires: libX11-devel +BuildRequires: libXau-devel +BuildRequires: libxcb-devel +BuildRequires: libXdmcp-devel +BuildRequires: libXext-devel +BuildRequires: pkg-config +## AUTOBUILDREQ-END +BuildRequires: tetex-latex +BuildRequires: xproto-devel +%if "%{stage1}" != "1" +Requires: libvdpau-Mesa +%endif +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +VDPAU is the Video Decode and Presentation API for UNIX. It provides an interface to video decode acceleration and presentation hardware present in modern GPUs. + +%package devel +Group: Development/Libraries +Summary: Libraries and headers for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description devel +VDPAU is the Video Decode and Presentation API for UNIX. + +This package contains libraries and header files need for development. + +%package docs +Group: Documentation +Summary: Documentation for %{name} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} + +%description docs +VDPAU is the Video Decode and Presentation API for UNIX. + +This package contains documentation for %{name}. + +%prep +%setup -q +#%patch0 -p1 +#autoreconf -vif + +%build +%configure \ + --disable-static +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +rm -rf %{buildroot}%{_libdir}/*.la +rm -rf %{buildroot}%{_libdir}/vdpau/*.la + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%config %{_sysconfdir}/vdpau_wrapper.cfg +%{_libdir}/libvdpau.so.* +%dir %{_libdir}/vdpau +%{_libdir}/vdpau/libvdpau_trace.so* +%doc AUTHORS COPYING + +%files devel +%defattr(-,root,root) +%dir %{_includedir}/vdpau +%{_includedir}/vdpau/*.h +%{_libdir}/libvdpau.so +%{_libdir}/pkgconfig/vdpau.pc + +%files docs +%defattr(-,root,root) +%{_docdir}/libvdpau + +%changelog +* Tue Aug 06 2013 Automatic Build System 0.7-1mamba +- automatic version update by autodist + +* Sat Feb 02 2013 Automatic Build System 0.6-1mamba +- automatic version update by autodist + +* Fri Oct 19 2012 Automatic Build System 0.5-1mamba +- automatic version update by autodist + +* Fri Jun 29 2012 Silvan Calarco 0.4.1-3mamba +- require libvdpau-Mesa +- added upstream patch to track dynamic library handles + +* Fri Jan 13 2012 Silvan Calarco 0.4.1-2mamba +- rebuilt in devel + +* Mon Mar 07 2011 gil 0.4.1-1mamba +- package created by autospec