1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

avcodec/dvbsubdec: Cosmetics

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang
2020-06-26 21:33:37 +08:00
parent c32114e0a5
commit 9cfed6d84a

View File

@@ -710,8 +710,8 @@ static void compute_default_clut(DVBSubContext *ctx, uint8_t *clut, AVSubtitleRe
} }
count = FFMAX(i - 1, 1); count = FFMAX(i - 1, 1);
for (i--; i>=0; i--) { for (i--; i >= 0; i--) {
int v = i*255/count; int v = i * 255 / count;
AV_WN32(clut + 4*list_inv[i], RGBA(v/2,v,v/2,v)); AV_WN32(clut + 4*list_inv[i], RGBA(v/2,v,v/2,v));
} }
} }
@@ -737,7 +737,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
} }
/* Not touching AVSubtitles again*/ /* Not touching AVSubtitles again*/
if(sub->num_rects) { if (sub->num_rects) {
avpriv_request_sample(ctx, "Different Version of Segment asked Twice"); avpriv_request_sample(ctx, "Different Version of Segment asked Twice");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
@@ -747,7 +747,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
sub->num_rects++; sub->num_rects++;
} }
if(ctx->compute_edt == 0) { if (ctx->compute_edt == 0) {
sub->end_display_time = ctx->time_out * 1000; sub->end_display_time = ctx->time_out * 1000;
*got_output = 1; *got_output = 1;
} else if (ctx->prev_start != AV_NOPTS_VALUE) { } else if (ctx->prev_start != AV_NOPTS_VALUE) {
@@ -851,7 +851,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
return 0; return 0;
fail: fail:
if (sub->rects) { if (sub->rects) {
for(i=0; i<sub->num_rects; i++) { for (i=0; i < sub->num_rects; i++) {
rect = sub->rects[i]; rect = sub->rects[i];
if (rect) { if (rect) {
av_freep(&rect->data[0]); av_freep(&rect->data[0]);
@@ -1210,7 +1210,7 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx,
} }
region->depth = 1 << (((*buf++) >> 2) & 7); region->depth = 1 << (((*buf++) >> 2) & 7);
if(region->depth<2 || region->depth>8){ if (region->depth < 2 || region->depth > 8) {
av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth); av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth);
region->depth= 4; region->depth= 4;
} }
@@ -1318,7 +1318,7 @@ static int dvbsub_parse_page_segment(AVCodecContext *avctx,
ff_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state); ff_dlog(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
if(ctx->compute_edt == 1) if (ctx->compute_edt == 1)
save_subtitle_set(avctx, sub, got_output); save_subtitle_set(avctx, sub, got_output);
if (page_state == 1 || page_state == 2) { if (page_state == 1 || page_state == 2) {
@@ -1601,7 +1601,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
{ {
DVBSubContext *ctx = avctx->priv_data; DVBSubContext *ctx = avctx->priv_data;
if(ctx->compute_edt == 0) if (ctx->compute_edt == 0)
save_subtitle_set(avctx, sub, got_output); save_subtitle_set(avctx, sub, got_output);
#ifdef DEBUG #ifdef DEBUG
save_display_set(ctx); save_display_set(ctx);
@@ -1717,12 +1717,12 @@ static int dvbsub_decode(AVCodecContext *avctx,
} }
end: end:
if(ret < 0) { if (ret < 0) {
*got_sub_ptr = 0; *got_sub_ptr = 0;
avsubtitle_free(sub); avsubtitle_free(sub);
return ret; return ret;
} else { } else {
if(ctx->compute_edt == 1 ) if (ctx->compute_edt == 1)
FFSWAP(int64_t, ctx->prev_start, sub->pts); FFSWAP(int64_t, ctx->prev_start, sub->pts);
} }