gmerlin
|
00001 /***************************************************************** 00002 * gmerlin - a general purpose multimedia framework and applications 00003 * 00004 * Copyright (c) 2001 - 2012 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 <gavl/connectors.h> 00028 #include <gavl/metadata.h> 00029 #include <gavl/edl.h> 00030 00031 #include <gavl/gavf.h> 00032 00033 #include <gmerlin/parameter.h> 00034 #include <gmerlin/streaminfo.h> 00035 #include <gmerlin/accelerator.h> 00036 #include <gmerlin/edl.h> 00037 00081 typedef int (*bg_read_audio_func_t)(void * priv, gavl_audio_frame_t* frame, 00082 int stream, 00083 int num_samples); 00084 00096 typedef int (*bg_read_video_func_t)(void * priv, gavl_video_frame_t* frame, 00097 int stream); 00098 00108 #define BG_PLUGIN_REMOVABLE (1<<0) //!< Plugin handles removable media (CD, DVD etc.) 00109 #define BG_PLUGIN_FILE (1<<1) //!< Plugin reads/writes files 00110 #define BG_PLUGIN_RECORDER (1<<2) //!< Plugin does hardware recording 00111 #define BG_PLUGIN_URL (1<<3) //!< Plugin can load URLs 00112 #define BG_PLUGIN_PLAYBACK (1<<4) //!< Plugin is an audio or video driver for playback 00113 #define BG_PLUGIN_PIPE (1<<8) //!< Plugin can do I/O from stdin or stdout ("-") 00114 #define BG_PLUGIN_TUNER (1<<9) //!< Plugin has some kind of tuner. Channels will be loaded as tracks. 00115 #define BG_PLUGIN_FILTER_1 (1<<10) //!< Plugin acts as a filter with one input 00116 #define BG_PLUGIN_EMBED_WINDOW (1<<11) //!< Plugin can embed it's window into another application 00117 #define BG_PLUGIN_VISUALIZE_FRAME (1<<12) //!< Visualization plugin outputs video frames 00118 #define BG_PLUGIN_VISUALIZE_GL (1<<13) //!< Visualization plugin outputs via OpenGL 00119 #define BG_PLUGIN_PP (1<<14) //!< Postprocessor 00120 #define BG_PLUGIN_CALLBACKS (1<<15) //!< Plugin can be opened from callbacks 00121 #define BG_PLUGIN_BROADCAST (1<<16) //!< Plugin can broadcasts (e.g. webstreams) 00122 #define BG_PLUGIN_DEVPARAM (1<<17) //!< Plugin has pluggable devices as parameters, which must be updated regurarly 00123 #define BG_PLUGIN_OV_STILL (1<<18) //!< OV plugin supports still images 00124 #define BG_PLUGIN_GAVF_IO (1<<19) //!< Plugin can read/write to/from a gavf I/O handle 00125 00126 #define BG_PLUGIN_AUDIO_COMPRESSOR (1<<19) //!< Plugin compresses audio 00127 #define BG_PLUGIN_VIDEO_COMPRESSOR (1<<20) //!< Plugin compresses video 00128 #define BG_PLUGIN_AUDIO_DECOMPRESSOR (1<<21) //!< Plugin decompresses audio 00129 #define BG_PLUGIN_VIDEO_DECOMPRESSOR (1<<22) //!< Plugin decompresses video 00130 #define BG_PLUGIN_OVERLAY_COMPRESSOR (1<<23) //!< Plugin compresses overlays 00131 #define BG_PLUGIN_OVERLAY_DECOMPRESSOR (1<<24) //!< Plugin decompresses overlays 00132 00133 #define BG_PLUGIN_UNSUPPORTED (1<<25) //!< Plugin is not supported. Only for a foreign API plugins 00134 00135 00136 #define BG_PLUGIN_ALL 0xFFFFFFFF //!< Mask of all possible plugin flags 00137 00141 #define BG_PLUGIN_API_VERSION 27 00142 00143 /* Include this into all plugin modules exactly once 00144 to let the plugin loader obtain the API version */ 00145 00146 #define BG_GET_PLUGIN_API_VERSION \ 00147 int get_plugin_api_version() __attribute__ ((visibility("default"))); \ 00148 int get_plugin_api_version() { return BG_PLUGIN_API_VERSION; } 00149 00150 #define BG_PLUGIN_PRIORITY_MIN 1 00151 #define BG_PLUGIN_PRIORITY_MAX 10 00152 00165 typedef enum 00166 { 00167 BG_STREAM_ACTION_OFF = 0, 00168 BG_STREAM_ACTION_DECODE, 00169 BG_STREAM_ACTION_READRAW, 00170 00171 } bg_stream_action_t; 00172 00173 /*************************************************** 00174 * Plugin API 00175 * 00176 * Plugin dlls contain a symbol "the_plugin", 00177 * which points to one of the structures below. 00178 * The member functions are described below. 00179 * 00180 ***************************************************/ 00181 00182 /* 00183 * Plugin types 00184 */ 00185 00190 typedef enum 00191 { 00192 BG_PLUGIN_NONE = 0, 00193 BG_PLUGIN_INPUT = (1<<0), 00194 BG_PLUGIN_OUTPUT_AUDIO = (1<<1), 00195 BG_PLUGIN_OUTPUT_VIDEO = (1<<2), 00196 BG_PLUGIN_RECORDER_AUDIO = (1<<3), 00197 BG_PLUGIN_RECORDER_VIDEO = (1<<4), 00198 BG_PLUGIN_ENCODER_AUDIO = (1<<5), 00199 BG_PLUGIN_ENCODER_VIDEO = (1<<6), 00200 BG_PLUGIN_ENCODER_TEXT = (1<<7), 00201 BG_PLUGIN_ENCODER_OVERLAY = (1<<8), 00202 BG_PLUGIN_ENCODER = (1<<9), 00203 BG_PLUGIN_ENCODER_PP = (1<<10), 00204 BG_PLUGIN_IMAGE_READER = (1<<11), 00205 BG_PLUGIN_IMAGE_WRITER = (1<<12), 00206 BG_PLUGIN_FILTER_AUDIO = (1<<13), 00207 BG_PLUGIN_FILTER_VIDEO = (1<<14), 00208 BG_PLUGIN_VISUALIZATION = (1<<15), 00209 BG_PLUGIN_AV_RECORDER = (1<<16), 00210 BG_PLUGIN_CODEC = (1<<17), 00211 } bg_plugin_type_t; 00212 00221 typedef struct 00222 { 00223 char * device; 00224 char * name; 00225 } bg_device_info_t; 00226 00237 bg_device_info_t * bg_device_info_append(bg_device_info_t * arr, 00238 const char * device, 00239 const char * name); 00240 00246 void bg_device_info_destroy(bg_device_info_t * arr); 00247 00248 /* Common part */ 00249 00254 typedef struct bg_plugin_common_s bg_plugin_common_t; 00255 00260 struct bg_plugin_common_s 00261 { 00262 char * gettext_domain; 00263 char * gettext_directory; 00264 00265 char * name; 00266 char * long_name; 00267 bg_plugin_type_t type; 00268 int flags; 00269 00270 char * description; 00271 00272 /* 00273 * If there might be more than one plugin for the same 00274 * job, there is a priority (0..10) which is used for the 00275 * decision 00276 */ 00277 00278 int priority; 00279 00284 void * (*create)(); 00285 00295 void (*destroy)(void* priv); 00296 00304 const bg_parameter_info_t * (*get_parameters)(void * priv); 00305 00309 bg_set_parameter_func_t set_parameter; 00310 00317 bg_get_parameter_func_t get_parameter; 00318 00328 int (*check_device)(const char * device, char ** name); 00329 00330 00338 bg_device_info_t * (*find_devices)(); 00339 00340 }; 00341 00342 /* 00343 * Plugin callbacks: Functions called by the 00344 * plugin to reflect user input or other changes 00345 * Applications might pass NULL callbacks, 00346 * so plugins MUST check for valid callbacks structure 00347 * before calling any of these functions 00348 */ 00349 00350 /* Input plugin */ 00351 00357 typedef struct bg_input_callbacks_s bg_input_callbacks_t; 00358 00367 struct bg_input_callbacks_s 00368 { 00374 void (*duration_changed)(void * data, gavl_time_t duration); 00375 00383 void (*metadata_changed)(void * data, const gavl_metadata_t * m); 00384 00393 void (*buffer_notify)(void * data, float percentage); 00394 00408 int (*user_pass)(void * data, const char * resource, 00409 char ** username, char ** password); 00410 00422 void (*aspect_changed)(void * data, int stream, 00423 int pixel_width, int pixel_height); 00424 00425 00426 void * data; 00427 00428 }; 00429 00430 /************************************************* 00431 * MEDIA INPUT 00432 *************************************************/ 00433 00438 typedef struct bg_input_plugin_s bg_input_plugin_t; 00439 00440 00450 struct bg_input_plugin_s 00451 { 00452 bg_plugin_common_t common; 00453 00459 const char * (*get_protocols)(void * priv); 00464 const char * (*get_mimetypes)(void * priv); 00465 00470 const char * (*get_extensions)(void * priv); 00471 00481 void (*set_callbacks)(void * priv, bg_input_callbacks_t * callbacks); 00482 00488 int (*open)(void * priv, const char * arg); 00489 00498 int (*open_fd)(void * priv, int fd, int64_t total_bytes, 00499 const char * mimetype); 00500 00512 int (*open_io)(void * priv, gavf_io_t * io); 00513 00519 const gavl_edl_t * (*get_edl)(void * priv); 00520 00528 const char * (*get_disc_name)(void * priv); 00529 00538 int (*eject_disc)(const char * device); 00539 00547 int (*get_num_tracks)(void * priv); 00548 00565 bg_track_info_t * (*get_track_info)(void * priv, int track); 00566 00577 int (*set_track)(void * priv, int track); 00578 00589 int (*get_audio_compression_info)(void * priv, int stream, 00590 gavl_compression_info_t * info); 00591 00602 int (*get_video_compression_info)(void * priv, int stream, 00603 gavl_compression_info_t * info); 00604 00615 int (*get_overlay_compression_info)(void * priv, int stream, 00616 gavl_compression_info_t * info); 00617 00618 /* 00619 * These functions set the audio- video- and subpicture streams 00620 * as well as programs (== DVD Angles). All these start with 0 00621 * 00622 * Arguments for actions are defined in the enum bg_stream_action_t 00623 * above. Plugins must return FALSE on failure (e.g. no such stream) 00624 * 00625 * Functions must be defined only, if the corresponding stream 00626 * type is supported by the plugin and can be switched. 00627 * Single stream plugins can leave these NULL 00628 * Gmerlin will never try to call these functions on nonexistent streams 00629 */ 00630 00638 int (*set_audio_stream)(void * priv, int stream, bg_stream_action_t action); 00639 00647 int (*set_video_stream)(void * priv, int stream, bg_stream_action_t action); 00648 00656 int (*set_text_stream)(void * priv, int stream, bg_stream_action_t action); 00657 00665 int (*set_overlay_stream)(void * priv, int stream, bg_stream_action_t action); 00666 00678 int (*start)(void * priv); 00679 00689 gavl_frame_table_t * (*get_frame_table)(void * priv, int stream); 00690 00703 // bg_read_audio_func_t read_audio; 00704 00713 gavl_audio_source_t * (*get_audio_source)(void * priv, int stream); 00714 00724 // int (*has_still)(void * priv, int stream); 00725 00733 // bg_read_video_func_t read_video; 00734 00744 gavl_video_source_t * (*get_video_source)(void * priv, int stream); 00745 00756 // int (*read_audio_packet)(void * priv, int stream, gavl_packet_t * p); 00757 00768 // int (*read_video_packet)(void * priv, int stream, gavl_packet_t * p); 00769 00778 gavl_packet_source_t * (*get_audio_packet_source)(void * priv, int stream); 00779 00788 gavl_packet_source_t * (*get_video_packet_source)(void * priv, int stream); 00789 00798 gavl_packet_source_t * (*get_overlay_packet_source)(void * priv, int stream); 00799 00812 void (*skip_video)(void * priv, int stream, int64_t * time, int scale, int exact); 00813 00820 // int (*has_subtitle)(void * priv, int stream); 00821 00833 // int (*read_subtitle_overlay)(void * priv, 00834 // gavl_overlay_t*ovl, int stream); 00835 00844 gavl_video_source_t * (*get_overlay_source)(void * priv, int stream); 00845 00864 // int (*read_subtitle_text)(void * priv, 00865 // char ** text, int * text_alloc, 00866 // int64_t * start_time, 00867 // int64_t * duration, int stream); 00868 00877 gavl_packet_source_t * (*get_text_source)(void * priv, int stream); 00878 00887 gavl_packet_source_t * (*get_subtitle_packet_source)(void * priv, int stream); 00888 00900 void (*seek)(void * priv, int64_t * time, int scale); 00901 00909 void (*stop)(void * priv); 00910 00917 void (*close)(void * priv); 00918 00919 }; 00920 00930 typedef struct bg_oa_plugin_s bg_oa_plugin_t; 00931 00938 struct bg_oa_plugin_s 00939 { 00940 bg_plugin_common_t common; 00941 00951 int (*open)(void * priv, gavl_audio_format_t* format); 00952 00959 int (*start)(void * priv); 00960 00966 gavl_audio_sink_t * (*get_sink)(void * priv); 00967 00976 int (*get_delay)(void * priv); 00977 00985 void (*stop)(void * priv); 00986 00993 void (*close)(void * priv); 00994 }; 00995 00996 /******************************************* 00997 * Recorder 00998 *******************************************/ 00999 01005 typedef struct bg_recorder_callbacks_s bg_recorder_callbacks_t; 01006 01015 struct bg_recorder_callbacks_s 01016 { 01024 void (*metadata_changed)(void * data, const gavl_metadata_t * m); 01025 01026 void * data; 01027 01028 }; 01029 01030 01035 typedef struct bg_recorder_plugin_s bg_recorder_plugin_t; 01036 01043 struct bg_recorder_plugin_s 01044 { 01045 bg_plugin_common_t common; 01046 01056 void (*set_callbacks)(void * priv, bg_recorder_callbacks_t * callbacks); 01057 01068 int (*open)(void * priv, gavl_audio_format_t * audio_format, 01069 gavl_video_format_t * video_format, gavl_metadata_t * m); 01070 01073 bg_read_audio_func_t read_audio; 01074 01078 gavl_audio_source_t * (*get_audio_source)(void * priv); 01079 01082 bg_read_video_func_t read_video; 01083 01087 gavl_video_source_t * (*get_video_source)(void * priv); 01088 01093 void (*close)(void * priv); 01094 }; 01095 01096 /******************************************* 01097 * VIDEO OUTPUT 01098 *******************************************/ 01099 01100 /* Callbacks */ 01101 01112 typedef struct bg_ov_callbacks_s bg_ov_callbacks_t; 01113 01119 struct bg_ov_callbacks_s 01120 { 01127 const bg_accelerator_map_t * accel_map; 01128 01134 int (*accel_callback)(void * data, int id); 01135 01149 int (*key_callback)(void * data, int key, int mask); 01150 01158 int (*key_release_callback)(void * data, int key, int mask); 01159 01169 int (*button_callback)(void * data, int x, int y, int button, int mask); 01170 01180 int (*button_release_callback)(void * data, int x, int y, int button, int mask); 01181 01190 int (*motion_callback)(void * data, int x, int y, int mask); 01191 01197 void (*show_window)(void * data, int show); 01198 01206 void (*brightness_callback)(void * data, float val); 01207 01215 void (*saturation_callback)(void * data, float val); 01216 01224 void (*contrast_callback)(void * data, float val); 01225 01233 void (*hue_callback)(void * data, float val); 01234 01235 void * data; 01236 }; 01237 01238 /* Plugin structure */ 01239 01244 typedef struct bg_ov_plugin_s bg_ov_plugin_t; 01245 01254 struct bg_ov_plugin_s 01255 { 01256 bg_plugin_common_t common; 01257 01268 void (*set_window)(void * priv, const char * window_id); 01269 01275 const char * (*get_window)(void * priv); 01276 01289 void (*set_window_options)(void * priv, const char * name, 01290 const char * klass, 01291 const gavl_video_frame_t * icon, 01292 const gavl_video_format_t * icon_format); 01293 01299 void (*set_window_title)(void * priv, const char * title); 01300 01301 01307 void (*set_callbacks)(void * priv, bg_ov_callbacks_t * callbacks); 01308 01319 int (*open)(void * priv, gavl_video_format_t * format, int keep_aspect); 01320 01325 // gavl_video_frame_t * (*get_frame)(void * priv); 01326 01340 gavl_video_sink_t * (*add_overlay_stream)(void * priv, gavl_video_format_t * format); 01341 01354 // gavl_overlay_t * (*create_overlay)(void * priv, int id); 01355 01362 // void (*set_overlay)(void * priv, int stream, gavl_overlay_t * ovl); 01363 01369 gavl_video_sink_t * (*get_sink)(void * priv); 01370 01379 void (*handle_events)(void * priv); 01380 01387 void (*update_aspect)(void * priv, int pixel_width, int pixel_height); 01388 01395 // void (*destroy_overlay)(void * priv, int id, gavl_overlay_t * ovl); 01396 01404 void (*close)(void * priv); 01405 01410 void (*show_window)(void * priv, int show); 01411 }; 01412 01413 /******************************************* 01414 * ENCODER 01415 *******************************************/ 01416 01427 typedef struct bg_encoder_callbacks_s bg_encoder_callbacks_t; 01428 01434 struct bg_encoder_callbacks_s 01435 { 01436 01445 int (*create_output_file)(void * data, const char * filename); 01446 01455 int (*create_temp_file)(void * data, const char * filename); 01456 01457 void * data; 01458 }; 01459 01460 01465 typedef struct bg_encoder_plugin_s bg_encoder_plugin_t; 01466 01467 01472 struct bg_encoder_plugin_s 01473 { 01474 bg_plugin_common_t common; 01475 01476 int max_audio_streams; 01477 int max_video_streams; 01478 int max_text_streams; 01479 int max_overlay_streams; 01480 01486 void (*set_callbacks)(void * priv, bg_encoder_callbacks_t * cb); 01487 01497 int (*writes_compressed_audio)(void * priv, 01498 const gavl_audio_format_t * format, 01499 const gavl_compression_info_t * info); 01500 01510 int (*writes_compressed_video)(void * priv, 01511 const gavl_video_format_t * format, 01512 const gavl_compression_info_t * info); 01513 01523 int (*writes_compressed_overlay)(void * priv, 01524 const gavl_video_format_t * format, 01525 const gavl_compression_info_t * info); 01526 01537 int (*open)(void * data, const char * filename, 01538 const gavl_metadata_t * metadata, 01539 const gavl_chapter_list_t * chapter_list); 01540 01541 01549 int (*open_io)(void * data, gavf_io_t * io, 01550 const gavl_metadata_t * metadata, 01551 const gavl_chapter_list_t * chapter_list); 01552 01553 01554 /* Return per stream parameters */ 01555 01563 const bg_parameter_info_t * (*get_audio_parameters)(void * priv); 01564 01572 const bg_parameter_info_t * (*get_video_parameters)(void * priv); 01573 01581 const bg_parameter_info_t * (*get_text_parameters)(void * priv); 01582 01590 const bg_parameter_info_t * (*get_overlay_parameters)(void * priv); 01591 01592 /* Add streams. The formats can be changed, be sure to get the 01593 * final formats with get_[audio|video]_format after starting the plugin 01594 * Return value is the index of the added stream. 01595 */ 01596 01608 int (*add_audio_stream)(void * priv, const gavl_metadata_t * m, 01609 const gavl_audio_format_t * format); 01610 01623 int (*add_audio_stream_compressed)(void * priv, const gavl_metadata_t * m, 01624 const gavl_audio_format_t * format, 01625 const gavl_compression_info_t * info); 01626 01637 int (*add_video_stream)(void * priv, 01638 const gavl_metadata_t * m, 01639 const gavl_video_format_t * format); 01640 01652 int (*add_video_stream_compressed)(void * priv, 01653 const gavl_metadata_t * m, 01654 const gavl_video_format_t * format, 01655 const gavl_compression_info_t * info); 01656 01663 int (*add_text_stream)(void * priv, 01664 const gavl_metadata_t * m, 01665 uint32_t * timescale); 01666 01679 int (*add_overlay_stream_compressed)(void * priv, 01680 const gavl_metadata_t * m, 01681 const gavl_video_format_t * format, 01682 const gavl_compression_info_t * ci); 01683 01696 int (*add_overlay_stream)(void * priv, 01697 const gavl_metadata_t * m, 01698 const gavl_video_format_t * format); 01699 01700 /* Set parameters for the streams */ 01701 01712 void (*set_audio_parameter)(void * priv, int stream, const char * name, 01713 const bg_parameter_value_t * v); 01714 01726 void (*set_video_parameter)(void * priv, int stream, const char * name, 01727 const bg_parameter_value_t * v); 01728 01739 void (*set_text_parameter)(void * priv, int stream, 01740 const char * name, 01741 const bg_parameter_value_t * v); 01742 01753 void (*set_overlay_parameter)(void * priv, int stream, 01754 const char * name, 01755 const bg_parameter_value_t * v); 01756 01765 int (*set_video_pass)(void * priv, int stream, int pass, int total_passes, 01766 const char * stats_file); 01767 01776 int (*start)(void * priv); 01777 01783 gavl_audio_sink_t * (*get_audio_sink)(void * priv, int stream); 01784 01790 gavl_packet_sink_t * (*get_audio_packet_sink)(void * priv, int stream); 01791 01797 gavl_video_sink_t * (*get_video_sink)(void * priv, int stream); 01798 01804 gavl_packet_sink_t * (*get_video_packet_sink)(void * priv, int stream); 01805 01811 gavl_packet_sink_t * (*get_text_sink)(void * priv, int stream); 01812 01818 gavl_video_sink_t * (*get_overlay_sink)(void * priv, int stream); 01819 01825 gavl_packet_sink_t * (*get_overlay_packet_sink)(void * priv, int stream); 01826 01834 void (*update_metadata)(void * priv, const gavl_metadata_t * m); 01835 01844 int (*close)(void * data, int do_delete); 01845 }; 01846 01847 01848 /******************************************* 01849 * ENCODER Postprocessor 01850 *******************************************/ 01851 01866 typedef struct 01867 { 01874 void (*action_callback)(void * data, char * action); 01875 01885 void (*progress_callback)(void * data, float perc); 01886 01887 void * data; 01888 01889 } bg_e_pp_callbacks_t; 01890 01896 typedef struct bg_encoder_pp_plugin_s bg_encoder_pp_plugin_t; 01897 01903 struct bg_encoder_pp_plugin_s 01904 { 01905 bg_plugin_common_t common; 01906 01907 int max_audio_streams; 01908 int max_video_streams; 01909 01910 char * supported_extensions; 01911 01918 void (*set_callbacks)(void * priv,bg_e_pp_callbacks_t * callbacks); 01919 01927 int (*init)(void * priv); 01928 01945 void (*add_track)(void * priv, const char * filename, 01946 gavl_metadata_t * metadata, int pp_only); 01947 01957 void (*run)(void * priv, const char * directory, int cleanup); 01958 01968 void (*stop)(void * priv); 01969 }; 01970 01971 01985 typedef struct bg_image_reader_plugin_s bg_image_reader_plugin_t; 01986 01990 struct bg_image_reader_plugin_s 01991 { 01992 bg_plugin_common_t common; 01993 const char * extensions; 01994 const char * mimetypes; 01995 02003 int (*read_header)(void * priv, const char * filename, 02004 gavl_video_format_t * format); 02005 02011 const gavl_metadata_t * (*get_metadata)(void * priv); 02012 02019 int (*get_compression_info)(void * priv, gavl_compression_info_t * ci); 02020 02030 int (*read_image)(void * priv, gavl_video_frame_t * frame); 02031 }; 02032 02037 typedef struct bg_iw_callbacks_s bg_iw_callbacks_t; 02038 02043 struct bg_iw_callbacks_s 02044 { 02045 02054 int (*create_output_file)(void * data, const char * filename); 02055 02056 void * data; 02057 }; 02058 02063 typedef struct bg_image_writer_plugin_s bg_image_writer_plugin_t; 02064 02069 struct bg_image_writer_plugin_s 02070 { 02071 bg_plugin_common_t common; 02072 const char * extensions; 02073 const char * mimetypes; 02074 02080 void (*set_callbacks)(void * priv, bg_iw_callbacks_t * cb); 02081 02092 int (*write_header)(void * priv, const char * filename, 02093 gavl_video_format_t * format, const gavl_metadata_t * m); 02094 02105 int (*write_image)(void * priv, gavl_video_frame_t * frame); 02106 } ; 02107 02138 /* Filters */ 02139 02144 typedef struct bg_fa_plugin_s bg_fa_plugin_t; 02145 02150 struct bg_fa_plugin_s 02151 { 02152 bg_plugin_common_t common; 02153 02160 void (*reset)(void * priv); 02161 02171 gavl_audio_source_t * (*connect)(void * priv, gavl_audio_source_t *, 02172 const gavl_audio_options_t * opt); 02173 02183 int (*need_restart)(void * priv); 02184 02185 }; 02186 02191 typedef struct bg_fv_plugin_s bg_fv_plugin_t; 02192 02197 struct bg_fv_plugin_s 02198 { 02199 bg_plugin_common_t common; 02200 02207 void (*reset)(void * priv); 02208 02218 int (*need_restart)(void * priv); 02219 02227 gavl_video_source_t * (*connect)(void * priv, 02228 gavl_video_source_t * src, 02229 const gavl_video_options_t * opt); 02230 02231 }; 02232 02233 02252 typedef struct bg_visualization_plugin_s bg_visualization_plugin_t; 02253 02254 02269 struct bg_visualization_plugin_s 02270 { 02271 bg_plugin_common_t common; 02272 02278 void (*set_callbacks)(void * priv, bg_ov_callbacks_t * cb); 02279 02291 int (*open_ov)(void * priv, gavl_audio_format_t * audio_format, 02292 gavl_video_format_t * video_format); 02293 02304 int (*open_win)(void * priv, gavl_audio_format_t * audio_format, 02305 const char * window_id); 02306 02319 void (*update)(void * priv, gavl_audio_frame_t * frame); 02320 02330 void (*draw_frame)(void * priv, gavl_video_frame_t * frame); 02331 02340 void (*show_frame)(void * priv); 02341 02346 void (*close)(void * priv); 02347 02348 }; 02349 02355 typedef struct bg_codec_plugin_s bg_codec_plugin_t; 02356 02357 02363 struct bg_codec_plugin_s 02364 { 02365 bg_plugin_common_t common; 02366 02372 const gavl_codec_id_t * (*get_compressions)(void * priv); 02373 02382 gavl_audio_sink_t * (*open_encode_audio)(void * priv, 02383 gavl_compression_info_t * ci, 02384 gavl_audio_format_t * fmt, 02385 gavl_metadata_t * m); 02386 02395 gavl_video_sink_t * (*open_encode_video)(void * priv, 02396 gavl_compression_info_t * ci, 02397 gavl_video_format_t * fmt, 02398 gavl_metadata_t * m); 02399 02408 gavl_video_sink_t * (*open_encode_overlay)(void * priv, 02409 gavl_compression_info_t * ci, 02410 gavl_video_format_t * fmt, 02411 gavl_metadata_t * m); 02412 02418 void (*set_packet_sink)(void * priv, gavl_packet_sink_t * s); 02419 02428 gavl_audio_source_t * (*connect_decode_audio)(void * priv, 02429 gavl_packet_source_t * src, 02430 const gavl_compression_info_t * ci, 02431 const gavl_audio_format_t * fmt, 02432 gavl_metadata_t * m); 02433 02442 gavl_video_source_t * (*connect_decode_video)(void * priv, 02443 gavl_packet_source_t * src, 02444 const gavl_compression_info_t * ci, 02445 const gavl_video_format_t * fmt, 02446 gavl_metadata_t * m); 02447 02456 gavl_video_source_t * (*connect_decode_overlay)(void * priv, 02457 gavl_packet_source_t * src, 02458 const gavl_compression_info_t * ci, 02459 const gavl_video_format_t * fmt, 02460 gavl_metadata_t * m); 02461 02462 02469 void (*reset)(void * priv); 02470 02477 int64_t (*skip)(void * priv, int64_t t); 02478 02486 int (*set_pass)(void * priv, int pass, int total_passes, 02487 const char * stats_file); 02488 02489 }; 02490 02495 #endif // __BG_PLUGIN_H_