Main Page | Data Structures | File List | Data Fields | Globals

bs.h

Go to the documentation of this file.
00001 /* 
00002  * h264bitstream - a library for reading and writing H.264 video
00003  * Copyright (C) 2005-2006 Auroras Entertainment, LLC
00004  * 
00005  * Written by Alex Izvorski <aizvorski@gmail.com>
00006  * 
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  * 
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 #include <stdint.h>
00023 
00024 #ifndef _BS_H
00025 #define _BS_H        1
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 typedef struct
00032 {
00033         uint8_t* start;
00034         uint8_t* p;
00035         uint8_t* end;
00036         int bits_left;
00037 } bs_t;
00038 
00039 void     bs_init(bs_t* b, uint8_t* buf, int size);
00040 uint32_t bs_byte_aligned(bs_t* b);
00041 uint32_t bs_eof(bs_t* b);
00042 int bs_pos(bs_t* b);
00043 
00044 uint32_t bs_read_u1(bs_t* b);
00045 uint32_t bs_read_u(bs_t* b, int n);
00046 uint32_t bs_read_f(bs_t* b, int n);
00047 uint32_t bs_read_u8(bs_t* b);
00048 uint32_t bs_read_ue(bs_t* b);
00049 int32_t  bs_read_se(bs_t* b);
00050 
00051 void bs_write_u1(bs_t* b, uint32_t v);
00052 void bs_write_u(bs_t* b, int n, uint32_t v);
00053 void bs_write_f(bs_t* b, int n, uint32_t v);
00054 void bs_write_u8(bs_t* b, uint32_t v);
00055 void bs_write_ue(bs_t* b, uint32_t v);
00056 void bs_write_se(bs_t* b, int32_t v);
00057 
00058 #ifdef __cplusplus
00059 }
00060 #endif
00061 
00062 #endif

Generated on Sat Jul 22 22:05:00 2006 by  doxygen 1.4.4