32#define DEFAULT_PACKET_SIZE 1024
33#define OVERREAD_SIZE 3
63 audio_st->codecpar->sample_rate = 8000;
64 audio_st->codecpar->bits_per_coded_sample = 8;
78 for (; p < end - 3; p += 4) {
81 if (x & (~(x+0x01010101)) & 0x80808080) {
84 }
else if (p[1] == 0xff) {
86 }
else if (p[2] == 0xff) {
88 }
else if (p[3] == 0xff) {
94 for (; p < end; ++p) {
95 if (*p == 0xff)
return p;
105 unsigned int soi_pos;
110 if (current_pos > current_pos + cache_size)
114 current_pos + cache_size +
139 uint8_t *startmarker_ptr, *end, *search_end, marker;
158 if (startmarker_ptr >= search_end - 1 ||
159 *(startmarker_ptr + 1) !=
EOI)
break;
162 if (startmarker_ptr != search_end) {
163 marker = *(startmarker_ptr + 1);
168 mxg->
soi_ptr = startmarker_ptr;
169 }
else if (marker ==
EOI) {
182 pkt->stream_index = 0;
194 }
else if ( (
SOF0 <= marker && marker <=
SOF15) ||
195 (
SOS <= marker && marker <=
COM) ) {
218 memcpy(
pkt->data, startmarker_ptr + 16,
size - 14);
222 pkt->stream_index = 1;
232 }
else if (marker ==
COM &&
size >= 18 &&
233 !strncmp(startmarker_ptr + 4,
"MXF", 3)) {
258 .p.extensions =
"mxg",
static AVStream * audio_st
static AVStream * video_st
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Public libavutil channel layout APIs header.
#define EOI
End Of Image marker.
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AV_CHANNEL_LAYOUT_MONO
#define AVERROR_EOF
End of file.
#define AV_LOG_WARNING
Something somehow does not look correct.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
#define AV_NOPTS_VALUE
Undefined timestamp value.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
Memory handling functions.
MJPEG encoder and decoder.
#define DEFAULT_PACKET_SIZE
static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size)
static int mxg_read_header(AVFormatContext *s)
static int mxg_close(struct AVFormatContext *s)
static uint8_t * mxg_find_startmarker(uint8_t *p, uint8_t *end)
An AVChannelLayout holds information about the channel layout of audio data.
This structure stores compressed data.