1 /*
2 * AST muxer
3 * Copyright (c) 2012 James Almer
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
28
37
38 #define CHECK_LOOP(type) \
39 if (ast->loop ## type > 0) { \
40 ast->loop ## type = av_rescale_rnd(ast->loop ## type, enc->sample_rate, 1000, AV_ROUND_DOWN); \
41 if (ast->loop ## type < 0 || ast->loop ## type > UINT_MAX) { \
42 av_log(s, AV_LOG_ERROR, "Invalid loop" #type " value\n"); \
43 return AVERROR(EINVAL); \
44 } \
45 }
46
48 {
52 unsigned int codec_tag;
53
56 } else {
59 }
60
64 }
65
67 if (!codec_tag) {
70 }
71
75 }
76
77 /* Convert milliseconds to samples */
80
82
84 avio_wb32(pb, 0);
/* File size minus header */
90
95 avio_wb32(pb, 0);
/* Size of first block */
96
97 /* Unknown */
103
105
106 return 0;
107 }
108
110 {
115
118
121
122 /* padding */
126
128
129 return 0;
130 }
131
133 {
139
141
143 /* Number of samples */
146
147 /* Loopstart if provided */
153 } else
155 } else
157
158 /* Loopend if provided. Otherwise number of samples again */
163 }
165 } else {
167 }
168
169 /* Size of first block */
171
172 /* File size minus header */
175
176 /* Loop flag */
180 }
181
184 }
185 return 0;
186 }
187
188 #define OFFSET(obj) offsetof(ASTMuxContext, obj)
193 };
194
200 };
201
205 .extensions = "ast",
212 .priv_class = &ast_muxer_class,
214 };