packetizer: hevc: add poc debug
[vlc.git] / modules / codec / hxxx_helper.h
blobc2b20ca23002311f77e9657b0e4920b7ab7c22fd
1 /*****************************************************************************
2 * hxxx_helper.h: AnnexB / avcC helper for dumb decoders
3 *****************************************************************************
4 * Copyright (C) 2017 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
25 #include <vlc_block.h>
26 #include <vlc_fourcc.h>
28 #include "../packetizer/h264_nal.h"
29 #include "../packetizer/hevc_nal.h"
31 struct hxxx_helper_nal
33 block_t *b;
34 union {
35 void *xps;
36 h264_sequence_parameter_set_t *h264_sps;
37 h264_picture_parameter_set_t *h264_pps;
38 hevc_sequence_parameter_set_t *hevc_sps;
39 hevc_picture_parameter_set_t *hevc_pps;
40 hevc_video_parameter_set_t *hevc_vps;
44 struct hxxx_helper
46 vlc_object_t *p_obj; /* for logs */
47 vlc_fourcc_t i_codec;
48 bool b_need_xvcC; /* Need avcC or hvcC */
50 bool b_is_xvcC;
51 uint8_t i_nal_length_size;
52 union {
53 struct {
54 struct hxxx_helper_nal sps_list[H264_SPS_ID_MAX + 1];
55 struct hxxx_helper_nal pps_list[H264_PPS_ID_MAX + 1];
56 uint8_t i_current_sps;
57 uint8_t i_sps_count;
58 uint8_t i_pps_count;
59 } h264;
60 struct {
61 struct hxxx_helper_nal sps_list[HEVC_SPS_ID_MAX + 1];
62 struct hxxx_helper_nal pps_list[HEVC_PPS_ID_MAX + 1];
63 struct hxxx_helper_nal vps_list[HEVC_VPS_ID_MAX + 1];
64 uint8_t i_current_sps;
65 uint8_t i_current_vps;
66 uint8_t i_sps_count;
67 uint8_t i_pps_count;
68 uint8_t i_vps_count;
69 } hevc;
72 /* Process the block: do the AnnexB <-> xvcC conversion if needed. If
73 * p_config_changed is not NULL, parse nals to detect a SPS/PPS or a video
74 * size change. */
75 block_t * (*pf_process_block)(struct hxxx_helper *hh, block_t *p_block,
76 bool *p_config_changed);
79 void hxxx_helper_init(struct hxxx_helper *hh, vlc_object_t *p_obj,
80 vlc_fourcc_t i_codec, bool b_need_xvcC);
81 void hxxx_helper_clean(struct hxxx_helper *hh);
83 int hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
84 size_t i_extra);
86 block_t *h264_helper_get_annexb_config(const struct hxxx_helper *hh);
87 block_t *hevc_helper_get_annexb_config(const struct hxxx_helper *hh);
89 block_t *h264_helper_get_avcc_config(const struct hxxx_helper *hh);
90 block_t *hevc_helper_get_hvcc_config(const struct hxxx_helper *hh);
92 int hxxx_helper_get_current_picture_size(const struct hxxx_helper *hh,
93 unsigned *p_w, unsigned *p_h,
94 unsigned *p_vw, unsigned *p_vh);
96 int hxxx_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den);
98 int h264_helper_get_current_dpb_values(const struct hxxx_helper *hh,
99 uint8_t *p_depth, unsigned *pi_delay);
101 int hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
102 uint8_t *p_profile, uint8_t *p_level);
104 int hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
105 video_color_primaries_t *p_primaries,
106 video_transfer_func_t *p_transfer,
107 video_color_space_t *p_colorspace,
108 bool *p_full_range);