[FFmpeg-devel] [RFC] Split libavformat
Ramiro Ribeiro Polla
ramiro
Wed Nov 21 12:58:48 CET 2007
Hello,
Luca Abeni wrote:
> Hi all,
>
> as promised, here is my attempt at splitting libavformat.
Sorry for not working any further on this. After all, summer is starting
and I live in a sub-tropical island, so it's quite hard to concentrate...
> The attached patches create 2 more libraries: libavdevice (mainly
> containing formats for getting audio and video from grabbing
> devices, but it might contain more things in the future) and
> libavnet (containing all the networking-related code).
>
[...]
> Index: ffmpeg/libavdevice/Makefile
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ ffmpeg/libavdevice/Makefile 2007-11-19 19:57:22.061554240 +0100
[...]
> +
> +# external libraries
> +OBJS-$(CONFIG_LIBDC1394_DEMUXER) += libdc1394.o
Sure, this lib is for grabbing devices, but it is also an external
library. What about also splitting external libraries out of libav* too?
(think pure libavformat/codec with no depencies at all).
> Index: ffmpeg/libavdevice/allformats.c
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ ffmpeg/libavdevice/allformats.c 2007-11-19 19:57:22.062554088 +0100
[...]
> +void avdevice_register_all(void)
> +{
> + static int inited;
> +
> + if (inited)
> + return;
> + inited = 1;
> +
> + av_register_all();
[...]
> Index: ffmpeg/ffmpeg.c
> ===================================================================
> --- ffmpeg.orig/ffmpeg.c 2007-11-19 19:49:07.299769464 +0100
> +++ ffmpeg/ffmpeg.c 2007-11-19 19:57:22.065553632 +0100
> @@ -28,6 +28,7 @@
> #include <signal.h>
> #include <limits.h>
> #include "avformat.h"
> +#include "avdevice.h"
> #include "swscale.h"
> #include "framehook.h"
> #include "opt.h"
> @@ -3883,7 +3884,7 @@
> int i;
> int64_t ti;
>
> - av_register_all();
> + avdevice_register_all();
Since we're breaking API already, to avoid this recursive calling of
av_register_all and deciding which register_all function to call, how
about "the user MUST initialize every library", as in:
avcodec_register_all();
avformat_register_all();
avdevice_register_all();
...
and remove av_register_all() (since it would cause dependencies to other
libraries).
[...]
> --- ffmpeg.orig/libavformat/allformats.c 2007-11-19 19:57:22.062554088 +0100
> +++ ffmpeg/libavformat/allformats.c 2007-11-19 20:09:18.796593952 +0100
[...]
> /* protocols */
> REGISTER_PROTOCOL (FILE, file);
> - REGISTER_PROTOCOL (HTTP, http);
> REGISTER_PROTOCOL (PIPE, pipe);
> - REGISTER_PROTOCOL (RTP, rtp);
> - REGISTER_PROTOCOL (TCP, tcp);
> - REGISTER_PROTOCOL (UDP, udp);
Regarding keeping file_protocol and pipe_protocol (already questioned
and answered on [1]), well, libav* already depend on libavutil. I don't
see any harm on them also depending on libavprotocol. That would
entirely isolate libavformat from any OS I/O stuff.
[...]
Just my R$0.02.
Great job, and sorry again for not taking it further =(
I'm off to the beach now...
Ramiro Polla
[1] http://article.gmane.org/gmane.comp.video.ffmpeg.devel/59602
More information about the ffmpeg-devel
mailing list