RDK Documentation (Open Sourced RDK Components)
audio_buffer.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @addtogroup AUDIO_CAPTURE_MANAGER_API
22  * @{
23  */
24 
26 {
27  public:
28  unsigned char * m_start_ptr;
29  unsigned int m_size;
30  unsigned int m_clip_length;
31  unsigned int m_refcount;
32 
33  audio_buffer(const unsigned char *in_ptr, unsigned int in_size, unsigned int clip_length, unsigned int refcount);
34  ~audio_buffer();
35 };
36 
37 /**
38  * @brief This API creates new audio buffer.
39  *
40  * It is used by the Data processor thread.
41  *
42  * @param[in] in_ptr start_ptr
43  * @param[in] in_size input size
44  * @parampin] clip_length Duration of the audio data
45  * @param[in] refcount reference count of the buffer.
46  */
47 audio_buffer * create_new_audio_buffer(const unsigned char *in_ptr, unsigned int in_size, unsigned int clip_length, unsigned int refcount);
48 
49 /**
50  * @brief This API is to release the audio buffer.
51  *
52  * @param[in] ptr Indicates the starting address of buffer
53  */
55 
56 /**
57  * @brief This API is used to update the buffer references.
58  *
59  * @param[in] ptr Buffer pointer.
60  * @param[in] refcount Number of clients connected.
61  */
62 inline void set_ref_audio_buffer(audio_buffer *ptr, unsigned int refcount){ ptr->m_refcount = refcount; } //needs global lock
63 
64 /**
65  * @brief Function to acquire lock.
66  */
68 
69 /**
70  * @brief Function to release lock.
71  */
73 
74 /**
75  * @brief Deletes the audio buffer.
76  *
77  * @param[in] ptr Indicates the starting address of buffer to be deleted.
78  */
80 
81 /**
82  * @}
83  */
audio_buffer
Definition: audio_buffer.h:25
free_audio_buffer
void free_audio_buffer(audio_buffer *ptr)
Deletes the audio buffer.
Definition: audio_buffer.cpp:69
audio_buffer_get_global_lock
void audio_buffer_get_global_lock()
Function to acquire lock.
Definition: audio_buffer.cpp:73
create_new_audio_buffer
audio_buffer * create_new_audio_buffer(const unsigned char *in_ptr, unsigned int in_size, unsigned int clip_length, unsigned int refcount)
This API creates new audio buffer.
Definition: audio_buffer.cpp:45
unref_audio_buffer
void unref_audio_buffer(audio_buffer *ptr)
This API is to release the audio buffer.
Definition: audio_buffer.cpp:51
audio_buffer_release_global_lock
void audio_buffer_release_global_lock()
Function to release lock.
Definition: audio_buffer.cpp:77
set_ref_audio_buffer
void set_ref_audio_buffer(audio_buffer *ptr, unsigned int refcount)
This API is used to update the buffer references.
Definition: audio_buffer.h:62