71 #include "libavutil/channel_layout.h"
72 #include "libavutil/imgutils.h"
73 #include "libavutil/intreadwrite.h"
77 #define HUFFMAN_TABLE_SIZE (64 * 1024)
116 if ((number == 0) || (number > 1024))
121 if ((number == 0) || (number > 1024))
126 if (sample_rate && (sample_rate < 8000 || sample_rate > 48000))
131 if (number > 2 || sample_rate && !number)
136 if (number > 2 || sample_rate && !number)
149 unsigned int sample_rate, bytes_per_sample, channels;
166 if (sample_rate > 0) {
167 if (sample_rate < 14 || sample_rate > INT_MAX) {
171 if (bytes_per_sample < 1 || bytes_per_sample > 2) {
176 if (channels < 1 || channels > 2) {
224 st->
codec->
bit_rate = sample_rate * bytes_per_sample * 8 * channels;
226 if (bytes_per_sample == 1)
231 if (sample_rate % 14 != 0) {
233 bytes_per_sample * channels;
235 bytes_per_sample * channels;
238 (sample_rate / 14) * bytes_per_sample * channels;
254 unsigned int chunk_size;
259 unsigned char r,
g,
b;
260 unsigned char palette_buffer[768];
270 }
else if (command == 1) {
272 ret =
avio_read(pb, palette_buffer, 768);
275 }
else if (ret != 768) {
281 for (i = 0; i < 768; i++)
282 if (palette_buffer[i] > 63) {
287 for (i = 0; i < 256; i++) {
288 r = palette_buffer[i * 3 ] << palette_scale;
289 g = palette_buffer[i * 3 + 1] << palette_scale;
290 b = palette_buffer[i * 3 + 2] << palette_scale;
291 palette[i] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
292 if (palette_scale == 2)
293 palette[i] |= palette[i] >> 6 & 0x30303;
302 if (chunk_size < 4 || chunk_size > INT_MAX - 4) {
314 else if (ret != chunk_size) {
355 int64_t timestamp,
int flags)
void av_free_packet(AVPacket *pkt)
Free a packet.
static int idcin_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
#define HUFFMAN_TABLE_SIZE
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
AVCodecContext * codec
Codec context associated with this stream.
int index
stream index in AVFormatContext
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...
#define AV_CH_LAYOUT_STEREO
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
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.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * priv_data
Format private data.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int idcin_read_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
int flags
A combination of AV_PKT_FLAG values.
uint64_t channel_layout
Audio channel layout.
int buf_size
Size of buf except extra allocated bytes.
static int idcin_probe(AVProbeData *p)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int bit_rate
the average bitrate
int width
picture width / height.
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
BYTE int const BYTE int int int height
int error
contains the error code or 0 if no error happened
This structure contains the data a format has to probe a file.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
#define AVERROR_INVALIDDATA
int eof_reached
true if eof reached
int channels
number of audio channels
static int idcin_read_header(AVFormatContext *s)
AVInputFormat ff_idcin_demuxer
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.