Commit c721d803 authored by Luca Abeni's avatar Luca Abeni

Introduce libavdevice

Originally committed as revision 11077 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 489b0d4d
version <next>
- The "device" muxers and demuxers are now in a new libavdevice library
- DV50 AKA DVCPRO50 encoder, decoder, muxer and demuxer
- TechSmith Camtasia (TSCC) video decoder
- IBM Ultimotion (ULTI) video decoder
......
......@@ -8,6 +8,7 @@ VPATH=$(SRC_PATH_BARE)
CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
-I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
-I$(SRC_PATH)/libavdevice \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H
LDFLAGS+= -g
......@@ -25,9 +26,9 @@ ALLPROGS_G = $(addsuffix _g$(EXESUF), $(BASENAMES))
ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
ifeq ($(BUILD_SHARED),yes)
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF)
DEP_LIBS=libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavdevice/$(SLIBPREF)avdevice$(SLIBSUF)
else
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF)
DEP_LIBS=libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavdevice/$(LIBPREF)avdevice$(LIBSUF)
endif
ALL_TARGETS-$(CONFIG_VHOOK) += videohook
......@@ -60,8 +61,8 @@ LIBS_drawtext$(SLIBSUF) = `freetype-config --libs`
VHOOKCFLAGS += $(VHOOKCFLAGS-yes)
SRCS = $(addsuffix .c, $(PROGS-yes)) cmdutils.c
LDFLAGS := -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
EXTRALIBS := -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
LDFLAGS := -L$(BUILD_ROOT)/libavdevice -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil $(LDFLAGS)
EXTRALIBS := -lavdevice$(BUILDSUF) -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)
ifeq ($(CONFIG_SWSCALER),yes)
LDFLAGS+=-L$(BUILD_ROOT)/libswscale
......@@ -74,6 +75,7 @@ lib:
$(MAKE) -C libavutil all
$(MAKE) -C libavcodec all
$(MAKE) -C libavformat all
$(MAKE) -C libavdevice all
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc all
endif
......@@ -165,6 +167,7 @@ install-libs:
$(MAKE) -C libavutil install-libs
$(MAKE) -C libavcodec install-libs
$(MAKE) -C libavformat install-libs
$(MAKE) -C libavdevice install-libs
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc install-libs
endif
......@@ -180,6 +183,7 @@ install-headers:
$(MAKE) -C libavutil install-headers
$(MAKE) -C libavcodec install-headers
$(MAKE) -C libavformat install-headers
$(MAKE) -C libavdevice install-headers
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc install-headers
endif
......@@ -201,6 +205,7 @@ uninstall-libs:
$(MAKE) -C libavutil uninstall-libs
$(MAKE) -C libavcodec uninstall-libs
$(MAKE) -C libavformat uninstall-libs
$(MAKE) -C libavdevice uninstall-libs
$(MAKE) -C libpostproc uninstall-libs
$(MAKE) -C libswscale uninstall-libs
......@@ -208,6 +213,7 @@ uninstall-headers:
$(MAKE) -C libavutil uninstall-headers
$(MAKE) -C libavcodec uninstall-headers
$(MAKE) -C libavformat uninstall-headers
$(MAKE) -C libavdevice uninstall-headers
$(MAKE) -C libpostproc uninstall-headers
$(MAKE) -C libswscale uninstall-headers
-rmdir "$(INCDIR)"
......@@ -216,6 +222,7 @@ depend dep: .depend .vhookdep
$(MAKE) -C libavutil depend
$(MAKE) -C libavcodec depend
$(MAKE) -C libavformat depend
$(MAKE) -C libavdevice depend
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc depend
endif
......@@ -239,6 +246,7 @@ clean:
$(MAKE) -C libavutil clean
$(MAKE) -C libavcodec clean
$(MAKE) -C libavformat clean
$(MAKE) -C libavdevice clean
$(MAKE) -C libpostproc clean
$(MAKE) -C libswscale clean
rm -f *.o *~ .libs gmon.out TAGS $(ALLPROGS) $(ALLPROGS_G) \
......@@ -252,6 +260,7 @@ distclean: clean
$(MAKE) -C libavutil distclean
$(MAKE) -C libavcodec distclean
$(MAKE) -C libavformat distclean
$(MAKE) -C libavdevice distclean
$(MAKE) -C libpostproc distclean
$(MAKE) -C libswscale distclean
rm -f .depend .vhookdep version.h config.* *.pc
......
......@@ -920,9 +920,11 @@ PARSER_LIST=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' "$source_path/
BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"`
MUXER_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
INDEV_LIST=`sed -n 's/^[^#]*_IN.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavdevice/alldevices.c"`
OUTDEV_LIST=`sed -n 's/^[^#]*OUTDEV.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavdevice/alldevices.c"`
PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"`
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST $PROTOCOL_LIST $BSF_LIST
enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST $PROTOCOL_LIST $BSF_LIST $INDEV_LIST $OUTDEV_LIST
enable $ARCH_EXT_LIST
die_unknown(){
......@@ -1729,13 +1731,16 @@ enabled_any $ENCODER_LIST && enable encoders
enabled_any $DECODER_LIST && enable decoders
enabled_any $MUXER_LIST && enable muxers
enabled_any $DEMUXER_LIST && enable demuxers
enabled_any $OUTDEV_LIST && enable muxers
enabled_any $INDEV_LIST && enable demuxers
enabled_any $PROTOCOL_LIST && enable protocols
enabled_any $BSF_LIST && enable bsfs
enabled_any $THREADS_LIST && enable threads
check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \
$BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST
$BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST \
$INDEV_LIST $OUTDEV_LIST
enabled libdc1394 && append pkg_requires "libraw1394"
enabled libtheora && append pkg_requires "theora"
......@@ -1888,6 +1893,7 @@ fi
sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
lavd_version=`grep '#define LIBAVDEVICE_VERSION ' "$source_path/libavdevice/avdevice.h" | sed 's/[^0-9\.]//g'`
lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
......@@ -1900,6 +1906,8 @@ if enabled shared; then
echo "SPPVERSION=$pp_version" >> config.mak
echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
echo "LAVCVERSION=$lavc_version" >> config.mak
echo "LAVDMAJOR=${lavd_version%%.*}" >> config.mak
echo "LAVDVERSION=$lavd_version" >> config.mak
echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
echo "LAVFVERSION=$lavf_version" >> config.mak
echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
......@@ -1926,6 +1934,8 @@ print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
$DEMUXER_LIST \
$MUXER_LIST \
$PROTOCOL_LIST \
$INDEV_LIST \
$OUTDEV_LIST \
echo "#define restrict $_restrict" >> $TMPH
......@@ -2050,6 +2060,8 @@ pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version"
pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg
pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version"
pkgconfig_generate libavdevice "FFmpeg device handling library" "$lavd_version" "-lavdevice $extralibs" "$pkg_requires libavformat = $lavf_version" ffmpeg
pkgconfig_generate_uninstalled libavdevice "FFmpeg device handling library" "$lavd_version" "$extralibs" "$pkg_requires libavformat = $lavf_version"
if enabled pp; then
pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc
pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version"
......
......@@ -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"
......@@ -3884,6 +3885,8 @@ int main(int argc, char **argv)
int i;
int64_t ti;
avcodec_register_all();
avdevice_register_all();
av_register_all();
for(i=0; i<CODEC_TYPE_NB; i++){
......
......@@ -22,6 +22,7 @@
#include <math.h>
#include <limits.h>
#include "avformat.h"
#include "avdevice.h"
#include "rtsp.h"
#include "swscale.h"
#include "avstring.h"
......@@ -2517,6 +2518,8 @@ int main(int argc, char **argv)
int flags;
/* register all codecs, demux and protocols */
avcodec_register_all();
avdevice_register_all();
av_register_all();
show_banner(program_name, program_birth_year);
......
include ../config.mak
NAME=avdevice
LIBVERSION=$(LAVDVERSION)
LIBMAJOR=$(LAVDMAJOR)
CFLAGS += -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat
OBJS = alldevices.o
HEADERS = avdevice.h
# input/output devices
OBJS-$(CONFIG_BKTR_DEMUXER) += bktr.o
OBJS-$(CONFIG_DV1394_DEMUXER) += dv1394.o
OBJS-$(CONFIG_OSS_DEMUXER) += audio.o
OBJS-$(CONFIG_OSS_MUXER) += audio.o
OBJS-$(CONFIG_V4L2_DEMUXER) += v4l2.o
OBJS-$(CONFIG_V4L_DEMUXER) += v4l.o
OBJS-$(CONFIG_X11_GRAB_DEVICE_DEMUXER) += x11grab.o
# external libraries
OBJS-$(CONFIG_LIBDC1394_DEMUXER) += libdc1394.o
CPPOBJS-$(CONFIG_AUDIO_BEOS_DEMUXER) += beosaudio.o
CPPOBJS-$(CONFIG_AUDIO_BEOS_MUXER) += beosaudio.o
include ../common.mak
/*
* Register all the grabbing devices.
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
#include "avdevice.h"
#define REGISTER_OUTDEV(X,x) { \
extern AVOutputFormat x##_muxer; \
if(ENABLE_##X##_MUXER) av_register_output_format(&x##_muxer); }
#define REGISTER_INDEV(X,x) { \
extern AVInputFormat x##_demuxer; \
if(ENABLE_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }
#define REGISTER_INOUTDEV(X,x) REGISTER_INDEV(X,x); REGISTER_OUTDEV(X,x)
void avdevice_register_all(void)
{
static int inited;
if (inited)
return;
inited = 1;
/* devices */
REGISTER_INOUTDEV (AUDIO_BEOS, audio_beos);
REGISTER_INDEV (BKTR, bktr);
REGISTER_INDEV (DV1394, dv1394);
REGISTER_INOUTDEV (OSS, oss);
REGISTER_INDEV (V4L2, v4l2);
REGISTER_INDEV (V4L, v4l);
REGISTER_INDEV (X11_GRAB_DEVICE, x11_grab_device);
/* external libraries */
REGISTER_INDEV (LIBDC1394, libdc1394);
}
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FFMPEG_AVDEVICE_H
#define FFMPEG_AVDEVICE_H
#define LIBAVDEVICE_VERSION_INT ((52<<16)+(0<<8)+0)
#define LIBAVDEVICE_VERSION 52.0.0
#define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
/**
* Initialize libavdevice and register all the input and output devices.
* @warning This function is not thread safe.
*/
void avdevice_register_all(void);
#endif /* FFMPEG_AVDEVICE_H */
......@@ -31,7 +31,6 @@ OBJS-$(CONFIG_AVI_MUXER) += avienc.o riff.o
OBJS-$(CONFIG_AVISYNTH) += avisynth.o
OBJS-$(CONFIG_AVS_DEMUXER) += avs.o vocdec.o voc.o
OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o
OBJS-$(CONFIG_BKTR_DEMUXER) += bktr.o
OBJS-$(CONFIG_C93_DEMUXER) += c93.o vocdec.o voc.o
OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
OBJS-$(CONFIG_DAUD_DEMUXER) += daud.o
......@@ -39,7 +38,6 @@ OBJS-$(CONFIG_DSICIN_DEMUXER) += dsicin.o
OBJS-$(CONFIG_DTS_DEMUXER) += raw.o
OBJS-$(CONFIG_DV_DEMUXER) += dv.o
OBJS-$(CONFIG_DV_MUXER) += dvenc.o
OBJS-$(CONFIG_DV1394_DEMUXER) += dv1394.o dv.o
OBJS-$(CONFIG_DXA_DEMUXER) += dxa.o riff.o
OBJS-$(CONFIG_EA_CDATA_DEMUXER) += eacdata.o
OBJS-$(CONFIG_EA_DEMUXER) += electronicarts.o
......@@ -114,8 +112,6 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
oggparseogm.o \
riff.o
OBJS-$(CONFIG_OGG_MUXER) += oggenc.o
OBJS-$(CONFIG_OSS_DEMUXER) += audio.o
OBJS-$(CONFIG_OSS_MUXER) += audio.o
OBJS-$(CONFIG_PSP_MUXER) += movenc.o riff.o isom.o
OBJS-$(CONFIG_RAWVIDEO_DEMUXER) += raw.o
OBJS-$(CONFIG_RAWVIDEO_MUXER) += raw.o
......@@ -141,8 +137,6 @@ OBJS-$(CONFIG_THP_DEMUXER) += thp.o
OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER) += tiertexseq.o
OBJS-$(CONFIG_TTA_DEMUXER) += tta.o
OBJS-$(CONFIG_TXD_DEMUXER) += txd.o
OBJS-$(CONFIG_V4L2_DEMUXER) += v4l2.o
OBJS-$(CONFIG_V4L_DEMUXER) += v4l.o
OBJS-$(CONFIG_VC1_DEMUXER) += raw.o
OBJS-$(CONFIG_VMD_DEMUXER) += sierravmd.o
OBJS-$(CONFIG_VOC_DEMUXER) += vocdec.o voc.o
......@@ -153,12 +147,10 @@ OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o
OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o
OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o
OBJS-$(CONFIG_WV_DEMUXER) += wv.o
OBJS-$(CONFIG_X11_GRAB_DEVICE_DEMUXER) += x11grab.o
OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg.o
OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpeg.o
# external libraries
OBJS-$(CONFIG_LIBDC1394_DEMUXER) += libdc1394.o
OBJS-$(CONFIG_LIBNUT_DEMUXER) += libnut.o riff.o
OBJS-$(CONFIG_LIBNUT_MUXER) += libnut.o riff.o
......@@ -167,9 +159,6 @@ OBJS-$(CONFIG_VHOOK) += framehook.o
EXTRALIBS := -L$(BUILD_ROOT)/libavutil -lavutil$(BUILDSUF) \
-lavcodec$(BUILDSUF) -L$(BUILD_ROOT)/libavcodec $(EXTRALIBS)
CPPOBJS-$(CONFIG_AUDIO_BEOS_DEMUXER) += beosaudio.o
CPPOBJS-$(CONFIG_AUDIO_BEOS_MUXER) += beosaudio.o
# protocols I/O
OBJS+= avio.o aviobuf.o
......
......@@ -60,19 +60,16 @@ void av_register_all(void)
REGISTER_MUXDEMUX (ASF, asf);
REGISTER_MUXER (ASF_STREAM, asf_stream);
REGISTER_MUXDEMUX (AU, au);
REGISTER_MUXDEMUX (AUDIO_BEOS, audio_beos);
REGISTER_MUXDEMUX (AVI, avi);
REGISTER_DEMUXER (AVISYNTH, avisynth);
REGISTER_DEMUXER (AVS, avs);
REGISTER_DEMUXER (BETHSOFTVID, bethsoftvid);
REGISTER_DEMUXER (BKTR, bktr);
REGISTER_DEMUXER (C93, c93);
REGISTER_MUXER (CRC, crc);
REGISTER_DEMUXER (DAUD, daud);
REGISTER_DEMUXER (DSICIN, dsicin);
REGISTER_DEMUXER (DTS, dts);
REGISTER_MUXDEMUX (DV, dv);
REGISTER_DEMUXER (DV1394, dv1394);
REGISTER_DEMUXER (DXA, dxa);
REGISTER_DEMUXER (EA, ea);
REGISTER_DEMUXER (EA_CDATA, ea_cdata);
......@@ -123,7 +120,6 @@ void av_register_all(void)
REGISTER_MUXDEMUX (NUT, nut);
REGISTER_DEMUXER (NUV, nuv);
REGISTER_MUXDEMUX (OGG, ogg);
REGISTER_MUXDEMUX (OSS, oss);
REGISTER_MUXDEMUX (PCM_ALAW, pcm_alaw);
REGISTER_MUXDEMUX (PCM_MULAW, pcm_mulaw);
REGISTER_MUXDEMUX (PCM_S16BE, pcm_s16be);
......@@ -156,8 +152,6 @@ void av_register_all(void)
REGISTER_DEMUXER (TIERTEXSEQ, tiertexseq);
REGISTER_DEMUXER (TTA, tta);
REGISTER_DEMUXER (TXD, txd);
REGISTER_DEMUXER (V4L2, v4l2);
REGISTER_DEMUXER (V4L, v4l);
REGISTER_DEMUXER (VC1, vc1);
REGISTER_DEMUXER (VMD, vmd);
REGISTER_MUXDEMUX (VOC, voc);
......@@ -166,11 +160,9 @@ void av_register_all(void)
REGISTER_DEMUXER (WSAUD, wsaud);
REGISTER_DEMUXER (WSVQA, wsvqa);
REGISTER_DEMUXER (WV, wv);
REGISTER_DEMUXER (X11_GRAB_DEVICE, x11_grab_device);
REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe);
/* external libraries */
REGISTER_DEMUXER (LIBDC1394, libdc1394);
REGISTER_MUXDEMUX (LIBNUT, libnut);
/* protocols */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment