65 for(metadata_item =
NULL;
68 if(!metadata_item->
value[0]) {
71 while((delim = strchr(metadata_item->
value,
'\n'))) {
74 while((delim = strchr(metadata_item->
value,
'\r'))) {
78 metadata_item->
key, metadata_item->
value);
89 const uint8_t *
line =
pkt->data;
90 const uint8_t *end =
pkt->data +
pkt->size;
92 while (end >
line && (end[-1] ==
'\n' || end[-1] ==
'\r'))
95 while (
line[0] ==
'\n' ||
line[0] ==
'\r')
100 for (
int i = 0;
i < p->precision; ++
i)
104 const uint8_t *next_line = memchr(
line,
'\n', end -
line);
109 if (next_line >
line && next_line[-1] ==
'\r')
115 "Subtitle starts with '[', may cause problems with LRC format.\n");
126 avio_printf(
s->pb,
"%02"PRIu64
":%02"PRIu64
".%0*"PRIu64
"]",
127 minutes, seconds, p->precision, rescaled);
137#define OFFSET(x) offsetof(LRCSubtitleContext, x)
138#define SE AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM
140 {
"precision",
"precision of the fractional part of the timestamp, 2 for centiseconds",
OFFSET(precision),
AV_OPT_TYPE_INT, {.i64 = 2}, 1, 6,
SE},
154 .p.extensions =
"lrc",
void avio_w8(AVIOContext *s, int b)
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)
#define i(width, name, range_min, range_max)
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
static void write_header(FFV1Context *f)
@ AV_OPT_TYPE_INT
Underlying C type is int.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
@ AV_CODEC_ID_TEXT
raw UTF-8 text
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#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.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
const AVMetadataConv ff_lrc_metadata_conv[]
static const AVClass lrcenc_class
static int lrc_write_header(AVFormatContext *s)
static int lrc_write_packet(AVFormatContext *s, AVPacket *pkt)
Utility Preprocessor macros.
#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....
int ff_standardize_creation_time(AVFormatContext *s)
Standardize creation_time metadata in AVFormatContext to an ISO-8601 timestamp string.
Describe the class of an AVClass context structure.
This structure stores compressed data.
Rational number (pair of numerator and denominator).
int precision
precision of the fractional part of the timestamp, 2 for centiseconds