26 #include "libavutil/bprint.h"
34 const char *header=
"[Script Info]";
36 if( !memcmp(p->
buf , header, strlen(header))
37 || !memcmp(p->
buf+3, header, strlen(header)))
53 int hh1, mm1, ss1, ms1;
54 int hh2, mm2, ss2, ms2;
56 if (sscanf(p,
"%*[^,],%d:%d:%d%*c%d,%d:%d:%d%*c%d",
57 &hh1, &mm1, &ss1, &ms1,
58 &hh2, &mm2, &ss2, &ms2) == 8) {
59 end = (hh2*3600LL + mm2*60LL + ss2) * 100LL + ms2;
60 *start = (hh1*3600LL + mm1*60LL + ss1) * 100LL + ms1;
61 *duration = end - *
start;
87 int header_remaining,
res = 0;
97 header_remaining= INT_MAX;
108 if (!memcmp(line.str,
"[Events]", 8))
110 else if (line.str[0]==
'[')
111 header_remaining= INT_MAX;
113 if (header_remaining) {
121 if (
read_ts(line.str, &ts_start, &duration) < 0)
153 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
157 min_ts, ts, max_ts, flags);
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
int64_t pos
byte position in stream, -1 if unknown
AVCodecContext * codec
Codec context associated with this stream.
void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q)
Remove and destroy all the subtitles packets.
AVPacket * ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, const uint8_t *event, int len, int merge)
Insert a new subtitle event.
int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt)
Generic read_packet() callback for subtitles demuxers using this queue system.
static av_cold int end(AVCodecContext *avctx)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
static av_cold int read_close(AVFormatContext *ctx)
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.
int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
Finalize buf into extradata and set its size appropriately.
void * priv_data
Format private data.
#define AV_BPRINT_SIZE_UNLIMITED
Convenience macros for special values for av_bprint_init() size_max parameter.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Init a print buffer.
Buffer to print data progressively.
void ff_subtitles_queue_finalize(FFDemuxSubtitlesQueue *q)
Set missing durations and sort subtitles by PTS, and then byte position.
static int read_header(FFV1Context *f)
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
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
This structure contains the data a format has to probe a file.
common internal api header.
void av_bprintf(AVBPrint *buf, const char *fmt,...) av_printf_format(2
Append a formatted string to a print buffer.
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.