Changeset 3a49e9f3cae6e766766fbf81ed9239a6e475be7e
- Timestamp:
- 06/03/08 15:19:37 (3 months ago)
- git-parent:
- Files:
-
- modules/codec/ffmpeg/Modules.am (modified) (2 diffs)
- modules/codec/ffmpeg/avcodec.c (modified) (3 diffs)
- modules/codec/ffmpeg/avcodec.h (modified) (1 diff)
- modules/codec/ffmpeg/avformat.c (modified) (2 diffs)
- modules/codec/ffmpeg/avutil.h (added)
- modules/codec/ffmpeg/imgresample.c (modified) (2 diffs)
- modules/codec/ffmpeg/mux.c (modified) (4 diffs)
- modules/codec/ffmpeg/swscale.c (modified) (1 diff)
- modules/codec/ffmpeg/video.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/codec/ffmpeg/Modules.am
r11aac010 r3a49e9f 5 5 audio.c \ 6 6 deinterlace.c \ 7 avutil.h \ 7 8 fourcc.h \ 8 9 chroma.h \ … … 21 22 avformat.h \ 22 23 demux.c \ 24 avutil.h \ 23 25 fourcc.h \ 24 26 chroma.h \ modules/codec/ffmpeg/avcodec.c
r11aac010 r3a49e9f 50 50 #include "avcodec.h" 51 51 #include "fourcc.h" 52 #include "avutil.h" 52 53 53 54 /***************************************************************************** … … 334 335 } 335 336 336 /*****************************************************************************337 *338 *****************************************************************************/339 void LibavcodecCallback( void *p_opaque, int i_level,340 const char *psz_format, va_list va )341 {342 int i_vlc_level;343 AVCodecContext *p_avctx = (AVCodecContext *)p_opaque;344 AVClass *p_avc;345 vlc_object_t *p_this;346 char *psz_new_format;347 const char *psz_item_name;348 349 p_avc = p_avctx ? p_avctx->av_class : 0;350 351 #define cln p_avc->class_name352 /* Make sure we can get p_this back */353 if( !p_avctx || !p_avc || !cln ||354 cln[0]!='A' || cln[1]!='V' || cln[2]!='C' || cln[3]!='o' ||355 cln[4]!='d' || cln[5]!='e' || cln[6]!='c' )356 {357 if( i_level == AV_LOG_ERROR ) vfprintf( stderr, psz_format, va );358 return;359 }360 #undef cln361 362 p_this = (vlc_object_t *)p_avctx->opaque;363 364 switch( i_level )365 {366 case AV_LOG_QUIET:367 i_vlc_level = VLC_MSG_ERR;368 break;369 case AV_LOG_ERROR:370 i_vlc_level = VLC_MSG_WARN;371 break;372 case AV_LOG_INFO:373 i_vlc_level = VLC_MSG_DBG;374 break;375 case AV_LOG_DEBUG:376 /* Print debug messages if they were requested */377 if( p_avctx->debug ) vfprintf( stderr, psz_format, va );378 return;379 default:380 return;381 }382 383 psz_item_name = p_avc->item_name(p_opaque);384 psz_new_format = malloc( strlen(psz_format) + strlen(psz_item_name)385 + 18 + 5 );386 snprintf( psz_new_format, strlen(psz_format) + strlen(psz_item_name)387 + 18 + 5, "%s (%s@%p)", psz_format, p_avc->item_name(p_opaque), p_opaque );388 msg_GenericVa( p_this, i_vlc_level,389 MODULE_STRING, psz_new_format, va );390 free( psz_new_format );391 }392 393 337 void InitLibavcodec( vlc_object_t *p_object ) 394 338 { … … 401 345 avcodec_init(); 402 346 avcodec_register_all(); 403 av_log_set_callback( Libav codecCallback );347 av_log_set_callback( LibavutilCallback ); 404 348 b_ffmpeginit = 1; 405 349 modules/codec/ffmpeg/avcodec.h
r11aac010 r3a49e9f 21 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 22 22 *****************************************************************************/ 23 24 #include <vlc_codecs.h> /* BITMAPINFOHEADER */25 23 26 24 picture_t * DecodeVideo ( decoder_t *, block_t ** ); modules/codec/ffmpeg/avformat.c
r11aac010 r3a49e9f 35 35 36 36 /* ffmpeg header */ 37 #define HAVE_MMX 1 38 #ifdef HAVE_LIBAVCODEC_AVCODEC_H 39 # include <libavcodec/avcodec.h> 40 #elif defined(HAVE_FFMPEG_AVCODEC_H) 41 # include <ffmpeg/avcodec.h> 42 #else 43 # include <avcodec.h> 44 #endif 45 46 #if LIBAVCODEC_BUILD < 5000 47 # error You must have a libavcodec >= 5000 (get CVS) 37 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H 38 # include <libavformat/avformat.h> 39 #elif defined(HAVE_FFMPEG_AVFORMAT_H) 40 # include <ffmpeg/avformat.h> 48 41 #endif 49 42 … … 71 64 #endif 72 65 vlc_module_end(); 73 74 /*****************************************************************************75 *76 *****************************************************************************/77 void LibavcodecCallback( void *p_opaque, int i_level,78 const char *psz_format, va_list va )79 {80 int i_vlc_level;81 AVCodecContext *p_avctx = (AVCodecContext *)p_opaque;82 AVClass *p_avc;83 vlc_object_t *p_this;84 char *psz_new_format;85 const char *psz_item_name;86 87 p_avc = p_avctx ? p_avctx->av_class : 0;88 89 #define cln p_avc->class_name90 /* Make sure we can get p_this back */91 if( !p_avctx || !p_avc || !cln ||92 cln[0]!='A' || cln[1]!='V' || cln[2]!='C' || cln[3]!='o' ||93 cln[4]!='d' || cln[5]!='e' || cln[6]!='c' )94 {95 if( i_level == AV_LOG_ERROR ) vfprintf( stderr, psz_format, va );96 return;97 }98 #undef cln99 100 p_this = (vlc_object_t *)p_avctx->opaque;101 102 switch( i_level )103 {104 case AV_LOG_QUIET:105 i_vlc_level = VLC_MSG_ERR;106 break;107 case AV_LOG_ERROR:108 i_vlc_level = VLC_MSG_WARN;109 break;110 case AV_LOG_INFO:111 i_vlc_level = VLC_MSG_DBG;112 break;113 case AV_LOG_DEBUG:114 /* Print debug messages if they were requested */115 if( p_avctx->debug ) vfprintf( stderr, psz_format, va );116 return;117 default:118 return;119 }120 121 psz_item_name = p_avc->item_name(p_opaque);122 psz_new_format = malloc( strlen(psz_format) + strlen(psz_item_name)123 + 18 + 5 );124 snprintf( psz_new_format, strlen(psz_format) + strlen(psz_item_name)125 + 18 + 5, "%s (%s@%p)", psz_format, p_avc->item_name(p_opaque), p_opaque );126 msg_GenericVa( p_this, i_vlc_level,127 MODULE_STRING, psz_new_format, va );128 free( psz_new_format );129 }130 131 void InitLibavcodec( vlc_object_t *p_object )132 {133 static int b_ffmpeginit = 0;134 vlc_mutex_t *lock = var_AcquireMutex( "avcodec" );135 136 /* *** init ffmpeg library (libavcodec) *** */137 if( !b_ffmpeginit )138 {139 avcodec_init();140 avcodec_register_all();141 av_log_set_callback( LibavcodecCallback );142 b_ffmpeginit = 1;143 144 msg_Dbg( p_object, "libavcodec initialized (interface %d )",145 LIBAVCODEC_VERSION_INT );146 }147 else148 {149 msg_Dbg( p_object, "libavcodec already initialized" );150 }151 152 vlc_mutex_unlock( lock );153 }modules/codec/ffmpeg/imgresample.c
r11aac010 r3a49e9f 1 1 /***************************************************************************** 2 * ffmpeg.c: video decoder using ffmpeg library2 * imageresample.c: scaling and chroma conversion using the old libavcodec API 3 3 ***************************************************************************** 4 4 * Copyright (C) 1999-2001 the VideoLAN team … … 34 34 #include <vlc_codec.h> 35 35 36 /* ffmpeg header */37 #define HAVE_MMX 138 #ifdef HAVE_LIBAVCODEC_AVCODEC_H39 # include <libavcodec/avcodec.h>40 #elif defined(HAVE_FFMPEG_AVCODEC_H)41 # include <ffmpeg/avcodec.h>42 #else43 # include <avcodec.h>44 #endif45 46 #if LIBAVCODEC_BUILD < 500047 # error You must have a libavcodec >= 5000 (get CVS)48 #endif49 50 36 #include "imgresample.h" 51 52 /****************************************************************************53 * Local prototypes54 ****************************************************************************/55 static const int pi_mode_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };56 static const char *const ppsz_mode_descriptions[] =57 { N_("Fast bilinear"), N_("Bilinear"), N_("Bicubic (good quality)"),58 N_("Experimental"), N_("Nearest neighbour (bad quality)"),59 N_("Area"), N_("Luma bicubic / chroma bilinear"), N_("Gauss"),60 N_("SincR"), N_("Lanczos"), N_("Bicubic spline") };61 37 62 38 /***************************************************************************** modules/codec/ffmpeg/mux.c
r11aac010 r3a49e9f 43 43 #include "avformat.h" 44 44 #include "fourcc.h" 45 #include "avutil.h" 45 46 46 47 //#define AVFORMAT_DEBUG 1 47 48 /* Version checking */49 #if defined(HAVE_LIBAVFORMAT_AVFORMAT_H) || defined(HAVE_FFMPEG_AVFORMAT_H)50 48 51 49 static const char *const ppsz_mux_options[] = { … … 96 94 /* Should we call it only once ? */ 97 95 av_register_all(); 98 av_log_set_callback( Libav codecCallback );96 av_log_set_callback( LibavutilCallback ); 99 97 100 98 config_ChainParse( p_mux, "ffmpeg-", ppsz_mux_options, p_mux->p_cfg ); … … 225 223 codec = stream->codec; 226 224 227 /* This is used by Libav codecCallback (ffmpeg.c) to print messages */225 /* This is used by LibavutilCallback (avutil.h) to print messages */ 228 226 codec->opaque = (void*)p_mux; 229 227 … … 506 504 return 0; 507 505 } 508 509 #endif /* HAVE_FFMPEG_AVFORMAT_H */modules/codec/ffmpeg/swscale.c
r11aac010 r3a49e9f 39 39 ****************************************************************************/ 40 40 static const int pi_mode_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 }; 41 staticconst char *const ppsz_mode_descriptions[] =41 const char *const ppsz_mode_descriptions[] = 42 42 { N_("Fast bilinear"), N_("Bilinear"), N_("Bicubic (good quality)"), 43 43 N_("Experimental"), N_("Nearest neighbour (bad quality)"), modules/codec/ffmpeg/video.c
r11aac010 r3a49e9f 34 34 #include <vlc_vout.h> 35 35 #include <vlc_input.h> /* hmmm, just for INPUT_RATE_DEFAULT */ 36 #include <vlc_codecs.h> /* BITMAPINFOHEADER */ 36 37 37 38 /* ffmpeg header */
