summaryrefslogtreecommitdiff
path: root/audio_codec/libcook/rv_depack_internal.h (plain)
blob: b0ebdeaeca10c1339bd4d14ff8b6c435e066b5c3
1/* ***** BEGIN LICENSE BLOCK *****
2 * Source last modified: $Id: rv_depack_internal.h,v 1.1.1.1.2.1 2005/05/04 18:21:20 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 RV_DEPACK_INTERNAL_H
39#define RV_DEPACK_INTERNAL_H
40
41#include "helix_types.h"
42#include "helix_result.h"
43#include "rm_memory.h"
44#include "rm_error.h"
45#include "rv_depack.h"
46#include "stream_hdr_structs.h"
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52 /* Frame type enum */
53 typedef enum
54 {
55 RVFrameTypePartial,
56 RVFrameTypeWhole,
57 RVFrameTypeLastPartial,
58 RVFrameTypeMultiple
59 }
60 RVFrameType;
61
62 /* Struct which holds frame header info */
63 typedef struct rv_frame_hdr_struct {
64 RVFrameType eType;
65 UINT32 ulPacketNum;
66 UINT32 ulNumPackets;
67 UINT32 ulFrameSize;
68 UINT32 ulPartialFrameSize;
69 UINT32 ulPartialFrameOffset;
70 UINT32 ulTimestamp;
71 UINT32 ulSeqNum;
72 UINT32 ulHeaderSize;
73 UINT32 ulHeaderOffset;
74 HXBOOL bBrokenUpByUs;
75 } rv_frame_hdr;
76
77 /*
78 * Internal rv_depack struct
79 */
80 typedef struct rv_depack_internal_struct {
81 void* pAvail;
82 rv_frame_avail_func_ptr fpAvail;
83 rm_error_func_ptr fpError;
84 void* pUserError;
85 rm_malloc_func_ptr fpMalloc;
86 rm_free_func_ptr fpFree;
87 void* pUserMem;
88 UINT32 ulZeroTimeOffset;
89 HX_BITFIELD bHasRelativeTimeStamps;
90 rm_rule_map rule2Flag;
91 rm_multistream_hdr multiStreamHdr;
92 rv_format_info* pSubStreamHdr;
93 HXBOOL* bIgnoreSubStream;
94 HXBOOL bStreamSwitchable;
95 UINT32 ulActiveSubStream;
96 rv_frame* pCurFrame;
97 HXBOOL bBrokenUpByUs;
98 HXBOOL bCreatedFirstFrame;
99 UINT32 ulLastSeqNumIn;
100 UINT32 ulLastSeqNumOut;
101 } rv_depack_internal;
102
103 /*
104 * Internal rv_depack functions
105 */
106 void* rv_depacki_malloc(rv_depack_internal* pInt, UINT32 ulSize);
107 void rv_depacki_free(rv_depack_internal* pInt, void* pMem);
108 HX_RESULT rv_depacki_init(rv_depack_internal* pInt, rm_stream_header* hdr);
109 HX_RESULT rv_depacki_unpack_rule_map(rv_depack_internal* pInt,
110 rm_rule_map* pMap,
111 BYTE** ppBuf,
112 UINT32* pulLen);
113 HX_RESULT rv_depacki_unpack_multistream_hdr(rv_depack_internal* pInt,
114 BYTE** ppBuf,
115 UINT32* pulLen);
116 HX_RESULT rv_depacki_unpack_opaque_data(rv_depack_internal* pInt,
117 BYTE* pBuf,
118 UINT32 ulLen);
119 void rv_depacki_cleanup_format_info(rv_depack_internal* pInt,
120 rv_format_info* pInfo);
121 void rv_depacki_cleanup_format_info_array(rv_depack_internal* pInt);
122 HX_RESULT rv_depacki_unpack_format_info(rv_depack_internal* pInt,
123 rv_format_info* pInfo,
124 BYTE** ppBuf,
125 UINT32* pulLen);
126 HX_RESULT rv_depacki_check_rule_book(rv_depack_internal* pInt,
127 rm_stream_header* hdr);
128 HX_RESULT rv_depacki_copy_format_info(rv_depack_internal* pInt,
129 rv_format_info* pSrc,
130 rv_format_info* pDst);
131 HX_RESULT rv_depacki_add_packet(rv_depack_internal* pInt,
132 rm_packet* pPacket);
133 UINT32 rv_depacki_rule_to_flags(rv_depack_internal* pInt, UINT32 ulRule);
134 UINT32 rv_depacki_rule_to_substream(rv_depack_internal* pInt, UINT32 ulRule);
135 HX_RESULT rv_depacki_parse_frame_header(rv_depack_internal* pInt,
136 BYTE** ppBuf,
137 UINT32* pulLen,
138 rm_packet* pPacket,
139 rv_frame_hdr* pFrameHdr);
140 HX_RESULT rv_depacki_read_14_or_30(BYTE** ppBuf,
141 UINT32* pulLen,
142 HXBOOL* pbHiBit,
143 UINT32* pulValue);
144 HX_RESULT rv_depacki_handle_partial(rv_depack_internal* pInt,
145 BYTE** ppBuf,
146 UINT32* pulLen,
147 rm_packet* pPacket,
148 rv_frame_hdr* pFrameHdr);
149 HX_RESULT rv_depacki_handle_one_frame(rv_depack_internal* pInt,
150 BYTE** ppBuf,
151 UINT32* pulLen,
152 rm_packet* pPacket,
153 rv_frame_hdr* pFrameHdr);
154 HX_RESULT rv_depacki_send_current_frame(rv_depack_internal* pInt);
155 void rv_depacki_cleanup_frame(rv_depack_internal* pInt,
156 rv_frame** ppFrame);
157 HX_RESULT rv_depacki_create_frame(rv_depack_internal* pInt,
158 rm_packet* pPacket,
159 rv_frame_hdr* pFrameHdr,
160 rv_frame** ppFrame);
161 void rv_depacki_check_to_clear_keyframe_flag(BYTE* pBuf,
162 UINT32 ulLen,
163 rm_packet* pkt,
164 rv_frame_hdr* hdr);
165 HX_RESULT rv_depacki_seek(rv_depack_internal* pInt, UINT32 ulTime);
166
167#ifdef __cplusplus
168}
169#endif
170
171#endif /* #ifndef RV_DEPACK_INTERNAL_H */
172