30 #include "libavutil/avstring.h"
31 #include "libavutil/bprint.h"
32 #include "libavutil/intreadwrite.h"
40 const unsigned char *ptr = p->
buf;
51 if (sscanf(s,
"%u:%u:%u.%u", &hh, &mm, &ss, &ms) == 4)
return (hh*3600 + mm*60 + ss) * 100 + ms;
52 if (sscanf(s,
"%u:%u:%u" , &hh, &mm, &ss ) == 3)
return (hh*3600 + mm*60 + ss) * 100;
53 if (sscanf(s,
"%u:%u.%u", &mm, &ss, &ms) == 3)
return ( mm*60 + ss) * 100 + ms;
54 if (sscanf(s,
"%u:%u" , &mm, &ss ) == 2)
return ( mm*60 + ss) * 100;
55 if (sscanf(s,
"%u.%u", &ss, &ms) == 2)
return ( ss) * 100 + ms;
56 return strtol(s, NULL, 10) * 100;
129 int64_t min_ts, int64_t ts, int64_t max_ts,
int flags)
133 min_ts, ts, max_ts, flags);
static int realtext_read_close(AVFormatContext *s)
int64_t pos
byte position in stream, -1 if unknown
char * av_strdup(const char *s) av_malloc_attrib
Duplicate the string s.
AVCodecContext * codec
Codec context associated with this stream.
static int realtext_read_packet(AVFormatContext *s, AVPacket *pkt)
static int read_ts(const char *s)
void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q)
Remove and destroy all the subtitles packets.
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
AVPacket * ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, const uint8_t *event, int len, int merge)
Insert a new subtitle event.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
const char * ff_smil_get_attr_ptr(const char *s, const char *attr)
SMIL helper to point on the value of an attribute in the given tag.
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.
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.
static int realtext_read_seek(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Buffer to print data progressively.
static int realtext_read_header(AVFormatContext *s)
int ff_smil_extract_next_chunk(AVIOContext *pb, AVBPrint *buf, char *c)
SMIL helper to load next chunk ("<...>" or untagged content) in buf.
void ff_subtitles_queue_finalize(FFDemuxSubtitlesQueue *q)
Set missing durations and sort subtitles by PTS, and then byte position.
static int realtext_probe(AVProbeData *p)
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
AVInputFormat ff_realtext_demuxer
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.
static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size)
Merge two consequent lists of equal size depending on bits read.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...