1 /*
2 * Copyright (c) 2012 Michael Niedermayer
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 /**
22 * @file
23 * audio pad filter.
24 *
25 * Based on af_aresample.c
26 */
27
36
40
45
46 #define OFFSET(x) offsetof(APadContext, x)
47 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
48
50 {
"packet_size",
"set silence packet size",
OFFSET(packet_size),
AV_OPT_TYPE_INT, { .i64 = 4096 }, 0, INT_MAX,
A },
51 {
"pad_len",
"number of samples of silence to add",
OFFSET(pad_len),
AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX,
A },
52 {
"whole_len",
"target number of samples in the audio stream",
OFFSET(whole_len),
AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX,
A },
53 { NULL }
54 };
55
57
59 {
61
64 av_log(ctx,
AV_LOG_ERROR,
"Both whole and pad length are set, this is not possible\n");
66 }
67
68 return 0;
69 }
70
72 {
75
78
81 }
82
84 {
88
90
94
98 }
102 }
103
104 if(!n_out)
106
108 if (!outsamplesref)
110
113
115 n_out,
118
122
124 }
126 }
127
129 {
133 },
134 { NULL }
135 };
136
138 {
142 },
143 { NULL }
144 };
145
153 .priv_class = &apad_class,
155 };