FFmpeg
Loading...
Searching...
No Matches
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
28#include "libavcodec/bsf.h"
30
32{
33 ctx->par_out->codec_id = AV_CODEC_ID_MP2;
34
35 return 0;
36}
37
39{
40 int ret;
41
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) {
51 return ret;
52 }
53 memset(pkt->data + original_size, 0, 1044 - original_size);
54 }
55
56 return 0;
57}
58
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};
static AVFormatContext * ctx
const FFBitStreamFilter ff_ahx_to_mp2_bsf
Definition ahx_to_mp2.c:59
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
Definition bsf.c:254
static AVPacket * pkt
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
@ AV_CODEC_ID_NONE
Definition codec_id.h:48
@ AV_CODEC_ID_MP2
Definition codec_id.h:453
@ AV_CODEC_ID_AHX
Definition codec_id.h:561
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition packet.c:434
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
Definition packet.c:121
#define av_cold
Definition attributes.h:117
The bitstream filter state.
Definition bsf.h:68
This structure stores compressed data.
Definition packet.h:580
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29