1/* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
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
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18#ifndef _BITSTREAM_IO_H_
19#define _BITSTREAM_IO_H_
20
21#define BitstreamPut1Bits(x,y)  BitstreamPutBits(x,1,y)
22#define BitstreamPutGT8Bits(x,y,z) BitstreamPutBits(x,y,z)
23
24#include "mp4lib_int.h"
25#ifdef __cplusplus
26extern "C"
27{
28#endif
29
30    BitstreamEncVideo *BitStreamCreateEnc(Int bufferSize);
31    Void  BitstreamCloseEnc(BitstreamEncVideo *stream);
32    PV_STATUS BitstreamPutBits(BitstreamEncVideo *stream, Int Length, UInt Value);
33    PV_STATUS BitstreamPutGT16Bits(BitstreamEncVideo *stream, Int Length, ULong Value);
34    PV_STATUS BitstreamSaveWord(BitstreamEncVideo *stream);
35    PV_STATUS BitstreamSavePartial(BitstreamEncVideo *stream, Int *fraction);
36    Int BitstreamGetPos(BitstreamEncVideo *stream);
37    void BitstreamEncReset(BitstreamEncVideo *stream);
38
39    Int BitstreamShortHeaderByteAlignStuffing(BitstreamEncVideo *stream);
40    Int BitstreamMpeg4ByteAlignStuffing(BitstreamEncVideo *stream);
41    PV_STATUS BitstreamAppendEnc(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2);
42    PV_STATUS BitstreamAppendPacket(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2);
43    PV_STATUS BitstreamAppendPacketNoOffset(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2);
44    PV_STATUS BitstreamRepos(BitstreamEncVideo *bitstream, Int byteCount, Int bitCount);
45    PV_STATUS BitstreamFlushBits(BitstreamEncVideo *bitstream1, Int num_bit_left);
46    PV_STATUS BitstreamPrependPacket(BitstreamEncVideo *bitstream1, BitstreamEncVideo *bitstream2);
47
48
49    Void  BitstreamSetOverrunBuffer(BitstreamEncVideo *stream, UChar *overrunBuffer, Int oBSize, VideoEncData *video);
50    PV_STATUS BitstreamUseOverrunBuffer(BitstreamEncVideo* stream, Int numExtraBytes);
51
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif /* _BITSTREAM_IO_H_ */
58