57 uint8_t *trailer = strstr(par->
extradata,
"\n[Events]");
60 trailer = strstr(trailer,
"Format:");
62 trailer = strstr(trailer,
"\n");
65 header_size = (++trailer - par->
extradata);
74 if (!strstr(par->
extradata,
"\n[Events]"))
75 avio_printf(
s->pb,
"[Events]\nFormat: %s, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n",
108 av_log(
s,
AV_LOG_DEBUG,
"wrote %d ASS lines, cached dialogues: %d, waiting for event id %d\n",
138 prev->next = dialogue;
139 dialogue->
prev = prev;
145 next->
prev = dialogue;
146 dialogue->
next = next;
161 int hh1, mm1, ss1, ms1;
162 int hh2, mm2, ss2, ms2;
175 if (ass->
ssa_mode && !strncmp(p,
"Marked=", 7))
178 layer = strtol(p, &p, 10);
181 hh1 = (int)(start / 360000); mm1 = (int)(start / 6000) % 60;
182 hh2 = (int)(end / 360000); mm2 = (int)(end / 6000) % 60;
183 ss1 = (int)(start / 100) % 60; ms1 = (int)(start % 100);
184 ss2 = (int)(end / 100) % 60; ms2 = (int)(end % 100);
185 if (hh1 > 9) hh1 = 9, mm1 = 59, ss1 = 59, ms1 = 99;
186 if (hh2 > 9) hh2 = 9, mm2 = 59, ss2 = 59, ms2 = 99;
188 text_len = strlen(p);
189 while (text_len > 0 && (p[text_len - 1] ==
'\r' || p[text_len - 1] ==
'\n'))
192 dialogue->
line =
av_asprintf(
"%s%ld,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%.*s",
194 layer, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, text_len, p);
195 if (!dialogue->
line) {
218#define OFFSET(x) offsetof(ASSContext, x)
219#define E AV_OPT_FLAG_ENCODING_PARAM
221 {
"ignore_readorder",
"write events immediately, even if they're out-of-order",
OFFSET(ignore_readorder),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
E },
226 .class_name =
"ass muxer",
235 .p.mime_type =
"text/x-ass",
236 .p.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 ffio_write_lines(AVIOContext *s, const unsigned char *buf, int size, const unsigned char *ending)
Write a sequence of text lines, converting line endings.
char * av_asprintf(const char *fmt,...)
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
static void write_header(FFV1Context *f)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Memory handling functions.
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH
If this flag is set, it indicates that for each codec type whose corresponding default codec (i....
#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
If this flag is set, then the only permitted audio/video/subtitle codec ids are AVOutputFormat....
DialogueLine * last_added_dialogue
DialogueLine * dialogue_cache
Describe the class of an AVClass context structure.
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.
This structure stores compressed data.
struct DialogueLine * next
struct DialogueLine * prev
static int write_trailer(AVFormatContext *s1)