configure: Improve detection of ibtool
[vlc.git] / modules / codec / hxxx_helper.h
blob44bb57a12db80471ccf07dd1a6a53b8e507b9f78
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 h264_sequence_parameter_set_t *h264_sps;
36 h264_picture_parameter_set_t *h264_pps;
40 struct hxxx_helper
42 vlc_object_t *p_obj; /* for logs */
43 vlc_fourcc_t i_codec;
44 bool b_need_xvcC; /* Need avcC or hvcC */
46 bool b_is_xvcC;
47 uint8_t i_nal_length_size;
48 union {
49 struct {
50 struct hxxx_helper_nal sps_list[H264_SPS_ID_MAX + 1];
51 struct hxxx_helper_nal pps_list[H264_PPS_ID_MAX + 1];
52 uint8_t i_current_sps;
53 uint8_t i_sps_count;
54 uint8_t i_pps_count;
55 } h264;
56 struct {
57 /* TODO: handle VPS/SPS/PPS */
58 void *p_annexb_config_nal;
59 size_t i_annexb_config_nal;
60 } hevc;
63 /* Process the block: do the AnnexB <-> xvcC conversion if needed. If
64 * p_config_changed is not NULL, parse nals to detect a SPS/PPS or a video
65 * size change. */
66 block_t * (*pf_process_block)(struct hxxx_helper *hh, block_t *p_block,
67 bool *p_config_changed);
70 void hxxx_helper_init(struct hxxx_helper *hh, vlc_object_t *p_obj,
71 vlc_fourcc_t i_codec, bool b_need_xvcC);
72 void hxxx_helper_clean(struct hxxx_helper *hh);
74 int hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
75 size_t i_extra);
77 block_t *h264_helper_get_annexb_config(struct hxxx_helper *hh);
79 block_t *h264_helper_get_avcc_config(struct hxxx_helper *hh);
81 int h264_helper_get_current_picture_size(struct hxxx_helper *hh,
82 unsigned *p_w, unsigned *p_h,
83 unsigned *p_vw, unsigned *p_vh);
85 int h264_helper_get_current_sar(struct hxxx_helper *hh, int *p_num, int *p_den);
87 int h264_helper_get_current_dpb_values(struct hxxx_helper *hh,
88 uint8_t *p_depth, unsigned *pi_delay);