From: ffmpegagent <ffmpegagent@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: softworkz <softworkz@hotmail.com>,
Hendrik Leppkes <h.leppkes@gmail.com>,
Marton Balint <cus@passwd.hu>
Subject: [FFmpeg-devel] [PATCH v2 1/2] avcodec/dvdsubdec, dvbsubdec: don't dump images to disk based on DEBUG define
Date: Mon, 10 Jan 2022 19:55:32 +0000
Message-ID: <2f12ac7f1fafe9a6032ec67c3441adfbdcbd2d30.1641844533.git.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.17.v2.ffstaging.FFmpeg.1641844533.ffmpegagent@gmail.com>
From: softworkz <softworkz@hotmail.com>
It's been a regular annoyance.
Introduce a debug-only parameter for this.
Signed-off-by: softworkz <softworkz@hotmail.com>
---
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".
next prev parent reply other threads:[~2022-01-10 19:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 4:49 [FFmpeg-devel] [PATCH 0/4] avcodec/dvbsubdec, dvdsubdec: " ffmpegagent
2022-01-07 4:49 ` [FFmpeg-devel] [PATCH 1/4] avcodec/dvbsubdec: " ffmpegagent
2022-01-07 4:49 ` [FFmpeg-devel] [PATCH 2/4] avcodec/dvbsubdec: fix writing ppm ffmpegagent
2022-01-07 4:49 ` [FFmpeg-devel] [PATCH 3/4] avcodec/dvdsubdec: don't dump images to disk based on DEBUG define ffmpegagent
2022-01-07 4:49 ` [FFmpeg-devel] [PATCH 4/4] avcodec/dvdsubdec: fix writing ppm ffmpegagent
2022-01-07 10:20 ` [FFmpeg-devel] [PATCH 0/4] avcodec/dvbsubdec, dvdsubdec: don't dump images to disk based on DEBUG define Hendrik Leppkes
2022-01-07 10:31 ` Hendrik Leppkes
2022-01-07 16:14 ` Soft Works
2022-01-10 10:31 ` Hendrik Leppkes
2022-01-10 13:44 ` Soft Works
2022-01-07 19:57 ` Marton Balint
2022-01-07 20:01 ` Soft Works
2022-01-07 21:53 ` Marton Balint
2022-01-07 22:20 ` Soft Works
2022-01-10 19:55 ` [FFmpeg-devel] [PATCH v2 0/2] " ffmpegagent
2022-01-10 19:55 ` ffmpegagent [this message]
2022-01-10 19:55 ` [FFmpeg-devel] [PATCH v2 2/2] avcodec/dvdsubdec, dvbsubdec: fix writing ppm ffmpegagent
2022-02-03 22:08 ` [FFmpeg-devel] [PATCH v2 0/2] avcodec/dvbsubdec, dvdsubdec: don't dump images to disk based on DEBUG define Soft Works
2022-05-28 14:52 ` [FFmpeg-devel] [PATCH v3] avcodec/dvdsubdec, dvbsubdec: remove bitmap dumping in DEBUG builds softworkz
2022-06-08 20:30 ` Marton Balint
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f12ac7f1fafe9a6032ec67c3441adfbdcbd2d30.1641844533.git.ffmpegagent@gmail.com \
--to=ffmpegagent@gmail.com \
--cc=cus@passwd.hu \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=h.leppkes@gmail.com \
--cc=softworkz@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git