29 #define DEFAULT_PACKET_SIZE 1024
30 #define OVERREAD_SIZE 3
76 for (; p < end - 3; p += 4) {
77 uint32_t x = *(uint32_t*)p;
79 if (x & (~(x+0x01010101)) & 0x80808080) {
82 }
else if (p[1] == 0xff) {
84 }
else if (p[2] == 0xff) {
86 }
else if (p[3] == 0xff) {
92 for (; p < end; ++p) {
93 if (*p == 0xff)
return p;
103 unsigned int soi_pos;
107 if (current_pos > current_pos + cache_size)
111 current_pos + cache_size +
133 uint8_t *startmarker_ptr, *end, *search_end, marker;
152 if (startmarker_ptr >= search_end - 1 ||
153 *(startmarker_ptr + 1) !=
EOI)
break;
156 if (startmarker_ptr != search_end) {
157 marker = *(startmarker_ptr + 1);
162 mxg->
soi_ptr = startmarker_ptr;
163 }
else if (marker ==
EOI) {
185 }
else if ( (
SOF0 <= marker && marker <=
SOF15) ||
186 (
SOS <= marker && marker <=
COM) ) {
205 if (marker ==
APP13 && size >= 16) {
210 pkt->
size = size - 14;
211 pkt->
data = startmarker_ptr + 16;
221 }
else if (marker ==
COM && size >= 18 &&
222 !strncmp(startmarker_ptr + 4,
"MXF", 3)) {
static uint8_t * mxg_find_startmarker(uint8_t *p, uint8_t *end)
MJPEG encoder and decoder.
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 *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static av_cold int read_close(AVFormatContext *ctx)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
void(* destruct)(struct AVPacket *)
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
uint64_t channel_layout
Audio channel layout.
AVCodecContext * codec
Codec context associated with this stream.
static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
struct MXGContext MXGContext
audio channel layout utility functions
#define DEFAULT_PACKET_SIZE
AVInputFormat ff_mxg_demuxer
static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size)
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
#define FF_INPUT_BUFFER_PADDING_SIZE
int error
contains the error code or 0 if no error happened
static int mxg_close(struct AVFormatContext *s)
int eof_reached
true if eof reached
int channels
number of audio channels
void * priv_data
Format private data.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static int mxg_read_header(AVFormatContext *s)