2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / Media Tools sub-project
\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
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
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
26 #ifndef _GF_MEDIA_DEV_H_
\r
27 #define _GF_MEDIA_DEV_H_
\r
29 #include <gpac/media_tools.h>
\r
31 GF_Err gf_import_message(GF_MediaImporter *import, GF_Err e, char *format, ...);
\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
41 Bool AVC_NALUIsSlice(u8 type);
\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
56 s16 offset_for_ref_frame[256];
\r
58 s32 timing_info_present_flag;
\r
59 u32 num_units_in_tick;
\r
61 s32 fixed_frame_rate_flag;
\r
64 u32 par_num, par_den;
\r
65 /*used to discard repeated SPSs - 0: not parsed, 1 parsed, 2 sent*/
\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
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
85 s32 redundant_pic_cnt;
\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
99 u8 exact_match_flag;
\r
100 u8 broken_link_flag;
\r
101 u8 changing_slice_group_idc;
\r
103 } AVCSeiRecoveryPoint;
\r
108 AVCSeiRecoveryPoint recovery_point;
\r
109 /*to be eventually completed by other sei*/
\r
118 AVCSliceInfo s_info;
\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
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
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
137 GF_Err AVC_ChangePAR(GF_AVCConfig *avcc, s32 ar_n, s32 ar_d);
\r
147 #endif /*_GF_MEDIA_DEV_H_*/
\r