Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stebbins <stebbins@jetheaddev.com>2014-06-19 00:38:36 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-06-30 19:25:16 +0400
commit5c019ec91d941c3b42491d63cf1e774cb391db88 (patch)
tree3eabd02edb100c55a062e7c6b3eaecd5329ea8d0 /libavcodec/pgssubdec.c
parent4701f7676ce9b2e9672960c12348b7de447419b2 (diff)
avcodec/pgssubdec: Pass AVSubtitleRect to decode_rle()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r--libavcodec/pgssubdec.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 63346c08f1..1f555bf2f9 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -111,7 +111,7 @@ static av_cold int close_decoder(AVCodecContext *avctx)
* @param buf pointer to the RLE data to process
* @param buf_size size of the RLE data to process
*/
-static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub, int rect,
+static int decode_rle(AVCodecContext *avctx, AVSubtitleRect *rect,
const uint8_t *buf, unsigned int buf_size)
{
const uint8_t *rle_bitmap_end;
@@ -119,15 +119,15 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub, int rect,
rle_bitmap_end = buf + buf_size;
- sub->rects[rect]->pict.data[0] = av_malloc(sub->rects[rect]->w * sub->rects[rect]->h);
+ rect->pict.data[0] = av_malloc(rect->w * rect->h);
- if (!sub->rects[rect]->pict.data[0])
+ if (!rect->pict.data[0])
return -1;
pixel_count = 0;
line_count = 0;
- while (buf < rle_bitmap_end && line_count < sub->rects[rect]->h) {
+ while (buf < rle_bitmap_end && line_count < rect->h) {
uint8_t flags, color;
int run;
@@ -142,27 +142,27 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub, int rect,
color = flags & 0x80 ? bytestream_get_byte(&buf) : 0;
}
- if (run > 0 && pixel_count + run <= sub->rects[rect]->w * sub->rects[rect]->h) {
- memset(sub->rects[rect]->pict.data[0] + pixel_count, color, run);
+ if (run > 0 && pixel_count + run <= rect->w * rect->h) {
+ memset(rect->pict.data[0] + pixel_count, color, run);
pixel_count += run;
} else if (!run) {
/*
* New Line. Check if correct pixels decoded, if not display warning
* and adjust bitmap pointer to correct new line position.
*/
- if (pixel_count % sub->rects[rect]->w > 0)
+ if (pixel_count % rect->w > 0)
av_log(avctx, AV_LOG_ERROR, "Decoded %d pixels, when line should be %d pixels\n",
- pixel_count % sub->rects[rect]->w, sub->rects[rect]->w);
+ pixel_count % rect->w, rect->w);
line_count++;
}
}
- if (pixel_count < sub->rects[rect]->w * sub->rects[rect]->h) {
+ if (pixel_count < rect->w * rect->h) {
av_log(avctx, AV_LOG_ERROR, "Insufficient RLE data for subtitle\n");
return -1;
}
- av_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[rect]->w * sub->rects[rect]->h);
+ av_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, rect->w * rect->h);
return 0;
}
@@ -439,7 +439,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
if (ctx->pictures[picture_id].rle_remaining_len)
av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n",
ctx->pictures[picture_id].rle_data_len, ctx->pictures[picture_id].rle_remaining_len);
- if (decode_rle(avctx, sub, rect, ctx->pictures[picture_id].rle, ctx->pictures[picture_id].rle_data_len) < 0)
+ if (decode_rle(avctx, sub->rects[rect], ctx->pictures[picture_id].rle, ctx->pictures[picture_id].rle_data_len) < 0)
return 0;
}