29 #define MAX_LINESIZE 2048
49 if (sscanf(ptr,
"{%*d}{}%c", &c) != 1 &&
50 sscanf(ptr,
"{%*d}{%*d}%c", &c) != 1 &&
51 sscanf(ptr,
"{DEFAULT}{}%c", &c) != 1)
63 if (sscanf(buf,
"{%d}{%c", &frame, &c) == 2)
72 if (sscanf(buf,
"{%d}{%d}", &frame_start, &frame_end) == 2)
77 static const char *
bom =
"\xEF\xBB\xBF";
96 char *
line = line_buf;
98 if (!strncmp(line,
bom, 3))
104 line[strcspn(line,
"\r\n")] = 0;
110 if ((sscanf(line,
"{%d}{}%6lf", &frame, &fps) == 2 ||
111 sscanf(line,
"{%d}{%*d}%6lf", &frame, &fps) == 2)
112 && frame <= 1 && fps > 3 && fps < 100) {
113 pts_info =
av_d2q(fps, 100000);
117 if (!st->
codec->
extradata && sscanf(line,
"{DEFAULT}{}%c", &c) == 1) {
125 #define SKIP_FRAME_ID \
126 p = strchr(p, '}'); \
128 av_log(s, AV_LOG_WARNING, "Invalid event \"%s\"" \
129 " at line %d\n", line, i); \
165 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
169 min_ts, ts, max_ts, flags);
180 #define OFFSET(x) offsetof(MicroDVDContext, x)
181 #define SD AV_OPT_FLAG_SUBTITLE_PARAM|AV_OPT_FLAG_DECODING_PARAM
203 .priv_class = µdvd_class,
#define LIBAVUTIL_VERSION_INT
int64_t pos
byte position in stream, -1 if unknown
void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q)
Remove and destroy all the subtitles packets.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt)
Generic read_packet() callback for subtitles demuxers using this queue system.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#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.
static void frame_end(MpegEncContext *s)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
void ff_subtitles_queue_finalize(FFDemuxSubtitlesQueue *q)
Set missing durations and sort subtitles by PTS, and then byte position.
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
static int read_header(FFV1Context *f)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int ff_subtitles_queue_seek(FFDemuxSubtitlesQueue *q, AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Update current_sub_idx to emulate a seek.
enum AVMediaType codec_type
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
char * av_strdup(const char *s)
Duplicate the string s.
AVIOContext * pb
I/O context.
static int frame_start(MpegEncContext *s)
Describe the class of an AVClass context structure.
rational number numerator/denominator
This structure contains the data a format has to probe a file.
static av_always_inline int ff_subtitles_next_line(const char *ptr)
Get the number of characters to increment to jump to the next line, or to the end of the string...
void * priv_data
Format private data.
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
AVPacket * ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, const uint8_t *event, size_t len, int merge)
Insert a new subtitle event.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.