gmerlin
plugin.h
00001 /*****************************************************************
00002  * gmerlin - a general purpose multimedia framework and applications
00003  *
00004  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
00005  * gmerlin-general@lists.sourceforge.net
00006  * http://gmerlin.sourceforge.net
00007  *
00008  * This program is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  * *****************************************************************/
00021 
00022 #ifndef __BG_PLUGIN_H_
00023 #define __BG_PLUGIN_H_
00024 
00025 #include <gavl/gavl.h>
00026 #include <gavl/compression.h>
00027 #include <gmerlin/parameter.h>
00028 #include <gmerlin/streaminfo.h>
00029 #include <gmerlin/accelerator.h>
00030 #include <gmerlin/edl.h>
00031 
00075 typedef int (*bg_read_audio_func_t)(void * priv, gavl_audio_frame_t* frame,
00076                                     int stream,
00077                                     int num_samples);
00078 
00090 typedef int (*bg_read_video_func_t)(void * priv, gavl_video_frame_t* frame,
00091                                     int stream);
00092 
00102 #define BG_PLUGIN_REMOVABLE        (1<<0)  //!< Plugin handles removable media (CD, DVD etc.)
00103 #define BG_PLUGIN_FILE             (1<<1)  //!< Plugin reads/writes files
00104 #define BG_PLUGIN_RECORDER         (1<<2)  //!< Plugin does hardware recording
00105 #define BG_PLUGIN_URL              (1<<3)  //!< Plugin can load URLs
00106 #define BG_PLUGIN_PLAYBACK         (1<<4)  //!< Plugin is an audio or video driver for playback
00107 #define BG_PLUGIN_STDIN            (1<<8)  //!< Plugin can read from stdin ("-")
00108 #define BG_PLUGIN_TUNER            (1<<9)  //!< Plugin has some kind of tuner. Channels will be loaded as tracks.
00109 #define BG_PLUGIN_FILTER_1        (1<<10)  //!< Plugin acts as a filter with one input
00110 #define BG_PLUGIN_EMBED_WINDOW    (1<<11)  //!< Plugin can embed it's window into another application
00111 #define BG_PLUGIN_VISUALIZE_FRAME (1<<12)  //!< Visualization plugin outputs video frames
00112 #define BG_PLUGIN_VISUALIZE_GL    (1<<13)  //!< Visualization plugin outputs via OpenGL
00113 #define BG_PLUGIN_PP              (1<<14)  //!< Postprocessor
00114 #define BG_PLUGIN_CALLBACKS       (1<<15)  //!< Plugin can be opened from callbacks
00115 #define BG_PLUGIN_BROADCAST       (1<<16)  //!< Plugin can broadcasts (e.g. webstreams)
00116 #define BG_PLUGIN_DEVPARAM        (1<<17)  //!< Plugin has pluggable devices as parameters, which must be updated regurarly
00117 
00118 #define BG_PLUGIN_UNSUPPORTED     (1<<24)  //!< Plugin is not supported. Only for a foreign API plugins
00119 
00120 
00121 #define BG_PLUGIN_ALL 0xFFFFFFFF //!< Mask of all possible plugin flags
00122 
00126 #define BG_PLUGIN_API_VERSION 24
00127 
00128 /* Include this into all plugin modules exactly once
00129    to let the plugin loader obtain the API version */
00130 
00131 #define BG_GET_PLUGIN_API_VERSION \
00132   int get_plugin_api_version() __attribute__ ((visibility("default"))); \
00133   int get_plugin_api_version() { return BG_PLUGIN_API_VERSION; }
00134 
00135 #define BG_PLUGIN_PRIORITY_MIN 1
00136 #define BG_PLUGIN_PRIORITY_MAX 10
00137 
00150 typedef enum
00151   {
00152     BG_STREAM_ACTION_OFF = 0, 
00153     BG_STREAM_ACTION_DECODE,  
00154     BG_STREAM_ACTION_READRAW, 
00155     
00156   } bg_stream_action_t;
00157 
00158 /***************************************************
00159  * Plugin API
00160  *
00161  * Plugin dlls contain a symbol "the_plugin",
00162  * which points to one of the structures below.
00163  * The member functions are described below.
00164  *
00165  ***************************************************/
00166 
00167 /*
00168  * Plugin types
00169  */
00170 
00175 typedef enum
00176   {
00177     BG_PLUGIN_NONE                       = 0,      
00178     BG_PLUGIN_INPUT                      = (1<<0), 
00179     BG_PLUGIN_OUTPUT_AUDIO               = (1<<1), 
00180     BG_PLUGIN_OUTPUT_VIDEO               = (1<<2), 
00181     BG_PLUGIN_RECORDER_AUDIO             = (1<<3), 
00182     BG_PLUGIN_RECORDER_VIDEO             = (1<<4), 
00183     BG_PLUGIN_ENCODER_AUDIO              = (1<<5), 
00184     BG_PLUGIN_ENCODER_VIDEO              = (1<<6), 
00185     BG_PLUGIN_ENCODER_SUBTITLE_TEXT      = (1<<7), 
00186     BG_PLUGIN_ENCODER_SUBTITLE_OVERLAY   = (1<<8), 
00187     BG_PLUGIN_ENCODER                    = (1<<9), 
00188     BG_PLUGIN_ENCODER_PP                 = (1<<10),
00189     BG_PLUGIN_IMAGE_READER               = (1<<11),
00190     BG_PLUGIN_IMAGE_WRITER               = (1<<12), 
00191     BG_PLUGIN_FILTER_AUDIO               = (1<<13), 
00192     BG_PLUGIN_FILTER_VIDEO               = (1<<14), 
00193     BG_PLUGIN_VISUALIZATION              = (1<<15), 
00194     BG_PLUGIN_AV_RECORDER                = (1<<16),  
00195   } bg_plugin_type_t;
00196 
00205 typedef struct
00206   {
00207   char * device; 
00208   char * name;   
00209   } bg_device_info_t;
00210 
00221 bg_device_info_t * bg_device_info_append(bg_device_info_t * arr,
00222                                          const char * device,
00223                                          const char * name);
00224 
00230 void bg_device_info_destroy(bg_device_info_t * arr);
00231 
00232 /* Common part */
00233 
00238 typedef struct bg_plugin_common_s bg_plugin_common_t;
00239 
00244 struct bg_plugin_common_s
00245   {
00246   char * gettext_domain; 
00247   char * gettext_directory; 
00248   
00249   char             * name;       
00250   char             * long_name;  
00251   bg_plugin_type_t type;  
00252   int              flags;  
00253   
00254   char             * description; 
00255   
00256   /*
00257    *  If there might be more than one plugin for the same
00258    *  job, there is a priority (0..10) which is used for the
00259    *  decision
00260    */
00261   
00262   int              priority; 
00263   
00268   void * (*create)();
00269       
00279   void (*destroy)(void* priv);
00280 
00288   const bg_parameter_info_t * (*get_parameters)(void * priv);
00289 
00293   bg_set_parameter_func_t set_parameter;
00294 
00301   bg_get_parameter_func_t get_parameter;
00302   
00312   int (*check_device)(const char * device, char ** name);
00313   
00314 
00322   bg_device_info_t * (*find_devices)();
00323     
00324   };
00325 
00326 /*
00327  *  Plugin callbacks: Functions called by the
00328  *  plugin to reflect user input or other changes
00329  *  Applications might pass NULL callbacks,
00330  *  so plugins MUST check for valid callbacks structure
00331  *  before calling any of these functions
00332  */
00333 
00334 /* Input plugin */
00335 
00341 typedef struct bg_input_callbacks_s bg_input_callbacks_t;
00342 
00351 struct bg_input_callbacks_s
00352   {
00358   void (*duration_changed)(void * data, gavl_time_t duration);
00359 
00367   void (*name_changed)(void * data, const char * name);
00368 
00376   void (*metadata_changed)(void * data, const bg_metadata_t * m);
00377 
00386   void (*buffer_notify)(void * data, float percentage);
00387 
00401   int (*user_pass)(void * data, const char * resource,
00402                    char ** username, char ** password);
00403 
00415   void (*aspect_changed)(void * data, int stream,
00416                          int pixel_width, int pixel_height);
00417   
00418   
00419   void * data; 
00420   
00421   };
00422 
00423 /*************************************************
00424  * MEDIA INPUT
00425  *************************************************/
00426 
00431 typedef struct bg_input_plugin_s bg_input_plugin_t;
00432 
00433 
00443 struct bg_input_plugin_s
00444   {
00445   bg_plugin_common_t common; 
00446 
00452   const char * (*get_protocols)(void * priv);
00457   const char * (*get_mimetypes)(void * priv);
00458 
00463   const char * (*get_extensions)(void * priv);
00464   
00474   void (*set_callbacks)(void * priv, bg_input_callbacks_t * callbacks);
00475   
00481   int (*open)(void * priv, const char * arg);
00482 
00491   int (*open_fd)(void * priv, int fd, int64_t total_bytes,
00492                  const char * mimetype);
00493 
00505   int (*open_callbacks)(void * priv,
00506                         int (*read_callback)(void * priv, uint8_t * data, int len),
00507                         int64_t (*seek_callback)(void * priv, uint64_t pos, int whence),
00508                         void * cb_priv, const char * filename, const char * mimetype,
00509                         int64_t total_bytes);
00510   
00516   const bg_edl_t * (*get_edl)(void * priv);
00517     
00525   const char * (*get_disc_name)(void * priv);
00526 
00535   int (*eject_disc)(const char * device);
00536   
00544   int (*get_num_tracks)(void * priv);
00545   
00562   bg_track_info_t * (*get_track_info)(void * priv, int track);
00563 
00574   int (*set_track)(void * priv, int track);
00575 
00586   int (*get_audio_compression_info)(void * priv, int stream,
00587                                     gavl_compression_info_t * info);
00588 
00599   int (*get_video_compression_info)(void * priv, int stream,
00600                                     gavl_compression_info_t * info);
00601   
00602   /*
00603    *  These functions set the audio- video- and subpicture streams
00604    *  as well as programs (== DVD Angles). All these start with 0
00605    *
00606    *  Arguments for actions are defined in the enum bg_stream_action_t
00607    *  above. Plugins must return FALSE on failure (e.g. no such stream)
00608    *
00609    *  Functions must be defined only, if the corresponding stream
00610    *  type is supported by the plugin and can be switched.
00611    *  Single stream plugins can leave these NULL
00612    *  Gmerlin will never try to call these functions on nonexistent streams
00613    */
00614 
00622   int (*set_audio_stream)(void * priv, int stream, bg_stream_action_t action);
00623 
00631   int (*set_video_stream)(void * priv, int stream, bg_stream_action_t action);
00632   
00640   int (*set_subtitle_stream)(void * priv, int stream, bg_stream_action_t action);
00641   
00653   int (*start)(void * priv);
00654 
00664   gavl_frame_table_t * (*get_frame_table)(void * priv, int stream);
00665     
00678   bg_read_audio_func_t read_audio;
00679 
00689   int (*has_still)(void * priv, int stream);
00690   
00698   bg_read_video_func_t read_video;
00699 
00710   int (*read_audio_packet)(void * priv, int stream, gavl_packet_t * p);
00711 
00722   int (*read_video_packet)(void * priv, int stream, gavl_packet_t * p);
00723 
00724   
00737   void (*skip_video)(void * priv, int stream, int64_t * time, int scale, int exact);
00738     
00745   int (*has_subtitle)(void * priv, int stream);
00746     
00758   int (*read_subtitle_overlay)(void * priv,
00759                                gavl_overlay_t*ovl, int stream);
00760 
00779   int (*read_subtitle_text)(void * priv,
00780                             char ** text, int * text_alloc,
00781                             int64_t * start_time,
00782                             int64_t * duration, int stream);
00783   
00795   void (*seek)(void * priv, int64_t * time, int scale);
00796   
00804   void (*stop)(void * priv);
00805   
00812   void (*close)(void * priv);
00813   
00814   };
00815 
00826 typedef struct bg_oa_callbacks_s bg_oa_callbacks_t;
00827 
00833 struct bg_oa_callbacks_s
00834   {
00835   bg_read_audio_func_t read_audio;
00836   };
00837 
00842 typedef struct bg_oa_plugin_s bg_oa_plugin_t;
00843 
00850 struct bg_oa_plugin_s
00851   {
00852   bg_plugin_common_t common; 
00853 
00863   int (*open)(void * priv, gavl_audio_format_t* format);
00864 
00871   int (*start)(void * priv);
00872     
00878   void (*write_audio)(void * priv, gavl_audio_frame_t* frame);
00879 
00888   int (*get_delay)(void * priv);
00889   
00897   void (*stop)(void * priv);
00898     
00905   void (*close)(void * priv);
00906   };
00907 
00908 /*******************************************
00909  * AUDIO RECORDER
00910  *******************************************/
00911 
00921 typedef struct bg_recorder_plugin_s bg_recorder_plugin_t;
00922 
00929 struct bg_recorder_plugin_s
00930   {
00931   bg_plugin_common_t common; 
00932 
00942   int (*open)(void * priv, gavl_audio_format_t * audio_format, gavl_video_format_t * video_format);
00943   
00946   bg_read_audio_func_t read_audio;
00947 
00950   bg_read_video_func_t read_video;
00951   
00956   void (*close)(void * priv);
00957   };
00958 
00959 /*******************************************
00960  * VIDEO OUTPUT
00961  *******************************************/
00962 
00963 /* Callbacks */
00964 
00975 typedef struct bg_ov_callbacks_s bg_ov_callbacks_t;
00976 
00982 struct bg_ov_callbacks_s
00983   {
00990   const bg_accelerator_map_t * accel_map;
00991   
00997   int (*accel_callback)(void * data, int id);
00998   
01012   int (*key_callback)(void * data, int key, int mask);
01013 
01021   int (*key_release_callback)(void * data, int key, int mask);
01022   
01032   int (*button_callback)(void * data, int x, int y, int button, int mask);
01033 
01043   int (*button_release_callback)(void * data, int x, int y, int button, int mask);
01044   
01053   int (*motion_callback)(void * data, int x, int y, int mask);
01054   
01060   void (*show_window)(void * data, int show);
01061 
01069   void (*brightness_callback)(void * data, float val);
01070 
01078   void (*saturation_callback)(void * data, float val);
01079 
01087   void (*contrast_callback)(void * data, float val);
01088 
01096   void (*hue_callback)(void * data, float val);
01097   
01098   void * data;
01099   };
01100 
01101 /* Plugin structure */
01102 
01107 typedef struct bg_ov_plugin_s bg_ov_plugin_t;
01108 
01117 struct bg_ov_plugin_s
01118   {
01119   bg_plugin_common_t common; 
01120 
01131   void (*set_window)(void * priv, const char * window_id);
01132   
01138   const char * (*get_window)(void * priv);
01139   
01152   void (*set_window_options)(void * priv, const char * name, 
01153                              const char * klass, 
01154                              const gavl_video_frame_t * icon,
01155                              const gavl_video_format_t * icon_format);
01156 
01162   void (*set_window_title)(void * priv, const char * title);
01163   
01164 
01170   void (*set_callbacks)(void * priv, bg_ov_callbacks_t * callbacks);
01171   
01182   int  (*open)(void * priv, gavl_video_format_t * format, int keep_aspect);
01183   
01195   gavl_video_frame_t * (*create_frame)(void * priv);
01196   
01210   int (*add_overlay_stream)(void * priv, gavl_video_format_t * format);
01211 
01224   gavl_overlay_t * (*create_overlay)(void * priv, int id);
01225   
01232   void (*set_overlay)(void * priv, int stream, gavl_overlay_t * ovl);
01233   
01241   void (*put_video)(void * priv, gavl_video_frame_t*frame);
01242 
01252   void (*put_still)(void * priv, gavl_video_frame_t*frame);
01253 
01262   void (*handle_events)(void * priv);
01263 
01270   void (*update_aspect)(void * priv, int pixel_width, int pixel_height);
01271     
01277   void (*destroy_frame)(void * priv, gavl_video_frame_t * frame);
01278 
01285   void (*destroy_overlay)(void * priv, int id, gavl_overlay_t * ovl);
01286 
01294   void (*close)(void * priv);
01295 
01300   void (*show_window)(void * priv, int show);
01301   };
01302 
01303 /*******************************************
01304  * ENCODER
01305  *******************************************/
01306 
01317 typedef struct bg_encoder_callbacks_s bg_encoder_callbacks_t;
01318 
01324 struct bg_encoder_callbacks_s
01325   {
01326   
01335   int (*create_output_file)(void * data, const char * filename);
01336 
01345   int (*create_temp_file)(void * data, const char * filename);
01346   
01347   void * data;
01348   };
01349 
01350 
01355 typedef struct bg_encoder_plugin_s bg_encoder_plugin_t;
01356 
01357 
01362 struct bg_encoder_plugin_s
01363   {
01364   bg_plugin_common_t common; 
01365   
01366   int max_audio_streams;  
01367   int max_video_streams;  
01368   int max_subtitle_text_streams;
01369   int max_subtitle_overlay_streams;
01370   
01376   void (*set_callbacks)(void * priv, bg_encoder_callbacks_t * cb);
01377 
01387   int (*writes_compressed_audio)(void * priv,
01388                                  const gavl_audio_format_t * format,
01389                                  const gavl_compression_info_t * info);
01390   
01400   int (*writes_compressed_video)(void * priv,
01401                                  const gavl_video_format_t * format,
01402                                  const gavl_compression_info_t * info);
01403   
01414   int (*open)(void * data, const char * filename,
01415               const bg_metadata_t * metadata,
01416               const bg_chapter_list_t * chapter_list);
01417   
01418   /* Return per stream parameters */
01419 
01427   const bg_parameter_info_t * (*get_audio_parameters)(void * priv);
01428 
01436   const bg_parameter_info_t * (*get_video_parameters)(void * priv);
01437 
01445   const bg_parameter_info_t * (*get_subtitle_text_parameters)(void * priv);
01446 
01454   const bg_parameter_info_t * (*get_subtitle_overlay_parameters)(void * priv);
01455   
01456   /* Add streams. The formats can be changed, be sure to get the
01457    * final formats with get_[audio|video]_format after starting the plugin
01458    * Return value is the index of the added stream.
01459    */
01460 
01472   int (*add_audio_stream)(void * priv, const char * language,
01473                           const gavl_audio_format_t * format);
01474 
01487   int (*add_audio_stream_compressed)(void * priv, const char * language,
01488                                      const gavl_audio_format_t * format,
01489                                      const gavl_compression_info_t * info);
01490   
01501   int (*add_video_stream)(void * priv, const gavl_video_format_t * format);
01502 
01514   int (*add_video_stream_compressed)(void * priv,
01515                                      const gavl_video_format_t * format,
01516                                      const gavl_compression_info_t * info);
01517   
01524   int (*add_subtitle_text_stream)(void * priv, const char * language,
01525                                   int * timescale);
01526   
01539   int (*add_subtitle_overlay_stream)(void * priv, const char * language,
01540                                      const gavl_video_format_t * format);
01541   
01542   /* Set parameters for the streams */
01543 
01554   void (*set_audio_parameter)(void * priv, int stream, const char * name,
01555                               const bg_parameter_value_t * v);
01556 
01568   void (*set_video_parameter)(void * priv, int stream, const char * name,
01569                               const bg_parameter_value_t * v);
01570 
01581   void (*set_subtitle_text_parameter)(void * priv, int stream,
01582                                       const char * name,
01583                                       const bg_parameter_value_t * v);
01584 
01595   void (*set_subtitle_overlay_parameter)(void * priv, int stream,
01596                                          const char * name,
01597                                          const bg_parameter_value_t * v);
01598   
01607   int (*set_video_pass)(void * priv, int stream, int pass, int total_passes,
01608                         const char * stats_file);
01609   
01618   int (*start)(void * priv);
01619   
01620   /*
01621    *  After setting the parameters, get the formats, you need to deliver the frames in
01622    */
01623 
01632   void (*get_audio_format)(void * priv, int stream, gavl_audio_format_t*ret);
01633 
01642   void (*get_video_format)(void * priv, int stream, gavl_video_format_t*ret);
01643 
01652   void (*get_subtitle_overlay_format)(void * priv, int stream,
01653                                       gavl_video_format_t*ret);
01654 
01655   /*
01656    *  Encode audio/video
01657    */
01658 
01669   int (*write_audio_frame)(void * data, gavl_audio_frame_t * frame, int stream);
01670 
01681   int (*write_audio_packet)(void * data, gavl_packet_t * packet, int stream);
01682 
01683   
01691   int (*write_video_frame)(void * data, gavl_video_frame_t * frame, int stream);
01692 
01700   int (*write_video_packet)(void * data, gavl_packet_t * packet, int stream);
01701   
01711   int (*write_subtitle_text)(void * data,const char * text,
01712                              int64_t start,
01713                              int64_t duration, int stream);
01714   
01722   int (*write_subtitle_overlay)(void * data, gavl_overlay_t * ovl, int stream);
01723   
01732   int (*close)(void * data, int do_delete);
01733   };
01734 
01735 
01736 /*******************************************
01737  * ENCODER Postprocessor
01738  *******************************************/
01739 
01754 typedef struct
01755   {
01762   void (*action_callback)(void * data, char * action);
01763 
01773   void (*progress_callback)(void * data, float perc);
01774 
01775   void * data; 
01776 
01777   } bg_e_pp_callbacks_t;
01778 
01784 typedef struct bg_encoder_pp_plugin_s bg_encoder_pp_plugin_t;
01785 
01791 struct bg_encoder_pp_plugin_s
01792   {
01793   bg_plugin_common_t common; 
01794   
01795   int max_audio_streams;  
01796   int max_video_streams;  
01797 
01798   char * supported_extensions; 
01799   
01806   void (*set_callbacks)(void * priv,bg_e_pp_callbacks_t * callbacks);
01807   
01815   int (*init)(void * priv);
01816 
01833   void (*add_track)(void * priv, const char * filename,
01834                     bg_metadata_t * metadata, int pp_only);
01835   
01845   void (*run)(void * priv, const char * directory, int cleanup);
01846 
01856   void (*stop)(void * priv);
01857   };
01858 
01859 
01873 typedef struct bg_image_reader_plugin_s bg_image_reader_plugin_t;
01874 
01878 struct bg_image_reader_plugin_s
01879   {
01880   bg_plugin_common_t common; 
01881   const char * extensions; 
01882   
01890   int (*read_header)(void * priv, const char * filename,
01891                      gavl_video_format_t * format);
01892 
01898   const bg_metadata_t * (*get_metadata)(void * priv);
01899 
01906   int (*get_compression_info)(void * priv, gavl_compression_info_t * ci);
01907   
01917   int (*read_image)(void * priv, gavl_video_frame_t * frame);
01918   };
01919 
01924 typedef struct bg_iw_callbacks_s bg_iw_callbacks_t;
01925 
01926 struct bg_iw_callbacks_s
01927   {
01928   
01937   int (*create_output_file)(void * data, const char * filename);
01938   
01939   void * data;
01940   };
01941 
01946 typedef struct bg_image_writer_plugin_s bg_image_writer_plugin_t;
01947 
01952 struct bg_image_writer_plugin_s
01953   {
01954   bg_plugin_common_t common; 
01955   const char * extensions; 
01956   
01962   void (*set_callbacks)(void * priv, bg_iw_callbacks_t * cb);
01963   
01974   int (*write_header)(void * priv, const char * filename,
01975                       gavl_video_format_t * format, const bg_metadata_t * m);
01976   
01987   int (*write_image)(void * priv, gavl_video_frame_t * frame);
01988   } ;
01989 
02020 /* Filters */
02021 
02026 typedef struct bg_fa_plugin_s bg_fa_plugin_t;
02027 
02032 struct bg_fa_plugin_s
02033   {
02034   bg_plugin_common_t common; 
02035 
02044   void (*connect_input_port)(void * priv, bg_read_audio_func_t func,
02045                              void * data,
02046                              int stream, int port);
02047 
02057   void (*set_input_format)(void * priv, gavl_audio_format_t * format, int port);
02058 
02059 
02066   void (*reset)(void * priv);
02067 
02075   void (*get_output_format)(void * priv, gavl_audio_format_t * format);
02076 
02086   int (*need_restart)(void * priv);
02087 
02091   bg_read_audio_func_t read_audio;
02092     
02093   };
02094 
02099 typedef struct bg_fv_plugin_s bg_fv_plugin_t;
02100 
02105 struct bg_fv_plugin_s
02106   {
02107   bg_plugin_common_t common; 
02108 
02117   gavl_video_options_t * (*get_options)(void * priv);
02118   
02127   void (*connect_input_port)(void * priv,
02128                              bg_read_video_func_t func,
02129                              void * data, int stream, int port);
02130 
02137   void (*set_input_format)(void * priv, gavl_video_format_t * format, int port);
02138   
02145   void (*reset)(void * priv);
02146 
02154   void (*get_output_format)(void * priv, gavl_video_format_t * format);
02155   
02165   int (*need_restart)(void * priv);
02166 
02170   bg_read_video_func_t read_video;
02171     
02172   };
02173 
02174 
02193 typedef struct bg_visualization_plugin_s bg_visualization_plugin_t;
02194 
02195 
02210 struct bg_visualization_plugin_s
02211   {
02212   bg_plugin_common_t common; 
02213 
02219   void (*set_callbacks)(void * priv, bg_ov_callbacks_t * cb);
02220 
02232   int (*open_ov)(void * priv, gavl_audio_format_t * audio_format,
02233                  gavl_video_format_t * video_format);
02234   
02245   int (*open_win)(void * priv, gavl_audio_format_t * audio_format,
02246                   const char * window_id);
02247 
02260   void (*update)(void * priv, gavl_audio_frame_t * frame);
02261 
02271   void (*draw_frame)(void * priv, gavl_video_frame_t * frame);
02272   
02281   void (*show_frame)(void * priv);
02282 
02287   void (*close)(void * priv);
02288   
02289   };
02290 
02291 
02292 
02297 #endif // __BG_PLUGIN_H_