xref: /third_party/ffmpeg/libavcodec/atsc_a53.h (revision cabdff1a)
1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * This file is part of FFmpeg.
3cabdff1aSopenharmony_ci *
4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
8cabdff1aSopenharmony_ci *
9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12cabdff1aSopenharmony_ci * Lesser General Public License for more details.
13cabdff1aSopenharmony_ci *
14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17cabdff1aSopenharmony_ci */
18cabdff1aSopenharmony_ci
19cabdff1aSopenharmony_ci#ifndef AVCODEC_ATSC_A53_H
20cabdff1aSopenharmony_ci#define AVCODEC_ATSC_A53_H
21cabdff1aSopenharmony_ci
22cabdff1aSopenharmony_ci#include <stddef.h>
23cabdff1aSopenharmony_ci#include <stdint.h>
24cabdff1aSopenharmony_ci
25cabdff1aSopenharmony_ci#include "libavutil/buffer.h"
26cabdff1aSopenharmony_ci#include "libavutil/frame.h"
27cabdff1aSopenharmony_ci
28cabdff1aSopenharmony_ci/**
29cabdff1aSopenharmony_ci * Check AVFrame for A53 side data and allocate and fill SEI message with A53 info
30cabdff1aSopenharmony_ci *
31cabdff1aSopenharmony_ci * @param frame      Raw frame to get A53 side data from
32cabdff1aSopenharmony_ci * @param prefix_len Number of bytes to allocate before SEI message
33cabdff1aSopenharmony_ci * @param data       Pointer to a variable to store allocated memory
34cabdff1aSopenharmony_ci *                   Upon return the variable will hold NULL on error or if frame has no A53 info.
35cabdff1aSopenharmony_ci *                   Otherwise it will point to prefix_len uninitialized bytes followed by
36cabdff1aSopenharmony_ci *                   *sei_size SEI message
37cabdff1aSopenharmony_ci * @param sei_size   Pointer to a variable to store generated SEI message length
38cabdff1aSopenharmony_ci * @return           Zero on success, negative error code on failure
39cabdff1aSopenharmony_ci */
40cabdff1aSopenharmony_ciint ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
41cabdff1aSopenharmony_ci                     void **data, size_t *sei_size);
42cabdff1aSopenharmony_ci
43cabdff1aSopenharmony_ci/**
44cabdff1aSopenharmony_ci * Parse a data array for ATSC A53 Part 4 Closed Captions and store them in an AVBufferRef.
45cabdff1aSopenharmony_ci *
46cabdff1aSopenharmony_ci * @param pbuf Pointer to an AVBufferRef to append the closed captions. *pbuf may be NULL, in
47cabdff1aSopenharmony_ci *             which case a new buffer will be allocated and put in it.
48cabdff1aSopenharmony_ci * @param data The data array containing the raw A53 data.
49cabdff1aSopenharmony_ci * @param size Size of the data array in bytes.
50cabdff1aSopenharmony_ci *
51cabdff1aSopenharmony_ci * @return Number of closed captions parsed on success, negative error code on failure.
52cabdff1aSopenharmony_ci *         If no Closed Captions are parsed, *pbuf is untouched.
53cabdff1aSopenharmony_ci */
54cabdff1aSopenharmony_ciint ff_parse_a53_cc(AVBufferRef **pbuf, const uint8_t *data, int size);
55cabdff1aSopenharmony_ci
56cabdff1aSopenharmony_ci#endif /* AVCODEC_ATSC_A53_H */
57