blob: f5a2878ba5204b12e54e286b8b944cd0a618022a
1 | /* ***** BEGIN LICENSE BLOCK ***** |
2 | * Source last modified: $Id: rv_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 RV_DEPACK_H |
39 | #define RV_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 "rv_format_info.h" |
48 | |
49 | #ifdef __cplusplus |
50 | extern "C" { |
51 | #endif /* #ifdef __cplusplus */ |
52 | |
53 | /* Callback functions */ |
54 | typedef HX_RESULT(*rv_frame_avail_func_ptr)(void* pAvail, UINT32 ulSubStreamNum, rv_frame* frame); |
55 | |
56 | /* |
57 | * rv_depack definition. Opaque to user. |
58 | */ |
59 | typedef void rv_depack; |
60 | |
61 | /* |
62 | * rv_depack_create |
63 | */ |
64 | rv_depack* rv_depack_create(void* pAvail, |
65 | rv_frame_avail_func_ptr fpAvail, |
66 | void* pUserError, |
67 | rm_error_func_ptr fpError); |
68 | |
69 | /* |
70 | * rv_depack_create2 |
71 | * |
72 | * This is the same as rv_depack_create(), but it allows |
73 | * the user to use custom memory allocation and free functions. |
74 | */ |
75 | rv_depack* rv_depack_create2(void* pAvail, |
76 | rv_frame_avail_func_ptr fpAvail, |
77 | void* pUserError, |
78 | rm_error_func_ptr fpError, |
79 | void* pUserMem, |
80 | rm_malloc_func_ptr fpMalloc, |
81 | rm_free_func_ptr fpFree); |
82 | |
83 | /* |
84 | * rv_depack_init |
85 | * |
86 | * This is initialized with a RealVideo rm_stream_header struct. |
87 | */ |
88 | HX_RESULT rv_depack_init(rv_depack* pDepack, rm_stream_header* header); |
89 | |
90 | /* |
91 | * rv_depack_get_num_substreams |
92 | * |
93 | * This accessor function tells how many video substreams there are |
94 | * in this video stream. For single-rate video streams, this will be 1. For |
95 | * SureStream video streams, this could be greater than 1. |
96 | */ |
97 | UINT32 rv_depack_get_num_substreams(rv_depack* pDepack); |
98 | |
99 | /* |
100 | * rv_depack_get_codec_4cc |
101 | * |
102 | * This accessor function returns the 4cc of the codec. This 4cc |
103 | * will be used to determine which codec to use. RealVideo always |
104 | * uses the same codec for all substreams. |
105 | */ |
106 | UINT32 rv_depack_get_codec_4cc(rv_depack* pDepack); |
107 | |
108 | /* |
109 | * rv_depack_get_codec_init_info |
110 | * |
111 | * This function fills in the structure which is used to initialize the codec. |
112 | */ |
113 | HX_RESULT rv_depack_get_codec_init_info(rv_depack* pDepack, rv_format_info** ppInfo); |
114 | |
115 | /* |
116 | * rv_depack_destroy_codec_init_info |
117 | * |
118 | * This function frees the memory associated with the rv_format_info object |
119 | * created by rv_depack_get_codec_init_info(). |
120 | */ |
121 | void rv_depack_destroy_codec_init_info(rv_depack* pDepack, rv_format_info** ppInfo); |
122 | |
123 | /* |
124 | * rv_depack_add_packet |
125 | * |
126 | * Put a video packet into the depacketizer. When enough data is |
127 | * present to depacketize, then the user will be called back |
128 | * on the rv_frame_avail_func_ptr set in rv_depack_create(). |
129 | */ |
130 | HX_RESULT rv_depack_add_packet(rv_depack* pDepack, rm_packet* packet); |
131 | |
132 | /* |
133 | * rv_depack_destroy_frame |
134 | * |
135 | * This cleans up a frame that was returned via |
136 | * the rv_frame_avail_func_ptr. |
137 | */ |
138 | void rv_depack_destroy_frame(rv_depack* pDepack, rv_frame** ppFrame); |
139 | |
140 | /* |
141 | * rv_depack_seek |
142 | * |
143 | * The user calls this function if the stream is seeked. It |
144 | * should be called before passing any post-seek packets. After calling |
145 | * rv_depack_seek(), no more pre-seek packets should be |
146 | * passed into rv_depack_add_packet(). |
147 | */ |
148 | HX_RESULT rv_depack_seek(rv_depack* pDepack, UINT32 ulTime); |
149 | |
150 | /* |
151 | * rv_depack_destroy |
152 | * |
153 | * This cleans up all memory allocated by the rv_depack_* calls |
154 | */ |
155 | void rv_depack_destroy(rv_depack** ppDepack); |
156 | |
157 | |
158 | #ifdef __cplusplus |
159 | } |
160 | #endif /* #ifdef __cplusplus */ |
161 | |
162 | #endif /* #ifndef RV_DEPACK_H */ |
163 |