FFmpeg
Loading...
Searching...
No Matches
libavcodec
bsf
ahx_to_mp2.c
Go to the documentation of this file.
1
/*
2
* AHX to MP2 bitstream filter
3
* Copyright (c) 2024 Paul B Mahol
4
*
5
* This file is part of FFmpeg.
6
*
7
* FFmpeg is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* FFmpeg is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with FFmpeg; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
/**
23
* @file
24
* AHX to MP2 bitstream filter.
25
*/
26
27
#include "
libavutil/intreadwrite.h
"
28
#include "
libavcodec/bsf.h
"
29
#include "
libavcodec/bsf_internal.h
"
30
31
static
av_cold
int
init
(
AVBSFContext
*
ctx
)
32
{
33
ctx
->par_out->codec_id =
AV_CODEC_ID_MP2
;
34
35
return
0;
36
}
37
38
static
int
filter
(
AVBSFContext
*
ctx
,
AVPacket
*
pkt
)
39
{
40
int
ret;
41
42
ret =
ff_bsf_get_packet_ref
(
ctx
,
pkt
);
43
if
(ret < 0)
44
return
ret;
45
46
if
(
pkt
->size < 1044) {
47
int
original_size =
pkt
->size;
48
ret =
av_grow_packet
(
pkt
, 1044-
pkt
->size);
49
if
(ret < 0) {
50
av_packet_unref
(
pkt
);
51
return
ret;
52
}
53
memset(
pkt
->data + original_size, 0, 1044 - original_size);
54
}
55
56
return
0;
57
}
58
59
const
FFBitStreamFilter
ff_ahx_to_mp2_bsf
= {
60
.p.name =
"ahx_to_mp2"
,
61
.p.codec_ids = (
const
enum
AVCodecID
[]){
AV_CODEC_ID_AHX
,
AV_CODEC_ID_NONE
},
62
.init =
init
,
63
.filter =
filter
,
64
};
ctx
static AVFormatContext * ctx
Definition
api-movenc-test.c:49
ff_ahx_to_mp2_bsf
const FFBitStreamFilter ff_ahx_to_mp2_bsf
Definition
ahx_to_mp2.c:59
ff_bsf_get_packet_ref
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
Definition
bsf.c:254
bsf.h
bsf_internal.h
pkt
static AVPacket * pkt
Definition
demux_decode.c:55
init
int(* init)(AVBSFContext *ctx)
Definition
dts2pts.c:608
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition
codec_id.h:47
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition
codec_id.h:48
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition
codec_id.h:453
AV_CODEC_ID_AHX
@ AV_CODEC_ID_AHX
Definition
codec_id.h:561
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition
packet.c:434
av_grow_packet
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
Definition
packet.c:121
intreadwrite.h
av_cold
#define av_cold
Definition
attributes.h:117
AVBSFContext
The bitstream filter state.
Definition
bsf.h:68
AVPacket
This structure stores compressed data.
Definition
packet.h:580
FFBitStreamFilter
Definition
bsf_internal.h:29
filter
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition
h263dsp.c:29
Generated on Tue Aug 18 2026 20:20:50 for FFmpeg by
1.13.2