21#ifndef AVFORMAT_SUBTITLES_H
22#define AVFORMAT_SUBTITLES_H
121 const uint8_t *event,
size_t len,
int merge);
128 const AVBPrint *event,
int merge);
207 int n = strcspn(ptr,
"\r\n");
209 while (*ptr ==
'\r') {
#define flags(name, subs,...)
static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size)
Merge two consequent lists of equal size depending on bits read.
#define av_warn_unused_result
This structure stores compressed data.
int nb_subs
number of subtitles packets
AVPacket ** subs
array of subtitles packets
int allocated_size
allocated size for subs
int current_sub_idx
current position for the read packet callback
enum sub_sort sort
sort method to use when finalizing subtitles
int keep_duplicates
set to 1 to keep duplicated subtitle events
av_warn_unused_result int ff_subtitles_read_text_chunk(FFTextReader *tr, AVBPrint *buf)
Read a subtitles chunk from FFTextReader.
ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
Read a line of text.
int64_t ff_text_pos(FFTextReader *r)
Return the byte position of the next byte returned by ff_text_r8().
int ff_subtitles_read_packet(AVFormatContext *s, AVPacket *pkt)
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.
AVPacket * ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, const uint8_t *event, size_t len, int merge)
Insert a new subtitle event.
void ff_text_read(FFTextReader *r, char *buf, size_t size)
Read the given number of bytes (in UTF-8).
int ff_subtitles_read_seek(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
int ff_subtitles_read_close(AVFormatContext *s)
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_text_eof(FFTextReader *r)
Return non-zero if EOF was reached.
void ff_text_init_buf(FFTextReader *r, const void *buf, size_t size)
Similar to ff_text_init_avio(), but sets it up to read from a bounded buffer.
av_warn_unused_result int ff_subtitles_read_chunk(AVIOContext *pb, AVBPrint *buf)
Same as ff_subtitles_read_text_chunk(), but read from an AVIOContext.
void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
Initialize the FFTextReader from the given AVIOContext.
int ff_text_r8(FFTextReader *r)
Return the next byte.
int ff_smil_extract_next_text_chunk(FFTextReader *tr, AVBPrint *buf, char *c)
SMIL helper to load next chunk ("<...>" or untagged content) in buf.
int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt)
Generic read_packet() callback for subtitles demuxers using this queue system.
int ff_text_peek_r8(FFTextReader *r)
Like ff_text_r8(), but don't remove the byte from the buffer.
AVPacket * ff_subtitles_queue_insert_bprint(FFDemuxSubtitlesQueue *q, const AVBPrint *event, int merge)
Same as ff_subtitles_queue_insert but takes an AVBPrint input.
void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q)
Set missing durations, sort subtitles by PTS (and then byte position), and drop duplicated events.
void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q)
Remove and destroy all the subtitles packets.
@ SUB_SORT_TS_POS
sort by timestamps, then position
@ SUB_SORT_POS_TS
sort by position, then timestamps
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.