Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: 'FFmpeg development discussions and patches' <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] RFC: opinions on making fftools work like a library
Date: Mon, 20 Mar 2023 12:09:51 +0100
Message-ID: <167931059150.27013.7350834478628534772@lain.khirnov.net> (raw)
In-Reply-To: <tencent_1F714DA8CFB0556C270FB89C96474D78A007@qq.com>

Quoting Zhao Zhili (2023-03-19 06:04:55)
> 
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Anton Khirnov
> > Sent: 2023年3月18日 2:12
> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] RFC: opinions on making fftools work like a library
> > 
> > Quoting Zhao Zhili (2023-03-03 19:15:03)
> > > I'd like to know what do you think about making fftools work like a
> > > library, like what ffmpeg-kit already did, but with built-in support.
> > 
> > Maybe you should first clarify what exactly do you mean by "work like a
> > library". Meaning literally turn it into a library with a C API you can
> > call? That would be a massive amount of work, though my current
> > refactorings are moving in that direction.
> > Or provide stronger guarantees for commandline options? Or something
> > else?
> 
> I mean user can simply rename main() to something like ffmpeg_main() and build
> it as a library, even without directly support in our build system. Sometimes
> user just want to copy-paste and run ffmpeg cmdline on mobile.

I don't really understand where does "mobile" come into this and why
should we bend over backwards to work around crippled platforms.

> Some projects already did this, but they need to tweak the source code to
> reset global states each time, avoiding exit() and so on. These projects cannot
> benefit from your refactor work until they rebase their projects on new version
> of fftools.

While I personally do agree that a well-written program's main() should
be reentrant, this is not exactly a mainstream view. And as I said - the
amount of work to do this properly is immense.
It is technically possible to do this "improperly", meaning just put all
global state into an FFmpegContext that's allocated in main, then pass
it to all functions. But this just papers over the actuall issues, not
to mention that making stability guarantees for such an abomination
would cripple development

-- 
Anton Khirnov
_______________________________________________
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:[~2023-03-20 11:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 18:15 Zhao Zhili
2023-03-04 11:10 ` Lynne
2023-03-06  1:55 ` Steven Liu
2023-03-17 18:11 ` Anton Khirnov
2023-03-18 11:33   ` Neal Gompa
2023-03-19  9:01     ` Rémi Denis-Courmont
2023-03-19 18:38       ` Stefano Sabatini
2023-03-20 11:00     ` Anton Khirnov
2023-03-19  5:04   ` Zhao Zhili
2023-03-20 11:09     ` Anton Khirnov [this message]

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=167931059150.27013.7350834478628534772@lain.khirnov.net \
    --to=anton@khirnov.net \
    --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