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  * xine audio decoder plugin interface
21  */
22 
23 #ifndef HAVE_AUDIO_DECODER_H
24 #define HAVE_AUDIO_DECODER_H
25 
26 #include <xine/attributes.h>
27 #include <xine/buffer.h>
28 
29 struct plugin_node_s;
30 
31 #define AUDIO_DECODER_IFACE_VERSION 16
32 
33 /*
34  * generic xine audio decoder plugin interface
35  */
36 
37 typedef struct audio_decoder_class_s audio_decoder_class_t;
38 typedef struct audio_decoder_s audio_decoder_t;
39 
40 struct audio_decoder_class_s {
41 
42   /*
43    * open a new instance of this plugin class
44    */
45   audio_decoder_t* (*open_plugin) (audio_decoder_class_t *this_gen, xine_stream_t *stream);
46 
47   /**
48    * @brief short human readable identifier for this plugin class
49    */
50   const char *identifier;
51 
52   /**
53    * @brief human readable (verbose = 1 line) description for this plugin class
54    *
55    * The description is passed to gettext() to internationalise.
56    */
57   const char *description;
58 
59   /**
60    * @brief Optional non-standard catalog to use with dgettext() for description.
61    */
62   const char *text_domain;
63 
64   /*
65    * free all class-related resources
66    */
67 
68   void (*dispose) (audio_decoder_class_t *this_gen);
69 };
70 
71 #define default_audio_decoder_class_dispose (void (*) (audio_decoder_class_t *this_gen))free
72 
73 struct audio_decoder_s {
74 
75   /*
76    * decode data from buf and feed decoded samples to
77    * audio output
78    */
79   void (*decode_data) (audio_decoder_t *this_gen, buf_element_t *buf);
80 
81   /*
82    * reset decoder after engine flush (prepare for new
83    * audio data not related to recently decoded data)
84    */
85   void (*reset) (audio_decoder_t *this_gen);
86 
87   /*
88    * inform decoder that a time reference discontinuity has happened.
89    * that is, it must forget any currently held pts value
90    */
91   void (*discontinuity) (audio_decoder_t *this_gen);
92 
93   /*
94    * close down, free all resources
95    */
96   void (*dispose) (audio_decoder_t *this_gen);
97 
98   /**
99    * @brief Pointer to the loaded plugin node.
100    *
101    * Used by the plugins loader. It's an opaque type when using the
102    * structure outside of xine's build.
103    */
104   struct plugin_node_s *node XINE_PRIVATE_FIELD;
105 };
106 
107 #endif
108