
Recherche avancée
Autres articles (44)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (3134)
-
Rust Win32 FFI : User-mode data execution prevention (DEP) violation
28 avril 2022, par TheElixI'm trying to pass a ID3D11Device instance from Rust to a C FFI Library (FFMPEG).


I made this sample code :


pub fn create_d3d11_device(&mut self, device: &mut Box, context: &mut Box) {
 let av_device : Box<avbufferref> = self.alloc(HwDeviceType::D3d11va);
 unsafe {
 let device_context = Box::from_raw(av_device.data as *mut AVHWDeviceContext);
 let mut d3d11_device_context = Box::from_raw(device_context.hwctx as *mut AVD3D11VADeviceContext);
 d3d11_device_context.device = device.as_mut() as *mut _;
 d3d11_device_context.device_context = context.as_mut() as *mut _;
 let avp = Box::into_raw(av_device);
 av_hwdevice_ctx_init(avp);
 self.av_hwdevice = Some(Box::from_raw(avp));
 }
 }
</avbufferref>


On the Rust side the Device does work, but on the C side, when FFMEPG calls
ID3D11DeviceContext_QueryInterface
the app crashes with the following error :Exception 0xc0000005 encountered at address 0x7ff9fb99ad38: User-mode data execution prevention (DEP) violation at location 0x7ff9fb99ad38


The address is actually the pointer for the lpVtbl of QueryInterface, like seen here :


The disassembly of the address also looks correct (this is done on an another debugging session) :


(lldb) disassemble --start-address 0x00007ffffdf3ad38
 0x7ffffdf3ad38: addb %ah, 0x7ffffd(%rdi,%riz,8)
 0x7ffffdf3ad3f: addb %al, (%rax)
 0x7ffffdf3ad41: movabsl -0x591fffff80000219, %eax
 0x7ffffdf3ad4a: outl %eax, $0xfd



Do you have any pointer to debug this further ?


EDIT : I made a Minimal Reproducion Sample. Interestingly this does not causes a DEP Violation, but simply a Segfault.


On the C side :


int test_ffi(ID3D11Device *device){
 ID3D11DeviceContext *context;
 device->lpVtbl->GetImmediateContext(device, &context);
 if (!context) return 1;
 return 0;
}



On the Rust side :


unsafe fn main_rust(){
 let mut device = None;
 let mut device_context = None;
 let _ = match windows::Win32::Graphics::Direct3D11::D3D11CreateDevice(None, D3D_DRIVER_TYPE_HARDWARE, OtherHinstance::default(), D3D11_CREATE_DEVICE_DEBUG, &[], D3D11_SDK_VERSION, &mut device, std::ptr::null_mut(), &mut device_context) {
 Ok(e) => e,
 Err(e) => panic!("Creation Failed: {}", e)
 };
 let mut device = match device {
 Some(e) => e,
 None => panic!("Creation Failed2")
 };
 let mut f2 : ID3D11Device = transmute_copy(&device); //Transmuting the WinAPI into a bindgen ID3D11Device
 test_ffi(&mut f2);
}



The bindgen build.rs :


extern crate bindgen;

use std::env;
use std::path::PathBuf;

fn main() {
 // Tell cargo to tell rustc to link the system bzip2
 // shared library.
 println!("cargo:rustc-link-lib=ffi_demoLIB");
 println!("cargo:rustc-link-lib=d3d11");

 // Tell cargo to invalidate the built crate whenever the wrapper changes
 println!("cargo:rerun-if-changed=library.h");

 // The bindgen::Builder is the main entry point
 // to bindgen, and lets you build up options for
 // the resulting bindings.
 let bindings = bindgen::Builder::default()
 // The input header we would like to generate
 // bindings for.
 .header("library.h")
 // Tell cargo to invalidate the built crate whenever any of the
 // included header files changed.
 .parse_callbacks(Box::new(bindgen::CargoCallbacks))
 .blacklist_type("_IMAGE_TLS_DIRECTORY64")
 .blacklist_type("IMAGE_TLS_DIRECTORY64")
 .blacklist_type("PIMAGE_TLS_DIRECTORY64")
 .blacklist_type("IMAGE_TLS_DIRECTORY")
 .blacklist_type("PIMAGE_TLS_DIRECTORY")
 // Finish the builder and generate the bindings.
 .generate()
 // Unwrap the Result and panic on failure.
 .expect("Unable to generate bindings");

 // Write the bindings to the $OUT_DIR/bindings.rs file.
 let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
 bindings
 .write_to_file(out_path.join("bindings.rs"))
 .expect("Couldn't write bindings!");
}



The Complete Repo can be found over here : https://github.com/TheElixZammuto/demo-ffi


-
Revision 30966 : eviter le moche ’doctype_ecrire’ lors de l’upgrade
17 août 2009, par fil@… — Logeviter le moche ’doctype_ecrire’ lors de l’upgrade
-
Revision 33458 : retablir le pied de la dist
1er décembre 2009, par cedric@… — Logretablir le pied de la dist