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 26
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 gavl_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 
00825 typedef struct bg_oa_plugin_s bg_oa_plugin_t;
00826 
00833 struct bg_oa_plugin_s
00834   {
00835   bg_plugin_common_t common; 
00836 
00846   int (*open)(void * priv, gavl_audio_format_t* format);
00847 
00854   int (*start)(void * priv);
00855     
00861   void (*write_audio)(void * priv, gavl_audio_frame_t* frame);
00862 
00871   int (*get_delay)(void * priv);
00872   
00880   void (*stop)(void * priv);
00881     
00888   void (*close)(void * priv);
00889   };
00890 
00891 /*******************************************
00892  * AUDIO RECORDER
00893  *******************************************/
00894 
00900 typedef struct bg_recorder_callbacks_s bg_recorder_callbacks_t;
00901 
00910 struct bg_recorder_callbacks_s
00911   {
00920   void (*metadata_changed)(void * data, const char * name,
00921                            const gavl_metadata_t * m);
00922   
00923   void * data; 
00924   
00925   };
00926 
00927 
00932 typedef struct bg_recorder_plugin_s bg_recorder_plugin_t;
00933 
00940 struct bg_recorder_plugin_s
00941   {
00942   bg_plugin_common_t common; 
00943 
00953   void (*set_callbacks)(void * priv, bg_recorder_callbacks_t * callbacks);
00954   
00965   int (*open)(void * priv, gavl_audio_format_t * audio_format,
00966               gavl_video_format_t * video_format);
00967   
00970   bg_read_audio_func_t read_audio;
00971 
00974   bg_read_video_func_t read_video;
00975   
00980   void (*close)(void * priv);
00981   };
00982 
00983 /*******************************************
00984  * VIDEO OUTPUT
00985  *******************************************/
00986 
00987 /* Callbacks */
00988 
00999 typedef struct bg_ov_callbacks_s bg_ov_callbacks_t;
01000 
01006 struct bg_ov_callbacks_s
01007   {
01014   const bg_accelerator_map_t * accel_map;
01015   
01021   int (*accel_callback)(void * data, int id);
01022   
01036   int (*key_callback)(void * data, int key, int mask);
01037 
01045   int (*key_release_callback)(void * data, int key, int mask);
01046   
01056   int (*button_callback)(void * data, int x, int y, int button, int mask);
01057 
01067   int (*button_release_callback)(void * data, int x, int y, int button, int mask);
01068   
01077   int (*motion_callback)(void * data, int x, int y, int mask);
01078   
01084   void (*show_window)(void * data, int show);
01085 
01093   void (*brightness_callback)(void * data, float val);
01094 
01102   void (*saturation_callback)(void * data, float val);
01103 
01111   void (*contrast_callback)(void * data, float val);
01112 
01120   void (*hue_callback)(void * data, float val);
01121   
01122   void * data;
01123   };
01124 
01125 /* Plugin structure */
01126 
01131 typedef struct bg_ov_plugin_s bg_ov_plugin_t;
01132 
01141 struct bg_ov_plugin_s
01142   {
01143   bg_plugin_common_t common; 
01144 
01155   void (*set_window)(void * priv, const char * window_id);
01156   
01162   const char * (*get_window)(void * priv);
01163   
01176   void (*set_window_options)(void * priv, const char * name, 
01177                              const char * klass, 
01178                              const gavl_video_frame_t * icon,
01179                              const gavl_video_format_t * icon_format);
01180 
01186   void (*set_window_title)(void * priv, const char * title);
01187   
01188 
01194   void (*set_callbacks)(void * priv, bg_ov_callbacks_t * callbacks);
01195   
01206   int  (*open)(void * priv, gavl_video_format_t * format, int keep_aspect);
01207   
01212   gavl_video_frame_t * (*get_frame)(void * priv);
01213   
01227   int (*add_overlay_stream)(void * priv, gavl_video_format_t * format);
01228 
01241   gavl_overlay_t * (*create_overlay)(void * priv, int id);
01242   
01249   void (*set_overlay)(void * priv, int stream, gavl_overlay_t * ovl);
01250   
01258   void (*put_video)(void * priv, gavl_video_frame_t*frame);
01259 
01269   void (*put_still)(void * priv, gavl_video_frame_t*frame);
01270 
01279   void (*handle_events)(void * priv);
01280 
01287   void (*update_aspect)(void * priv, int pixel_width, int pixel_height);
01288     
01293   //  void (*destroy_frame)(void * priv, gavl_video_frame_t * frame);
01294 
01301   void (*destroy_overlay)(void * priv, int id, gavl_overlay_t * ovl);
01302 
01310   void (*close)(void * priv);
01311 
01316   void (*show_window)(void * priv, int show);
01317   };
01318 
01319 /*******************************************
01320  * ENCODER
01321  *******************************************/
01322 
01333 typedef struct bg_encoder_callbacks_s bg_encoder_callbacks_t;
01334 
01340 struct bg_encoder_callbacks_s
01341   {
01342   
01351   int (*create_output_file)(void * data, const char * filename);
01352 
01361   int (*create_temp_file)(void * data, const char * filename);
01362   
01363   void * data;
01364   };
01365 
01366 
01371 typedef struct bg_encoder_plugin_s bg_encoder_plugin_t;
01372 
01373 
01378 struct bg_encoder_plugin_s
01379   {
01380   bg_plugin_common_t common; 
01381   
01382   int max_audio_streams;  
01383   int max_video_streams;  
01384   int max_subtitle_text_streams;
01385   int max_subtitle_overlay_streams;
01386   
01392   void (*set_callbacks)(void * priv, bg_encoder_callbacks_t * cb);
01393 
01403   int (*writes_compressed_audio)(void * priv,
01404                                  const gavl_audio_format_t * format,
01405                                  const gavl_compression_info_t * info);
01406   
01416   int (*writes_compressed_video)(void * priv,
01417                                  const gavl_video_format_t * format,
01418                                  const gavl_compression_info_t * info);
01419   
01430   int (*open)(void * data, const char * filename,
01431               const gavl_metadata_t * metadata,
01432               const bg_chapter_list_t * chapter_list);
01433   
01434   /* Return per stream parameters */
01435 
01443   const bg_parameter_info_t * (*get_audio_parameters)(void * priv);
01444 
01452   const bg_parameter_info_t * (*get_video_parameters)(void * priv);
01453 
01461   const bg_parameter_info_t * (*get_subtitle_text_parameters)(void * priv);
01462 
01470   const bg_parameter_info_t * (*get_subtitle_overlay_parameters)(void * priv);
01471   
01472   /* Add streams. The formats can be changed, be sure to get the
01473    * final formats with get_[audio|video]_format after starting the plugin
01474    * Return value is the index of the added stream.
01475    */
01476 
01488   int (*add_audio_stream)(void * priv, const gavl_metadata_t * m,
01489                           const gavl_audio_format_t * format);
01490 
01503   int (*add_audio_stream_compressed)(void * priv, const gavl_metadata_t * m,
01504                                      const gavl_audio_format_t * format,
01505                                      const gavl_compression_info_t * info);
01506   
01517   int (*add_video_stream)(void * priv,
01518                           const gavl_metadata_t * m,
01519                           const gavl_video_format_t * format);
01520 
01532   int (*add_video_stream_compressed)(void * priv,
01533                                      const gavl_metadata_t * m,
01534                                      const gavl_video_format_t * format,
01535                                      const gavl_compression_info_t * info);
01536   
01543   int (*add_subtitle_text_stream)(void * priv,
01544                                   const gavl_metadata_t * m,
01545                                   int * timescale);
01546   
01559   int (*add_subtitle_overlay_stream)(void * priv,
01560                                      const gavl_metadata_t * m,
01561                                      const gavl_video_format_t * format);
01562   
01563   /* Set parameters for the streams */
01564 
01575   void (*set_audio_parameter)(void * priv, int stream, const char * name,
01576                               const bg_parameter_value_t * v);
01577 
01589   void (*set_video_parameter)(void * priv, int stream, const char * name,
01590                               const bg_parameter_value_t * v);
01591 
01602   void (*set_subtitle_text_parameter)(void * priv, int stream,
01603                                       const char * name,
01604                                       const bg_parameter_value_t * v);
01605 
01616   void (*set_subtitle_overlay_parameter)(void * priv, int stream,
01617                                          const char * name,
01618                                          const bg_parameter_value_t * v);
01619   
01628   int (*set_video_pass)(void * priv, int stream, int pass, int total_passes,
01629                         const char * stats_file);
01630   
01639   int (*start)(void * priv);
01640   
01641   /*
01642    *  After setting the parameters, get the formats, you need to deliver the frames in
01643    */
01644 
01653   void (*get_audio_format)(void * priv, int stream, gavl_audio_format_t*ret);
01654 
01663   void (*get_video_format)(void * priv, int stream, gavl_video_format_t*ret);
01664 
01673   void (*get_subtitle_overlay_format)(void * priv, int stream,
01674                                       gavl_video_format_t*ret);
01675 
01676   /*
01677    *  Encode audio/video
01678    */
01679 
01690   int (*write_audio_frame)(void * data, gavl_audio_frame_t * frame, int stream);
01691 
01702   int (*write_audio_packet)(void * data, gavl_packet_t * packet, int stream);
01703 
01704   
01712   int (*write_video_frame)(void * data, gavl_video_frame_t * frame, int stream);
01713 
01721   int (*write_video_packet)(void * data, gavl_packet_t * packet, int stream);
01722   
01732   int (*write_subtitle_text)(void * data,const char * text,
01733                              int64_t start,
01734                              int64_t duration, int stream);
01735   
01743   int (*write_subtitle_overlay)(void * data, gavl_overlay_t * ovl, int stream);
01744 
01754   void (*update_metadata)(void * data, const char * name,
01755                           const gavl_metadata_t * m);
01756 
01765   int (*close)(void * data, int do_delete);
01766   };
01767 
01768 
01769 /*******************************************
01770  * ENCODER Postprocessor
01771  *******************************************/
01772 
01787 typedef struct
01788   {
01795   void (*action_callback)(void * data, char * action);
01796 
01806   void (*progress_callback)(void * data, float perc);
01807 
01808   void * data; 
01809 
01810   } bg_e_pp_callbacks_t;
01811 
01817 typedef struct bg_encoder_pp_plugin_s bg_encoder_pp_plugin_t;
01818 
01824 struct bg_encoder_pp_plugin_s
01825   {
01826   bg_plugin_common_t common; 
01827   
01828   int max_audio_streams;  
01829   int max_video_streams;  
01830 
01831   char * supported_extensions; 
01832   
01839   void (*set_callbacks)(void * priv,bg_e_pp_callbacks_t * callbacks);
01840   
01848   int (*init)(void * priv);
01849 
01866   void (*add_track)(void * priv, const char * filename,
01867                     gavl_metadata_t * metadata, int pp_only);
01868   
01878   void (*run)(void * priv, const char * directory, int cleanup);
01879 
01889   void (*stop)(void * priv);
01890   };
01891 
01892 
01906 typedef struct bg_image_reader_plugin_s bg_image_reader_plugin_t;
01907 
01911 struct bg_image_reader_plugin_s
01912   {
01913   bg_plugin_common_t common; 
01914   const char * extensions; 
01915   
01923   int (*read_header)(void * priv, const char * filename,
01924                      gavl_video_format_t * format);
01925 
01931   const gavl_metadata_t * (*get_metadata)(void * priv);
01932 
01939   int (*get_compression_info)(void * priv, gavl_compression_info_t * ci);
01940   
01950   int (*read_image)(void * priv, gavl_video_frame_t * frame);
01951   };
01952 
01957 typedef struct bg_iw_callbacks_s bg_iw_callbacks_t;
01958 
01963 struct bg_iw_callbacks_s
01964   {
01965   
01974   int (*create_output_file)(void * data, const char * filename);
01975   
01976   void * data;
01977   };
01978 
01983 typedef struct bg_image_writer_plugin_s bg_image_writer_plugin_t;
01984 
01989 struct bg_image_writer_plugin_s
01990   {
01991   bg_plugin_common_t common; 
01992   const char * extensions; 
01993   
01999   void (*set_callbacks)(void * priv, bg_iw_callbacks_t * cb);
02000   
02011   int (*write_header)(void * priv, const char * filename,
02012                       gavl_video_format_t * format, const gavl_metadata_t * m);
02013   
02024   int (*write_image)(void * priv, gavl_video_frame_t * frame);
02025   } ;
02026 
02057 /* Filters */
02058 
02063 typedef struct bg_fa_plugin_s bg_fa_plugin_t;
02064 
02069 struct bg_fa_plugin_s
02070   {
02071   bg_plugin_common_t common; 
02072 
02081   void (*connect_input_port)(void * priv, bg_read_audio_func_t func,
02082                              void * data,
02083                              int stream, int port);
02084 
02094   void (*set_input_format)(void * priv, gavl_audio_format_t * format, int port);
02095 
02096 
02103   void (*reset)(void * priv);
02104 
02112   void (*get_output_format)(void * priv, gavl_audio_format_t * format);
02113 
02123   int (*need_restart)(void * priv);
02124 
02128   bg_read_audio_func_t read_audio;
02129     
02130   };
02131 
02136 typedef struct bg_fv_plugin_s bg_fv_plugin_t;
02137 
02142 struct bg_fv_plugin_s
02143   {
02144   bg_plugin_common_t common; 
02145 
02154   gavl_video_options_t * (*get_options)(void * priv);
02155   
02164   void (*connect_input_port)(void * priv,
02165                              bg_read_video_func_t func,
02166                              void * data, int stream, int port);
02167 
02174   void (*set_input_format)(void * priv, gavl_video_format_t * format, int port);
02175   
02182   void (*reset)(void * priv);
02183 
02191   void (*get_output_format)(void * priv, gavl_video_format_t * format);
02192   
02202   int (*need_restart)(void * priv);
02203 
02207   bg_read_video_func_t read_video;
02208     
02209   };
02210 
02211 
02230 typedef struct bg_visualization_plugin_s bg_visualization_plugin_t;
02231 
02232 
02247 struct bg_visualization_plugin_s
02248   {
02249   bg_plugin_common_t common; 
02250 
02256   void (*set_callbacks)(void * priv, bg_ov_callbacks_t * cb);
02257 
02269   int (*open_ov)(void * priv, gavl_audio_format_t * audio_format,
02270                  gavl_video_format_t * video_format);
02271   
02282   int (*open_win)(void * priv, gavl_audio_format_t * audio_format,
02283                   const char * window_id);
02284 
02297   void (*update)(void * priv, gavl_audio_frame_t * frame);
02298 
02308   void (*draw_frame)(void * priv, gavl_video_frame_t * frame);
02309   
02318   void (*show_frame)(void * priv);
02319 
02324   void (*close)(void * priv);
02325   
02326   };
02327 
02328 
02329 
02334 #endif // __BG_PLUGIN_H_