From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 01B66429D3 for ; Mon, 10 Jan 2022 19:55:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7A03068AD8B; Mon, 10 Jan 2022 21:55:44 +0200 (EET) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 27A76689D48 for ; Mon, 10 Jan 2022 21:55:37 +0200 (EET) Received: by mail-pl1-f173.google.com with SMTP id w7so13570124plp.13 for ; Mon, 10 Jan 2022 11:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=nV2/UTmCMMEcjrkCg6rnvByLxFRpm6sMohKb9ZnO7TI=; b=fF7m6wIFFKDvzlF3jH7fIGB/h+r4EaNd1x2bvuv6M5OHVLUl2HHg9zJcBDvCf3xFoj ZSkIUeqiI8MDD0SPGuUfVDBbUqCllDMYvr62GRp/PQ7RacBUlfzBIzPy2oAGDRCkZBsB iMFtGIQUcjOSR8OFSxiqJkTK3ifSBS2tYHk2CZquanRb64x5M16EgUPIVgJeQzYrvi6G uuJQUrxLRn6x3gslOTx8c6C8E+dAeFAXTqyDnnbFhV2GCMnrD+WhXfvg081AZselONd+ cVYxi2AqoxG4QEPpN6fiVHHkULcZQeO9j//1R4OM6+ndzzNNhika1leAEv4H5sOaN9dP W9qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=nV2/UTmCMMEcjrkCg6rnvByLxFRpm6sMohKb9ZnO7TI=; b=WXmwqZUM5GHg49FCVgHwY15BKLwzl4gvx2gx71mV1nYbpB9FZm1Tm+MU4Xmx0ZLvmv KmWitQbxLMtRLQQT+sReCtTJ/9q3XR9Wi6jFjv+emL1KVoQL3nDWt+t4G8McwmW/aXSP XzvrZkeGGTnVrI3QodQgaleWzVMeUKjGEzUsJM8OgXjsgF7Fz9aSUacynTxKsk6smFhL IWg5RL1OE1vfK8Wq6z5U8DftDajO5J0OEtFLWnhl8p/g5L6G8XIXoWjOg/55qpS8Y1QU wSFrVdtg0wUcLtDDDANRUQ323KqJ06V1xl4qoYzHO+ROd6c23fpIrtiyAp4xnI0e2x3I d2KQ== X-Gm-Message-State: AOAM533UUUtkTwpni2FIR1Q1JWNvRd+CdynnyRXbBUYOZ2pUiCa/Oni7 V1QPMWuVQH/ds5VpGILyrIBh96lSV88vIA== X-Google-Smtp-Source: ABdhPJxqwKfAK9IS/6WgLXxMPdPU7W7B6IZfxe28fdyX3nmW3/nBv+AcRSGOfhwPmUymC2jKGXPRlQ== X-Received: by 2002:a17:90a:ae17:: with SMTP id t23mr8362100pjq.116.1641844535666; Mon, 10 Jan 2022 11:55:35 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id n5sm4646391pfo.39.2022.01.10.11.55.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jan 2022 11:55:35 -0800 (PST) Message-Id: <2f12ac7f1fafe9a6032ec67c3441adfbdcbd2d30.1641844533.git.ffmpegagent@gmail.com> In-Reply-To: References: From: ffmpegagent Date: Mon, 10 Jan 2022 19:55:32 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2 1/2] avcodec/dvdsubdec, dvbsubdec: don't dump images to disk based on DEBUG define X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: softworkz , Hendrik Leppkes , Marton Balint Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: softworkz It's been a regular annoyance. Introduce a debug-only parameter for this. Signed-off-by: softworkz --- libavcodec/dvbsubdec.c | 16 +++++++++++----- libavcodec/dvdsubdec.c | 9 +++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index bc741a1de6..8db9963fda 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -137,6 +137,9 @@ typedef struct DVBSubContext { DVBSubRegionDisplay *display_list; DVBSubDisplayDefinition *display_definition; +#ifdef DEBUG + int dump_imgs; +#endif } DVBSubContext; @@ -1534,11 +1537,11 @@ static int save_display_set(DVBSubContext *ctx) } - snprintf(filename, sizeof(filename), "dvbs.%d", fileno_index); - - png_save(ctx, filename, pbuf, width, height); - - av_freep(&pbuf); + if (ctx->dump_imgs) { + snprintf(filename, sizeof(filename), "dvbs.%d", fileno_index); + png_save(ctx, filename, pbuf, width, height); + av_freep(&pbuf); + } } fileno_index++; @@ -1730,6 +1733,9 @@ static const AVOption options[] = { {"compute_edt", "compute end of time using pts or timeout", OFFSET(compute_edt), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DS}, {"compute_clut", "compute clut when not available(-1) or only once (-2) or always(1) or never(0)", OFFSET(compute_clut), AV_OPT_TYPE_BOOL, {.i64 = -1}, -2, 1, DS}, {"dvb_substream", "", OFFSET(substream), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, DS}, +#ifdef DEBUG + { "dump_imgs", "Dump subtitle images to disk", OFFSET(dump_imgs), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DS}, +#endif {NULL} }; static const AVClass dvbsubdec_class = { diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 52259f0730..c0f796068e 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -44,6 +44,7 @@ typedef struct DVDSubContext uint8_t used_color[256]; #ifdef DEBUG int sub_id; + int dump_imgs; #endif } DVDSubContext; @@ -597,8 +598,9 @@ static int dvdsub_decode(AVCodecContext *avctx, ff_dlog(NULL, "start=%d ms end =%d ms\n", sub->start_display_time, sub->end_display_time); - ppm_save(ppm_name, sub->rects[0]->data[0], - sub->rects[0]->w, sub->rects[0]->h, (uint32_t*) sub->rects[0]->data[1]); + if (ctx->dump_imgs) + ppm_save(ppm_name, sub->rects[0]->data[0], + sub->rects[0]->w, sub->rects[0]->h, (uint32_t*) sub->rects[0]->data[1]); } #endif @@ -745,6 +747,9 @@ static const AVOption options[] = { { "palette", "set the global palette", OFFSET(palette_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD }, { "ifo_palette", "obtain the global palette from .IFO file", OFFSET(ifo_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD }, { "forced_subs_only", "Only show forced subtitles", OFFSET(forced_subs_only), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, SD}, +#ifdef DEBUG + { "dump_imgs", "Dump subtitle images to disk", OFFSET(dump_imgs), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, SD}, +#endif { NULL } }; static const AVClass dvdsub_class = { -- ffmpeg-codebot _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".