1 /*
2  * Copyright (C) 2000-2018 the xine project
3  *
4  * This file is part of xine, a free video player.
5  *
6  * xine is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * xine is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19  *
20  * generic plugin definitions
21  */
22 
23 #ifndef XINE_PLUGIN_H
24 #define XINE_PLUGIN_H
25 
26 #include <xine/attributes.h>
27 #include <xine/os_types.h>
28 
29 #define PLUGIN_NONE	      0
30 #define PLUGIN_INPUT	      1
31 #define PLUGIN_DEMUX	      2
32 #define PLUGIN_AUDIO_DECODER  3
33 #define PLUGIN_VIDEO_DECODER  4
34 #define PLUGIN_SPU_DECODER    5
35 #define PLUGIN_AUDIO_OUT      6
36 #define PLUGIN_VIDEO_OUT      7
37 #define PLUGIN_POST           8
38 
39 #define PLUGIN_TYPE_MAX       PLUGIN_POST
40 
41 #define PLUGIN_XINE_MODULE    0x10
42 
43 /* this flag may be or'ed with type in order to force preloading the plugin.
44  * very useful to register config items on xine initialization.
45  */
46 #define PLUGIN_MUST_PRELOAD   (1 << 7)
47 
48 /* this flag may be or'ed with type to prevent the plugin loader from unloading
49  * the plugin
50  */
51 #define PLUGIN_NO_UNLOAD      (1 << 6)
52 
53 #define PLUGIN_TYPE_MASK      ((1 << 6) - 1)
54 
55 typedef struct {
56   uint8_t                  type;                    /* one of the PLUGIN_* constants above     */
57   uint8_t                  API;                     /* API version supported by this plugin    */
58   const char              *id;                      /* a name that identifies this plugin      */
59   uint32_t                 version;                 /* version number, increased every release */
60   const void              *special_info;            /* plugin-type specific, see structs below */
61   void                  *(*init)(xine_t *, const void *); /* init the plugin class             */
62 } plugin_info_t;
63 
64 
65 /* special_info for a video output plugin */
66 typedef struct {
67   int                      priority;                /* priority of this plugin for auto-probing  */
68   int                      visual_type;             /* visual type supported by this plugin      */
69 } vo_info_t;
70 
71 /* special info for a audio output plugin */
72 typedef struct {
73   int                      priority;
74 } ao_info_t;
75 
76 /* special_info for a decoder plugin */
77 typedef struct {
78   const uint32_t          *supported_types;         /* streamtypes this decoder can handle       */
79   int                      priority;
80 } decoder_info_t;
81 
82 /* special info for a post plugin */
83 typedef struct {
84   uint32_t                 type;                    /* type of the post plugin, use one of XINE_POST_TYPE_* */
85 } post_info_t;
86 
87 /* special info for a demuxer plugin */
88 typedef struct {
89   int                      priority;
90 } demuxer_info_t;
91 
92 /* special info for an input plugin */
93 typedef struct {
94   int                      priority;
95 } input_info_t;
96 
97 
98 /* special info for generic loadable module
99  * examples:
100  *   { .type = "tls_v1" },
101  *   { .type = "gl_v1", .sub_type = XINE_VISUAL_TYPE_X11 },
102  */
103 typedef struct {
104   int                      priority;
105   char                     type[16];     /* plugin type (and version) */
106   unsigned int             sub_type;
107 } xine_module_info_t;
108 
109 
110 /* register a list of statically linked plugins
111  * info is a list of plugin_info_t terminated by PLUGIN_NONE
112  * example:
113  *   plugin_info_t acme_plugin_info[] = {
114  *     { PLUGIN_VIDEO_OUT, 21, "acme", XINE_VERSION_CODE, &vo_info_acme,
115  *   init_class_acme },
116  *     { PLUGIN_NONE, 0, "", 0, NULL, NULL }
117  *   };
118  *
119  */
120 void xine_register_plugins(xine_t *self, const plugin_info_t *info) XINE_PROTECTED;
121 
122 #endif
123