smem + display

This forum is about all development around libVLC.
FaresVS
New Cone
New Cone
Posts: 2
Joined: 30 Jul 2015 19:19

smem + display

Postby FaresVS » 30 Jul 2015 19:51

Hi,

I'm looking to apply some processing (on the fly) on an audio input.
The input has multiple channels, and depending on a state variable (you don't want to know about this), i want to mix the channels and output an audio with two channels.

transcode and smem seem to be the way to go.

The most simple workflow is to do nothing, that is :

Code: Select all

sprintf(smem_options, "#display");
Then I can call libvlc_media_player_play() and everything works properly.


To do the processing I want, my workflow would probably need look like this :

Code: Select all

sprintf(smem_options, "#transcode{acodec=fl32}:smem{audio-postrender-callback=%lld,audio-prerender-callback=%lld,time-sync}:display", &handleStream, &prepareRender);
I can access to the data in my function handleStream(...) and do wathever I want there. But then, the display does not do anything.

My question is : what should I do in handleStream (or elsewhere) to output something that could be handled properly in the ":display" (or to an rtp{...} or wathever) ?
I didn't see any example of a display or a rtp which comes AFTER a smem. Is it possible to do it ?

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: smem + display

Postby Rémi Denis-Courmont » 30 Jul 2015 22:12

smem and display are both final elements in the chain. More precisely, they ignore anything that comes after them. You can't do what you want with smem. You need to write your own plugin; LibVLC alone will not work.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

FaresVS
New Cone
New Cone
Posts: 2
Joined: 30 Jul 2015 19:19

Re: smem + display

Postby FaresVS » 03 Aug 2015 19:09

Thank you for your answer Rémi.


I've written an audio filter which does the processing I want.

I created a simple main.cpp based on some examples I found, which more or less looks something like this :

Code: Select all

char const * vlc_args[] = { "-I", "dummy", "-vvv", "--ignore-config", "--no-plugins-cache", "--audio-filter=MonSuperPlugin" }; int vlc_argc = sizeof(vlc_args) / sizeof(vlc_args[0]); libvlc_instance_t * inst = libvlc_new(vlc_argc, vlc_args); libvlc_media_t * m = libvlc_media_new_path(inst, MY_FILENAME); libvlc_media_player_t * mp = libvlc_media_player_new_from_media(m); libvlc_media_release(m); libvlc_media_player_play(mp); ...
The audio-filter is called and everything works as expected.

But now, I would like to control the behavior of MonSuperPlugin dynamically, based on a set of variables which will be updated (multiple times) from the main() function.
I declared those variables in the plugin (add_float(....), var_Create(...), callback, etc.) based on what I've seen in existing plugins (normvol.c, equalizer.c)

Now, in my main() function, I would like to do something like this (in a loop) :

Code: Select all

float myFirstValue = ... float mySecondValue = ... var_SetFloat( XXX, "myFirstVariableName", myFirstValue); var_SetFloat( XXX, "mySecondVariableName", mySecondValue);
Next time the DoWork() is called in MonSuperPlugin, those new values would be retrieved and it would update the processing accordingly.


Is it possible to do something like that ? If it is, what should I put in the place of those XXX in my main() function ? If it isn't possible, what workaround would you suggest ?

Thanks,
Fares.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 26 guests