summaryrefslogtreecommitdiff
path: root/audio_codec/libcook/ra_depack.h (plain)
blob: aedfd6405699f451af600243357b73d95b50bcb6
1/* ***** BEGIN LICENSE BLOCK *****
2 * Source last modified: $Id: ra_depack.h,v 1.1.1.1.2.1 2005/05/04 18:20:57 hubbe Exp $
3 *
4 * REALNETWORKS CONFIDENTIAL--NOT FOR DISTRIBUTION IN SOURCE CODE FORM
5 * Portions Copyright (c) 1995-2005 RealNetworks, Inc.
6 * All Rights Reserved.
7 *
8 * The contents of this file, and the files included with this file,
9 * are subject to the current version of the Real Format Source Code
10 * Porting and Optimization License, available at
11 * https://helixcommunity.org/2005/license/realformatsource (unless
12 * RealNetworks otherwise expressly agrees in writing that you are
13 * subject to a different license). You may also obtain the license
14 * terms directly from RealNetworks. You may not use this file except
15 * in compliance with the Real Format Source Code Porting and
16 * Optimization License. There are no redistribution rights for the
17 * source code of this file. Please see the Real Format Source Code
18 * Porting and Optimization License for the rights, obligations and
19 * limitations governing use of the contents of the file.
20 *
21 * RealNetworks is the developer of the Original Code and owns the
22 * copyrights in the portions it created.
23 *
24 * This file, and the files included with this file, is distributed and
25 * made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND,
26 * EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL
27 * SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT
29 * OR NON-INFRINGEMENT.
30 *
31 * Technology Compatibility Kit Test Suite(s) Location:
32 * https://rarvcode-tck.helixcommunity.org
33 *
34 * Contributor(s):
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#ifndef RA_DEPACK_H
39#define RA_DEPACK_H
40
41#include "helix_types.h"
42#include "helix_result.h"
43#include "rm_error.h"
44#include "rm_memory.h"
45#include "rm_stream.h"
46#include "rm_packet.h"
47#include "ra_format_info.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif /* #ifdef __cplusplus */
52
53 /* Encoded audio block definition. */
54 typedef struct ra_block_struct {
55 BYTE* pData;
56 UINT32 ulDataLen;
57 UINT32 ulTimestamp;
58 UINT32 ulDataFlags;
59 } ra_block;
60
61 /* Callback functions */
62 typedef HX_RESULT(*ra_block_avail_func_ptr)(void* pAvail,
63 UINT32 ulSubStream,
64 ra_block* block);
65
66 /*
67 * ra_depack definition. Opaque to user.
68 */
69 typedef void ra_depack;
70
71 /*
72 * ra_depack_create
73 *
74 * Users should use this function if they don't need to
75 * customize their memory allocation routines. In this
76 * case, the SDK will use malloc() and free() for
77 * memory allocation.
78 */
79 ra_depack* ra_depack_create(void* pAvail,
80 ra_block_avail_func_ptr fpAvail,
81 void* pUserError,
82 rm_error_func_ptr fpError);
83
84 /*
85 * ra_depack_create2
86 *
87 * Users should use this function if they need to
88 * customize the memory allocation routines.
89 */
90 ra_depack* ra_depack_create2(void* pAvail,
91 ra_block_avail_func_ptr fpAvail,
92 void* pUserError,
93 rm_error_func_ptr fpError,
94 void* pUserMem,
95 rm_malloc_func_ptr fpMalloc,
96 rm_free_func_ptr fpFree);
97
98 /*
99 * ra_depack_init
100 *
101 * The depacketizer will be initialized with a RealAudio stream header.
102 */
103 HX_RESULT ra_depack_init(ra_depack* pDepack, rm_stream_header* pHdr);
104
105 /*
106 * ra_depack_get_num_substreams
107 *
108 * This accessor function tells how many audio substreams there are
109 * in this audio stream. For single-rate files, this will be 1. For
110 * SureStream audio streams, this could be greater than 1.
111 */
112 UINT32 ra_depack_get_num_substreams(ra_depack* pDepack);
113
114 /*
115 * ra_depack_get_codec_4cc
116 *
117 * This accessor function returns the 4cc of the codec. This 4cc
118 * will be used to determine which codec to use for this substream.
119 */
120 UINT32 ra_depack_get_codec_4cc(ra_depack* pDepack, UINT32 ulSubStream);
121
122 /*
123 * ra_depack_get_codec_init_info
124 *
125 * This function fills in the structure which is used to initialize the codec.
126 */
127 HX_RESULT ra_depack_get_codec_init_info(ra_depack* pDepack,
128 UINT32 ulSubStream,
129 ra_format_info** ppInfo);
130
131 /*
132 * ra_depack_destroy_codec_init_info
133 *
134 * This function frees the memory associated with the ra_format_info object
135 * created by ra_depack_get_codec_init_info().
136 */
137 void ra_depack_destroy_codec_init_info(ra_depack* pDepack,
138 ra_format_info** ppInfo);
139
140 /*
141 * ra_depack_add_packet
142 *
143 * Put an audio packet into the depacketizer. When enough data is
144 * present to deinterleave, then the user will be called back
145 * on the rm_block_avail_func_ptr set in ra_depack_create().
146 */
147 HX_RESULT ra_depack_add_packet(ra_depack* pDepack, rm_packet* pPacket);
148
149 /*
150 * ra_depack_destroy_block
151 *
152 * This method cleans up a block received via the
153 * ra_block_avail_func_ptr callback.
154 */
155 void ra_depack_destroy_block(ra_depack* pDepack, ra_block** ppBlock);
156
157 /*
158 * ra_depack_seek
159 *
160 * The user calls this function if the stream is seeked. It
161 * should be called before passing any post-seek packets.
162 */
163 HX_RESULT ra_depack_seek(ra_depack* pDepack, UINT32 ulTime);
164
165 /*
166 * ra_depack_destroy
167 *
168 * This cleans up all memory allocated by the ra_depack_* calls
169 */
170 void ra_depack_destroy(ra_depack** ppDepack);
171
172
173#ifdef __cplusplus
174}
175#endif /* #ifdef __cplusplus */
176
177#endif /* #ifndef RA_DEPACK_H */
178