39 if (buf[2] !=
':' || buf[5] !=
':' || buf[8] !=
'.')
46 return ms - packet_time;
52 int buf_size = avpkt->
size;
54 const uint8_t *buf_end = buf + buf_size;
56 int w,
h, x, y, i, ret;
57 int64_t packet_time = 0;
62 if (buf_size < 27 + 7 * 2 + 4 * (3 + has_alpha)) {
68 if (buf[0] !=
'[' || buf[13] !=
'-' || buf[26] !=
']') {
79 w = bytestream_get_le16(&
buf);
80 h = bytestream_get_le16(&
buf);
83 x = bytestream_get_le16(&
buf);
84 y = bytestream_get_le16(&
buf);
86 bytestream_get_le16(&
buf);
87 bytestream_get_le16(&
buf);
92 bytestream_get_le16(&
buf);
94 if (buf_end -
buf <
h + 3*4)
102 sub->rects[0] =
av_mallocz(
sizeof(*sub->rects[0]));
103 if (!sub->rects[0]) {
107 sub->rects[0]->x = x; sub->rects[0]->y = y;
108 sub->rects[0]->w =
w; sub->rects[0]->h =
h;
110 sub->rects[0]->linesize[0] =
w;
112 sub->rects[0]->nb_colors = 4;
114 if (!sub->rects[0]->data[0] || !sub->rects[0]->data[1]) {
124 for (i = 0; i < sub->rects[0]->nb_colors; i++)
125 ((uint32_t*)sub->rects[0]->data[1])[i] = bytestream_get_be24(&
buf);
129 for (i = 1; i < sub->rects[0]->nb_colors; i++)
130 ((uint32_t *)sub->rects[0]->data[1])[i] |= 0xff000000;
132 for (i = 0; i < sub->rects[0]->nb_colors; i++)
133 ((uint32_t *)sub->rects[0]->data[1])[i] |= *
buf++ << 24;
141 rect = sub->rects[0];
142 for (j = 0; j < 4; j++) {
153 bitmap = sub->rects[0]->data[0];
154 for (y = 0; y <
h; y++) {
156 if (y == (h + 1) / 2) bitmap = sub->rects[0]->data[0] +
w;
157 for (x = 0; x <
w; ) {
161 run =
FFMIN(run, w - x);
163 if (!run) run = w - x;
164 memset(bitmap, color, run);
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
ptrdiff_t const GLvoid * data
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
attribute_deprecated AVPicture pict
8 bits with AV_PIX_FMT_RGB32 palette
attribute_deprecated int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
static const uint8_t tc_muls[9]
bitstream reader API header.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int decode_init(AVCodecContext *avctx)
#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)
const char * name
Name of the codec implementation.
static const uint8_t tc_offsets[9]
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...
A bitmap, pict will be set.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
attribute_deprecated uint8_t * data[AV_NUM_DATA_POINTERS]
pointers to the image data planes
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
const uint8_t ff_log2_tab[256]
Libavcodec external API header.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Rational number (pair of numerator and denominator).
#define FF_DISABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
static const uint8_t * align_get_bits(GetBitContext *s)
#define MKTAG(a, b, c, d)
This structure stores compressed data.
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.