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 4AB85429E2 for ; Mon, 10 Jan 2022 19:55:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 480A968AC57; Mon, 10 Jan 2022 21:55:43 +0200 (EET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9F1A3689D48 for ; Mon, 10 Jan 2022 21:55:36 +0200 (EET) Received: by mail-pj1-f53.google.com with SMTP id m13so14846064pji.3 for ; Mon, 10 Jan 2022 11:55:36 -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=WTYbWltxZhq+x3qyAnJFVQpa4ZOs6jWCblR/c4/IPaI=; b=eKEVBZg9k4f23e3CaM0TjWDrMZokI5RWR0SMn5ObirJZ6/Rjz69pWZiHktRPsy2sd9 5pTP9d/jJpW44sqnwt340Kynv7cuCyTVbErk3o9K0/3zDelLLMPwY2bgZqg4/9Twf1Mp 7htsIUnZykzUxw6UwqWVDjnYsXYqx8r1s3aNHDcWyswB/uVZFXlj+R24nI/l7U8h7uvv +yKmErYQ5+Dxe+c7daNqaDoJqWC+FErreLGdQFSB3IFABzBIByzmCXf9pg7Q9qRCu8M9 3aiIIh/VUAPoV0eChJFTQy7YJagdNmq6hKtPMAg6GKnXvHqPmvt0m2rMPUl4yMZm1jdc u6NA== 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=WTYbWltxZhq+x3qyAnJFVQpa4ZOs6jWCblR/c4/IPaI=; b=xrrAvurJHWeWB3eXnYaJnj1yShT4+CS7LF/4/yTlee+1xLz+8yUu2FMWJQ0bKvMKhW L6o7kAgcuT9wrXEIKRx/ca63oJKRnnFQpOhK+lwoWnxnfoRMq80LlfqFoWf1gN9pQska T8pw2gbCrATvQxEVCh2FBxwRJqBYx8s1Zb0kczYN8QHuNQVofv/RGwhfzRZbO2slNIwz HLQD92VG9WSPMqh0+i/4gYrenW2PvwkEMwBJf8KTZ8gm939okQ9TXSQX7i4HXTs1BNd1 BSQe5mkQoNRO1zWmAoVFDmVbkxawTPjPBhsXeAa3QhiZojeh31LF5o0nSA2IxajbJ4Nr KvuA== X-Gm-Message-State: AOAM530eEZB8KDhXf9XLf2Bm9aVqlYJlad16xyvYHdrwhIoOPGPbtfLW Dj4/CvfEWLUEV4A/bD7j3UQIM291ePVAaw== X-Google-Smtp-Source: ABdhPJxpKrRMMqq9MeIzyIlgM+E0XNdvxoGNmMhE+O889DVTrY+Wci86dqGKtqjGcmMKnvdN7B0y7Q== X-Received: by 2002:a17:902:e5c4:b0:149:e3fc:fa58 with SMTP id u4-20020a170902e5c400b00149e3fcfa58mr1037520plf.142.1641844534592; Mon, 10 Jan 2022 11:55:34 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id d185sm6271424pgc.58.2022.01.10.11.55.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jan 2022 11:55:34 -0800 (PST) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Mon, 10 Jan 2022 19:55:31 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2 0/2] avcodec/dvbsubdec, dvdsubdec: 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: It's annoying and unexpected, but still useful at times (as I've realized just recently). This is a follow-up to the earlier submission here: https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg128080.html There has been a comment from Anton, questioning whether the dump-feature is useful. Meanwhile I came to the conclusion that it can be useful in-fact. It just shouldn't happen automatically when DEBUG is defined. That's what these patches do. I also added fixes for the fopen() call. softworkz (2): avcodec/dvdsubdec,dvbsubdec: don't dump images to disk based on DEBUG define avcodec/dvdsubdec,dvbsubdec: fix writing ppm libavcodec/dvbsubdec.c | 20 +++++++++++++------- libavcodec/dvdsubdec.c | 11 ++++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) base-commit: 6c4074e4234edacfb3f37184fd68771df3cb2b7f Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-17%2Fsoftworkz%2Fsubmit_dvb_subs-v2 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-17/softworkz/submit_dvb_subs-v2 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/17 Range-diff vs v1: 1: 6ca8905c3d ! 1: 2f12ac7f1f avcodec/dvbsubdec: don't dump images to disk based on DEBUG define @@ Metadata Author: softworkz ## Commit message ## - avcodec/dvbsubdec: don't dump images to disk based on DEBUG define + avcodec/dvdsubdec,dvbsubdec: don't dump images to disk based on DEBUG define It's been a regular annoyance. Introduce a debug-only parameter for this. @@ libavcodec/dvbsubdec.c: static const AVOption options[] = { {NULL} }; static const AVClass dvbsubdec_class = { + + ## libavcodec/dvdsubdec.c ## +@@ libavcodec/dvdsubdec.c: typedef struct DVDSubContext + uint8_t used_color[256]; + #ifdef DEBUG + int sub_id; ++ int dump_imgs; + #endif + } DVDSubContext; + +@@ libavcodec/dvdsubdec.c: 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 + +@@ libavcodec/dvdsubdec.c: 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 = { 2: 8da6e4ab17 ! 2: 0cd2c77f31 avcodec/dvbsubdec: fix writing ppm @@ Metadata Author: softworkz ## Commit message ## - avcodec/dvbsubdec: fix writing ppm + avcodec/dvdsubdec,dvbsubdec: fix writing ppm fopen needs (b)inary mode @@ libavcodec/dvbsubdec.c: static void png_save(DVBSubContext *ctx, const char *fil if (!f) { perror(fname2); return; + + ## libavcodec/dvdsubdec.c ## +@@ libavcodec/dvdsubdec.c: static void ppm_save(const char *filename, uint8_t *bitmap, int w, int h, + int back[3] = {0, 255, 0}; /* green background */ + FILE *f; + +- f = fopen(filename, "w"); ++ f = fopen(filename, "wb"); + if (!f) { + perror(filename); + return; 3: 9186ff48ec < -: ---------- avcodec/dvdsubdec: don't dump images to disk based on DEBUG define 4: 341474e338 < -: ---------- avcodec/dvdsubdec: fix writing ppm -- 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".