32 #include "libavutil/intreadwrite.h"
33 #include "libavutil/intfloat.h"
34 #include "libavutil/dict.h"
50 unsigned header_size, comment_size;
81 if (sample_rate <= 0 || sample_rate > INT_MAX) {
86 sample_rate_frac = sample_rate - floor(sample_rate);
89 "truncating fractional part of sample rate (%f)\n",
92 if ((header_size + 4) & 7 || header_size <
SOX_FIXED_HDR + comment_size
98 if (comment_size && comment_size < UINT_MAX) {
99 char *comment =
av_malloc(comment_size+1);
102 if (
avio_read(pb, comment, comment_size) != comment_size) {
106 comment[comment_size] = 0;
#define AV_LOG_WARNING
Something somehow does not look correct.
AVCodecContext * codec
Codec context associated with this stream.
static int sox_probe(AVProbeData *p)
static int sox_read_header(AVFormatContext *s)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#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 bit_rate
the average bitrate
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() and chilren.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
This structure contains the data a format has to probe a file.
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
AVInputFormat ff_sox_demuxer
#define AVERROR_INVALIDDATA
int channels
number of audio channels
#define SOX_FIXED_HDR
Size of fixed header without magic.