31 if (i > 1 && line[i - 2] ==
'\r')
47 while (*p !=
'\0' && *p !=
':')
83 char line[128] = { 0 };
94 ret =
get_line(pb, line,
sizeof(line));
113 char boundary[70 + 2 + 1];
118 ret =
get_line(s->
pb, boundary,
sizeof(boundary));
122 if (strncmp(boundary,
"--", 2))
141 long int val = strtol(value,
NULL, 10);
143 if (val == LONG_MIN || val == LONG_MAX)
153 int found_content_type = 0;
160 if (strncmp(line,
"--", 2))
180 "Unexpected %s : %s\n",
184 found_content_type = 1;
192 if (!found_content_type || size < 0) {
220 .mime_type =
"multipart/x-mixed-replace",
221 .extensions =
"mjpg",
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int get_line(AVIOContext *pb, char *line, int line_size)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int split_tag_value(char **tag, char **value, char *line)
int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
static int parse_multipart_header(AVFormatContext *s)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static int mpjpeg_read_header(AVFormatContext *s)
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
#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. ...
AVCodecContext * codec
Codec context associated with this stream.
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
GLsizei GLboolean const GLfloat * value
AVInputFormat ff_mpjpeg_demuxer
static int mpjpeg_read_probe(AVProbeData *p)
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
static int check_content_type(char *line)
int error
contains the error code or 0 if no error happened
This structure contains the data a format has to probe a file.
static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
int eof_reached
true if eof reached
static int parse_content_length(const char *value)
This structure stores compressed data.