≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
audioSource from callback
Posted by:
(you are not logged in)
Enter the missing letter in: "Interna?ional"
(you are not logged in)
Text:
[quote][b]dominikp[/b] wrote: Hey folks, I am currently trying to create a small video viewer using Libav and Irrklang. However, I am struggling to find a nice solution to create a SoundSource for a given video file. I came up with two approaches that are both rather clunky: - Decoding the entire audio to PCM-data and calling addSoundSourceFromPCMData - Following the .mp3 extension example. I implemented a custom IAudioStream so I can just use play2D(<Path to video>) In both cases Video and Audio decoding must be done independently from one another, which makes syncing quite challenging. Is there any way I can mimic an SDL-like functionality where I can create a SoundSource from a custom callback (which is similar to the readFrames method in IAudioStream)? Written in code I would like to something like this: [code] auto decode_audio = [&](void* target, ik_s32 frameCountToRead) -> ik_32 { // Do decoding and syncing using Libav shared context between video and audio }; ... SAudioStreamFormat format; // This should match the actual format returned by decode_audio irrklang::ISoundSource* videoSound = engine->addSoundSourceFromCallback(decode_audio, "name", format); engine->play2D(videoSound); [/code] The engine would periodically call decode_audio to get new PCM-data to play. I think something like this, basically creating an "anonymous" IAudioStream implementation, would be very handy. Does anyone know a hack to achieve something like this? Sorry for the weird mix of question and feature request 😊. I hope someone can help me and everyone reading this: Have a nice Easter Monday.[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact