61 trailer = strstr(trailer,
"Format:");
63 trailer = strstr(trailer,
"\n");
66 header_size = (++trailer - par->
extradata);
74 if (header_size && par->
extradata[header_size - 1] !=
'\n')
77 if (!strstr(par->
extradata,
"\n[Events]"))
78 avio_printf(
s->pb,
"[Events]\r\nFormat: %s, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n",
111 av_log(
s,
AV_LOG_DEBUG,
"wrote %d ASS lines, cached dialogues: %d, waiting for event id %d\n",
141 prev->
next = dialogue;
142 dialogue->
prev = prev;
148 next->
prev = dialogue;
149 dialogue->
next = next;
164 int hh1, mm1, ss1, ms1;
165 int hh2, mm2, ss2, ms2;
168 if (!text || !dialogue) {
181 if (ass->
ssa_mode && !strncmp(p,
"Marked=", 7))
184 layer = strtol(p, &p, 10);
187 hh1 = (
int)(start / 360000); mm1 = (
int)(start / 6000) % 60;
188 hh2 = (
int)(end / 360000); mm2 = (
int)(end / 6000) % 60;
189 ss1 = (
int)(start / 100) % 60; ms1 = (
int)(start % 100);
190 ss2 = (
int)(end / 100) % 60; ms2 = (
int)(end % 100);
191 if (hh1 > 9) hh1 = 9, mm1 = 59, ss1 = 59, ms1 = 99;
192 if (hh2 > 9) hh2 = 9, mm2 = 59, ss2 = 59, ms2 = 99;
194 dialogue->
line =
av_asprintf(
"%s%ld,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s",
196 layer, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, p);
198 if (!dialogue->
line) {
221 #define OFFSET(x) offsetof(ASSContext, x)
222 #define E AV_OPT_FLAG_ENCODING_PARAM
224 {
"ignore_readorder",
"write events immediately, even if they're out-of-order",
OFFSET(ignore_readorder),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
E },
238 .mime_type =
"text/x-ass",
239 .extensions =
"ass,ssa",
#define avio_print(s,...)
Write strings (const char *) to the context.
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
Writes a formatted string to the context.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
char * av_asprintf(const char *fmt,...)
#define flags(name, subs,...)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string.
size_t static size_t av_strnlen(const char *s, size_t len)
Get the count of continuous non zero chars starting from the beginning.
#define LIBAVUTIL_VERSION_INT
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
DialogueLine * last_added_dialogue
DialogueLine * dialogue_cache
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
struct DialogueLine * next
struct DialogueLine * prev