Commit a519cacc authored by Antoine Cellerier's avatar Antoine Cellerier

Split ffmpeg module in avcodec (decoders, encoders, deinterlacing), avformat...

Split ffmpeg module in avcodec (decoders, encoders, deinterlacing), avformat (demuxers, muxers), swscale (scaling, chroma conversion) and postproc modules.
parent 7f9999df
...@@ -192,7 +192,7 @@ case "${host_os}" in ...@@ -192,7 +192,7 @@ case "${host_os}" in
VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation]) VLC_ADD_LDFLAGS([mkv mp4], [-Wl,-framework,IOKit,-framework,CoreFoundation])
VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup]) VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup])
VLC_ADD_LDFLAGS([libvlc_control],[-Wl,dynamic_lookup]) VLC_ADD_LDFLAGS([libvlc_control],[-Wl,dynamic_lookup])
VLC_ADD_LDFLAGS([ffmpeg i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress]) VLC_ADD_LDFLAGS([avcodec avformat swscale postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress])
VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings]) VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
VLC_ADD_LDFLAGS([libvlc],[-Wl,-framework,Cocoa,-framework,CoreFoundation]) VLC_ADD_LDFLAGS([libvlc],[-Wl,-framework,Cocoa,-framework,CoreFoundation])
VLC_ADD_LDFLAGS([motion],[-Wl,-framework,IOKit,-framework,CoreFoundation]) VLC_ADD_LDFLAGS([motion],[-Wl,-framework,IOKit,-framework,CoreFoundation])
...@@ -645,7 +645,7 @@ AC_CHECK_LIB(m,cos,[ ...@@ -645,7 +645,7 @@ AC_CHECK_LIB(m,cos,[
VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain],[-lm]) VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain],[-lm])
]) ])
AC_CHECK_LIB(m,pow,[ AC_CHECK_LIB(m,pow,[
VLC_ADD_LIBS([ffmpeg ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlc vorbis freetype mod mpc dmo quicktime realaudio realvideo galaktos opengl],[-lm]) VLC_ADD_LIBS([avcodec avformat swscale postproc ffmpegaltivec stream_out_transrate i420_rgb faad twolame equalizer spatializer param_eq libvlc vorbis freetype mod mpc dmo quicktime realaudio realvideo galaktos opengl],[-lm])
]) ])
AC_CHECK_LIB(m,sqrt,[ AC_CHECK_LIB(m,sqrt,[
VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm]) VLC_ADD_LIBS([headphone_channel_mixer normvol speex mono colorthres extract],[-lm])
...@@ -2993,102 +2993,98 @@ AS_IF([test "${enable_id3tag}" != "no"], [ ...@@ -2993,102 +2993,98 @@ AS_IF([test "${enable_id3tag}" != "no"], [
]) ])
dnl dnl
dnl ffmpeg decoder/demuxer plugin dnl avcodec decoder/encoder plugin
dnl dnl
dnl we try to find ffmpeg using : 1- given tree, 2- pkg-config
dnl 3- default place,
AC_ARG_ENABLE(ffmpeg, AC_ARG_ENABLE(avcodec,
[ --enable-ffmpeg ffmpeg codec (default enabled)]) [ --enable-avcodec libavcodec codec (default enabled)])
if test "${enable_ffmpeg}" != "no" if test "${enable_avcodec}" != "no"
then then
PKG_CHECK_MODULES(AVCODEC,[libavcodec, libavutil],
[
VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h)
AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
VLC_ADD_PLUGIN([avcodec])
VLC_ADD_LIBS([avcodec],[$AVCODEC_LIBS])
VLC_ADD_CFLAGS([avcodec],[$AVCODEC_CFLAGS])
VLC_RESTORE_FLAGS
],[
AC_MSG_ERROR([Could not find libavcodec or libavutil.])
])
fi
dnl
dnl avformat demuxer/muxer plugin
dnl
dnl Trying with pkg-config AC_ARG_ENABLE(avformat,
PKG_CHECK_MODULES(FFMPEG,[libavcodec, libavformat, libavutil], [ --enable-avformat libavformat containers (default enabled)])
if test "${enable_avformat}" != "no"
then
PKG_CHECK_MODULES(AVFORMAT,[libavformat, libavcodec, libavutil],
[ [
VLC_SAVE_FLAGS VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS} ${FFMPEG_CFLAGS}" CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
CFLAGS="${CFLAGS} ${FFMPEG_CFLAGS}" CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
AC_CHECK_HEADERS(ffmpeg/avcodec.h libavcodec/avcodec.h) AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h)
AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h) AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h)
AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h) AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
dnl newer ffmpeg have a separate libpostproc VLC_ADD_PLUGIN([avformat])
PKG_CHECK_MODULES(POSTPROC, libpostproc,[ VLC_ADD_LIBS([avformat],[$AVFORMAT_LIBS])
VLC_ADD_CFLAGS([ffmpeg],[${POSTPROC_CFLAGS}]) VLC_ADD_CFLAGS([avformat],[$AVFORMAT_CFLAGS])
VLC_ADD_LIBS([ffmpeg],[${POSTPROC_LIBS}]) VLC_RESTORE_FLAGS
]) ],[
CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}" AC_MSG_ERROR([Could not find libavformat, libavcodec or libavutil.])
CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}" ])
AC_CHECK_HEADERS(postproc/postprocess.h) fi
VLC_ADD_PLUGIN([ffmpeg])
if test "${enable_sout}" != "no" -a "${enable_switcher}" = "yes"; then
VLC_ADD_PLUGIN([stream_out_switcher])
fi
VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[${FFMPEG_CFLAGS}])
VLC_ADD_LIBS([ffmpeg stream_out_switcher],[${FFMPEG_LIBS}])
dnl even newer ffmpeg has a libswscale
PKG_CHECK_MODULES(SWSCALE,[libswscale],[
VLC_ADD_CFLAGS([ffmpeg],[${SWSCALE_CFLAGS}])
VLC_ADD_LIBS([ffmpeg],[${SWSCALE_LIBS}])
AC_CHECK_LIB(swscale, sws_getContext,
[AC_CHECK_HEADERS([ffmpeg/swscale.h libswscale/swscale.h])],
[AC_CHECK_LIB(avcodec,img_resample,[],
[AC_MSG_ERROR([Your FFmpeg library doesn't have the needed img_resample() function. You should rebuild it with software scaler disabled, or install the swscale headers.])],
[${FFMPEG_LIBS}])
],
[${SWSCALE_LIBS}])
],[AC_CHECK_LIB(avcodec,img_resample,[],
[AC_MSG_ERROR([Your FFmpeg library doesn't have the needed img_resample() function. You should rebuild it with software scaler disabled, or install the swscale headers.])],
[${FFMPEG_LIBS}])
]
)
VLC_RESTORE_FLAGS
],[ dnl
dnl swscale image scaling and conversion plugin
dnl
dnl AC_ARG_ENABLE(swscale,
dnl last chance: at the default place [ --enable-swscale libswscale image scaling and conversion (default enabled)])
dnl if test "${enable_swscale}" != "no"
then
PKG_CHECK_MODULES(SWSCALE,[libswscale, libavutil],
[
VLC_SAVE_FLAGS VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}" CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg} ${LIBS_ffmpeg}" CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
AC_CHECK_HEADERS(ffmpeg/avcodec.h libavcodec/avcodec.h) AC_CHECK_HEADERS(libswscale/swscale.h ffmpeg/swscale.h)
AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h) AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h) VLC_ADD_PLUGIN([swscale])
AC_CHECK_HEADERS(postproc/postprocess.h) VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
AC_CHECK_LIB(avutil, av_crc_init, [
VLC_ADD_LIBS([ffmpeg],[-lavutil])
LDAVUTIL="-lavutil"])
AC_CHECK_LIB(avcodec, avcodec_init, [
VLC_ADD_BUILTINS([ffmpeg])
VLC_ADD_LIBS([ffmpeg],[-lavcodec])
if test "${enable_sout}" != "no" -a "${enable_switcher}" = "yes"; then
VLC_ADD_BUILTINS([stream_out_switcher])
fi],
[ AC_MSG_ERROR([Could not find ffmpeg on your system: you may get it from http://ffmpeg.sf.net/ (svn version is recommended). Alternatively you can use --disable-ffmpeg to disable the ffmpeg plugins.]) ], [$LDAVUTIL])
AC_CHECK_LIB(postproc, pp_postprocess, [
VLC_ADD_LIBS([ffmpeg],[-lpostproc])],
AC_MSG_ERROR([Could not find libpostproc inside FFmpeg. You should configure FFmpeg with --enable-gpl --enable-postproc.]),
[$LDAVUTIL])
AC_CHECK_LIB(avformat, av_open_input_stream, [
VLC_ADD_LIBS([ffmpeg],[-lavformat -lz]) ], [], [-lavcodec -lz $LDAVUTIL])
VLC_RESTORE_FLAGS VLC_RESTORE_FLAGS
],[
AC_MSG_ERROR([Could not find libswscale or libavutil.])
])
fi
AC_CHECK_LIB(swscale, sws_getContext, [ dnl
AC_CHECK_HEADERS(ffmpeg/swscale.h libswscale/swscale.h) dnl postproc plugin
VLC_ADD_LIBS([ffmpeg],[-lswscale]) ], dnl
[AC_CHECK_LIB(avcodec,img_resample,[],
[AC_MSG_ERROR([Your FFmpeg library doesn't have the needed img_resample() function. You should rebuild it with software scaler disabled, or install the swscale headers.])],
[-lavcodec $LDAVUTIL])
],
[${SWSCALE_LIBS}])
AC_ARG_ENABLE(postproc,
[ --enable-postproc libpostproc image post-processing (default enabled)])
if test "${enable_postproc}" != "no"
then
PKG_CHECK_MODULES(POSTPROC,[libpostproc],
[
VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
AC_CHECK_HEADERS(libpostproc/postproc.h ffmpeg/postproc.h)
VLC_ADD_PLUGIN([postproc])
VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS])
VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS])
VLC_RESTORE_FLAGS VLC_RESTORE_FLAGS
],[
AC_MSG_ERROR([Could not find libpostproc.])
]) ])
fi fi
......
SOURCES_ffmpeg = \ SOURCES_avcodec = \
ffmpeg.c \ avcodec.c \
ffmpeg.h \ avcodec.h \
video.c \ video.c \
audio.c \ audio.c \
video_filter.c \
deinterlace.c \ deinterlace.c \
chroma.c \
postprocess.c \
demux.c \
scale.c \
$(NULL) $(NULL)
EXTRA_libffmpeg_plugin_la_SOURCES = \
mux.c \ if ENABLE_SOUT
SOURCES_avcodec += encoder.c
endif
EXTRA_libavcodec_plugin_la_SOURCES = \
encoder.c \ encoder.c \
$(NULL) $(NULL)
SOURCES_avformat = \
avformat.c \
avformat.h \
demux.c \
$(NULL)
if ENABLE_SOUT if ENABLE_SOUT
SOURCES_ffmpeg += mux.c encoder.c SOURCES_avformat += mux.c
endif endif
libvlc_LTLIBRARIES += $(LTLIBffmpeg)
EXTRA_LTLIBRARIES += libffmpeg_plugin.la
SOURCES_ffmpegaltivec = \ EXTRA_libavformat_plugin_la_SOURCES = \
ffmpeg.c \ mux.c \
ffmpeg.h \ $(NULL)
video.c \
audio.c \ SOURCES_swscale = \
swscale.c \
swscale.h \
video_filter.c \ video_filter.c \
deinterlace.c \
chroma.c \ chroma.c \
encoder.c \
postprocess.c \
demux.c \
mux.c \
scale.c \ scale.c \
$(NULL) $(NULL)
SOURCES_postproc = \
postproc.c \
postprocess.c \
$(NULL)
libvlc_LTLIBRARIES += \
$(LTLIBavcodec) \
$(LTLIBavformat) \
$(LTLIBswscale) \
$(LTLIBpostproc)
EXTRA_LTLIBRARIES += \
libavcodec_plugin.la \
libavformat_plugin.la \
libswscale_plugin.la \
libpostproc_plugin.la
# FIXME SOURCES_ffmpegaltivec = \
# FIXME ffmpeg.c \
# FIXME ffmpeg.h \
# FIXME video.c \
# FIXME audio.c \
# FIXME video_filter.c \
# FIXME deinterlace.c \
# FIXME chroma.c \
# FIXME encoder.c \
# FIXME postprocess.c \
# FIXME demux.c \
# FIXME mux.c \
# FIXME scale.c \
# FIXME $(NULL)
This diff is collapsed.
This diff is collapsed.
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include "ffmpeg.h" #include "ffmpeg.h"
#if !defined(HAVE_LIBSWSCALE_SWSCALE_H) && !defined(HAVE_FFMPEG_SWSCALE_H) #if !defined(HAVE_LIBSWSCALE_SWSCALE_H) && !defined(HAVE_FFMPEG_SWSCALE_H)
void InitLibavcodec ( vlc_object_t *p_object );
static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * ); static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * );
/***************************************************************************** /*****************************************************************************
...@@ -123,9 +122,6 @@ int OpenChroma( vlc_object_t *p_this ) ...@@ -123,9 +122,6 @@ int OpenChroma( vlc_object_t *p_this )
p_filter->p_sys->p_rsc = NULL; p_filter->p_sys->p_rsc = NULL;
} }
/* libavcodec needs to be initialized for some chroma conversions */
InitLibavcodec(p_this);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
This diff is collapsed.
...@@ -219,12 +219,12 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec, ...@@ -219,12 +219,12 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
p_pic = p_dec->pf_vout_buffer_new( p_dec ); p_pic = p_dec->pf_vout_buffer_new( p_dec );
if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init ) // FIXME if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init )
{ // FIXME {
InitPostproc( p_sys->p_pp, p_context->width, // FIXME InitPostproc( p_sys->p_pp, p_context->width,
p_context->height, p_context->pix_fmt ); // FIXME p_context->height, p_context->pix_fmt );
p_sys->b_pp_init = true; // FIXME p_sys->b_pp_init = true;
} // FIXME }
return p_pic; return p_pic;
} }
...@@ -361,7 +361,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -361,7 +361,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_pp = NULL; p_sys->p_pp = NULL;
p_sys->b_pp = p_sys->b_pp_async = p_sys->b_pp_init = false; p_sys->b_pp = p_sys->b_pp_async = p_sys->b_pp_init = false;
p_sys->p_pp = OpenPostproc( p_dec, &p_sys->b_pp_async ); // FIXME p_sys->p_pp = OpenPostproc( p_dec, &p_sys->b_pp_async );
/* ffmpeg doesn't properly release old pictures when frames are skipped */ /* ffmpeg doesn't properly release old pictures when frames are skipped */
//if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = 0; //if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = 0;
...@@ -724,7 +724,7 @@ void EndVideoDec( decoder_t *p_dec ) ...@@ -724,7 +724,7 @@ void EndVideoDec( decoder_t *p_dec )
decoder_sys_t *p_sys = p_dec->p_sys; decoder_sys_t *p_sys = p_dec->p_sys;
if( p_sys->p_ff_pic ) av_free( p_sys->p_ff_pic ); if( p_sys->p_ff_pic ) av_free( p_sys->p_ff_pic );
ClosePostproc( p_dec, p_sys->p_pp ); // FIXME ClosePostproc( p_dec, p_sys->p_pp );
free( p_sys->p_buffer_orig ); free( p_sys->p_buffer_orig );
} }
...@@ -819,9 +819,9 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec, ...@@ -819,9 +819,9 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
uint8_t *p_dst, *p_src; uint8_t *p_dst, *p_src;
int i_src_stride, i_dst_stride; int i_src_stride, i_dst_stride;
if( p_sys->p_pp && p_sys->b_pp ) // FIXME if( p_sys->p_pp && p_sys->b_pp )
PostprocPict( p_sys->p_pp, p_pic, p_ff_pic ); // FIXME PostprocPict( p_sys->p_pp, p_pic, p_ff_pic );
else // FIXME else
{ {
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ ) for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{ {
......
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
#include "ffmpeg.h" #include "ffmpeg.h"
#if !defined(HAVE_LIBSWSCALE_SWSCALE_H) && !defined(HAVE_FFMPEG_SWSCALE_H) #if !defined(HAVE_LIBSWSCALE_SWSCALE_H) && !defined(HAVE_FFMPEG_SWSCALE_H)
void InitLibavcodec ( vlc_object_t *p_object );
static int CheckInit( filter_t *p_filter ); static int CheckInit( filter_t *p_filter );
static picture_t *Process( filter_t *p_filter, picture_t *p_pic ); static picture_t *Process( filter_t *p_filter, picture_t *p_pic );
...@@ -150,9 +149,6 @@ static int OpenFilterEx( vlc_object_t *p_this, bool b_enable_croppadd ) ...@@ -150,9 +149,6 @@ static int OpenFilterEx( vlc_object_t *p_this, bool b_enable_croppadd )
p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height, p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height,
(char *)&p_filter->fmt_out.video.i_chroma ); (char *)&p_filter->fmt_out.video.i_chroma );
/* libavcodec needs to be initialized for some chroma conversions */
InitLibavcodec(p_this);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
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