avcodec/x86/h264_idct: Fix ff_h264_luma_dc_dequant_idct_sse2 checkasm failures
[ffmpeg.git] / libavformat / nal.h
1 /*
2 * NAL helper functions for muxers
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef AVFORMAT_NAL_H
22 #define AVFORMAT_NAL_H
23
24 #include <stdint.h>
25 #include "avio.h"
26
27 typedef struct NALU {
28 int offset;
29 uint32_t size;
30 } NALU;
31
32 typedef struct NALUList {
33 NALU *nalus;
34 unsigned nalus_array_size;
35 unsigned nb_nalus; ///< valid entries in nalus
36 } NALUList;
37
38 /* This function will parse the given annex B buffer and create
39 * a NALUList from it. This list can be passed to ff_nal_units_write_list()
40 * to write the access unit reformatted to mp4.
41 *
42 * @param list A NALUList. The list->nalus and list->nalus_array_size
43 * must be valid when calling this function and may be updated.
44 * nb_nalus is set by this function on success.
45 * @param buf buffer containing annex B H.264 or H.265. Must be padded.
46 * @param size size of buf, excluding padding.
47 * @return < 0 on error, the size of the mp4-style packet on success.
48 */
49 int ff_nal_units_create_list(NALUList *list, const uint8_t *buf, int size);
50
51 /* Writes a NALUList to the specified AVIOContext. The list must originate
52 * from ff_nal_units_create_list() with the same buf. */
53 void ff_nal_units_write_list(const NALUList *list, AVIOContext *pb,
54 const uint8_t *buf);
55
56 const uint8_t *ff_nal_find_startcode(const uint8_t *p, const uint8_t *end);
57 const uint8_t *ff_nal_mp4_find_startcode(const uint8_t *start,
58 const uint8_t *end,
59 int nal_length_size);
60
61 int ff_nal_parse_units(AVIOContext *s, const uint8_t *buf, int size);
62 int ff_nal_parse_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size);
63
64 uint8_t *ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len,
65 uint32_t *dst_len, int header_len);
66
67 #endif /* AVFORMAT_NAL_H */