FFmpeg: libavcodec/cbs_bsf.c Source File
Go to the documentation of this file. 1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
22
24 {
27 uint8_t *side_data;
28 int err;
29
31 return 0;
32
34 if (err < 0) {
36 "Failed to read extradata from packet side data.\n");
37 return err;
38 }
39
40 err =
ctx->type->update_fragment(bsf,
NULL, frag);
41 if (err < 0)
42 return err;
43
45 if (err < 0) {
47 "Failed to write extradata into packet side data.\n");
48 return err;
49 }
50
53 if (!side_data)
56
58 return 0;
59 }
60
62 {
65 int err;
66
68 if (err < 0)
69 return err;
70
72 if (err < 0)
74
76 if (err < 0) {
78 ctx->type->fragment_name);
80 }
81
84 ctx->type->unit_name);
87 }
88
89 err =
ctx->type->update_fragment(bsf,
pkt, frag);
90 if (err < 0)
92
94 if (err < 0) {
96 ctx->type->fragment_name);
98 }
99
100 err = 0;
103
104 if (err < 0)
106
107 return err;
108 }
109
111 {
114 int err;
115
117
119 if (err < 0)
120 return err;
121
123 if (err < 0)
124 return err;
125
126 ctx->output->trace_enable = 1;
128 ctx->output->trace_context =
ctx->output;
130
133 if (err < 0) {
136 }
137
138 err =
type->update_fragment(bsf,
NULL, frag);
139 if (err < 0)
141
143 if (err < 0) {
146 }
147 }
148
149 err = 0;
152 return err;
153 }
154
156 {
158
162 }
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVCodecParameters * par_in
Parameters of the input stream.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
int ff_cbs_bsf_generic_init(AVBSFContext *bsf, const CBSBSFType *type)
Initialise generic CBS BSF setup.
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt)
av_cold void ff_cbs_fragment_free(CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
int ff_cbs_read_extradata(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecParameters *par)
Read the extradata bitstream found in codec parameters into a fragment, then split into units and dec...
int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt)
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
The bitstream filter state.
av_cold void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int ff_cbs_write_extradata(CodedBitstreamContext *ctx, AVCodecParameters *par, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to the extradata in codec parameters.
AVCodecParameters * par_out
Parameters of the output stream.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Coded bitstream fragment structure, combining one or more units.
int ff_cbs_write_packet(CodedBitstreamContext *ctx, AVPacket *pkt, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to a packet.
size_t data_size
The number of bytes in the bitstream.
void ff_cbs_trace_write_log(void *trace_context, PutBitContext *pbc, int length, const char *str, const int *subscripts, int64_t value)
Helper function for write tracing which formats the syntax element and logs the result.
uint8_t * data
Pointer to the bitstream form of this fragment.
void ff_cbs_bsf_generic_close(AVBSFContext *bsf)
Close a generic CBS BSF instance.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag)
Write the content of the fragment to its own internal buffer.
void * priv_data
Opaque filter-specific private data.
int ff_cbs_bsf_generic_filter(AVBSFContext *bsf, AVPacket *pkt)
Filter operation for CBS BSF.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
int ff_cbs_read_packet(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt)
Read the data bitstream from a packet into a fragment, then split into units and decompose.
av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, enum AVCodecID codec_id, void *log_ctx)
Create and initialise a new context for the given codec.
This structure stores compressed data.
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int nb_units
Number of units in this fragment.
Generated on Thu Sep 26 2024 23:14:51 for FFmpeg by
doxygen
1.8.17