33 static const uint8_t
tc_offsets[9] = { 0, 1, 3, 4, 6, 7, 9, 10, 11 };
34 static const uint8_t
tc_muls[9] = { 10, 6, 10, 6, 10, 10, 10, 10, 1 };
39 if (buf[2] !=
':' || buf[5] !=
':' || buf[8] !=
'.')
46 return ms - packet_time;
51 const uint8_t *buf = avpkt->
data;
52 int buf_size = avpkt->
size;
54 const uint8_t *buf_end = buf + buf_size;
56 int w, h, x, y, rlelen, i;
57 int64_t packet_time = 0;
60 memset(sub, 0,
sizeof(*sub));
63 if (buf_size < 27 + 7 * 2 + 4 * 3) {
69 if (buf[0] !=
'[' || buf[13] !=
'-' || buf[26] !=
']') {
80 w = bytestream_get_le16(&buf);
81 h = bytestream_get_le16(&buf);
84 x = bytestream_get_le16(&buf);
85 y = bytestream_get_le16(&buf);
87 bytestream_get_le16(&buf);
88 bytestream_get_le16(&buf);
89 rlelen = bytestream_get_le16(&buf);
105 ((uint32_t*)sub->
rects[0]->
pict.
data[1])[i] = bytestream_get_be24(&buf);
111 rlelen =
FFMIN(rlelen, buf_end - buf);
114 for (y = 0; y < h; y++) {
116 if (y == (h + 1) / 2) bitmap = sub->
rects[0]->
pict.
data[0] + w;
117 for (x = 0; x < w; ) {
121 run =
FFMIN(run, w - x);
123 if (!run) run = w - x;
124 memset(bitmap, color, run);
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
int x
top left corner of pict, undefined when pict is not set
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void align_get_bits(GetBitContext *s)
int nb_colors
number of colors in pict, undefined when pict is not set
const uint8_t ff_log2_tab[256]
int w
width of pict, undefined when pict is not set
uint8_t * data[AV_NUM_DATA_POINTERS]
static const uint8_t tc_muls[9]
bitstream reader API header.
int h
height of pict, undefined when pict is not set
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static av_cold int decode_init(AVCodecContext *avctx)
int y
top left corner of pict, undefined when pict is not set
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static int64_t parse_timecode(const uint8_t *buf, int64_t packet_time)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static const uint8_t tc_offsets[9]
uint32_t end_display_time
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
AVPicture pict
data+linesize for the bitmap of this subtitle.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
A bitmap, pict will be set.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
rational number numerator/denominator
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
uint32_t start_display_time
8 bit with PIX_FMT_RGB32 palette
static const uint8_t color[]
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.