Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 05/10] fftools: move opt_timelimit from cmdutils to ffmpeg
Date: Thu, 17 Mar 2022 16:34:22 +0100
Message-ID: <AS1PR01MB956484455C67AAADE22FFED88F129@AS1PR01MB9564.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <20220315090532.27295-5-anton@khirnov.net>

Anton Khirnov:
> This option is only supported by ffmpeg.
> ---
>  fftools/cmdutils.c   | 17 -----------------
>  fftools/ffmpeg_opt.c | 20 ++++++++++++++++++++
>  2 files changed, 20 insertions(+), 17 deletions(-)
> 
> diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
> index 12ef07b62f..e5684fa840 100644
> --- a/fftools/cmdutils.c
> +++ b/fftools/cmdutils.c
> @@ -47,10 +47,6 @@
>  #include "libavutil/opt.h"
>  #include "cmdutils.h"
>  #include "opt_common.h"
> -#if HAVE_SYS_RESOURCE_H
> -#include <sys/time.h>
> -#include <sys/resource.h>
> -#endif
>  #ifdef _WIN32
>  #include <windows.h>
>  #endif
> @@ -797,19 +793,6 @@ do {                                                                           \
>      return 0;
>  }
>  
> -int opt_timelimit(void *optctx, const char *opt, const char *arg)
> -{
> -#if HAVE_SETRLIMIT
> -    int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
> -    struct rlimit rl = { lim, lim + 1 };
> -    if (setrlimit(RLIMIT_CPU, &rl))
> -        perror("setrlimit");
> -#else
> -    av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt);
> -#endif
> -    return 0;
> -}
> -
>  void print_error(const char *filename, int err)
>  {
>      char errbuf[128];
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index b2746259d7..778e02c39e 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -19,8 +19,15 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>   */
>  
> +#include "config.h"
> +
>  #include <stdint.h>
>  
> +#if HAVE_SYS_RESOURCE_H
> +#include <sys/time.h>
> +#include <sys/resource.h>
> +#endif
> +
>  #include "ffmpeg.h"
>  #include "cmdutils.h"
>  #include "opt_common.h"
> @@ -3501,6 +3508,19 @@ static int opt_progress(void *optctx, const char *opt, const char *arg)
>      return 0;
>  }
>  
> +int opt_timelimit(void *optctx, const char *opt, const char *arg)
> +{
> +#if HAVE_SETRLIMIT
> +    int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
> +    struct rlimit rl = { lim, lim + 1 };
> +    if (setrlimit(RLIMIT_CPU, &rl))
> +        perror("setrlimit");
> +#else
> +    av_log(NULL, AV_LOG_WARNING, "-%s not implemented on this OS\n", opt);
> +#endif
> +    return 0;
> +}
> +
>  #define OFFSET(x) offsetof(OptionsContext, x)
>  const OptionDef options[] = {
>      /* main options */

LGTM to moving. Didn't look at whether the headers removed from
cmdutils.c were only used by opt_timelimit() though.

- Andreas
_______________________________________________
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".

  reply	other threads:[~2022-03-17 15:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  9:05 [FFmpeg-devel] [PATCH 01/10] fftools/cmdutils: drop prototypes for nonexistent functions Anton Khirnov
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 02/10] fftools/cmdutils: drop extern declarations for nonexistent variables Anton Khirnov
2022-03-17 14:21   ` Andreas Rheinhardt
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 03/10] fftools: drop useless indirection Anton Khirnov
2022-03-17 14:21   ` Andreas Rheinhardt
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 04/10] fftools/cmdutils: split common option handlers into their own file Anton Khirnov
2022-03-17 15:30   ` Andreas Rheinhardt
2022-03-20 10:07   ` Anton Khirnov
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 05/10] fftools: move opt_timelimit from cmdutils to ffmpeg Anton Khirnov
2022-03-17 15:34   ` Andreas Rheinhardt [this message]
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 06/10] fftools/ffmpeg: drop mistakenly added empty line Anton Khirnov
2022-03-17 15:35   ` Andreas Rheinhardt
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 07/10] fftools/ffplay: drop options deprecated since 2011 Anton Khirnov
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 08/10] fftools/ffprobe; drop -show_format_entry Anton Khirnov
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 09/10] fftools: drop the fake "default" option from ffplay/ffprobe Anton Khirnov
2022-03-15  9:05 ` [FFmpeg-devel] [PATCH 10/10] fftools/cmdutils: drop redundant code Anton Khirnov
2022-03-17 14:19 ` [FFmpeg-devel] [PATCH 01/10] fftools/cmdutils: drop prototypes for nonexistent functions Andreas Rheinhardt

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=AS1PR01MB956484455C67AAADE22FFED88F129@AS1PR01MB9564.eurprd01.prod.exchangelabs.com \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /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