Merge branch 'master' of https://github.com/ZoneMinder/ZoneMinder into plugin_support

This commit is contained in:
Emmanuel Papin 2015-06-08 19:42:57 +02:00
commit a32a0f2752
10 changed files with 173 additions and 64 deletions

View File

@ -191,7 +191,7 @@ sub runServer
$dbh = zmDbConnect(); $dbh = zmDbConnect();
$x10 = new X10::ActiveHome( port=>ZM_X10_DEVICE, house_code=>ZM_X10_HOUSE_CODE, debug=>0 ); $x10 = new X10::ActiveHome( port=>$Config{ZM_X10_DEVICE}, house_code=>$Config{ZM_X10_HOUSE_CODE}, debug=>0 );
loadTasks(); loadTasks();
@ -204,7 +204,7 @@ sub runServer
#print( "F:".fileno(SERVER)."\n" ); #print( "F:".fileno(SERVER)."\n" );
my $reload = undef; my $reload = undef;
my $reload_count = 0; my $reload_count = 0;
my $reload_limit = &ZM_X10_DB_RELOAD_INTERVAL / $timeout; my $reload_limit = $Config{ZM_X10_DB_RELOAD_INTERVAL} / $timeout;
while( 1 ) while( 1 )
{ {
my $nfound = select( my $rout = $rin, undef, undef, $timeout ); my $nfound = select( my $rout = $rin, undef, undef, $timeout );
@ -750,7 +750,7 @@ sub x10listen
foreach my $event ( @_ ) foreach my $event ( @_ )
{ {
#print( Data::Dumper( $_ )."\n" ); #print( Data::Dumper( $_ )."\n" );
if ( $event->house_code() eq ZM_X10_HOUSE_CODE ) if ( $event->house_code() eq $Config{ZM_X10_HOUSE_CODE} )
{ {
my $unit_code = $event->unit_code(); my $unit_code = $event->unit_code();
my $device = $device_hash{$unit_code}; my $device = $device_hash{$unit_code};

View File

@ -76,13 +76,21 @@ SWScale::SWScale() : gotdefaults(false), swscale_ctx(NULL), input_avframe(NULL),
Debug(4,"SWScale object created"); Debug(4,"SWScale object created");
/* Allocate AVFrame for the input */ /* Allocate AVFrame for the input */
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
input_avframe = av_frame_alloc();
#else
input_avframe = avcodec_alloc_frame(); input_avframe = avcodec_alloc_frame();
#endif
if(input_avframe == NULL) { if(input_avframe == NULL) {
Fatal("Failed allocating AVFrame for the input"); Fatal("Failed allocating AVFrame for the input");
} }
/* Allocate AVFrame for the output */ /* Allocate AVFrame for the output */
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
output_avframe = av_frame_alloc();
#else
output_avframe = avcodec_alloc_frame(); output_avframe = avcodec_alloc_frame();
#endif
if(output_avframe == NULL) { if(output_avframe == NULL) {
Fatal("Failed allocating AVFrame for the output"); Fatal("Failed allocating AVFrame for the output");
} }
@ -133,7 +141,7 @@ int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint
return -3; return -3;
} }
#if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0, 8, 0) #if LIBSWSCALE_VERSION_CHECK(0, 8, 0, 8, 0)
/* Warn if the input or output pixelformat is not supported */ /* Warn if the input or output pixelformat is not supported */
if(!sws_isSupportedInput(in_pf)) { if(!sws_isSupportedInput(in_pf)) {
Warning("swscale does not support the input format: %c%c%c%c",(in_pf)&0xff,((in_pf)&0xff),((in_pf>>16)&0xff),((in_pf>>24)&0xff)); Warning("swscale does not support the input format: %c%c%c%c",(in_pf)&0xff,((in_pf)&0xff),((in_pf>>16)&0xff),((in_pf>>24)&0xff));

View File

@ -32,7 +32,17 @@ extern "C" {
#include <libavutil/avutil.h> #include <libavutil/avutil.h>
#include <libavutil/base64.h> #include <libavutil/base64.h>
#include <libavutil/mathematics.h> #include <libavutil/mathematics.h>
#if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(50, 28, 0)
/* LIBAVUTIL_VERSION_CHECK checks for the right version of libav and FFmpeg
* The original source is vlc (in modules/codec/avcodec/avcommon_compat.h)
* a is the major version
* b and c the minor and micro versions of libav
* d and e the minor and micro versions of FFmpeg */
#define LIBAVUTIL_VERSION_CHECK(a, b, c, d, e) \
( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
(LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
#if LIBAVUTIL_VERSION_CHECK(50, 29, 0, 29, 0)
#include <libavutil/opt.h> #include <libavutil/opt.h>
#else #else
#include <libavcodec/opt.h> #include <libavcodec/opt.h>
@ -42,43 +52,82 @@ extern "C" {
#include <ffmpeg/base64.h> #include <ffmpeg/base64.h>
#include <ffmpeg/mathematics.h> #include <ffmpeg/mathematics.h>
#include <ffmpeg/opt.h> #include <ffmpeg/opt.h>
#endif #endif /* HAVE_LIBAVUTIL_AVUTIL_H */
// AVCODEC // AVCODEC
#if HAVE_LIBAVCODEC_AVCODEC_H #if HAVE_LIBAVCODEC_AVCODEC_H
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
/*
* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
* The original source is vlc (in modules/codec/avcodec/avcommon_compat.h)
* a is the major version
* b and c the minor and micro versions of libav
* d and e the minor and micro versions of FFmpeg */
#define LIBAVCODEC_VERSION_CHECK(a, b, c, d, e) \
( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
(LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
#elif HAVE_FFMPEG_AVCODEC_H #elif HAVE_FFMPEG_AVCODEC_H
#include <ffmpeg/avcodec.h> #include <ffmpeg/avcodec.h>
#endif #endif /* HAVE_LIBAVCODEC_AVCODEC_H */
#if defined(HAVE_LIBAVCODEC_AVCODEC_H) #if defined(HAVE_LIBAVCODEC_AVCODEC_H)
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) #if LIBAVCODEC_VERSION_CHECK(54, 25, 0, 51, 100)
#define _AVCODECID AVCodecID #define _AVCODECID AVCodecID
#else #else
#define _AVCODECID CodecID #define _AVCODECID CodecID
#endif #endif
#endif #endif /* HAVE_LIBAVCODEC_AVCODEC_H */
// AVFORMAT // AVFORMAT
#if HAVE_LIBAVFORMAT_AVFORMAT_H #if HAVE_LIBAVFORMAT_AVFORMAT_H
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
/* LIBAVFORMAT_VERSION_CHECK checks for the right version of libav and FFmpeg
* The original source is vlc (in modules/codec/avcodec/avcommon_compat.h)
* a is the major version
* b and c the minor and micro versions of libav
* d and e the minor and micro versions of FFmpeg */
#define LIBAVFORMAT_VERSION_CHECK(a, b, c, d, e) \
( (LIBAVFORMAT_VERSION_MICRO < 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
(LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
#elif HAVE_FFMPEG_AVFORMAT_H #elif HAVE_FFMPEG_AVFORMAT_H
#include <ffmpeg/avformat.h> #include <ffmpeg/avformat.h>
#endif #endif /* HAVE_LIBAVFORMAT_AVFORMAT_H */
// AVDEVICE // AVDEVICE
#if HAVE_LIBAVDEVICE_AVDEVICE_H #if HAVE_LIBAVDEVICE_AVDEVICE_H
#include <libavdevice/avdevice.h> #include <libavdevice/avdevice.h>
/* LIBAVDEVICE_VERSION_CHECK checks for the right version of libav and FFmpeg
* a is the major version
* b and c the minor and micro versions of libav
* d and e the minor and micro versions of FFmpeg */
#define LIBAVDEVICE_VERSION_CHECK(a, b, c, d, e) \
( (LIBAVDEVICE_VERSION_MICRO < 100 && LIBAVDEVICE_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
(LIBAVDEVICE_VERSION_MICRO >= 100 && LIBAVDEVICE_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
#elif HAVE_FFMPEG_AVDEVICE_H #elif HAVE_FFMPEG_AVDEVICE_H
#include <ffmpeg/avdevice.h> #include <ffmpeg/avdevice.h>
#endif #endif /* HAVE_LIBAVDEVICE_AVDEVICE_H */
// SWSCALE // SWSCALE
#if HAVE_LIBSWSCALE_SWSCALE_H #if HAVE_LIBSWSCALE_SWSCALE_H
#include <libswscale/swscale.h> #include <libswscale/swscale.h>
/* LIBSWSCALE_VERSION_CHECK checks for the right version of libav and FFmpeg
* a is the major version
* b and c the minor and micro versions of libav
* d and e the minor and micro versions of FFmpeg */
#define LIBSWSCALE_VERSION_CHECK(a, b, c, d, e) \
( (LIBSWSCALE_VERSION_MICRO < 100 && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(a, b, c) ) || \
(LIBSWSCALE_VERSION_MICRO >= 100 && LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(a, d, e) ) )
#elif HAVE_FFMPEG_SWSCALE_H #elif HAVE_FFMPEG_SWSCALE_H
#include <ffmpeg/swscale.h> #include <ffmpeg/swscale.h>
#endif #endif /* HAVE_LIBSWSCALE_SWSCALE_H */
#ifdef __cplusplus #ifdef __cplusplus
} }
@ -86,7 +135,7 @@ extern "C" {
#if ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H ) #if ( HAVE_LIBAVUTIL_AVUTIL_H || HAVE_LIBAVCODEC_AVCODEC_H || HAVE_LIBAVFORMAT_AVFORMAT_H || HAVE_LIBAVDEVICE_AVDEVICE_H )
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0) #if !LIBAVFORMAT_VERSION_CHECK(52, 107, 0, 107, 0)
#if defined(AVIO_WRONLY) #if defined(AVIO_WRONLY)
#define AVIO_FLAG_WRITE AVIO_WRONLY #define AVIO_FLAG_WRITE AVIO_WRONLY
#else #else
@ -129,7 +178,7 @@ protected:
}; };
#endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL #endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 25, 0) #if !LIBAVCODEC_VERSION_CHECK(54, 25, 0, 51, 100)
#define AV_CODEC_ID_NONE CODEC_ID_NONE #define AV_CODEC_ID_NONE CODEC_ID_NONE
#define AV_CODEC_ID_PCM_MULAW CODEC_ID_PCM_MULAW #define AV_CODEC_ID_PCM_MULAW CODEC_ID_PCM_MULAW
#define AV_CODEC_ID_PCM_ALAW CODEC_ID_PCM_ALAW #define AV_CODEC_ID_PCM_ALAW CODEC_ID_PCM_ALAW
@ -165,7 +214,7 @@ protected:
inline static const std::string av_make_error_string(int errnum) inline static const std::string av_make_error_string(int errnum)
{ {
char errbuf[AV_ERROR_MAX_STRING_SIZE]; char errbuf[AV_ERROR_MAX_STRING_SIZE];
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(50, 12, 13) #if LIBAVUTIL_VERSION_CHECK(50, 13, 0, 13, 0)
av_strerror(errnum, errbuf, AV_ERROR_MAX_STRING_SIZE); av_strerror(errnum, errbuf, AV_ERROR_MAX_STRING_SIZE);
#else #else
snprintf(errbuf, AV_ERROR_MAX_STRING_SIZE, "libav error %d", errnum); snprintf(errbuf, AV_ERROR_MAX_STRING_SIZE, "libav error %d", errnum);

View File

@ -170,7 +170,7 @@ int FfmpegCamera::Capture( Image &image )
Debug( 5, "Got packet from stream %d", packet.stream_index ); Debug( 5, "Got packet from stream %d", packet.stream_index );
if ( packet.stream_index == mVideoStreamId ) if ( packet.stream_index == mVideoStreamId )
{ {
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 25, 0) #if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0)
if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 ) if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 )
#else #else
if ( avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size ) < 0 ) if ( avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size ) < 0 )
@ -224,7 +224,7 @@ int FfmpegCamera::OpenFfmpeg() {
mIsOpening = true; mIsOpening = true;
// Open the input, not necessarily a file // Open the input, not necessarily a file
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 2, 0, 4, 0)
Debug ( 1, "Calling av_open_input_file" ); Debug ( 1, "Calling av_open_input_file" );
if ( av_open_input_file( &mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 ) if ( av_open_input_file( &mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )
#else #else
@ -275,7 +275,7 @@ int FfmpegCamera::OpenFfmpeg() {
Debug ( 1, "Opened input" ); Debug ( 1, "Opened input" );
// Locate stream info from avformat_open_input // Locate stream info from avformat_open_input
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 6, 0, 6, 0)
Debug ( 1, "Calling av_find_stream_info" ); Debug ( 1, "Calling av_find_stream_info" );
if ( av_find_stream_info( mFormatContext ) < 0 ) if ( av_find_stream_info( mFormatContext ) < 0 )
#else #else
@ -290,7 +290,7 @@ int FfmpegCamera::OpenFfmpeg() {
mVideoStreamId = -1; mVideoStreamId = -1;
for (unsigned int i=0; i < mFormatContext->nb_streams; i++ ) for (unsigned int i=0; i < mFormatContext->nb_streams; i++ )
{ {
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1) #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ) if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
#else #else
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO ) if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
@ -314,7 +314,7 @@ int FfmpegCamera::OpenFfmpeg() {
Debug ( 1, "Found decoder" ); Debug ( 1, "Found decoder" );
// Open the codec // Open the codec
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 7, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 8, 0, 8, 0)
Debug ( 1, "Calling avcodec_open" ); Debug ( 1, "Calling avcodec_open" );
if ( avcodec_open( mCodecContext, mCodec ) < 0 ) if ( avcodec_open( mCodecContext, mCodec ) < 0 )
#else #else
@ -326,10 +326,18 @@ int FfmpegCamera::OpenFfmpeg() {
Debug ( 1, "Opened codec" ); Debug ( 1, "Opened codec" );
// Allocate space for the native video frame // Allocate space for the native video frame
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
mRawFrame = av_frame_alloc();
#else
mRawFrame = avcodec_alloc_frame(); mRawFrame = avcodec_alloc_frame();
#endif
// Allocate space for the converted video frame // Allocate space for the converted video frame
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
mFrame = av_frame_alloc();
#else
mFrame = avcodec_alloc_frame(); mFrame = avcodec_alloc_frame();
#endif
if(mRawFrame == NULL || mFrame == NULL) if(mRawFrame == NULL || mFrame == NULL)
Fatal( "Unable to allocate frame for %s", mPath.c_str() ); Fatal( "Unable to allocate frame for %s", mPath.c_str() );
@ -399,7 +407,7 @@ int FfmpegCamera::CloseFfmpeg(){
} }
if ( mFormatContext ) if ( mFormatContext )
{ {
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 17, 0, 25, 0)
av_close_input_file( mFormatContext ); av_close_input_file( mFormatContext );
#else #else
avformat_close_input( &mFormatContext ); avformat_close_input( &mFormatContext );

View File

@ -434,7 +434,7 @@ LocalCamera::LocalCamera( int p_id, const std::string &p_device, int p_channel,
Panic("Unexpected colours: %d",colours); Panic("Unexpected colours: %d",colours);
} }
if( capture ) { if( capture ) {
#if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0, 8, 0) #if LIBSWSCALE_VERSION_CHECK(0, 8, 0, 8, 0)
if(!sws_isSupportedInput(capturePixFormat)) { if(!sws_isSupportedInput(capturePixFormat)) {
Error("swscale does not support the used capture format: %c%c%c%c",(capturePixFormat)&0xff,((capturePixFormat>>8)&0xff),((capturePixFormat>>16)&0xff),((capturePixFormat>>24)&0xff)); Error("swscale does not support the used capture format: %c%c%c%c",(capturePixFormat)&0xff,((capturePixFormat>>8)&0xff),((capturePixFormat>>16)&0xff),((capturePixFormat>>24)&0xff));
conversion_type = 2; /* Try ZM format conversions */ conversion_type = 2; /* Try ZM format conversions */
@ -622,7 +622,11 @@ LocalCamera::LocalCamera( int p_id, const std::string &p_device, int p_channel,
#if HAVE_LIBSWSCALE #if HAVE_LIBSWSCALE
/* Initialize swscale stuff */ /* Initialize swscale stuff */
if(capture && conversion_type == 1) { if(capture && conversion_type == 1) {
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
tmpPicture = av_frame_alloc();
#else
tmpPicture = avcodec_alloc_frame(); tmpPicture = avcodec_alloc_frame();
#endif
if ( !tmpPicture ) if ( !tmpPicture )
Fatal( "Could not allocate temporary picture" ); Fatal( "Could not allocate temporary picture" );
@ -852,7 +856,11 @@ void LocalCamera::Initialise()
Fatal( "Can't map video buffer %d (%d bytes) to memory: %s(%d)", i, vid_buf.length, strerror(errno), errno ); Fatal( "Can't map video buffer %d (%d bytes) to memory: %s(%d)", i, vid_buf.length, strerror(errno), errno );
#if HAVE_LIBSWSCALE #if HAVE_LIBSWSCALE
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
capturePictures[i] = av_frame_alloc();
#else
capturePictures[i] = avcodec_alloc_frame(); capturePictures[i] = avcodec_alloc_frame();
#endif
if ( !capturePictures[i] ) if ( !capturePictures[i] )
Fatal( "Could not allocate picture" ); Fatal( "Could not allocate picture" );
avpicture_fill( (AVPicture *)capturePictures[i], (uint8_t*)v4l2_data.buffers[i].start, capturePixFormat, v4l2_data.fmt.fmt.pix.width, v4l2_data.fmt.fmt.pix.height ); avpicture_fill( (AVPicture *)capturePictures[i], (uint8_t*)v4l2_data.buffers[i].start, capturePixFormat, v4l2_data.fmt.fmt.pix.width, v4l2_data.fmt.fmt.pix.height );
@ -1006,7 +1014,11 @@ void LocalCamera::Initialise()
v4l1_data.buffers[i].height = height; v4l1_data.buffers[i].height = height;
v4l1_data.buffers[i].format = palette; v4l1_data.buffers[i].format = palette;
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
capturePictures[i] = av_frame_alloc();
#else
capturePictures[i] = avcodec_alloc_frame(); capturePictures[i] = avcodec_alloc_frame();
#endif
if ( !capturePictures[i] ) if ( !capturePictures[i] )
Fatal( "Could not allocate picture" ); Fatal( "Could not allocate picture" );
avpicture_fill( (AVPicture *)capturePictures[i], (unsigned char *)v4l1_data.bufptr+v4l1_data.frames.offsets[i], capturePixFormat, width, height ); avpicture_fill( (AVPicture *)capturePictures[i], (unsigned char *)v4l1_data.bufptr+v4l1_data.frames.offsets[i], capturePixFormat, width, height );

View File

@ -48,7 +48,7 @@ void VideoStream::Initialise( )
av_log_set_level( AV_LOG_QUIET ); av_log_set_level( AV_LOG_QUIET );
av_register_all( ); av_register_all( );
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 13, 0) #if LIBAVFORMAT_VERSION_CHECK(53, 13, 0, 19, 0)
avformat_network_init(); avformat_network_init();
#endif #endif
initialised = true; initialised = true;
@ -58,7 +58,7 @@ void VideoStream::SetupFormat( )
{ {
/* allocate the output media context */ /* allocate the output media context */
ofc = NULL; ofc = NULL;
#if ((LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 5, 0)) && (LIBAVFORMAT_VERSION_MICRO >= 100)) #if (LIBAVFORMAT_VERSION_CHECK(53, 2, 0, 2, 0) && (LIBAVFORMAT_VERSION_MICRO >= 100))
avformat_alloc_output_context2( &ofc, NULL, format, filename ); avformat_alloc_output_context2( &ofc, NULL, format, filename );
#else #else
AVFormatContext *s= avformat_alloc_context(); AVFormatContext *s= avformat_alloc_context();
@ -69,7 +69,7 @@ void VideoStream::SetupFormat( )
AVOutputFormat *oformat; AVOutputFormat *oformat;
if (format) { if (format) {
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 45, 0) #if LIBAVFORMAT_VERSION_CHECK(52, 45, 0, 45, 0)
oformat = av_guess_format(format, NULL, NULL); oformat = av_guess_format(format, NULL, NULL);
#else #else
oformat = guess_format(format, NULL, NULL); oformat = guess_format(format, NULL, NULL);
@ -78,7 +78,7 @@ void VideoStream::SetupFormat( )
Fatal( "Requested output format '%s' is not a suitable output format", format ); Fatal( "Requested output format '%s' is not a suitable output format", format );
} }
} else { } else {
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 45, 0) #if LIBAVFORMAT_VERSION_CHECK(52, 45, 0, 45, 0)
oformat = av_guess_format(NULL, filename, NULL); oformat = av_guess_format(NULL, filename, NULL);
#else #else
oformat = guess_format(NULL, filename, NULL); oformat = guess_format(NULL, filename, NULL);
@ -95,7 +95,7 @@ void VideoStream::SetupFormat( )
{ {
Fatal( "Could not allocate private data for output format." ); Fatal( "Could not allocate private data for output format." );
} }
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 92, 0) #if LIBAVFORMAT_VERSION_CHECK(52, 92, 0, 92, 0)
if (s->oformat->priv_class) { if (s->oformat->priv_class) {
*(const AVClass**)s->priv_data = s->oformat->priv_class; *(const AVClass**)s->priv_data = s->oformat->priv_class;
av_opt_set_defaults(s->priv_data); av_opt_set_defaults(s->priv_data);
@ -186,7 +186,7 @@ void VideoStream::SetupCodec( int colours, int subpixelorder, int width, int hei
} }
else else
{ {
#if ((LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 11, 0)) && (LIBAVFORMAT_VERSION_MICRO >= 100)) #if (LIBAVFORMAT_VERSION_CHECK(53, 8, 0, 11, 0) && (LIBAVFORMAT_VERSION_MICRO >= 100))
Debug( 1, "Could not find codec \"%s\". Using default \"%s\"", codec_name, avcodec_get_name( codec_id ) ); Debug( 1, "Could not find codec \"%s\". Using default \"%s\"", codec_name, avcodec_get_name( codec_id ) );
#else #else
Debug( 1, "Could not find codec \"%s\". Using default \"%d\"", codec_name, codec_id ); Debug( 1, "Could not find codec \"%s\". Using default \"%d\"", codec_name, codec_id );
@ -202,20 +202,20 @@ void VideoStream::SetupCodec( int colours, int subpixelorder, int width, int hei
codec = avcodec_find_encoder( codec_id ); codec = avcodec_find_encoder( codec_id );
if ( !codec ) if ( !codec )
{ {
#if ((LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 11, 0)) && (LIBAVFORMAT_VERSION_MICRO >= 100)) #if (LIBAVFORMAT_VERSION_CHECK(53, 8, 0, 11, 0) && (LIBAVFORMAT_VERSION_MICRO >= 100))
Fatal( "Could not find encoder for '%s'", avcodec_get_name( codec_id ) ); Fatal( "Could not find encoder for '%s'", avcodec_get_name( codec_id ) );
#else #else
Fatal( "Could not find encoder for '%d'", codec_id ); Fatal( "Could not find encoder for '%d'", codec_id );
#endif #endif
} }
#if ((LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 11, 0)) && (LIBAVFORMAT_VERSION_MICRO >= 100)) #if (LIBAVFORMAT_VERSION_CHECK(53, 8, 0, 11, 0) && (LIBAVFORMAT_VERSION_MICRO >= 100))
Debug( 1, "Found encoder for '%s'", avcodec_get_name( codec_id ) ); Debug( 1, "Found encoder for '%s'", avcodec_get_name( codec_id ) );
#else #else
Debug( 1, "Found encoder for '%d'", codec_id ); Debug( 1, "Found encoder for '%d'", codec_id );
#endif #endif
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 10, 0) #if LIBAVFORMAT_VERSION_CHECK(53, 10, 0, 17, 0)
ost = avformat_new_stream( ofc, codec ); ost = avformat_new_stream( ofc, codec );
#else #else
ost = av_new_stream( ofc, 0 ); ost = av_new_stream( ofc, 0 );
@ -311,7 +311,7 @@ void VideoStream::OpenStream( )
AVCodecContext *c = ost->codec; AVCodecContext *c = ost->codec;
/* open the codec */ /* open the codec */
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 7, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 8, 0, 8, 0)
if ( (avRet = avcodec_open( c, codec )) < 0 ) if ( (avRet = avcodec_open( c, codec )) < 0 )
#else #else
if ( (avRet = avcodec_open2( c, codec, 0 )) < 0 ) if ( (avRet = avcodec_open2( c, codec, 0 )) < 0 )
@ -323,7 +323,11 @@ void VideoStream::OpenStream( )
Debug( 1, "Opened codec" ); Debug( 1, "Opened codec" );
/* allocate the encoded raw picture */ /* allocate the encoded raw picture */
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
opicture = av_frame_alloc( );
#else
opicture = avcodec_alloc_frame( ); opicture = avcodec_alloc_frame( );
#endif
if ( !opicture ) if ( !opicture )
{ {
Panic( "Could not allocate opicture" ); Panic( "Could not allocate opicture" );
@ -344,7 +348,11 @@ void VideoStream::OpenStream( )
tmp_opicture = NULL; tmp_opicture = NULL;
if ( c->pix_fmt != pf ) if ( c->pix_fmt != pf )
{ {
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
tmp_opicture = av_frame_alloc( );
#else
tmp_opicture = avcodec_alloc_frame( ); tmp_opicture = avcodec_alloc_frame( );
#endif
if ( !tmp_opicture ) if ( !tmp_opicture )
{ {
Panic( "Could not allocate tmp_opicture" ); Panic( "Could not allocate tmp_opicture" );
@ -364,9 +372,9 @@ void VideoStream::OpenStream( )
if ( !(of->flags & AVFMT_NOFILE) ) if ( !(of->flags & AVFMT_NOFILE) )
{ {
int ret; int ret;
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 14, 0) #if LIBAVFORMAT_VERSION_CHECK(53, 15, 0, 21, 0)
ret = avio_open2( &ofc->pb, filename, AVIO_FLAG_WRITE, NULL, NULL ); ret = avio_open2( &ofc->pb, filename, AVIO_FLAG_WRITE, NULL, NULL );
#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 102, 0) #elif LIBAVFORMAT_VERSION_CHECK(52, 102, 0, 102, 0)
ret = avio_open( &ofc->pb, filename, AVIO_FLAG_WRITE ); ret = avio_open( &ofc->pb, filename, AVIO_FLAG_WRITE );
#else #else
ret = url_fopen( &ofc->pb, filename, AVIO_FLAG_WRITE ); ret = url_fopen( &ofc->pb, filename, AVIO_FLAG_WRITE );
@ -396,13 +404,13 @@ void VideoStream::OpenStream( )
} }
} }
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 100, 1) #if LIBAVFORMAT_VERSION_CHECK(52, 101, 0, 101, 0)
av_dump_format(ofc, 0, filename, 1); av_dump_format(ofc, 0, filename, 1);
#else #else
dump_format(ofc, 0, filename, 1); dump_format(ofc, 0, filename, 1);
#endif #endif
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 4, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 2, 0, 4, 0)
int ret = av_write_header( ofc ); int ret = av_write_header( ofc );
#else #else
int ret = avformat_write_header( ofc, NULL ); int ret = avformat_write_header( ofc, NULL );
@ -525,7 +533,7 @@ VideoStream::~VideoStream( )
if ( !(of->flags & AVFMT_NOFILE) ) if ( !(of->flags & AVFMT_NOFILE) )
{ {
/* close the output file */ /* close the output file */
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1) #if LIBAVFORMAT_VERSION_CHECK(52, 105, 0, 105, 0)
avio_close( ofc->pb ); avio_close( ofc->pb );
#else #else
url_fclose( ofc->pb ); url_fclose( ofc->pb );
@ -625,7 +633,7 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t *buffer, int buffer_size,
int got_packet = 0; int got_packet = 0;
if ( of->flags & AVFMT_RAWPICTURE ) if ( of->flags & AVFMT_RAWPICTURE )
{ {
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 2, 1) #if LIBAVCODEC_VERSION_CHECK(52, 30, 2, 30, 2)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
#else #else
pkt->flags |= PKT_FLAG_KEY; pkt->flags |= PKT_FLAG_KEY;
@ -640,7 +648,7 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t *buffer, int buffer_size,
opicture_ptr->pts = c->frame_number; opicture_ptr->pts = c->frame_number;
opicture_ptr->quality = c->global_quality; opicture_ptr->quality = c->global_quality;
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(54, 0, 0) #if LIBAVFORMAT_VERSION_CHECK(54, 1, 0, 2, 100)
int ret = avcodec_encode_video2( c, pkt, opicture_ptr, &got_packet ); int ret = avcodec_encode_video2( c, pkt, opicture_ptr, &got_packet );
if ( ret != 0 ) if ( ret != 0 )
{ {
@ -656,7 +664,7 @@ double VideoStream::ActuallyEncodeFrame( const uint8_t *buffer, int buffer_size,
{ {
if ( c->coded_frame->key_frame ) if ( c->coded_frame->key_frame )
{ {
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1) #if LIBAVCODEC_VERSION_CHECK(52, 30, 2, 30, 2)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
#else #else
pkt->flags |= PKT_FLAG_KEY; pkt->flags |= PKT_FLAG_KEY;

View File

@ -162,7 +162,7 @@ int RemoteCameraRtsp::PrimeCapture()
mVideoStreamId = -1; mVideoStreamId = -1;
for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ ) for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ )
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1) #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ) if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
#else #else
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO ) if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )
@ -183,7 +183,7 @@ int RemoteCameraRtsp::PrimeCapture()
Panic( "Unable to locate codec %d decoder", mCodecContext->codec_id ); Panic( "Unable to locate codec %d decoder", mCodecContext->codec_id );
// Open codec // Open codec
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 7, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 8, 0, 8, 0)
if ( avcodec_open( mCodecContext, mCodec ) < 0 ) if ( avcodec_open( mCodecContext, mCodec ) < 0 )
#else #else
if ( avcodec_open2( mCodecContext, mCodec, 0 ) < 0 ) if ( avcodec_open2( mCodecContext, mCodec, 0 ) < 0 )
@ -191,10 +191,18 @@ int RemoteCameraRtsp::PrimeCapture()
Panic( "Can't open codec" ); Panic( "Can't open codec" );
// Allocate space for the native video frame // Allocate space for the native video frame
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
mRawFrame = av_frame_alloc();
#else
mRawFrame = avcodec_alloc_frame(); mRawFrame = avcodec_alloc_frame();
#endif
// Allocate space for the converted video frame // Allocate space for the converted video frame
#if LIBAVCODEC_VERSION_CHECK(55, 28, 1, 45, 101)
mFrame = av_frame_alloc();
#else
mFrame = avcodec_alloc_frame(); mFrame = avcodec_alloc_frame();
#endif
if(mRawFrame == NULL || mFrame == NULL) if(mRawFrame == NULL || mFrame == NULL)
Fatal( "Unable to allocate frame(s)"); Fatal( "Unable to allocate frame(s)");
@ -292,7 +300,7 @@ int RemoteCameraRtsp::Capture( Image &image )
{ {
packet.data = buffer.head(); packet.data = buffer.head();
packet.size = buffer.size(); packet.size = buffer.size();
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 25, 0) #if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0)
int len = avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ); int len = avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet );
#else #else
int len = avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size ); int len = avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size );

View File

@ -211,7 +211,7 @@ RtspThread::~RtspThread()
{ {
if ( mFormatContext ) if ( mFormatContext )
{ {
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 96, 0) #if LIBAVFORMAT_VERSION_CHECK(52, 96, 0, 96, 0)
avformat_free_context( mFormatContext ); avformat_free_context( mFormatContext );
#else #else
av_free_format_context( mFormatContext ); av_free_format_context( mFormatContext );
@ -437,7 +437,7 @@ int RtspThread::run()
for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ ) for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ )
{ {
SessionDescriptor::MediaDescriptor *mediaDesc = mSessDesc->getStream( i ); SessionDescriptor::MediaDescriptor *mediaDesc = mSessDesc->getStream( i );
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1) #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ) if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO )
#else #else
if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO ) if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO )

View File

@ -23,7 +23,7 @@
#include "zm_sdp.h" #include "zm_sdp.h"
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1) #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
SessionDescriptor::StaticPayloadDesc SessionDescriptor::smStaticPayloads[] = { SessionDescriptor::StaticPayloadDesc SessionDescriptor::smStaticPayloads[] = {
{ 0, "PCMU", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_MULAW, 8000, 1 }, { 0, "PCMU", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_PCM_MULAW, 8000, 1 },
{ 3, "GSM", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 }, { 3, "GSM", AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_NONE, 8000, 1 },
@ -372,7 +372,7 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
for ( unsigned int i = 0; i < mMediaList.size(); i++ ) for ( unsigned int i = 0; i < mMediaList.size(); i++ )
{ {
const MediaDescriptor *mediaDesc = mMediaList[i]; const MediaDescriptor *mediaDesc = mMediaList[i];
#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 8, 0) #if !LIBAVFORMAT_VERSION_CHECK(53, 10, 0, 17, 0)
AVStream *stream = av_new_stream( formatContext, i ); AVStream *stream = av_new_stream( formatContext, i );
#else #else
AVStream *stream = avformat_new_stream( formatContext, NULL ); AVStream *stream = avformat_new_stream( formatContext, NULL );
@ -380,7 +380,7 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
#endif #endif
Debug( 1, "Looking for codec for %s payload type %d / %s", mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() ); Debug( 1, "Looking for codec for %s payload type %d / %s", mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() );
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1) #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
if ( mediaDesc->getType() == "video" ) if ( mediaDesc->getType() == "video" )
stream->codec->codec_type = AVMEDIA_TYPE_VIDEO; stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
else if ( mediaDesc->getType() == "audio" ) else if ( mediaDesc->getType() == "audio" )
@ -396,6 +396,9 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
stream->codec->codec_type = CODEC_TYPE_DATA; stream->codec->codec_type = CODEC_TYPE_DATA;
#endif #endif
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
std::string codec_name;
#endif
if ( mediaDesc->getPayloadType() < PAYLOAD_TYPE_DYNAMIC ) if ( mediaDesc->getPayloadType() < PAYLOAD_TYPE_DYNAMIC )
{ {
// Look in static table // Look in static table
@ -404,7 +407,11 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
if ( smStaticPayloads[i].payloadType == mediaDesc->getPayloadType() ) if ( smStaticPayloads[i].payloadType == mediaDesc->getPayloadType() )
{ {
Debug( 1, "Got static payload type %d, %s", smStaticPayloads[i].payloadType, smStaticPayloads[i].payloadName ); Debug( 1, "Got static payload type %d, %s", smStaticPayloads[i].payloadType, smStaticPayloads[i].payloadName );
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
codec_name = std::string( smStaticPayloads[i].payloadName );
#else
strncpy( stream->codec->codec_name, smStaticPayloads[i].payloadName, sizeof(stream->codec->codec_name) );; strncpy( stream->codec->codec_name, smStaticPayloads[i].payloadName, sizeof(stream->codec->codec_name) );;
#endif
stream->codec->codec_type = smStaticPayloads[i].codecType; stream->codec->codec_type = smStaticPayloads[i].codecType;
stream->codec->codec_id = smStaticPayloads[i].codecId; stream->codec->codec_id = smStaticPayloads[i].codecId;
stream->codec->sample_rate = smStaticPayloads[i].clockRate; stream->codec->sample_rate = smStaticPayloads[i].clockRate;
@ -420,7 +427,11 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
if ( smDynamicPayloads[i].payloadName == mediaDesc->getPayloadDesc() ) if ( smDynamicPayloads[i].payloadName == mediaDesc->getPayloadDesc() )
{ {
Debug( 1, "Got dynamic payload type %d, %s", mediaDesc->getPayloadType(), smDynamicPayloads[i].payloadName ); Debug( 1, "Got dynamic payload type %d, %s", mediaDesc->getPayloadType(), smDynamicPayloads[i].payloadName );
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
codec_name = std::string( smStaticPayloads[i].payloadName );
#else
strncpy( stream->codec->codec_name, smDynamicPayloads[i].payloadName, sizeof(stream->codec->codec_name) );; strncpy( stream->codec->codec_name, smDynamicPayloads[i].payloadName, sizeof(stream->codec->codec_name) );;
#endif
stream->codec->codec_type = smDynamicPayloads[i].codecType; stream->codec->codec_type = smDynamicPayloads[i].codecType;
stream->codec->codec_id = smDynamicPayloads[i].codecId; stream->codec->codec_id = smDynamicPayloads[i].codecId;
stream->codec->sample_rate = mediaDesc->getClock(); stream->codec->sample_rate = mediaDesc->getClock();
@ -428,7 +439,12 @@ AVFormatContext *SessionDescriptor::generateFormatContext() const
} }
} }
} }
#if LIBAVCODEC_VERSION_CHECK(55, 50, 3, 60, 103)
if ( codec_name.empty() )
#else
if ( !stream->codec->codec_name[0] ) if ( !stream->codec->codec_name[0] )
#endif
{ {
Warning( "Can't find payload details for %s payload type %d, name %s", mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() ); Warning( "Can't find payload details for %s payload type %d, name %s", mediaDesc->getType().c_str(), mediaDesc->getPayloadType(), mediaDesc->getPayloadDesc().c_str() );
//return( 0 ); //return( 0 );

View File

@ -38,7 +38,7 @@ protected:
{ {
int payloadType; int payloadType;
const char payloadName[6]; const char payloadName[6];
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
AVMediaType codecType; AVMediaType codecType;
#else #else
enum CodecType codecType; enum CodecType codecType;
@ -51,7 +51,7 @@ protected:
struct DynamicPayloadDesc struct DynamicPayloadDesc
{ {
const char payloadName[32]; const char payloadName[32];
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0))
AVMediaType codecType; AVMediaType codecType;
#else #else
enum CodecType codecType; enum CodecType codecType;