1 /*
2 * True Audio (TTA) muxer
3 * Copyright (c) 2016 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
24
29
37
39 {
42
46 }
48
52 }
56 }
57
58 /* Prevent overflow */
62 }
65
66 return 0;
67 }
68
70 {
73 int ret;
74
76 return ret;
77
78 /* Ignore most extradata information if present. It can be innacurate
79 if for example remuxing from Matroska */
87
88 return 0;
89 }
90
92 {
94 int ret;
95
98 if (ret < 0) {
99 return ret;
100 }
101
104
107 /* Two frames with a different duration than the default frame
108 size means the TTA stream comes from a faulty container, and
109 there's no way the last frame duration will be correct. */
111
113 }
114 /* First frame with a different duration than the default frame size.
115 Assume it's the last frame in the stream and continue. */
117 }
118
119 return 0;
120 }
121
123 {
126
131 }
132 }
133
135 {
138 unsigned int crc;
140
144
145 /* Write Seek table */
151
152 /* Write audio data */
154
157
158 return 0;
159 }
160
164 .mime_type = "audio/x-tta",
165 .extensions = "tta",
173 };
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
void avio_wl16(AVIOContext *s, unsigned int val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static av_cold int init(AVCodecContext *avctx)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
This struct describes the properties of an encoded stream.
void avio_wl32(AVIOContext *s, unsigned int val)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
unsigned long ff_crcEDB88320_update(unsigned long checksum, const uint8_t *buf, unsigned int len)
AVStream ** streams
A list of all streams in the file.
Public header for CRC hash function implementation.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int extradata_size
Size of the extradata content in bytes.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
void ffio_init_checksum(AVIOContext *s, unsigned long(*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum)
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
static int write_trailer(AVFormatContext *s1)
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int ff_ape_write_tag(AVFormatContext *s)
Write an APE tag into a file.
unsigned long ffio_get_checksum(AVIOContext *s)
int bits_per_raw_sample
This is the number of valid bits in each output sample.
int sample_rate
Audio only.
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
This structure stores compressed data.