gmerlin
|
Audio visualization plugin. More...
#include <plugin.h>
Data Fields | |
bg_plugin_common_t | common |
Infos and functions common to all plugin types. More... | |
void(* | set_callbacks )(void *priv, bg_ov_callbacks_t *cb) |
return callback More... | |
int(* | open_ov )(void *priv, gavl_audio_format_t *audio_format, gavl_video_format_t *video_format) |
Open a frame based visualization plugin. More... | |
int(* | open_win )(void *priv, gavl_audio_format_t *audio_format, const char *window_id) |
Open a window based visualization plugin. More... | |
void(* | update )(void *priv, gavl_audio_frame_t *frame) |
Send audio data to the plugin. More... | |
void(* | draw_frame )(void *priv, gavl_video_frame_t *frame) |
Draw an image. More... | |
void(* | show_frame )(void *priv) |
Show the image. More... | |
void(* | close )(void *priv) |
Close a plugin. More... | |
Audio visualization plugin.
These plugins get audio samples and run visualizations of them. Output can be either into a gavl_video_frame_t or directly via OpenGL. Which method is used is denoted by the BG_PLUGIN_VISUALIZE_FRAME and BG_PLUGIN_VISUALIZE_GL flags.
For OpenGL, you need to pass a window ID to the plugin. The plugin is then responsible for creating Subwindows and setting up an OpenGL context. In General, it's stronly recommended to use the bg_visualizer_t module to use visualizations.
bg_plugin_common_t bg_visualization_plugin_s::common |
Infos and functions common to all plugin types.
void(* bg_visualization_plugin_s::set_callbacks)(void *priv, bg_ov_callbacks_t *cb) |
return callback
priv | The handle returned by the create() method |
cb | The callbacks to be called |
int(* bg_visualization_plugin_s::open_ov)(void *priv, gavl_audio_format_t *audio_format, gavl_video_format_t *video_format) |
Open a frame based visualization plugin.
priv | The handle returned by the create() method |
audio_format | Audio format |
video_format | Video format |
The audio format parameter will most likely changed to the nearest supported format. In the video format parameter, you usually pass the desired render size. Everything else (except the framerate) will be set up by the plugin.
int(* bg_visualization_plugin_s::open_win)(void *priv, gavl_audio_format_t *audio_format, const char *window_id) |
Open a window based visualization plugin.
priv | The handle returned by the create() method |
audio_format | Audio format |
window_id | A window ID |
The audio format parameter will most likely changed to the nearest supported format. For the window id, use strings formatted like the one returned by bg_ov_plugin_t
void(* bg_visualization_plugin_s::update)(void *priv, gavl_audio_frame_t *frame) |
Send audio data to the plugin.
priv | The handle returned by the create() method |
frame | Audio frame |
This updates the plugin with new audio samples. After that, we may or may not call the draw_frame function below to actually draw an image. Note, that visualization plugins are not required to do internal audio buffering, so it's wise to pass a frame with as many samples as the samples_per_frame member of the audio format returned by open_ov or open_win.
void(* bg_visualization_plugin_s::draw_frame)(void *priv, gavl_video_frame_t *frame) |
Draw an image.
priv | The handle returned by the create() method |
The | video frame to draw to |
For OpenGL plugins, frame is NULL. For frame based plugins, the image will be drawn into the frame you pass. You must display the frame on your own then.
void(* bg_visualization_plugin_s::show_frame)(void *priv) |
Show the image.
priv | The handle returned by the create() method |
This function is needed only for OpenGL plugins. Under X11, it will typically call glXSwapBuffers and process events on the X11 window.
void(* bg_visualization_plugin_s::close)(void *priv) |
Close a plugin.
priv | The handle returned by the create() method |