Re: [FFmpeg-devel] [PATCH] build: Allow libffmpeg to be built for Chromium-based browsers
On Sat, 29 Jul 2017 11:40:30 +0200 Nicolas George <geo...@nsup.org> wrote: > Le decadi 10 thermidor, an CCXXV, James Le Cuirot a écrit : > > This Makefile snippet allows libffmpeg to be created without the help > > of Chromium's build system. It uses the CONFIG_SHARED variable to > > decide whether to link the FFmpeg libraries statically or > > dynamically. In the latter case, libffmpeg is just a wrapper with no > > symbols of its own. > > I concur with the other remarks: this is not the right approach, and it > has many flaws. > > But on the other hand, I strongly support the underlying idea: having > many libraries causes no end of trouble, for users a little but for > developers mostly. See for example the proliferation of avpriv symbols > whenever code needs to be factored between libraries but too complex for > a public API. > > So if you were interested in making this right: make it the default and > only library for the project, to be applied at / instead of the next > major bump, I would strongly support it, and help to the extent of my > ability. I am merely an end user here so I'm afraid my interest in this only goes as far as the Chromium use case. I'm not sure whether it's the default but it actually can be built to link directly against the individual libraries and this is exactly what Gentoo's Chromium package does when the system-ffmpeg flag is enabled. I don't know why Opera and Vivaldi build libffmpeg.so as a separate component or why Chromium even makes this an option in the first place. A distro may not have the same library versions available but that doesn't stop these browsers bundling the individual libraries. Perhaps it's to make swapping it out easier but then it's just one file instead of three. I wasn't too optimistic about this being accepted but the Gentoo FFmpeg maintainer insisted that I put it forward anyway. Hopefully I can still convince him to carry the patch, otherwise users like me will lose out. Several others expressed interest. pgpbH0zm4mZhD.pgp Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] build: Allow libffmpeg to be built for Chromium-based browsers
On Sat Jul 29 12:20:05 EEST 2017 Reimar Döffinger wrote: > On 28.07.2017, at 12:07, James Le Cuirot wrote: > > diff --git a/ffbuild/libffmpeg.mak b/ffbuild/libffmpeg.mak > > new file mode 100644 > > index 000..992cf3c > > --- /dev/null > > +++ b/ffbuild/libffmpeg.mak > > @@ -0,0 +1,21 @@ > > +LIBFFMPEG = $(SLIBPREF)ffmpeg$(SLIBSUF) > > +LIBFFMPEG_LINK = $(LD) -shared -Wl,-soname,$(LIBFFMPEG) -Wl,-Bsymbolic > > -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--gc-sections $(LDFLAGS) > > $(LDLIBFLAGS) -o $(LIBFFMPEG) > > + > > +libffmpeg-: libavcodec/$(LIBPREF)avcodec$(LIBSUF) > > libavformat/$(LIBPREF)avformat$(LIBSUF) libavutil/$(LIBPREF)avutil$(LIBSUF) > > libswresample/$(LIBPREF)swresample$(LIBSUF) > > +$(LIBFFMPEG_LINK) -Wl,--whole-archive $^ -Wl,--no-whole-archive > > $(FFEXTRALIBS) > > + > > +libffmpeg-yes: libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) > > libavformat/$(SLIBPREF)avformat$(SLIBSUF) > > libavutil/$(SLIBPREF)avutil$(SLIBSUF) > > +$(LIBFFMPEG_LINK) -Wl,--no-as-needed -lavcodec -lavformat -lavutil > > I don't see you using a version file to filter out the private > symbols? That is a VERY dangerous thing to forget. > Also I don't like that it doesn't reuse the standard linking options > used for the main libraries. If you mean LD_O and SHFLAGS, I didn't use them because -o $@ and -Wl,-soname,$$(@F) were using "libffmpeg-" as the name. My Make-fu isn't that great and I'd love to know if there is some way to do this properly. If you mean the additional linker flags, these are the same flags that Chromium uses to create libffmpeg. Maybe they're not strictly required. SHFLAGS also applies the version scripts. Chromium doesn't use one so I didn't either. My knowledge here is sketchy so I'm not sure if it makes any difference when this library won't be used at build time but I came up with a new script anyway. It makes av* global, leaving everything else local, and this seems to work. The version label doesn't matter for this use case so I simply put LIBFFMPEG but I guess it could be something like LIBFFMPEG_57.55.55. pgp9BeOQLU7dE.pgp Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] build: Allow libffmpeg to be built for Chromium-based browsers
Google Chrome ships with support for proprietary codecs and Chromium can be built with support for them, either using the bundled FFmpeg or a system copy. This leaves other browsers such as Opera and Vivaldi, which ship with a libffmpeg that does not support proprietary codecs, presumably for cost reasons. These projects actively encourage users to swap this library with an alternative. Official instructions say to download the very large Chromium tarball and use its build system to configure and build libffmpeg. This involves building a lot of extra baggage that simply isn't needed because libffmpeg is literally just the main FFmpeg libraries combined. Binary-based distributions can easily take this hit but for source-based distributions, this hit is passed onto the end user. This Makefile snippet allows libffmpeg to be created without the help of Chromium's build system. It uses the CONFIG_SHARED variable to decide whether to link the FFmpeg libraries statically or dynamically. In the latter case, libffmpeg is just a wrapper with no symbols of its own. At this current time, recent Chromium versions support the 3.x ABI with just one major exception. Unless built against the system copy, -DFF_API_CONVERGENCE_DURATION=0 is used. This means that, other factors notwithstanding, full compatibility will not be seen until libavcodec hits 59. This is why I have provided the ability to link FFmpeg statically. This is how to build libffmpeg for a recent Chromium-based release: ./configure --disable-shared --enable-static --enable-pic --extra-cflags="-DFF_API_CONVERGENCE_DURATION=0" make libffmpeg make install-libffmpeg I have tested this with FFmpeg 3.3.2 and latest master. I have tested it against current Opera Stable, Opera Beta, Opera Developer, Vivaldi Stable, and Vivaldi Snapshot. --- Makefile | 1 + ffbuild/libffmpeg.mak | 21 + 2 files changed, 22 insertions(+) create mode 100644 ffbuild/libffmpeg.mak diff --git a/Makefile b/Makefile index 29870d7..1e267e7 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,7 @@ all: all-yes include $(SRC_PATH)/tools/Makefile include $(SRC_PATH)/ffbuild/common.mak +include $(SRC_PATH)/ffbuild/libffmpeg.mak FF_EXTRALIBS := $(FFEXTRALIBS) FF_DEP_LIBS := $(DEP_LIBS) diff --git a/ffbuild/libffmpeg.mak b/ffbuild/libffmpeg.mak new file mode 100644 index 000..992cf3c --- /dev/null +++ b/ffbuild/libffmpeg.mak @@ -0,0 +1,21 @@ +LIBFFMPEG = $(SLIBPREF)ffmpeg$(SLIBSUF) +LIBFFMPEG_LINK = $(LD) -shared -Wl,-soname,$(LIBFFMPEG) -Wl,-Bsymbolic -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--gc-sections $(LDFLAGS) $(LDLIBFLAGS) -o $(LIBFFMPEG) + +libffmpeg-: libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavutil/$(LIBPREF)avutil$(LIBSUF) libswresample/$(LIBPREF)swresample$(LIBSUF) + $(LIBFFMPEG_LINK) -Wl,--whole-archive $^ -Wl,--no-whole-archive $(FFEXTRALIBS) + +libffmpeg-yes: libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavutil/$(SLIBPREF)avutil$(SLIBSUF) + $(LIBFFMPEG_LINK) -Wl,--no-as-needed -lavcodec -lavformat -lavutil + +$(LIBFFMPEG): libffmpeg-$(CONFIG_SHARED) +libffmpeg: $(LIBFFMPEG) + +install-libffmpeg: $(LIBFFMPEG) + $(Q)mkdir -p "$(SHLIBDIR)/chromium" + $(INSTALL) -m 755 $< "$(SHLIBDIR)/chromium/$<" + $(STRIP) "$(SHLIBDIR)/chromium/$<" + +uninstall-libffmpeg: + $(RM) "$(SHLIBDIR)/chromium/$(LIBFFMPEG)" + +.PHONY: libffmpeg libffmpeg-* install-libffmpeg -- 2.13.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel