OSDN Git Service

add tstools.
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / internal / media_dev.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005 \r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / Media Tools sub-project\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 \r
26 #ifndef _GF_MEDIA_DEV_H_\r
27 #define _GF_MEDIA_DEV_H_\r
28 \r
29 #include <gpac/media_tools.h>\r
30 \r
31 GF_Err gf_import_message(GF_MediaImporter *import, GF_Err e, char *format, ...);\r
32 \r
33 /*returns 0 if not a start code, or size of start code (3 or 4 bytes). If start code, bitstream\r
34 is positionned AFTER start code*/\r
35 u32 AVC_IsStartCode(GF_BitStream *bs);\r
36 /*returns size of chunk between current and next startcode (excluding startcode sizes), 0 if no more startcodes (eos)*/\r
37 u32 AVC_NextStartCode(GF_BitStream *bs);\r
38 /*returns NAL unit type - bitstream must be sync'ed!!*/\r
39 u8 AVC_NALUType(GF_BitStream *bs);\r
40 /*slice NALU*/\r
41 Bool AVC_NALUIsSlice(u8 type);\r
42 \r
43 \r
44 typedef struct\r
45 {\r
46     s32 profile_idc;\r
47     s32 level_idc;\r
48     s32 prof_compat;\r
49     s32 log2_max_frame_num;\r
50     u32 poc_type, poc_cycle_length;\r
51     s32 log2_max_poc_lsb;\r
52     s32 delta_pic_order_always_zero_flag;\r
53         s32 offset_for_non_ref_pic, offset_for_top_to_bottom_field;\r
54         Bool frame_mbs_only_flag;\r
55 \r
56     s16 offset_for_ref_frame[256];\r
57 \r
58     s32 timing_info_present_flag;\r
59     u32 num_units_in_tick;\r
60     u32 time_scale;\r
61     s32 fixed_frame_rate_flag;\r
62 \r
63         u32 width, height;\r
64         u32 par_num, par_den;\r
65         /*used to discard repeated SPSs - 0: not parsed, 1 parsed, 2 sent*/\r
66         u32 status;\r
67 } AVC_SPS;\r
68 \r
69 typedef struct \r
70 {\r
71     s32 sps_id;\r
72     s32 pic_order_present;      /* pic_order_present_flag*/\r
73     s32 redundant_pic_cnt_present; /* redundant_pic_cnt_present_flag */\r
74     int slice_group_count;      /* num_slice_groups_minus1 + 1*/\r
75         /*used to discard repeated SPSs - 0: not parsed, 1 parsed, 2 sent*/\r
76         u32 status;\r
77 } AVC_PPS;\r
78 \r
79 typedef struct\r
80 {\r
81         u8 nal_ref_idc, nal_unit_type, field_pic_flag, bottom_field_flag;\r
82         u32 frame_num, idr_pic_id, poc_lsb, slice_type;\r
83         s32 delta_poc_bottom;\r
84         s32 delta_poc[2];\r
85         s32 redundant_pic_cnt;\r
86 \r
87         s32 poc;\r
88         u32 poc_msb, poc_msb_prev, poc_lsb_prev, frame_num_prev;\r
89         s32 frame_num_offset, frame_num_offset_prev;\r
90 \r
91         AVC_SPS *sps;\r
92         AVC_PPS *pps;\r
93 } AVCSliceInfo;\r
94 \r
95 \r
96 typedef struct \r
97 {\r
98         u32 frame_cnt;\r
99         u8 exact_match_flag;\r
100         u8 broken_link_flag;\r
101         u8 changing_slice_group_idc;\r
102         u8 valid;\r
103 } AVCSeiRecoveryPoint;\r
104 \r
105 \r
106 typedef struct \r
107 {\r
108         AVCSeiRecoveryPoint recovery_point;\r
109         /*to be eventually completed by other sei*/\r
110 \r
111 } AVCSei;\r
112 \r
113 typedef struct\r
114 {\r
115         AVC_SPS sps[32];\r
116         AVC_PPS pps[255];\r
117 \r
118         AVCSliceInfo s_info;\r
119         AVCSei sei;\r
120 } AVCState;\r
121 \r
122 /*return sps ID or -1 if error*/\r
123 s32 AVC_ReadSeqInfo(GF_BitStream *bs, AVCState *avc, u32 *vui_flag_pos);\r
124 /*return pps ID or -1 if error*/\r
125 s32 AVC_ReadPictParamSet(GF_BitStream *bs, AVCState *avc);\r
126 /*is slice a RAP*/\r
127 Bool AVC_SliceIsIDR(AVCState *avc);\r
128 /*parses NALU, updates avc state and returns:\r
129         1 if NALU part of new frame\r
130         0 if NALU part of prev frame\r
131         -1 if bitstream error\r
132 */\r
133 s32 AVC_ParseNALU(GF_BitStream *bs, u32 nal_hdr, AVCState *avc);\r
134 /*remove SEI messages not allowed in MP4*/\r
135 u32 AVC_ReformatSEI_NALU(char *buffer, u32 nal_size, AVCState *avc);\r
136 \r
137 GF_Err AVC_ChangePAR(GF_AVCConfig *avcc, s32 ar_n, s32 ar_d);\r
138 \r
139 \r
140 typedef struct\r
141 {\r
142         u8 rate_idx;\r
143         u8 pck_size;\r
144 } QCPRateTable;\r
145 \r
146 \r
147 #endif          /*_GF_MEDIA_DEV_H_*/\r
148 \r