1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
/*****************************************************************
* gmerlin-avdecoder - a general purpose multimedia decoding library
*
* Copyright (c) 2001 - 2024 Members of the Gmerlin project
* http://github.com/bplaum
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *****************************************************************/
#ifndef BGAV_MPEG4_HEADER_H_INCLUDED
#define BGAV_MPEG4_HEADER_H_INCLUDED
#define MPEG4_CODE_VOS_START 1
#define MPEG4_CODE_VO_START 2
#define MPEG4_CODE_VOL_START 3
#define MPEG4_CODE_VOP_START 4
#define MPEG4_CODE_USER_DATA 5
#define MPEG4_CODE_GOV_START 6
int bgav_mpeg4_get_start_code(const uint8_t * data);
int bgav_mpeg4_remove_packed_flag(gavl_buffer_t * buf);
typedef struct
{
int random_accessible_vol; // 1
int video_object_type_indication; // 8
int is_object_layer_identifier; // 1
// if (is_object_layer_identifier) {
int video_object_layer_verid; // 4
int video_object_layer_priority; // 3
// }
int aspect_ratio_info; // 4
// if (aspect_ratio_info == "extended_PAR") {
int par_width; // 8
int par_height; // 8
// }
int vol_control_parameters; // 1
// if (vol_control_parameters) {
int chroma_format; // 2
int low_delay; // 1
int vbv_parameters; // 1
// if (vbv_parameters) {
int first_half_bit_rate; // 15
/* int marker_bit; */
int latter_half_bit_rate; // 15
/* int marker_bit; */
int first_half_vbv_buffer_size; // 15
/* int marker_bit; */
int latter_half_vbv_buffer_size; // 3
int first_half_vbv_occupancy; // 11
/* int marker_bit; */
int latter_half_vbv_occupancy; // 15
/* int marker_bit; */
// }
// }
int video_object_layer_shape; // 2
// if (video_object_layer_shape == "grayscale"
// && video_object_layer_verid != '0001')
int video_object_layer_shape_extension; // 4
/* int marker_bit; */ // 1
int vop_time_increment_resolution; // 16
/* int marker_bit; */ // 1
int fixed_vop_rate; // 1
// if (fixed_vop_rate)
int fixed_vop_time_increment; // 1-16
int video_object_layer_width; // 13
int video_object_layer_height; // 13
/* Calculated */
int time_increment_bits;
} bgav_mpeg4_vol_header_t;
int bgav_mpeg4_vol_header_read(bgav_mpeg4_vol_header_t * ret,
const uint8_t * buffer, int len);
void bgav_mpeg4_vol_header_dump(bgav_mpeg4_vol_header_t * h);
void bgav_mpeg4_get_pixel_aspect(bgav_mpeg4_vol_header_t * h,
uint32_t * width, uint32_t * height);
typedef struct
{
int coding_type;
int modulo_time_base;
int time_increment;
int vop_coded;
} bgav_mpeg4_vop_header_t;
int bgav_mpeg4_vop_header_read(bgav_mpeg4_vop_header_t * ret,
const uint8_t * buffer, int len,
const bgav_mpeg4_vol_header_t * vol);
void bgav_mpeg4_vop_header_dump(bgav_mpeg4_vop_header_t * h);
typedef struct
{
int profile_and_level_indication;
} bgav_mpeg4_vos_header_t;
int bgav_mpeg4_vos_header_read(bgav_mpeg4_vos_header_t * ret,
const uint8_t * buffer, int len);
void bgav_mpeg4_vos_header_dump(bgav_mpeg4_vos_header_t * h);
#endif // BGAV_MPEG4_HEADER_H_INCLUDED
|