Changeset a519caccb5a01a42700c664d69bb5ced218dafa1

Show
Ignore:
Timestamp:
06/02/08 18:43:54 (3 months ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1212425034 +0200
git-parent:

[7f9999df31ecac9d34fcf98a6074776ab275b754]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1212411693 +0200
Message:

Split ffmpeg module in avcodec (decoders, encoders, deinterlacing), avformat (demuxers, muxers), swscale (scaling, chroma conversion) and postproc modules.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • configure.ac

    r0b74611 ra519cac  
    193193    VLC_ADD_LDFLAGS([vlc],[-Wl,-undefined,dynamic_lookup]) 
    194194    VLC_ADD_LDFLAGS([libvlc_control],[-Wl,dynamic_lookup]) 
    195     VLC_ADD_LDFLAGS([ffmpeg i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress]) 
     195    VLC_ADD_LDFLAGS([avcodec avformat swscale postproc i420_rgb_mmx x264],[-Wl,-read_only_relocs,suppress]) 
    196196    VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings]) 
    197197    VLC_ADD_LDFLAGS([libvlc],[-Wl,-framework,Cocoa,-framework,CoreFoundation]) 
     
    646646]) 
    647647AC_CHECK_LIB(m,pow,[ 
    648   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]) 
     648  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]) 
    649649]) 
    650650AC_CHECK_LIB(m,sqrt,[ 
     
    29942994 
    29952995dnl 
    2996 dnl  ffmpeg decoder/demuxer plugin 
    2997 dnl 
    2998 dnl we try to find ffmpeg using : 1- given tree, 2- pkg-config 
    2999 dnl                               3- default place, 
    3000  
    3001 AC_ARG_ENABLE(ffmpeg, 
    3002 [  --enable-ffmpeg         ffmpeg codec (default enabled)]) 
    3003 if test "${enable_ffmpeg}" != "no" 
    3004 then 
    3005  
    3006 dnl Trying with pkg-config 
    3007    PKG_CHECK_MODULES(FFMPEG,[libavcodec, libavformat, libavutil], 
     2996dnl  avcodec decoder/encoder plugin 
     2997dnl 
     2998 
     2999AC_ARG_ENABLE(avcodec, 
     3000[  --enable-avcodec    libavcodec codec (default enabled)]) 
     3001if test "${enable_avcodec}" != "no" 
     3002then 
     3003  PKG_CHECK_MODULES(AVCODEC,[libavcodec, libavutil], 
    30083004    [ 
    3009      VLC_SAVE_FLAGS 
    3010      CPPFLAGS="${CPPFLAGS} ${FFMPEG_CFLAGS}" 
    3011      CFLAGS="${CFLAGS} ${FFMPEG_CFLAGS}" 
    3012      AC_CHECK_HEADERS(ffmpeg/avcodec.h libavcodec/avcodec.h) 
    3013      AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h) 
    3014      AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h) 
    3015      dnl newer ffmpeg have a separate libpostproc 
    3016      PKG_CHECK_MODULES(POSTPROC, libpostproc,[ 
    3017        VLC_ADD_CFLAGS([ffmpeg],[${POSTPROC_CFLAGS}])  
    3018        VLC_ADD_LIBS([ffmpeg],[${POSTPROC_LIBS}])  
    3019        ]) 
    3020      CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}" 
    3021      CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}" 
    3022      AC_CHECK_HEADERS(postproc/postprocess.h) 
    3023      VLC_ADD_PLUGIN([ffmpeg]) 
    3024      if test "${enable_sout}" != "no" -a "${enable_switcher}" = "yes"; then 
    3025         VLC_ADD_PLUGIN([stream_out_switcher]) 
    3026      fi 
    3027      VLC_ADD_CFLAGS([ffmpeg stream_out_switcher],[${FFMPEG_CFLAGS}]) 
    3028      VLC_ADD_LIBS([ffmpeg stream_out_switcher],[${FFMPEG_LIBS}]) 
    3029  
    3030      dnl even newer ffmpeg has a libswscale 
    3031      PKG_CHECK_MODULES(SWSCALE,[libswscale],[ 
    3032        VLC_ADD_CFLAGS([ffmpeg],[${SWSCALE_CFLAGS}]) 
    3033        VLC_ADD_LIBS([ffmpeg],[${SWSCALE_LIBS}]) 
    3034        AC_CHECK_LIB(swscale, sws_getContext, 
    3035          [AC_CHECK_HEADERS([ffmpeg/swscale.h libswscale/swscale.h])], 
    3036          [AC_CHECK_LIB(avcodec,img_resample,[], 
    3037             [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.])], 
    3038          [${FFMPEG_LIBS}]) 
    3039          ], 
    3040          [${SWSCALE_LIBS}]) 
    3041     ],[AC_CHECK_LIB(avcodec,img_resample,[], 
    3042         [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.])], 
    3043         [${FFMPEG_LIBS}]) 
    3044       ] 
    3045     ) 
    3046     VLC_RESTORE_FLAGS 
    3047  
    3048   ],[ 
    3049  
    3050     dnl 
    3051     dnl last chance: at the default place 
    3052     dnl 
    30533005      VLC_SAVE_FLAGS 
    3054       CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}" 
    3055       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg} ${LIBS_ffmpeg}" 
    3056       AC_CHECK_HEADERS(ffmpeg/avcodec.h libavcodec/avcodec.h) 
    3057       AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h) 
    3058       AC_CHECK_HEADERS(ffmpeg/avutil.h libavutil/avutil.h) 
    3059       AC_CHECK_HEADERS(postproc/postprocess.h) 
    3060  
    3061       AC_CHECK_LIB(avutil, av_crc_init, [ 
    3062         VLC_ADD_LIBS([ffmpeg],[-lavutil]) 
    3063         LDAVUTIL="-lavutil"]) 
    3064  
    3065       AC_CHECK_LIB(avcodec, avcodec_init, [ 
    3066         VLC_ADD_BUILTINS([ffmpeg]) 
    3067         VLC_ADD_LIBS([ffmpeg],[-lavcodec]) 
    3068         if test "${enable_sout}" != "no" -a "${enable_switcher}" = "yes"; then 
    3069             VLC_ADD_BUILTINS([stream_out_switcher]) 
    3070         fi], 
    3071          [ 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]) 
    3072  
    3073       AC_CHECK_LIB(postproc, pp_postprocess, [ 
    3074         VLC_ADD_LIBS([ffmpeg],[-lpostproc])], 
    3075       AC_MSG_ERROR([Could not find libpostproc inside FFmpeg. You should configure FFmpeg with --enable-gpl --enable-postproc.]), 
    3076         [$LDAVUTIL]) 
    3077  
    3078       AC_CHECK_LIB(avformat, av_open_input_stream, [ 
    3079         VLC_ADD_LIBS([ffmpeg],[-lavformat -lz]) ], [], [-lavcodec -lz $LDAVUTIL]) 
     3006      CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}" 
     3007      CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}" 
     3008      AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h) 
     3009      AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h) 
     3010      VLC_ADD_PLUGIN([avcodec]) 
     3011      VLC_ADD_LIBS([avcodec],[$AVCODEC_LIBS]) 
     3012      VLC_ADD_CFLAGS([avcodec],[$AVCODEC_CFLAGS]) 
    30803013      VLC_RESTORE_FLAGS 
    3081  
    3082       AC_CHECK_LIB(swscale, sws_getContext, [ 
    3083         AC_CHECK_HEADERS(ffmpeg/swscale.h libswscale/swscale.h) 
    3084         VLC_ADD_LIBS([ffmpeg],[-lswscale]) ], 
    3085         [AC_CHECK_LIB(avcodec,img_resample,[], 
    3086             [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.])], 
    3087         [-lavcodec $LDAVUTIL]) 
    3088       ], 
    3089       [${SWSCALE_LIBS}]) 
    3090  
     3014    ],[ 
     3015      AC_MSG_ERROR([Could not find libavcodec or libavutil.]) 
     3016  ]) 
     3017fi 
     3018 
     3019dnl 
     3020dnl  avformat demuxer/muxer plugin 
     3021dnl 
     3022 
     3023AC_ARG_ENABLE(avformat, 
     3024[  --enable-avformat   libavformat containers (default enabled)]) 
     3025if test "${enable_avformat}" != "no" 
     3026then 
     3027  PKG_CHECK_MODULES(AVFORMAT,[libavformat, libavcodec, libavutil], 
     3028    [ 
     3029      VLC_SAVE_FLAGS 
     3030      CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}" 
     3031      CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}" 
     3032      AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h) 
     3033      AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h) 
     3034      AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h) 
     3035      VLC_ADD_PLUGIN([avformat]) 
     3036      VLC_ADD_LIBS([avformat],[$AVFORMAT_LIBS]) 
     3037      VLC_ADD_CFLAGS([avformat],[$AVFORMAT_CFLAGS]) 
    30913038      VLC_RESTORE_FLAGS 
     3039    ],[ 
     3040      AC_MSG_ERROR([Could not find libavformat, libavcodec or libavutil.]) 
     3041  ]) 
     3042fi 
     3043 
     3044dnl 
     3045dnl  swscale image scaling and conversion plugin 
     3046dnl 
     3047 
     3048AC_ARG_ENABLE(swscale, 
     3049[  --enable-swscale    libswscale image scaling and conversion (default enabled)]) 
     3050if test "${enable_swscale}" != "no" 
     3051then 
     3052  PKG_CHECK_MODULES(SWSCALE,[libswscale, libavutil], 
     3053    [ 
     3054      VLC_SAVE_FLAGS 
     3055      CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}" 
     3056      CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}" 
     3057      AC_CHECK_HEADERS(libswscale/swscale.h ffmpeg/swscale.h) 
     3058      AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h) 
     3059      VLC_ADD_PLUGIN([swscale]) 
     3060      VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS]) 
     3061      VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS]) 
     3062      VLC_RESTORE_FLAGS 
     3063    ],[ 
     3064      AC_MSG_ERROR([Could not find libswscale or libavutil.]) 
     3065  ]) 
     3066fi 
     3067 
     3068dnl 
     3069dnl  postproc plugin 
     3070dnl 
     3071 
     3072AC_ARG_ENABLE(postproc, 
     3073[  --enable-postproc   libpostproc image post-processing (default enabled)]) 
     3074if test "${enable_postproc}" != "no" 
     3075then 
     3076  PKG_CHECK_MODULES(POSTPROC,[libpostproc], 
     3077    [ 
     3078      VLC_SAVE_FLAGS 
     3079      CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}" 
     3080      CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}" 
     3081      AC_CHECK_HEADERS(libpostproc/postproc.h ffmpeg/postproc.h) 
     3082      VLC_ADD_PLUGIN([postproc]) 
     3083      VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS]) 
     3084      VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS]) 
     3085      VLC_RESTORE_FLAGS 
     3086    ],[ 
     3087      AC_MSG_ERROR([Could not find libpostproc.]) 
    30923088  ]) 
    30933089fi 
  • modules/codec/ffmpeg/Modules.am

    rbbb0de5 ra519cac  
    1 SOURCES_ffmpeg = \ 
    2     ffmpeg.c \ 
    3     ffmpeg.h \ 
     1SOURCES_avcodec = \ 
     2    avcodec.c \ 
     3    avcodec.h \ 
    44    video.c \ 
    55    audio.c \ 
    6     video_filter.c \ 
    76    deinterlace.c \ 
    8     chroma.c \ 
    9     postprocess.c \ 
    10     demux.c \ 
    11     scale.c \ 
    127    $(NULL) 
    13 EXTRA_libffmpeg_plugin_la_SOURCES = \ 
    14     mux.c \ 
     8 
     9if ENABLE_SOUT 
     10SOURCES_avcodec += encoder.c 
     11endif 
     12 
     13EXTRA_libavcodec_plugin_la_SOURCES = \ 
    1514    encoder.c \ 
    1615    $(NULL) 
    1716 
     17SOURCES_avformat = \ 
     18    avformat.c \ 
     19    avformat.h \ 
     20    demux.c \ 
     21    $(NULL) 
     22 
    1823if ENABLE_SOUT 
    19 SOURCES_ffmpeg += mux.c encoder.c 
     24SOURCES_avformat += mux.c 
    2025endif 
    21 libvlc_LTLIBRARIES += $(LTLIBffmpeg) 
    22 EXTRA_LTLIBRARIES += libffmpeg_plugin.la 
    2326 
    24 SOURCES_ffmpegaltivec = \ 
    25     ffmpeg.c \ 
    26     ffmpeg.h \ 
    27     video.c \ 
    28     audio.c \ 
     27EXTRA_libavformat_plugin_la_SOURCES = \ 
     28    mux.c \ 
     29    $(NULL) 
     30 
     31SOURCES_swscale = \ 
     32    swscale.c \ 
     33    swscale.h \ 
    2934    video_filter.c \ 
    30     deinterlace.c \ 
    3135    chroma.c \ 
    32     encoder.c \ 
    33     postprocess.c \ 
    34     demux.c \ 
    35     mux.c \ 
    3636    scale.c \ 
    3737    $(NULL) 
    3838 
     39SOURCES_postproc = \ 
     40    postproc.c \ 
     41    postprocess.c \ 
     42    $(NULL) 
     43 
     44libvlc_LTLIBRARIES += \ 
     45    $(LTLIBavcodec) \ 
     46    $(LTLIBavformat) \ 
     47    $(LTLIBswscale) \ 
     48    $(LTLIBpostproc) 
     49 
     50EXTRA_LTLIBRARIES += \ 
     51    libavcodec_plugin.la \ 
     52    libavformat_plugin.la \ 
     53    libswscale_plugin.la \ 
     54    libpostproc_plugin.la 
     55 
     56# FIXME SOURCES_ffmpegaltivec = \ 
     57# FIXME     ffmpeg.c \ 
     58# FIXME     ffmpeg.h \ 
     59# FIXME     video.c \ 
     60# FIXME     audio.c \ 
     61# FIXME     video_filter.c \ 
     62# FIXME     deinterlace.c \ 
     63# FIXME     chroma.c \ 
     64# FIXME     encoder.c \ 
     65# FIXME     postprocess.c \ 
     66# FIXME     demux.c \ 
     67# FIXME     mux.c \ 
     68# FIXME     scale.c \ 
     69# FIXME     $(NULL) 
     70 
  • modules/codec/ffmpeg/chroma.c

    r2e2178f ra519cac  
    4949 
    5050#if !defined(HAVE_LIBSWSCALE_SWSCALE_H)  && !defined(HAVE_FFMPEG_SWSCALE_H) 
    51 void InitLibavcodec ( vlc_object_t *p_object ); 
    5251static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * ); 
    5352 
     
    124123    } 
    125124 
    126     /* libavcodec needs to be initialized for some chroma conversions */ 
    127     InitLibavcodec(p_this); 
    128  
    129125    return VLC_SUCCESS; 
    130126} 
  • modules/codec/ffmpeg/video.c

    r3561b9b ra519cac  
    220220    p_pic = p_dec->pf_vout_buffer_new( p_dec ); 
    221221 
    222     if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init ) 
    223     { 
    224         InitPostproc( p_sys->p_pp, p_context->width, 
    225                           p_context->height, p_context->pix_fmt ); 
    226         p_sys->b_pp_init = true; 
    227     } 
     222// FIXME    if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init ) 
     223// FIXME    { 
     224// FIXME        InitPostproc( p_sys->p_pp, p_context->width, 
     225// FIXME                          p_context->height, p_context->pix_fmt ); 
     226// FIXME        p_sys->b_pp_init = true; 
     227// FIXME    } 
    228228 
    229229    return p_pic; 
     
    362362    p_sys->p_pp = NULL; 
    363363    p_sys->b_pp = p_sys->b_pp_async = p_sys->b_pp_init = false; 
    364     p_sys->p_pp = OpenPostproc( p_dec, &p_sys->b_pp_async ); 
     364    // FIXME p_sys->p_pp = OpenPostproc( p_dec, &p_sys->b_pp_async ); 
    365365 
    366366    /* ffmpeg doesn't properly release old pictures when frames are skipped */ 
     
    725725 
    726726    if( p_sys->p_ff_pic ) av_free( p_sys->p_ff_pic ); 
    727     ClosePostproc( p_dec, p_sys->p_pp ); 
     727    // FIXME ClosePostproc( p_dec, p_sys->p_pp ); 
    728728    free( p_sys->p_buffer_orig ); 
    729729} 
     
    820820        int i_src_stride, i_dst_stride; 
    821821 
    822         if( p_sys->p_pp && p_sys->b_pp ) 
    823             PostprocPict( p_sys->p_pp, p_pic, p_ff_pic ); 
    824         else 
     822        // FIXME if( p_sys->p_pp && p_sys->b_pp ) 
     823        // FIXME    PostprocPict( p_sys->p_pp, p_pic, p_ff_pic ); 
     824        // FIXME else 
    825825        { 
    826826            for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ ) 
  • modules/codec/ffmpeg/video_filter.c

    r3561b9b ra519cac  
    4747 
    4848#if !defined(HAVE_LIBSWSCALE_SWSCALE_H)  && !defined(HAVE_FFMPEG_SWSCALE_H) 
    49 void InitLibavcodec ( vlc_object_t *p_object ); 
    5049static int CheckInit( filter_t *p_filter ); 
    5150static picture_t *Process( filter_t *p_filter, picture_t *p_pic ); 
     
    150149             p_filter->fmt_out.video.i_width, p_filter->fmt_out.video.i_height, 
    151150             (char *)&p_filter->fmt_out.video.i_chroma ); 
    152  
    153     /* libavcodec needs to be initialized for some chroma conversions */ 
    154     InitLibavcodec(p_this); 
    155151 
    156152    return VLC_SUCCESS;