NUGU SDK Linux  1.7.6
nugu_decoder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NUGU_DECODER_H__
18 #define __NUGU_DECODER_H__
19 
20 #include <nugu.h>
21 #include <base/nugu_pcm.h>
22 #include <base/nugu_buffer.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
36 typedef struct _nugu_decoder NuguDecoder;
37 
42 typedef struct _nugu_decoder_driver NuguDecoderDriver;
43 
65  NuguPcm *sink);
66 
75 NUGU_API int nugu_decoder_free(NuguDecoder *dec);
76 
87 NUGU_API int nugu_decoder_play(NuguDecoder *dec, const void *data,
88  size_t data_len);
89 
99 NUGU_API int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data);
100 
108 
117 NUGU_API void *nugu_decoder_decode(NuguDecoder *dec, const void *data,
118  size_t data_len, size_t *output_len);
119 
127 
149 };
150 
160  int (*create)(NuguDecoderDriver *driver, NuguDecoder *dec);
161 
166  int (*decode)(NuguDecoderDriver *driver, NuguDecoder *dec,
167  const void *data, size_t data_len, NuguBuffer *out_buf);
172  int (*destroy)(NuguDecoderDriver *driver, NuguDecoder *dec);
173 };
174 
183 NUGU_API NuguDecoderDriver *
184 nugu_decoder_driver_new(const char *name, enum nugu_decoder_type type,
185  struct nugu_decoder_driver_ops *ops);
186 
195 
204 
213 
220 NUGU_API NuguDecoderDriver *nugu_decoder_driver_find(const char *name);
221 
228 NUGU_API NuguDecoderDriver *
230 
235 #ifdef __cplusplus
236 }
237 #endif
238 
239 #endif
struct _nugu_buffer NuguBuffer
Buffer object.
Definition: nugu_buffer.h:52
NUGU_API int nugu_decoder_driver_remove(NuguDecoderDriver *driver)
Remove the driver from driver list.
NUGU_API NuguDecoderDriver * nugu_decoder_driver_find(const char *name)
Find a driver by name in the driver list.
NUGU_API int nugu_decoder_driver_register(NuguDecoderDriver *driver)
Register the driver to driver list.
NUGU_API NuguDecoderDriver * nugu_decoder_driver_find_bytype(enum nugu_decoder_type type)
Find a driver by type in the driver list.
NUGU_API int nugu_decoder_driver_free(NuguDecoderDriver *driver)
Destroy the decoder driver.
nugu_decoder_type
decoder type
Definition: nugu_decoder.h:146
struct _nugu_decoder_driver NuguDecoderDriver
decoder driver object
Definition: nugu_decoder.h:42
NUGU_API NuguDecoderDriver * nugu_decoder_driver_new(const char *name, enum nugu_decoder_type type, struct nugu_decoder_driver_ops *ops)
Create new decoder driver.
@ NUGU_DECODER_TYPE_CUSTOM
Definition: nugu_decoder.h:148
@ NUGU_DECODER_TYPE_OPUS
Definition: nugu_decoder.h:147
NUGU_API int nugu_decoder_set_driver_data(NuguDecoder *dec, void *data)
Set custom data for driver.
NUGU_API void * nugu_decoder_get_driver_data(NuguDecoder *dec)
Get custom data for driver.
NUGU_API int nugu_decoder_free(NuguDecoder *dec)
Destroy the decoder object.
NUGU_API int nugu_decoder_play(NuguDecoder *dec, const void *data, size_t data_len)
Decode the encoded data and pass the result to sink.
struct _nugu_decoder NuguDecoder
decoder object
Definition: nugu_decoder.h:36
NUGU_API NuguDecoder * nugu_decoder_new(NuguDecoderDriver *driver, NuguPcm *sink)
Create new decoder object.
NUGU_API void * nugu_decoder_decode(NuguDecoder *dec, const void *data, size_t data_len, size_t *output_len)
Decode the encoded data.
NUGU_API NuguPcm * nugu_decoder_get_pcm(NuguDecoder *dec)
Get pcm(sink) object.
struct _nugu_pcm NuguPcm
pcm object
Definition: nugu_pcm.h:37
decoder driver operations
Definition: nugu_decoder.h:155
int(* destroy)(NuguDecoderDriver *driver, NuguDecoder *dec)
Called when the decoder is destroyed.
Definition: nugu_decoder.h:172
int(* decode)(NuguDecoderDriver *driver, NuguDecoder *dec, const void *data, size_t data_len, NuguBuffer *out_buf)
Called when a decoding request is received from the decoder.
Definition: nugu_decoder.h:166
int(* create)(NuguDecoderDriver *driver, NuguDecoder *dec)
Called when creating a new decoder.
Definition: nugu_decoder.h:160