Commit a8c5af18 authored by Jean-Paul Saman's avatar Jean-Paul Saman

davinci: separate XDM 0.9 and XDM 1.0 code

- encoder.c: separate XDM 0.9 and XDM 1.0 code into separate files
- fourcc.c : indicate which XDM API to use for this codec
parent a688d669
...@@ -6,20 +6,27 @@ SOURCES_davinci = \ ...@@ -6,20 +6,27 @@ SOURCES_davinci = \
fourcc.c \ fourcc.c \
$(NULL) $(NULL)
# Davinci speed hack # Davinci resizer/scaling hack
# resizer.c \ # resizer.c \
# reziser.h # reziser.h
if ENABLE_SOUT if ENABLE_SOUT
SOURCES_davinci += encoder.c SOURCES_davinci += encoder.c audio_encoder.c video_encoder.c audio1_encoder.c
# video1_encoder.c
endif endif
EXTRA_libdavinci_plugin_la_SOURCES = \ EXTRA_libdavinci_plugin_la_SOURCES = \
encoder.c \ encoder.c \
audio_encoder.c \
video_encoder.c \
audio1_encoder.c \
$(NULL) $(NULL)
# video1_encoder.c
libvlc_LTLIBRARIES += \ libvlc_LTLIBRARIES += \
$(LTLIBdavinci) $(LTLIBdavinci)
EXTRA_LTLIBRARIES += \ EXTRA_LTLIBRARIES += \
libdavinci_plugin.la libdavinci_plugin.la
...@@ -87,11 +87,11 @@ int OpenAudioDecoder( vlc_object_t *p_this ) ...@@ -87,11 +87,11 @@ int OpenAudioDecoder( vlc_object_t *p_this )
decoder_sys_t *p_sys; decoder_sys_t *p_sys;
Engine_Error err; Engine_Error err;
AUDDEC_Params params; AUDDEC_Params params;
int i_cat; int i_cat, i_xdm;
const char *psz_codec; const char *psz_codec;
const char *psz_namecodec; const char *psz_namecodec;
if( !GetDavinciDecoder( p_dec->fmt_in.i_codec, &i_cat, if( !GetDavinciDecoder( p_dec->fmt_in.i_codec, &i_cat, &i_xdm,
&psz_codec, &psz_namecodec ) ) &psz_codec, &psz_namecodec ) )
{ {
msg_Dbg( p_dec, "Unsupported codec : %4.4s",(char*)&p_dec->fmt_in.i_codec ); msg_Dbg( p_dec, "Unsupported codec : %4.4s",(char*)&p_dec->fmt_in.i_codec );
......
/*****************************************************************************
* encoder.c: video encoder module using the DaVinci DSP.
*****************************************************************************
* Copyright (C) 2010 M2X BV
* $Id$
*
* Authors: Jean-Paul Saman <jean-paul.saman at m2x dot nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_vout.h>
#include <vlc_aout.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
#include "davinci.h"
/* XDM 1.0 */
#include <ti/sdo/ce/audio1/audenc1.h>
#include <assert.h>
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* XDM 1.0 */
static block_t *EncodeAudio1( encoder_t *, aout_buffer_t * );
static inline IAUDIO_ChannelMode davinci_get_audio_channels( int i_channels );
/*****************************************************************************
* Encoder
*****************************************************************************/
struct xdm_sys_t
{
/* XDM 1.0 */
AUDENC1_Handle handle;
AUDENC1_Params params;
AUDENC1_DynamicParams dparams;
XDM1_BufDesc in;
XDM1_BufDesc out;
};
/*****************************************************************************
*
*****************************************************************************/
int OpenEncoderAudio1( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm;
p_sys->xdm = (xdm_sys_t *) calloc( 1, sizeof( xdm_sys_t ) );
if( !p_sys->xdm )
return VLC_ENOMEM;
xdm = p_sys->xdm;
xdm->params.size = sizeof( xdm->params );
p_enc->i_tolerance = var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "tolerance" );
p_enc->i_tolerance *= 1024; /* bits per second */
xdm->params.encMode = var_CreateGetBool( p_enc, ENC_CFG_PREFIX "cbr" ) ? IAUDIO_CBR : IAUDIO_VBR;
xdm->params.bitRate = p_enc->fmt_out.i_bitrate;
if( xdm->params.encMode == IAUDIO_VBR )
xdm->params.maxBitRate = p_enc->fmt_out.i_bitrate + p_enc->i_tolerance;
else
xdm->params.maxBitRate = p_enc->fmt_out.i_bitrate;
xdm->params.sampleRate = p_enc->fmt_out.audio.i_rate;
xdm->params.channelMode = davinci_get_audio_channels( p_enc->fmt_out.audio.i_channels );
if( xdm->params.channelMode == IAUDIO_11_0 )
xdm->params.dualMonoMode = IAUDIO_DUALMONO_LR;
xdm->params.dataEndianness = XDM_LE_16;
xdm->params.inputFormat = IAUDIO_INTERLEAVED; // IAUDIO_BLOCK
xdm->params.inputBitsPerSample = p_enc->fmt_out.audio.i_bitspersample;
xdm->params.crcFlag = XDAS_FALSE;
xdm->params.ancFlag = XDAS_FALSE;
xdm->params.lfeFlag = XDAS_FALSE;
msg_Info( p_enc, "audio %d channels, %d Hz (max bitrate %d kBps)\n",
(int)p_enc->fmt_out.audio.i_channels,
(int)xdm->params.sampleRate,
((int)xdm->params.maxBitRate) >> 13 /* / (8*1024)*/);
/* Create encoder handle */
xdm->handle = AUDENC1_create( p_sys->engine, (String)p_sys->psz_codec, &xdm->params );
if( !xdm->handle )
{
goto error;
}
p_sys->pf_encode_audio = EncodeAudio1;
return VLC_SUCCESS;
error:
free( p_sys->xdm );
p_sys->xdm = NULL;
return VLC_EGENERIC;
}
void CloseEncoderAudio1( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
/* Delete audio encoder */
if( p_enc->fmt_out.i_cat == AUDIO_ES )
AUDENC1_delete( xdm->handle );
/* Free 'DaVinci compliant' buffers */
davinci_FreeBuffer1( &xdm->in );
davinci_FreeBuffer1( &xdm->out );
free( xdm );
xdm = NULL;
}
/*****************************************************************************
* Audio Encoder: XDM 1.0 API
*****************************************************************************/
static inline IAUDIO_ChannelMode davinci_get_audio_channels( int i_channels )
{
IAUDIO_ChannelMode i_mode = IAUDIO_2_0;
switch( i_channels )
{
case 1: i_mode = IAUDIO_1_0; /* Single channel. */
break;
case 2: i_mode = IAUDIO_2_0; /* Two channel. */
break;
case 3: i_mode = IAUDIO_3_0; /* Three channel. */
break;
case 4: i_mode = IAUDIO_3_1; /* Four channel. */
break;
case 5: i_mode = IAUDIO_3_2; /* Five channel. */
break;
case 6: i_mode = IAUDIO_2_3; /* 5.1 channel. */
break;
case 7: i_mode = IAUDIO_3_4; /* 7.1 channel. */
break;
default: i_mode = IAUDIO_2_0; /**< Two channel. */
break;
}
return i_mode;
}
static inline int davinci_InitAudio1Buffers( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
int i_ret = VLC_SUCCESS;
AUDENC1_Status status;
xdm->dparams.size = sizeof( xdm->dparams );
memset( &status, 0, sizeof( status ) );
status.size = sizeof( status );
/* Configue the encoder */
xdm->dparams.bitRate = p_enc->fmt_out.i_bitrate;
xdm->dparams.sampleRate = p_enc->fmt_out.audio.i_rate;
xdm->dparams.channelMode = davinci_get_audio_channels( p_enc->fmt_out.audio.i_channels );
if( xdm->dparams.channelMode == IAUDIO_11_0 )
xdm->dparams.dualMonoMode = IAUDIO_DUALMONO_LR;
xdm->dparams.lfeFlag = XDAS_FALSE; /* FIXME: What to fill in here?
* Number of LFE (Low Frequency Effects) channels in the stream. */
xdm->dparams.inputBitsPerSample = p_enc->fmt_out.audio.i_bitspersample;
//(p_enc->fmt_in.i_codec == AOUT_FMT_S16_NE) ? 16: 32;
msg_Info( p_enc, "using %d channels at %d Hz samplerate (bitrate %d kBps, "
"%d bits per sample)\n",
p_enc->fmt_out.audio.i_channels,
(int)xdm->dparams.sampleRate,
((int)xdm->dparams.bitRate) >> 13 /* / (8*1024)*/,
(int)xdm->dparams.inputBitsPerSample );
if( AUDENC1_control( xdm->handle, XDM_SETPARAMS, &xdm->dparams, &status )
!= AUDENC1_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters" );
return VLC_EGENERIC;
}
/* Configure buffers */
if( AUDENC1_control( xdm->handle, XDM_GETBUFINFO, &xdm->dparams, &status )
!= AUDENC1_EOK )
{
msg_Err( p_enc, "Failed to get buffer info" );
return VLC_EGENERIC;
}
/* Allocate input buffer(s) */
if( (i_ret = davinci_AllocateBuffer1( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &xdm->in ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate input buffers" );
return i_ret;
}
/* Allocate output buffer */
if( (i_ret = davinci_AllocateBuffer1( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &xdm->out ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate output buffers" );
return i_ret;
}
return i_ret;
}
static block_t *EncodeAudio1( encoder_t *p_enc, aout_buffer_t *p_buffer )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
AUDENC1_InArgs in_args;
AUDENC1_OutArgs out_args;
block_t *p_block;
int i_ret;
if( xdm->in.numBufs == 0 || xdm->out.numBufs == 0 )
{
if( davinci_InitAudio1Buffers( p_enc ) != VLC_SUCCESS )
return NULL;
}
/* Configure input */
memset( &in_args, 0, sizeof( in_args ) );
in_args.size = sizeof( in_args );
/* NOTE: assume interleaved channels */
memcpy( xdm->in.descs[0].buf, p_buffer->p_buffer, p_buffer->i_nb_bytes );
/* Configure output */
memset( &out_args, 0, sizeof( out_args ) );
out_args.size = sizeof( out_args );
/* Encode the audio */
if( (i_ret = AUDENC1_process( xdm->handle, &xdm->in, &xdm->out,
&in_args, &out_args )) != AUDENC1_EOK )
{
msg_Err( p_enc, "Audio encoding failed (%d): %s", i_ret,
davinci_GetExtendedError( out_args.extendedError ) );
return NULL;
}
/* Print some info */
//msg_Dbg( p_enc, "Bytes generated: %d", (int)out_args.bytesGenerated );
/* Put everything in the block */
if( out_args.bytesGenerated <= 0 )
return NULL;
p_block = block_New( p_enc, out_args.bytesGenerated );
if( !p_block )
return NULL;
memcpy( p_block->p_buffer, xdm->out.descs[0].buf, out_args.bytesGenerated );
/* NOTE: assumption */
p_block->i_dts = p_block->i_pts = p_buffer->start_date;
/* Shamelessly copied from ffmpeg/encoder.c */
p_block->i_length = (mtime_t)1000000 *
(mtime_t)p_enc->fmt_out.audio.i_frame_length /
(mtime_t)p_enc->fmt_out.audio.i_rate;
return p_block;
}
/*****************************************************************************
* encoder.c: video encoder module using the DaVinci DSP.
*****************************************************************************
* Copyright (C) 2008-2010 M2X BV
* $Id$
*
* Authors: Antoine Cellerier <dionoea at videolan dot org>
* Rafaël Carré <rcarre@m2x.nl>
* Jean-Paul Saman <jean-paul.saman at m2x dot nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_vout.h>
#include <vlc_aout.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
#include "davinci.h"
/* XDM 0.9 */
#include <ti/sdo/ce/audio/audenc.h>
#include <assert.h>
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* XDM 0.9 */
static block_t *EncodeAudio( encoder_t *, aout_buffer_t * );
/*****************************************************************************
* Encoder
*****************************************************************************/
struct xdm_sys_t
{
/* XDM 0.9 */
AUDENC_Handle handle;
AUDENC_Params params;
AUDENC_DynamicParams dparams;
XDM_BufDesc in;
XDM_BufDesc out;
};
/*****************************************************************************
*
*****************************************************************************/
int OpenEncoderAudio( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm;
xdm = (xdm_sys_t *) calloc( 1, sizeof( xdm_sys_t ) );
if( !xdm )
return VLC_ENOMEM;
xdm = p_sys->xdm;
xdm->params.size = sizeof( xdm->params );
switch( var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "quality" ) )
{
case 1: xdm->params.encodingPreset = XDM_HIGH_QUALITY; break;
case 2: xdm->params.encodingPreset = XDM_HIGH_SPEED; break;
case 3: xdm->params.encodingPreset = XDM_USER_DEFINED; break;
default:
xdm->params.encodingPreset = XDM_DEFAULT;
break;
}
xdm->params.maxBitrate = p_enc->fmt_out.i_bitrate;
xdm->params.maxSampleRate = p_enc->fmt_out.audio.i_rate;
xdm->params.maxNoOfCh = p_enc->fmt_out.audio.i_channels;
xdm->params.dataEndianness = XDM_BYTE;
msg_Info( p_enc, "audio %d channels, %d Hz (max bitrate %d kBps)\n",
(int)xdm->params.maxNoOfCh,
(int)xdm->params.maxSampleRate,
((int)xdm->params.maxBitrate) >> 13 /* / (8*1024)*/);
/* Create encoder handle */
xdm->handle = AUDENC_create( p_sys->engine, (String)p_sys->psz_codec, &xdm->params );
if( !xdm->handle )
goto error;
p_sys->pf_encode_audio = EncodeAudio;
return VLC_SUCCESS;
error:
free( p_sys->xdm );
p_sys->xdm = NULL;
return VLC_EGENERIC;
}
void CloseEncoderAudio( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
/* Delete audio encoder */
if( p_enc->fmt_out.i_cat == AUDIO_ES )
AUDENC_delete( xdm->handle );
/* Free 'DaVinci compliant' buffers */
davinci_FreeBuffer( &xdm->in );
davinci_FreeBuffer( &xdm->out );
free( xdm );
xdm = NULL;
}
/*****************************************************************************
* Audio Encoder: XDM 0.9
*****************************************************************************/
static inline int davinci_InitAudioBuffers( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
int i_ret = VLC_SUCCESS;
AUDENC_Status status;
xdm->dparams.size = sizeof( xdm->dparams );
memset( &status, 0, sizeof( status ) );
status.size = sizeof( status );
/* Configue the encoder */
/* NOTE: assuming channels are interleaved */
xdm->dparams.inputFormat = IAUDIO_INTERLEAVED; // IAUDIO_BLOCK;
xdm->dparams.bitRate = p_enc->fmt_out.i_bitrate;
xdm->dparams.sampleRate = p_enc->fmt_out.audio.i_rate;
switch( p_enc->fmt_out.audio.i_channels )
{
case 1: xdm->dparams.numChannels = IAUDIO_MONO; /* Single channel. */
break;
case 2: xdm->dparams.numChannels = IAUDIO_STEREO; /* Two channel. */
break;
case 3: xdm->dparams.numChannels = IAUDIO_THREE_ZERO; /* Three channel. */
break;
case 5: xdm->dparams.numChannels = IAUDIO_FIVE_ZERO; /* Five channel. */
break;
case 6: xdm->dparams.numChannels = IAUDIO_FIVE_ONE; /* 5.1 channel. */
break;
case 7: xdm->dparams.numChannels = IAUDIO_SEVEN_ONE; /* 7.1 channel. */
break;
default:
msg_Warn( p_enc, "assuming stereo audio channels" );
xdm->dparams.numChannels = IAUDIO_STEREO; /**< Two channel. */
break;
}
xdm->dparams.numLFEChannels = 0; /* FIXME: What to fill in here?
* Number of LFE (Low Frequency Effects) channels in the stream. */
xdm->dparams.inputBitsPerSample = p_enc->fmt_out.audio.i_bitspersample;
//p_enc->fmt_in.i_codec == AOUT_FMT_S16_NE) ? 16: 32;
msg_Info( p_enc, "using %d channels at %d Hz samplerate (bitrate %d kBps, "
"%d bits per sample)\n",
p_enc->fmt_out.audio.i_channels,
(int)xdm->dparams.sampleRate,
((int)xdm->dparams.bitRate) >> 13 /* / (8*1024)*/,
(int)xdm->dparams.inputBitsPerSample );
if( AUDENC_control( xdm->handle, XDM_SETPARAMS, &xdm->dparams, &status )
!= AUDENC_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters." );
return VLC_EGENERIC;
}
/* Configure buffers */
if( AUDENC_control( xdm->handle, XDM_GETBUFINFO, &xdm->dparams, &status )
!= AUDENC_EOK )
{
msg_Err( p_enc, "Failed to get buffer info" );
return VLC_EGENERIC;
}
/* Allocate input buffer(s) */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &xdm->in ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate input buffers" );
return i_ret;
}
/* Allocate output buffer */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &xdm->out ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate output buffers" );
return i_ret;
}
return i_ret;
}
static block_t *EncodeAudio( encoder_t *p_enc, aout_buffer_t *p_buffer )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
AUDENC_InArgs in_args;
AUDENC_OutArgs out_args;
block_t *p_block;
int i_ret;
if( xdm->in.numBufs == 0 || xdm->out.numBufs == 0 )
{
if( davinci_InitAudioBuffers( p_enc ) != VLC_SUCCESS )
return NULL;
}
/* Configure input */
memset( &in_args, 0, sizeof( in_args ) );
in_args.size = sizeof( in_args );
/* NOTE: assume interleaved channels */
memcpy( xdm->in.bufs[0], p_buffer->p_buffer, p_buffer->i_nb_bytes );
/* Configure output */
memset( &out_args, 0, sizeof( out_args ) );
out_args.size = sizeof( out_args );
/* Encode the audio */
if( (i_ret = AUDENC_process( xdm->handle, &xdm->in, &xdm->out,
&in_args, &out_args )) != AUDENC_EOK )
{
msg_Err( p_enc, "Audio encoding failed (%d): %s", i_ret,
davinci_GetExtendedError( out_args.extendedError ) );
return NULL;
}
/* Print some info */
//msg_Dbg( p_enc, "Bytes generated: %d", (int)out_args.bytesGenerated );
/* Put everything in the block */
if( out_args.bytesGenerated <= 0 )
return NULL;
p_block = block_New( p_enc, out_args.bytesGenerated );
if( !p_block )
return NULL;
memcpy( p_block->p_buffer, xdm->out.bufs[0], out_args.bytesGenerated );
/* NOTE: assumption */
p_block->i_dts = p_block->i_pts = p_buffer->start_date;
/* Shamelessly copied from ffmpeg/encoder.c */
p_block->i_length = (mtime_t)1000000 *
(mtime_t)p_enc->fmt_out.audio.i_frame_length /
(mtime_t)p_enc->fmt_out.audio.i_rate;
return p_block;
}
/***************************************************************************** /*****************************************************************************
* davinci.c: decoder and encoder modules using the DaVinci DSP. * davinci.c: decoder and encoder modules using the DaVinci DSP.
***************************************************************************** *****************************************************************************
* Copyright (C) 2008-2009 M2X BV * Copyright (C) 2008-2010 M2X BV
* $Id$ * $Id$
* *
* Authors: Antoine Cellerier <dionoea at videolan dot org> * Authors: Antoine Cellerier <dionoea at videolan dot org>
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#include <assert.h>
#include "davinci.h" #include "davinci.h"
/***************************************************************************** /*****************************************************************************
...@@ -79,6 +81,11 @@ ...@@ -79,6 +81,11 @@
#define ENC_QUALITY_LONGTEXT N_( "Encoder qualtiy setting preset. " \ #define ENC_QUALITY_LONGTEXT N_( "Encoder qualtiy setting preset. " \
"ranges from 0..3 (0=encoders default, 1=high quality, 2=speed, 3=user defined" ) "ranges from 0..3 (0=encoders default, 1=high quality, 2=speed, 3=user defined" )
#define ENC_CBR_TEXT N_("Constant bitrate encoding (default: true)" )
#define ENC_CBR_LONGTEXT N_( "Use constant bitrate encoding. If disabled, " \
"then variable bitrate encoding is used resulting in higher bandwidth savings." )
/* */
#define MODULE_DESCRIPTION N_( "Various audio and video decoders/encoders" \ #define MODULE_DESCRIPTION N_( "Various audio and video decoders/encoders" \
"delivered by TI Davinci library. This includes MPEG4, H264, VC-1, "\ "delivered by TI Davinci library. This includes MPEG4, H264, VC-1, "\
"MPEG1, MPEG2, AAC and MP3 codecs") "MPEG1, MPEG2, AAC and MP3 codecs")
...@@ -116,12 +123,16 @@ vlc_module_begin() ...@@ -116,12 +123,16 @@ vlc_module_begin()
set_section( N_("Encoding") , NULL ) set_section( N_("Encoding") , NULL )
set_callbacks( OpenEncoder, CloseEncoder ) set_callbacks( OpenEncoder, CloseEncoder )
/* encoder settings */ /* encoder settings - XDM 0.9 only */
add_integer( ENC_CFG_PREFIX "quality", 0, NULL, ENC_QUALITY_TEXT, add_integer( ENC_CFG_PREFIX "quality", 0, NULL, ENC_QUALITY_TEXT,
ENC_QUALITY_LONGTEXT, true ) ENC_QUALITY_LONGTEXT, true )
change_integer_range( 0, 3 ) change_integer_range( 0, 3 )
/* video encoder settings */ /* encoder settings - XDM 1.0 only */
add_bool( ENC_CFG_PREFIX "cbr", true, NULL, ENC_CBR_TEXT,
ENC_CBR_LONGTEXT, true )
/* video encoder settings - XDM all versions */
add_integer( ENC_CFG_PREFIX "keyint", 0, NULL, ENC_KEYINT_TEXT, add_integer( ENC_CFG_PREFIX "keyint", 0, NULL, ENC_KEYINT_TEXT,
ENC_KEYINT_LONGTEXT, false ) ENC_KEYINT_LONGTEXT, false )
add_bool( ENC_CFG_PREFIX "interlace", false, NULL, ENC_INTERLACE_TEXT, add_bool( ENC_CFG_PREFIX "interlace", false, NULL, ENC_INTERLACE_TEXT,
...@@ -150,6 +161,7 @@ vlc_module_end() ...@@ -150,6 +161,7 @@ vlc_module_end()
*****************************************************************************/ *****************************************************************************/
#include <ti/sdo/ce/osal/Memory.h> #include <ti/sdo/ce/osal/Memory.h>
/* XDM 0.9 */
int davinci_AllocateBuffer( XDAS_Int32 i_num, XDAS_Int32 *pi_sizes, int davinci_AllocateBuffer( XDAS_Int32 i_num, XDAS_Int32 *pi_sizes,
XDM_BufDesc *buf ) XDM_BufDesc *buf )
{ {
...@@ -203,6 +215,44 @@ void davinci_FreeBuffer( XDM_BufDesc *buf ) ...@@ -203,6 +215,44 @@ void davinci_FreeBuffer( XDM_BufDesc *buf )
} }
} }
/* XDM 1.0 */
int davinci_AllocateBuffer1( XDAS_Int32 i_num, XDAS_Int32 *pi_sizes,
XDM1_BufDesc *buf )
{
int i;
assert(i_num < XDM_MAX_IO_BUFFERS);
buf->numBufs = i_num;
for( i = 0; i < i_num; i++ )
{
buf->descs[i].bufSize = pi_sizes[i];
buf->descs[i].buf = Memory_contigAlloc( pi_sizes[i], Memory_DEFAULTALIGNMENT );
if( !buf->descs[i].buf )
{
goto error;
}
}
return VLC_SUCCESS;
error:
for( i--; i >= 0; i-- )
Memory_contigFree( buf->descs[i].buf, buf->descs[i].bufSize );
return VLC_ENOMEM;
}
void davinci_FreeBuffer1( XDM1_BufDesc *buf )
{
if( buf->numBufs != 0 )
{
int i;
for( i = 0; i < buf->numBufs; i++ )
Memory_contigFree( buf->descs[i].buf, buf->descs[i].bufSize );
buf->numBufs = 0;
}
}
/***************************************************************************** /*****************************************************************************
* Misc utils * Misc utils
*****************************************************************************/ *****************************************************************************/
...@@ -264,3 +314,4 @@ void davinci_PrintAvailableAlgorithms( vlc_object_t *p_this, const char *psz_eng ...@@ -264,3 +314,4 @@ void davinci_PrintAvailableAlgorithms( vlc_object_t *p_this, const char *psz_eng
} }
} }
} }
/***************************************************************************** /*****************************************************************************
* davinci.h: decoder and encoder modules using the DaVinci DSP. * davinci.h: decoder and encoder modules using the DaVinci DSP.
***************************************************************************** *****************************************************************************
* Copyright (C) 2008-2009 M2X BV * Copyright (C) 2008-2010 M2X BV
* $Id$ * $Id$
* *
* Authors: Antoine Cellerier <dionoea at videolan dot org> * Authors: Antoine Cellerier <dionoea at videolan dot org>
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define VLC_DAVINCI_H #define VLC_DAVINCI_H
#define XDM_INCLUDE_DOT9_SUPPORT /* Support old 0.9 API */ #define XDM_INCLUDE_DOT9_SUPPORT /* Support old 0.9 API */
#include <gnu/targets/std.h> #include <gnu/targets/std.h>
#include <xdc/std.h> #include <xdc/std.h>
#include <ti/xdais/xdas.h> #include <ti/xdais/xdas.h>
...@@ -38,28 +39,86 @@ ...@@ -38,28 +39,86 @@
#define ENC_CFG_PREFIX "sout-davinci-" #define ENC_CFG_PREFIX "sout-davinci-"
#define DEC_CFG_PREFIX "davinci-" #define DEC_CFG_PREFIX "davinci-"
/* Wrapper for XDM version specific data */
typedef struct xdm_sys_t xdm_sys_t;
/* decoder */
int OpenVideoDecoder( vlc_object_t * ); int OpenVideoDecoder( vlc_object_t * );
void CloseVideoDecoder( vlc_object_t * ); void CloseVideoDecoder( vlc_object_t * );
int OpenAudioDecoder( vlc_object_t * ); int OpenAudioDecoder( vlc_object_t * );
void CloseAudioDecoder( vlc_object_t * ); void CloseAudioDecoder( vlc_object_t * );
/* encoder */
struct encoder_sys_t
{
char *psz_ti_engine;
const char *psz_codec;
Engine_Handle engine;
xdm_sys_t *xdm;
block_t *(*pf_encode_video)( encoder_t *, picture_t * );
block_t *(*pf_encode_audio)( encoder_t *, aout_buffer_t * );
/* stats */
#ifdef DEBUG_FPS
mtime_t i_pts_start;
mtime_t i_pts_end;
int i_fps;
#endif
int i_pics;
};
int OpenEncoder( vlc_object_t * ); int OpenEncoder( vlc_object_t * );
void CloseEncoder( vlc_object_t * ); void CloseEncoder( vlc_object_t * );
int OpenEncoderAudio( encoder_t * );
void CloseEncoderAudio( encoder_t * );
int OpenEncoderAudio1( encoder_t * );
void CloseEncoderAudio1( encoder_t * );
int OpenEncoderVideo( encoder_t * );
void CloseEncoderVideo( encoder_t * );
//int OpenEncoderVideo1( encoder_t * );
//void CloseEncoderVideo1( encoder_t * );
/***************************************************************************** /*****************************************************************************
* Common stuff * Common stuff
*****************************************************************************/ *****************************************************************************/
extern const char *ppsz_engine_error[]; extern const char *ppsz_engine_error[];
int davinci_AllocateBuffer( XDAS_Int32, XDAS_Int32 *, XDM_BufDesc * ); #ifdef DEBUG_FPS
void davinci_FreeBuffer( XDM_BufDesc * ); void calculate_fps( encoder_t *p_enc );
#endif
const char *davinci_GetExtendedError( XDAS_Int32 ); const char *davinci_GetExtendedError( XDAS_Int32 );
void davinci_PrintAvailableAlgorithms( vlc_object_t *, const char * ); void davinci_PrintAvailableAlgorithms( vlc_object_t *, const char * );
bool GetDavinciDecoder( vlc_fourcc_t, int *, const char **, const char ** ); /* Davinci FourCC */
bool GetDavinciEncoder( vlc_fourcc_t, int *, const char **, const char ** ); enum davinci_xdm_version_e
{
DAVINCI_XDM0_9 = 0x09,
DAVINCI_XDM1_0 = 0x0A,
DAVINCI_XDM1_1 = 0x0C,
};
bool GetDavinciDecoder( vlc_fourcc_t, int *, int *, const char **, const char ** );
bool GetDavinciEncoder( vlc_fourcc_t, int *, int *, const char **, const char ** );
bool GetVlcFourcc( const char *, int *, vlc_fourcc_t *, const char ** ); bool GetVlcFourcc( const char *, int *, vlc_fourcc_t *, const char ** );
XDAS_Int32 VlcChromaToXdm( vlc_fourcc_t ); XDAS_Int32 VlcChromaToXdm( vlc_fourcc_t );
/* XDM 0.9 */
int davinci_AllocateBuffer( XDAS_Int32, XDAS_Int32 *, XDM_BufDesc * );
void davinci_FreeBuffer( XDM_BufDesc * );
/* XDM 1.0 */
int davinci_AllocateBuffer1( XDAS_Int32, XDAS_Int32 *, XDM1_BufDesc * );
void davinci_FreeBuffer1( XDM1_BufDesc * );
#endif #endif
/***************************************************************************** /*****************************************************************************
* encoder.c: video encoder module using the DaVinci DSP. * encoder.c: video encoder module using the DaVinci DSP.
***************************************************************************** *****************************************************************************
* Copyright (C) 2008-2009 M2X BV * Copyright (C) 2008-2010 M2X BV
* $Id$ * $Id$
* *
* Authors: Antoine Cellerier <dionoea at videolan dot org> * Authors: Antoine Cellerier <dionoea at videolan dot org>
...@@ -36,49 +36,15 @@ ...@@ -36,49 +36,15 @@
#include <vlc_sout.h> #include <vlc_sout.h>
#include <vlc_codec.h> #include <vlc_codec.h>
#undef DEBUG_FPS
#include "davinci.h" #include "davinci.h"
#include <ti/sdo/ce/video/videnc.h>
#include <ti/sdo/ce/audio/audenc.h>
#include <assert.h> #include <assert.h>
/***************************************************************************** /*****************************************************************************
* Local prototypes * Encoder
*****************************************************************************/ *****************************************************************************/
static block_t *EncodeVideo( encoder_t *, picture_t * );
static block_t *EncodeAudio( encoder_t *, aout_buffer_t * );
static int GetVideoEncoderSettings( encoder_t *p_enc, const char *psz_codec );
static int GetAudioEncoderSettings( encoder_t *p_enc, const char *psz_codec );
/*****************************************************************************
* Video encoder
*****************************************************************************/
struct encoder_sys_t
{
char *psz_ti_engine;
Engine_Handle e;
/* video */
VIDENC_Handle c;
/* audio */
AUDENC_Handle a;
XDM_BufDesc in;
XDM_BufDesc out;
/* stats */
#undef DEBUG_FPS
#ifdef DEBUG_FPS
mtime_t i_pts_start;
mtime_t i_pts_end;
int i_fps;
#endif
int i_pics;
};
/***************************************************************************** /*****************************************************************************
* *
...@@ -86,30 +52,30 @@ struct encoder_sys_t ...@@ -86,30 +52,30 @@ struct encoder_sys_t
int OpenEncoder( vlc_object_t *p_this ) int OpenEncoder( vlc_object_t *p_this )
{ {
encoder_t *p_enc = (encoder_t *)p_this; encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys; encoder_sys_t *p_sys = NULL;
Engine_Error err; Engine_Error err;
int i_cat; int i_cat, i_xdm;
const char *psz_codec;
const char *psz_namecodec; const char *psz_namecodec;
if( !GetDavinciEncoder( p_enc->fmt_out.i_codec, &i_cat, /* Allocate our private structure */
&psz_codec, &psz_namecodec ) ) p_enc->p_sys = (encoder_sys_t *)calloc( 1, sizeof( encoder_sys_t ) );
if( !p_enc->p_sys )
return VLC_ENOMEM;
p_sys = p_enc->p_sys;
if( !GetDavinciEncoder( p_enc->fmt_out.i_codec, &i_cat, &i_xdm,
&p_sys->psz_codec, &psz_namecodec ) )
{ {
msg_Dbg( p_enc, "Unsupported codec : %4.4s",(char*)&p_enc->fmt_out.i_codec ); msg_Dbg( p_enc, "Unsupported codec : %4.4s",(char*)&p_enc->fmt_out.i_codec );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
msg_Dbg( p_enc, "found davinci encoder %s for %s (codec=%4.4s, cat=%s)", msg_Dbg( p_enc, "found davinci encoder %s for %s (codec=%4.4s, cat=%s)",
psz_codec, (char*)&p_enc->fmt_out.i_codec, psz_namecodec, p_sys->psz_codec, (char*)&p_enc->fmt_out.i_codec, psz_namecodec,
(i_cat == VIDEO_ES) ? "video" : (i_cat == VIDEO_ES) ? "video" :
(i_cat == AUDIO_ES) ? "audio" : "other" ); (i_cat == AUDIO_ES) ? "audio" : "other" );
/* Allocate our private structure */
p_enc->p_sys = (encoder_sys_t *)calloc( 1, sizeof( encoder_sys_t ) );
if( !p_enc->p_sys )
return VLC_ENOMEM;
p_sys = p_enc->p_sys;
p_sys->psz_ti_engine = var_CreateGetString( p_enc, DEC_CFG_PREFIX "engine" ); p_sys->psz_ti_engine = var_CreateGetString( p_enc, DEC_CFG_PREFIX "engine" );
if( !p_sys->psz_ti_engine ) if( !p_sys->psz_ti_engine )
{ {
...@@ -121,7 +87,7 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -121,7 +87,7 @@ int OpenEncoder( vlc_object_t *p_this )
CERuntime_init(); CERuntime_init();
/* Create an engine handle */ /* Create an engine handle */
p_sys->e = Engine_open( p_sys->psz_ti_engine, NULL /*&Engine_ATTRS*/, &err ); p_sys->engine = Engine_open( p_sys->psz_ti_engine, NULL /*&Engine_ATTRS*/, &err );
if( err != Engine_EOK ) if( err != Engine_EOK )
{ {
msg_Err( p_enc, "Error while opening engine `%s': %s", msg_Err( p_enc, "Error while opening engine `%s': %s",
...@@ -135,14 +101,25 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -135,14 +101,25 @@ int OpenEncoder( vlc_object_t *p_this )
switch( i_cat ) switch( i_cat )
{ {
case VIDEO_ES: case VIDEO_ES:
if( GetVideoEncoderSettings( p_enc, psz_codec ) != VLC_SUCCESS ) if( OpenEncoderVideo( p_enc ) != VLC_SUCCESS )
goto error; goto error;
p_enc->pf_encode_video = EncodeVideo; p_enc->pf_encode_video = p_sys->pf_encode_video;
break; break;
case AUDIO_ES: case AUDIO_ES:
if( GetAudioEncoderSettings( p_enc, psz_codec ) != VLC_SUCCESS ) switch( i_xdm )
{
case DAVINCI_XDM0_9:
if( OpenEncoderAudio( p_enc ) != VLC_SUCCESS )
goto error;
break;
case DAVINCI_XDM1_0:
if( OpenEncoderAudio1( p_enc ) != VLC_SUCCESS )
goto error; goto error;
p_enc->pf_encode_audio = EncodeAudio; break;
default:
goto error;
}
p_enc->pf_encode_audio = p_sys->pf_encode_audio;
break; break;
default: default:
msg_Err( p_enc, "aborting unknown ES (%d)", i_cat ); msg_Err( p_enc, "aborting unknown ES (%d)", i_cat );
...@@ -155,125 +132,61 @@ error: ...@@ -155,125 +132,61 @@ error:
msg_Err( p_enc, "Failed to create %s encoder (%s) for %s", msg_Err( p_enc, "Failed to create %s encoder (%s) for %s",
(i_cat == VIDEO_ES) ? "video" : (i_cat == VIDEO_ES) ? "video" :
(i_cat == AUDIO_ES) ? "audio" : "other", (i_cat == AUDIO_ES) ? "audio" : "other",
psz_codec, psz_namecodec ); p_sys->psz_codec, psz_namecodec );
if( p_sys->e ) Engine_close( p_sys->e ); if( p_sys->engine ) Engine_close( p_sys->engine );
free( p_sys->psz_ti_engine ); free( p_sys->psz_ti_engine );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/***************************************************************************** /*****************************************************************************
* * CloseEncoder
*****************************************************************************/ *****************************************************************************/
void CloseEncoder( vlc_object_t *p_this ) void CloseEncoder( vlc_object_t *p_this )
{ {
encoder_t *p_enc = (encoder_t *)p_this; encoder_t *p_enc = (encoder_t *)p_this;
encoder_sys_t *p_sys = p_enc->p_sys; encoder_sys_t *p_sys = p_enc->p_sys;
/* Delete video encoder */ /* Delete encoder */
if( p_enc->fmt_out.i_cat == VIDEO_ES ) int i_xdm, i_cat;
VIDENC_delete( p_sys->c ); if( !GetDavinciEncoder( p_enc->fmt_out.i_codec, &i_cat, &i_xdm,
NULL, NULL ) )
/* Delete audio encoder */
if( p_enc->fmt_out.i_cat == AUDIO_ES )
AUDENC_delete( p_sys->a );
/* Delete codec engine handle */
Engine_close( p_sys->e );
/* Exit the codec engine */
CERuntime_exit(); /* XXX: Should this be done only once (if we have encoder + decoder runing) */
/* Free 'DaVinci compliant' buffers */
davinci_FreeBuffer( &p_sys->in );
davinci_FreeBuffer( &p_sys->out );
free( p_sys->psz_ti_engine );
free( p_sys );
}
/*****************************************************************************
* Video Encoder
*****************************************************************************/
static int GetVideoEncoderSettings( encoder_t *p_enc, const char *psz_codec )
{
encoder_sys_t *p_sys = p_enc->p_sys;
VIDENC_Params params;
p_enc->i_iframes = var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "keyint" );
p_enc->i_tolerance = var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "tolerance" );
p_enc->i_tolerance *= 1024; /* bits per second */
#ifdef DEBUG_FPS
p_sys->i_fps = p_enc->i_iframes;
#endif
/* Configure encoder */
params.size = sizeof( params );
switch( var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "quality" ) )
{ {
case 1: params.encodingPreset = XDM_HIGH_QUALITY; break; switch( i_cat )
case 2: params.encodingPreset = XDM_HIGH_SPEED; break; {
case 3: params.encodingPreset = XDM_USER_DEFINED; break; case VIDEO_ES:
default: switch( i_xdm )
params.encodingPreset = XDM_DEFAULT; {
break; case DAVINCI_XDM0_9: CloseEncoderVideo( p_enc ); break;
//case DAVINCI_XDM1_0: CloseEncoderVideo1( p_enc ); break;
} }
switch( var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "rc" ) ) break;
case AUDIO_ES:
switch( i_xdm )
{ {
case 1: params.rateControlPreset = IVIDEO_LOW_DELAY; break; case DAVINCI_XDM0_9: CloseEncoderAudio( p_enc ); break;
case 2: params.rateControlPreset = IVIDEO_STORAGE; break; case DAVINCI_XDM1_0: CloseEncoderAudio1( p_enc ); break;
case 3: params.rateControlPreset = IVIDEO_TWOPASS; break; }
case 4: params.rateControlPreset = IVIDEO_NONE; break; break;
case 5: params.rateControlPreset = IVIDEO_USER_DEFINED; break;
default: default:
params.rateControlPreset = IVIDEO_RATECONTROLPRESET_DEFAULT; msg_Err( p_enc, "Trying to release unsupported codec." );
break; break;
} }
params.maxHeight = p_enc->fmt_in.video.i_height;
params.maxWidth = p_enc->fmt_in.video.i_width;
params.maxFrameRate = p_enc->fmt_out.video.i_frame_rate_base ?
p_enc->fmt_out.video.i_frame_rate * 1000 /
p_enc->fmt_out.video.i_frame_rate_base :
50000; /* Frames per 1000 seconds */
params.maxBitRate = p_enc->fmt_out.i_bitrate
+ p_enc->i_tolerance;
params.dataEndianness = XDM_BYTE;
params.maxInterFrameInterval = 0; /* NOTE: should be null */
params.inputChromaFormat = VlcChromaToXdm( p_enc->fmt_in.i_codec );
msg_Info( p_enc, "max %dx%d at %.3f fps (max bitrate %d kBps, I-Frame interval %d)\n",
(int)params.maxWidth, (int)params.maxHeight,
((float)params.maxFrameRate)/1000.,
((int)params.maxBitRate) / (8*1024),
(int)p_enc->i_iframes );
if( params.inputChromaFormat == XDM_CHROMA_NA )
{
msg_Warn( p_enc, "Unsupported input chroma (%4.4s), forcing I420.",
(const char *)&p_enc->fmt_in.i_codec );
params.inputChromaFormat = VlcChromaToXdm( VLC_FOURCC('I','4','2','0' ) );
} }
/* NOTE: we don't know if it's progressive or interlaced /* Delete codec engine handle */
* until we get the first picture (p_pic->b_progressive). Engine_close( p_sys->engine );
* Thus let a knowledgeable user override this setting. */
if( var_CreateGetBool( p_enc, ENC_CFG_PREFIX "interlace" ) )
params.inputContentType = IVIDEO_INTERLACED;
else
params.inputContentType = IVIDEO_PROGRESSIVE;
/* Create encoder handle */ /* Exit the codec engine */
p_sys->c = VIDENC_create( p_sys->e, (String)psz_codec, &params ); CERuntime_exit(); /* FIXME: Should this be done only once (if we have encoder + decoder runing) */
if( !p_sys->c )
return VLC_EGENERIC;
return VLC_SUCCESS; free( p_sys->psz_ti_engine );
free( p_sys );
} }
#ifdef DEBUG_FPS #ifdef DEBUG_FPS
static inline void calculate_fps( encoder_t *p_enc ) void calculate_fps( encoder_t *p_enc )
{ {
encoder_sys_t *p_sys = p_enc->p_sys; encoder_sys_t *p_sys = p_enc->p_sys;
...@@ -302,405 +215,3 @@ static inline void calculate_fps( encoder_t *p_enc ) ...@@ -302,405 +215,3 @@ static inline void calculate_fps( encoder_t *p_enc )
} }
#endif #endif
static inline void davinci_CopyPictureToXDM( encoder_t *p_enc, XDM_BufDesc *p_buf, picture_t *p_pic )
{
VLC_UNUSED( p_enc );
/* Copy input picture */
assert( p_pic->i_planes == p_buf->numBufs );
assert( p_pic->i_planes == 1 );
for( int i = 0; i < p_pic->i_planes; i++ )
{
plane_t *p = p_pic->p + i;
memcpy( p_buf->bufs[i], p->p_pixels, p->i_pitch * p->i_visible_lines );
}
}
static int davinci_SetDynamicParams( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
VIDENC_DynamicParams dparams;
VIDENC_Status status;
dparams.size = sizeof( dparams );
memset( &status, 0, sizeof( status ) );
status.size = sizeof( status );
/* Configue the encoder */
dparams.inputHeight = p_enc->fmt_in.video.i_height;
dparams.inputWidth = p_enc->fmt_in.video.i_width;
dparams.refFrameRate = (p_enc->fmt_out.video.i_frame_rate_base != 0) ?
(p_enc->fmt_out.video.i_frame_rate * 1000) /
p_enc->fmt_out.video.i_frame_rate_base :
p_enc->i_iframes * 1000; /* Frames per 1000 seconds */
dparams.targetFrameRate = dparams.refFrameRate; /* input fps = output fps */
dparams.targetBitRate = p_enc->fmt_out.i_bitrate;
dparams.intraFrameInterval = p_enc->i_iframes;
dparams.generateHeader = XDM_ENCODE_AU; /* don't encode only the header */
dparams.captureWidth = 0;
dparams.forceIFrame = 1;
if( VIDENC_control( p_sys->c, XDM_SETPARAMS, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters: %dx%d @%d fps, "
"%d kBps, I-frame interval %d",
(int)dparams.inputWidth, (int)dparams.inputHeight,
(int)dparams.refFrameRate / 1000,
(int)dparams.targetBitRate >> 13 /* / (1024 * 8) */,
(int)dparams.intraFrameInterval );
return VLC_EGENERIC;
}
msg_Info( p_enc, "using %dx%d at %.3f fps (bitrate %d kBps, I-Frame interval %d)\n",
(int)dparams.inputWidth, (int)dparams.inputHeight,
((float)dparams.targetFrameRate)/1000.,
((int)dparams.targetBitRate) >> 13 /* / (8*1024)*/,
(int)dparams.intraFrameInterval );
return VLC_SUCCESS;
}
static int davinci_InitVideoBuffers( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
int i_ret = VLC_SUCCESS;
VIDENC_DynamicParams dparams;
VIDENC_Status status;
dparams.size = sizeof( dparams );
memset( &status, 0, sizeof( status ) );
status.size = sizeof( status );
/* Configue the encoder */
dparams.inputHeight = p_enc->fmt_in.video.i_height;
dparams.inputWidth = p_enc->fmt_in.video.i_width;
dparams.refFrameRate = (p_enc->fmt_out.video.i_frame_rate_base != 0) ?
(p_enc->fmt_out.video.i_frame_rate * 1000) /
p_enc->fmt_out.video.i_frame_rate_base :
p_enc->i_iframes * 1000; /* Frames per 1000 seconds */
dparams.targetFrameRate = dparams.refFrameRate; /* input fps = output fps */
dparams.targetBitRate = p_enc->fmt_out.i_bitrate;
dparams.intraFrameInterval = p_enc->i_iframes;
dparams.generateHeader = XDM_ENCODE_AU; /* don't encode only the header */
dparams.captureWidth = 0;
dparams.forceIFrame = 1;
if( VIDENC_control( p_sys->c, XDM_SETPARAMS, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters: %dx%d @%d fps, "
"%d kBps, I-frame interval %d",
(int)dparams.inputWidth, (int)dparams.inputHeight,
(int)dparams.refFrameRate / 1000,
(int)dparams.targetBitRate >> 13 /* / (1024 * 8) */,
(int)dparams.intraFrameInterval );
return VLC_EGENERIC;
}
msg_Info( p_enc, "using %dx%d at %.3f fps (bitrate %d kBps, I-Frame interval %d)\n",
(int)dparams.inputWidth, (int)dparams.inputHeight,
((float)dparams.targetFrameRate)/1000.,
((int)dparams.targetBitRate) >> 13 /* / (8*1024)*/,
(int)dparams.intraFrameInterval );
/* Configure buffers */
if( VIDENC_control( p_sys->c, XDM_GETBUFINFO, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to get buffer info" );
return VLC_EGENERIC;
}
/* Allocate input buffer(s) */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &p_sys->in ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate input buffers" );
return i_ret;
}
/* Allocate output buffer */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &p_sys->out ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate input buffers" );
return i_ret;
}
return i_ret;
}
static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
{
encoder_sys_t *p_sys = p_enc->p_sys;
block_t *p_block;
VIDENC_InArgs in_args;
VIDENC_OutArgs out_args;
int i;
if( p_sys->in.numBufs == 0 || p_sys->out.numBufs == 0 )
{
if( davinci_InitVideoBuffers( p_enc ) != VLC_SUCCESS )
return NULL;
}
else if( p_sys->i_pics >= p_enc->i_iframes )
{
if( davinci_SetDynamicParams( p_enc ) != VLC_SUCCESS )
msg_Err( p_enc, "Encoding continues with previous settings" );
p_sys->i_pics = 0;
}
p_sys->i_pics++;
davinci_CopyPictureToXDM( p_enc, &p_sys->in, p_pic );
/* Configure input */
in_args.size = sizeof( in_args );
/* Configure output */
memset( &out_args, 0, sizeof( out_args ) );
out_args.size = sizeof( out_args );
/* Encode the video */
i = VIDENC_process( p_sys->c, &p_sys->in, &p_sys->out,
&in_args, &out_args );
if( i != VIDENC_EOK )
{
msg_Err( p_enc, "Video encoding failed (%d): %s", i,
davinci_GetExtendedError( out_args.extendedError ) );
return NULL;
}
/* Print some info */
//msg_Dbg( p_enc, "Bytes generated: %d", (int)out_args.bytesGenerated );
#ifdef DEBUG_FPS
calculate_fps( p_enc );
#endif
/* Put everything in the block */
if( out_args.bytesGenerated <= 0 )
return NULL;
p_block = block_New( p_enc, out_args.bytesGenerated );
if( !p_block )
return NULL;
memcpy( p_block->p_buffer, p_sys->out.bufs[0], out_args.bytesGenerated );
switch( out_args.encodedFrameType )
{
case IVIDEO_I_FRAME:
case IVIDEO_II_FRAME:
p_block->i_flags |= BLOCK_FLAG_TYPE_I;
break;
case IVIDEO_P_FRAME:
case IVIDEO_PP_FRAME:
p_block->i_flags |= BLOCK_FLAG_TYPE_P;
break;
case IVIDEO_B_FRAME:
case IVIDEO_BB_FRAME:
p_block->i_flags |= BLOCK_FLAG_TYPE_B;
break;
default:
msg_Warn( p_enc, "Unknown frame type" );
p_block->i_flags |= BLOCK_FLAG_TYPE_PB; /* Wild guess */
break;
}
p_block->i_dts = p_block->i_pts = p_pic->date;
/* Shamelessly copied from ffmpeg/encoder.c */
p_block->i_length = INT64_C(1000000) *
p_enc->fmt_in.video.i_frame_rate_base /
p_enc->fmt_in.video.i_frame_rate;
return p_block;
}
/*****************************************************************************
* Audio Encoder
*****************************************************************************/
static int GetAudioEncoderSettings( encoder_t *p_enc, const char *psz_codec )
{
encoder_sys_t *p_sys = p_enc->p_sys;
AUDENC_Params params;
params.size = sizeof( params );
switch( var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "quality" ) )
{
case 1: params.encodingPreset = XDM_HIGH_QUALITY; break;
case 2: params.encodingPreset = XDM_HIGH_SPEED; break;
case 3: params.encodingPreset = XDM_USER_DEFINED; break;
default:
params.encodingPreset = XDM_DEFAULT;
break;
}
params.maxBitrate = p_enc->fmt_out.i_bitrate;
params.maxSampleRate = p_enc->fmt_out.audio.i_rate;
params.maxNoOfCh = p_enc->fmt_out.audio.i_channels;
params.dataEndianness = XDM_BYTE;
msg_Info( p_enc, "audio %d channels, %d Hz (max bitrate %d kBps)\n",
(int)params.maxNoOfCh,
(int)params.maxSampleRate,
((int)params.maxBitrate) >> 13 /* / (8*1024)*/);
/* Create encoder handle */
p_sys->a = AUDENC_create( p_sys->e, (String)psz_codec, &params );
if( !p_sys->a )
return VLC_EGENERIC;
return VLC_SUCCESS;
}
static inline int davinci_InitAudioBuffers( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
int i_ret = VLC_SUCCESS;
AUDENC_DynamicParams dparams;
AUDENC_Status status;
dparams.size = sizeof( dparams );
memset( &status, 0, sizeof( status ) );
status.size = sizeof( status );
/* Configue the encoder */
/* NOTE: assuming channels are interleaved */
dparams.inputFormat = IAUDIO_INTERLEAVED; // IAUDIO_BLOCK;
dparams.bitRate = p_enc->fmt_out.i_bitrate;
dparams.sampleRate = p_enc->fmt_out.audio.i_rate;
switch( p_enc->fmt_out.audio.i_channels )
{
case 1: dparams.numChannels = IAUDIO_MONO; /* Single channel. */
break;
case 2: dparams.numChannels = IAUDIO_STEREO; /* Two channel. */
break;
case 3: dparams.numChannels = IAUDIO_THREE_ZERO; /* Three channel. */
break;
case 5: dparams.numChannels = IAUDIO_FIVE_ZERO; /* Five channel. */
break;
case 6: dparams.numChannels = IAUDIO_FIVE_ONE; /* 5.1 channel. */
break;
case 7: dparams.numChannels = IAUDIO_SEVEN_ONE; /* 7.1 channel. */
break;
default:
msg_Warn( p_enc, "assuming stereo audio channels" );
dparams.numChannels = IAUDIO_STEREO; /**< Two channel. */
break;
}
dparams.numLFEChannels = 0; /* FIXME: What to fill in here?
* Number of LFE (Low Frequency Effects) channels in the stream. */
dparams.inputBitsPerSample = p_enc->fmt_out.audio.i_bitspersample;
//p_enc->fmt_in.i_codec == AOUT_FMT_S16_NE) ? 16: 32;
if( AUDENC_control( p_sys->c, XDM_SETPARAMS, &dparams, &status )
!= AUDENC_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters: %d @ %d Hz, "
"bitrate %d kBps, %d bits per sample",
p_enc->fmt_out.audio.i_channels,
(int)dparams.sampleRate,
((int)dparams.bitRate) >> 13 /* / (8*1024)*/,
(int)dparams.inputBitsPerSample );
return VLC_EGENERIC;
}
msg_Info( p_enc, "using %d channels at %d Hz samplerate (bitrate %d kBps, "
"%d bits per sample)\n",
p_enc->fmt_out.audio.i_channels,
(int)dparams.sampleRate,
((int)dparams.bitRate) >> 13 /* / (8*1024)*/,
(int)dparams.inputBitsPerSample );
/* Configure buffers */
if( AUDENC_control( p_sys->c, XDM_GETBUFINFO, &dparams, &status )
!= AUDENC_EOK )
{
msg_Err( p_enc, "Failed to get buffer info" );
return VLC_EGENERIC;
}
/* Allocate input buffer(s) */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &p_sys->in ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate input buffers" );
return i_ret;
}
/* Allocate output buffer */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &p_sys->out ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate input buffers" );
return i_ret;
}
return i_ret;
}
static block_t *EncodeAudio( encoder_t *p_enc, aout_buffer_t *p_buffer )
{
encoder_sys_t *p_sys = p_enc->p_sys;
AUDENC_InArgs in_args;
AUDENC_OutArgs out_args;
block_t *p_block;
int i_ret;
if( p_sys->in.numBufs == 0 || p_sys->out.numBufs == 0 )
{
if( davinci_InitAudioBuffers( p_enc ) != VLC_SUCCESS )
return NULL;
}
/* Configure input */
memset( &in_args, 0, sizeof( in_args ) );
in_args.size = sizeof( in_args );
/* NOTE: assume interleaved channels */
memcpy( p_sys->in.bufs[0], p_buffer->p_buffer, p_buffer->i_nb_bytes );
/* Configure output */
memset( &out_args, 0, sizeof( out_args ) );
out_args.size = sizeof( out_args );
/* Encode the audio */
if( (i_ret = AUDENC_process( p_sys->c, &p_sys->in, &p_sys->out,
&in_args, &out_args )) != AUDENC_EOK )
{
msg_Err( p_enc, "Audio encoding failed (%d): %s", i_ret,
davinci_GetExtendedError( out_args.extendedError ) );
return NULL;
}
/* Print some info */
//msg_Dbg( p_enc, "Bytes generated: %d", (int)out_args.bytesGenerated );
/* Put everything in the block */
if( out_args.bytesGenerated <= 0 )
return NULL;
p_block = block_New( p_enc, out_args.bytesGenerated );
if( !p_block )
return NULL;
memcpy( p_block->p_buffer, p_sys->out.bufs[0], out_args.bytesGenerated );
/* NOTE: assumption */
p_block->i_dts = p_block->i_pts = p_buffer->start_date;
/* Shamelessly copied from ffmpeg/encoder.c */
p_block->i_length = (mtime_t)1000000 *
(mtime_t)p_enc->fmt_out.audio.i_frame_length /
(mtime_t)p_enc->fmt_out.audio.i_rate;
return p_block;
}
/***************************************************************************** /*****************************************************************************
* fourcc.c: davinci <-> libvlc conversion routines * fourcc.c: davinci <-> libvlc conversion routines
***************************************************************************** *****************************************************************************
* Copyright (C) 2009 M2X BV * Copyright (C) 2009-2010 M2X BV
* $Id$ * $Id$
* *
* Authors: Jean-Paul Saman <jpsaman@videolan.org> * Authors: Jean-Paul Saman <jpsaman@videolan.org>
...@@ -42,40 +42,42 @@ ...@@ -42,40 +42,42 @@
#define DAVINCI_HAS_MPEG4_CODEC #define DAVINCI_HAS_MPEG4_CODEC
#define DAVINCI_HAS_H264_CODEC #define DAVINCI_HAS_H264_CODEC
#define DAVINCI_HAS_VC1_CODEC #define DAVINCI_HAS_VC1_CODEC
#define DAVINCI_HAS_G711_CODEC
#undef DAVINCI_HAS_G711_CODEC
#undef DAVINCI_HAS_MP3_CODEC #undef DAVINCI_HAS_MP3_CODEC
#undef DAVINCI_HAS_AAC_CODEC #define DAVINCI_HAS_AAC_CODEC
/* decoders */ /* decoders names */
#define DAVINCI_DEC_MPEG1 "mpegdec" #define DAVINCI_DEC_MPEG1 "mpegdec"
#define DAVINCI_DEC_MPEG2 "mpeg2dec" #define DAVINCI_DEC_MPEG2 "mpeg2dec"
#define DAVINCI_DEC_MPEG4 "mpeg4dec" #define DAVINCI_DEC_MPEG4 "mpeg4dec"
#define DAVINCI_DEC_H264 "h264dec" #define DAVINCI_DEC_H264 "h264dec"
#define DAVINCI_DEC_VC1 "vc1dec" #define DAVINCI_DEC_VC1 "vc1dec"
#define DAVINIC_DEC_MP3 "mp3dec"
#define DAVINCI_DEC_AAC "aacdec" #define DAVINCI_DEC_AAC "aacdec"
#define DAVINIC_DEC_MP3 "mp3dec"
#define DAVINCI_DEC_G711 "g711dec" #define DAVINCI_DEC_G711 "g711dec"
/* encoders */ /* encoders names */
#define DAVINCI_ENC_MPEG1 "mpegenc" #define DAVINCI_ENC_MPEG1 "mpegenc"
#define DAVINCI_ENC_MPEG2 "mpeg2enc" #define DAVINCI_ENC_MPEG2 "mpeg2enc"
#define DAVINCI_ENC_MPEG4 "mpeg4enc" #define DAVINCI_ENC_MPEG4 "mpeg4enc"
#define DAVINCI_ENC_H264 "h264enc" #define DAVINCI_ENC_H264 "h264enc"
#define DAVINCI_ENC_VC1 "vc1enc" #define DAVINCI_ENC_VC1 "vc1enc"
#define DAVINCI_ENC_AAC "aaclcenc"
#define DAVINCI_ENC_G711 "g711enc" #define DAVINCI_ENC_G711 "g711enc"
#define DAVINIC_NONE "" #define DAVINCI_NONE ""
static const struct static const struct
{ {
vlc_fourcc_t i_fourcc; vlc_fourcc_t i_fourcc;
const char psz_decoder[10];
const char psz_encoder[10];
int i_cat; int i_cat;
const char psz_name[36]; const char psz_name[36];
const char psz_decoder[10];
const char psz_encoder[10];
enum davinci_xdm_version_e i_xdm_version;
} codecs_table[] = } codecs_table[] =
{ {
/* /*
...@@ -83,353 +85,503 @@ static const struct ...@@ -83,353 +85,503 @@ static const struct
*/ */
#ifdef DAVINCI_HAS_MPEG1_CODEC #ifdef DAVINCI_HAS_MPEG1_CODEC
/* MPEG-1 Video */ /* MPEG-1 Video */
{ VLC_FOURCC('m','p','1','v'), DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, { VLC_FOURCC('m','p','1','v'),
VIDEO_ES, "MPEG-1 Video" }, VIDEO_ES, "MPEG-1 Video",
{ VLC_FOURCC('m','p','e','g'), DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-1 Video" }, { VLC_FOURCC('m','p','e','g'),
{ VLC_FOURCC('m','p','g','1'), DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, VIDEO_ES, "MPEG-1 Video",
VIDEO_ES, "MPEG-1 Video" }, DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, DAVINCI_XDM0_9 },
{ VLC_FOURCC('P','I','M','1'), DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, { VLC_FOURCC('m','p','g','1'),
VIDEO_ES, "Pinnacle DC1000 (MPEG-1 Video)" }, VIDEO_ES, "MPEG-1 Video",
DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, DAVINCI_XDM0_9 },
{ VLC_FOURCC('P','I','M','1'),
VIDEO_ES, "Pinnacle DC1000 (MPEG-1 Video)",
DAVINCI_DEC_MPEG1, DAVINCI_ENC_MPEG1, DAVINCI_XDM0_9 },
#endif #endif
#ifdef DAVINCI_HAS_MPEG2_CODEC #ifdef DAVINCI_HAS_MPEG2_CODEC
/* MPEG-2 Video */ /* MPEG-2 Video */
{ VLC_FOURCC('m','p','2','v'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('m','p','2','v'),
VIDEO_ES, "MPEG-2 Video" }, VIDEO_ES, "MPEG-2 Video",
{ VLC_FOURCC('M','P','E','G'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-2 Video" }, { VLC_FOURCC('M','P','E','G'),
{ VLC_FOURCC('m','p','g','v'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, VIDEO_ES, "MPEG-2 Video",
VIDEO_ES, "MPEG-2 Video" }, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','p','g','2'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('m','p','g','v'),
VIDEO_ES, "MPEG-2 Video" }, VIDEO_ES, "MPEG-2 Video",
{ VLC_FOURCC('h','d','v','1'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
VIDEO_ES, "HDV 720p30 (MPEG-2 Video)" }, { VLC_FOURCC('m','p','g','2'),
{ VLC_FOURCC('h','d','v','2'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, VIDEO_ES, "MPEG-2 Video",
VIDEO_ES, "Sony HDV (MPEG-2 Video)" }, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('h','d','v','3'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('h','d','v','1'),
VIDEO_ES, "FCP HDV (MPEG-2 Video)" }, VIDEO_ES, "HDV 720p30 (MPEG-2 Video)",
{ VLC_FOURCC('h','d','v','5'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
VIDEO_ES, "HDV 720p25 (MPEG-2 Video)" }, { VLC_FOURCC('h','d','v','2'),
{ VLC_FOURCC('h','d','v','6'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, VIDEO_ES, "Sony HDV (MPEG-2 Video)",
VIDEO_ES, "HDV 1080p24 (MPEG-2 Video)" }, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('h','d','v','7'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('h','d','v','3'),
VIDEO_ES, "HDV 1080p25 (MPEG-2 Video)" }, VIDEO_ES, "FCP HDV (MPEG-2 Video)",
{ VLC_FOURCC('h','d','v','8'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
VIDEO_ES, "HDV 1080p30 (MPEG-2 Video)" }, { VLC_FOURCC('h','d','v','5'),
VIDEO_ES, "HDV 720p25 (MPEG-2 Video)",
{ VLC_FOURCC('m','x','5','n'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG2 IMX NTSC 525/60 50mb/s (FCP)" }, { VLC_FOURCC('h','d','v','6'),
{ VLC_FOURCC('m','x','5','p'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, VIDEO_ES, "HDV 1080p24 (MPEG-2 Video)",
VIDEO_ES, "MPEG2 IMX PAL 625/60 50mb/s (FCP)" }, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','x','4','n'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('h','d','v','7'),
VIDEO_ES, "MPEG2 IMX NTSC 525/60 40mb/s (FCP)" }, VIDEO_ES, "HDV 1080p25 (MPEG-2 Video)",
{ VLC_FOURCC('m','x','4','p'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG2 IMX PAL 625/50 40mb/s (FCP)" }, { VLC_FOURCC('h','d','v','8'),
{ VLC_FOURCC('m','x','3','n'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, VIDEO_ES, "HDV 1080p30 (MPEG-2 Video)",
VIDEO_ES, "MPEG2 IMX NTSC 525/60 30mb/s (FCP)" }, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','x','3','p'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2,
VIDEO_ES, "MPEG2 IMX NTSC 625/50 30mb/s (FCP)" }, { VLC_FOURCC('m','x','5','n'),
{ VLC_FOURCC('x','d','v','2'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, VIDEO_ES, "MPEG2 IMX NTSC 525/60 50mb/s (FCP)",
VIDEO_ES, "XDCAM HD 1080i60" }, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('A','V','m','p'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('m','x','5','p'),
VIDEO_ES, "AVID IMX PAL" }, VIDEO_ES, "MPEG2 IMX PAL 625/60 50mb/s (FCP)",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','x','4','n'),
VIDEO_ES, "MPEG2 IMX NTSC 525/60 40mb/s (FCP)",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','x','4','p'),
VIDEO_ES, "MPEG2 IMX PAL 625/50 40mb/s (FCP)",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','x','3','n'),
VIDEO_ES, "MPEG2 IMX NTSC 525/60 30mb/s (FCP)",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','x','3','p'),
VIDEO_ES, "MPEG2 IMX NTSC 625/50 30mb/s (FCP)",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('x','d','v','2'),
VIDEO_ES, "XDCAM HD 1080i60",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('A','V','m','p'),
VIDEO_ES, "AVID IMX PAL",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
/* ATI VCR2 */ /* ATI VCR2 */
{ VLC_FOURCC('V','C','R','2'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('V','C','R','2'),
VIDEO_ES, "ATI VCR2 Video" }, VIDEO_ES, "ATI VCR2 Video",
{ VLC_FOURCC('M','M','E','S'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
VIDEO_ES, "Matrox MPEG-2" }, { VLC_FOURCC('M','M','E','S'),
{ VLC_FOURCC('m','m','e','s'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, VIDEO_ES, "Matrox MPEG-2",
VIDEO_ES, "Matrox MPEG-2" }, DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('P','I','M','2'), DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, { VLC_FOURCC('m','m','e','s'),
VIDEO_ES, "Pinnacle DC1000 (MPEG-2 Video)" }, VIDEO_ES, "Matrox MPEG-2",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
{ VLC_FOURCC('P','I','M','2'),
VIDEO_ES, "Pinnacle DC1000 (MPEG-2 Video)",
DAVINCI_DEC_MPEG2, DAVINCI_ENC_MPEG2, DAVINCI_XDM0_9 },
#endif #endif
#ifdef DAVINCI_HAS_MPEG4_CODEC #ifdef DAVINCI_HAS_MPEG4_CODEC
/* MPEG-4 Video */ /* MPEG-4 Video */
{ VLC_FOURCC('D','I','V','X'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('D','I','V','X'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('d','i','v','x'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('d','i','v','x'),
{ VLC_FOURCC('M','P','4','S'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','p','4','s'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('M','P','4','S'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('M','4','S','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('m','p','4','s'),
{ VLC_FOURCC('m','4','s','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('M','4','S','2'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','4','s','2'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* XVID flavours */ /* XVID flavours */
{ VLC_FOURCC('x','v','i','d'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('x','v','i','d'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('X','V','I','D'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('X','V','I','D'),
{ VLC_FOURCC('X','v','i','D'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('X','V','I','X'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('X','v','i','D'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('x','v','i','x'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('X','V','I','X'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('x','v','i','x'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* DX50 */ /* DX50 */
{ VLC_FOURCC('D','X','5','0'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('D','X','5','0'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('d','x','5','0'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('d','x','5','0'),
{ VLC_FOURCC('B','L','Z','0'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "Blizzard MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('D','X','G','M'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('B','L','Z','0'),
VIDEO_ES, "Electronic Arts Game MPEG-4 Video" }, VIDEO_ES, "Blizzard MPEG-4 Video",
{ VLC_FOURCC('m','p','4','v'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('D','X','G','M'),
{ VLC_FOURCC('M','P','4','V'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "Electronic Arts Game MPEG-4 Video",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC( 4, 0, 0, 0 ), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('m','p','4','v'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('m','4','c','c'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('M','P','4','V'),
{ VLC_FOURCC('M','4','C','C'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('F','M','P','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC( 4, 0, 0, 0 ),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('f','m','p','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('m','4','c','c'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('M','4','C','C'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('F','M','P','4'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('f','m','p','4'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* 3ivx delta 3.5 Unsupported /* 3ivx delta 3.5 Unsupported
* putting it here gives extreme distorted images * putting it here gives extreme distorted images
{ VLC_FOURCC('3','I','V','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('3','I','V','1'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('3','i','v','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, */ { VLC_FOURCC('3','i','v','1'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9}, */
/* 3ivx delta 4 */ /* 3ivx delta 4 */
{ VLC_FOURCC('3','I','V','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('3','I','V','2'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('3','i','v','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('3','i','v','2'),
{ VLC_FOURCC('U','M','P','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "UB MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('W','V','1','F'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('U','M','P','4'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "UB MPEG-4 Video",
{ VLC_FOURCC('S','E','D','G'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "Samsung MPEG-4 Video" }, { VLC_FOURCC('W','V','1','F'),
{ VLC_FOURCC('R','M','P','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "REALmagic MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('H','D','X','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('S','E','D','G'),
VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" }, VIDEO_ES, "Samsung MPEG-4 Video",
{ VLC_FOURCC('h','d','x','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" }, { VLC_FOURCC('R','M','P','4'),
{ VLC_FOURCC('S','M','P','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "REALmagic MPEG-4 Video",
VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('s','m','p','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('H','D','X','4'),
VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)" }, VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)",
{ VLC_FOURCC('f','v','f','w'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "FFmpeg MPEG-4" }, { VLC_FOURCC('h','d','x','4'),
{ VLC_FOURCC('F','V','F','W'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)",
VIDEO_ES, "FFmpeg MPEG-4" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('F','F','D','S'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('S','M','P','4'),
VIDEO_ES, "FFDShow MPEG-4" }, VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)",
{ VLC_FOURCC('V','I','D','M'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "vidm 4.01 codec" }, { VLC_FOURCC('s','m','p','4'),
{ VLC_FOURCC('D','C','O','D'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('f','m','p','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('f','v','f','w'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "FFmpeg MPEG-4",
{ VLC_FOURCC('M','V','X','M'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('F','V','F','W'),
{ VLC_FOURCC('P','M','4','V'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "FFmpeg MPEG-4",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('f','m','p','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('F','F','D','S'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "FFDShow MPEG-4",
{ VLC_FOURCC('M','4','T','3'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('V','I','D','M'),
{ VLC_FOURCC('G','E','O','X'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "vidm 4.01 codec",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('D','M','K','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('D','C','O','D'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('D','I','G','I'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('f','m','p','4'),
{ VLC_FOURCC('I','N','M','C'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MPEG-4 Video",
VIDEO_ES, "MPEG-4 Video" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('S','N','4','0'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('M','V','X','M'),
VIDEO_ES, "MPEG-4 Video" }, VIDEO_ES, "MPEG-4 Video",
{ VLC_FOURCC('E','P','H','V'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MPEG-4 Video" }, { VLC_FOURCC('P','M','4','V'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('f','m','p','4'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('M','4','T','3'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('G','E','O','X'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('D','M','K','2'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('D','I','G','I'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('I','N','M','C'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('S','N','4','0'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('E','P','H','V'),
VIDEO_ES, "MPEG-4 Video",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* MSMPEG4 v1 */ /* MSMPEG4 v1 */
{ VLC_FOURCC('D','I','V','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('D','I','V','1'),
VIDEO_ES, "MS MPEG-4 Video v1" }, VIDEO_ES, "MS MPEG-4 Video v1",
{ VLC_FOURCC('d','i','v','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v1" }, { VLC_FOURCC('d','i','v','1'),
{ VLC_FOURCC('M','P','G','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MS MPEG-4 Video v1",
VIDEO_ES, "MS MPEG-4 Video v1" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','p','g','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('M','P','G','4'),
VIDEO_ES, "MS MPEG-4 Video v1" }, VIDEO_ES, "MS MPEG-4 Video v1",
{ VLC_FOURCC('m','p','4','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v1" }, { VLC_FOURCC('m','p','g','4'),
VIDEO_ES, "MS MPEG-4 Video v1",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','p','4','1'),
VIDEO_ES, "MS MPEG-4 Video v1",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* MSMPEG4 v2 */ /* MSMPEG4 v2 */
{ VLC_FOURCC('D','I','V','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('D','I','V','2'),
VIDEO_ES, "MS MPEG-4 Video v2" }, VIDEO_ES, "MS MPEG-4 Video v2",
{ VLC_FOURCC('d','i','v','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v2" }, { VLC_FOURCC('d','i','v','2'),
{ VLC_FOURCC('M','P','4','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MS MPEG-4 Video v2",
VIDEO_ES, "MS MPEG-4 Video v2" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','p','4','2'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('M','P','4','2'),
VIDEO_ES, "MS MPEG-4 Video v2" }, VIDEO_ES, "MS MPEG-4 Video v2",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','p','4','2'),
VIDEO_ES, "MS MPEG-4 Video v2",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* MSMPEG4 v3 / M$ mpeg4 v3 */ /* MSMPEG4 v3 / M$ mpeg4 v3 */
{ VLC_FOURCC('M','P','G','3'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('M','P','G','3'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
{ VLC_FOURCC('m','p','g','3'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v3" }, { VLC_FOURCC('m','p','g','3'),
{ VLC_FOURCC('d','i','v','3'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MS MPEG-4 Video v3",
VIDEO_ES, "MS MPEG-4 Video v3" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('M','P','4','3'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('d','i','v','3'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
{ VLC_FOURCC('m','p','4','3'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v3" }, { VLC_FOURCC('M','P','4','3'),
VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('m','p','4','3'),
VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* DivX 3.20 */ /* DivX 3.20 */
{ VLC_FOURCC('D','I','V','3'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('D','I','V','3'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
{ VLC_FOURCC('D','I','V','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v3" }, { VLC_FOURCC('D','I','V','4'),
{ VLC_FOURCC('d','i','v','4'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MS MPEG-4 Video v3",
VIDEO_ES, "MS MPEG-4 Video v3" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('D','I','V','5'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('d','i','v','4'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
{ VLC_FOURCC('d','i','v','5'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v3" }, { VLC_FOURCC('D','I','V','5'),
{ VLC_FOURCC('D','I','V','6'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MS MPEG-4 Video v3",
VIDEO_ES, "MS MPEG-4 Video v3" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('d','i','v','6'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('d','i','v','5'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('D','I','V','6'),
VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('d','i','v','6'),
VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* Cool Codec */ /* Cool Codec */
{ VLC_FOURCC('C','O','L','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('C','O','L','1'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
{ VLC_FOURCC('c','o','l','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v3" }, { VLC_FOURCC('c','o','l','1'),
{ VLC_FOURCC('C','O','L','0'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, VIDEO_ES, "MS MPEG-4 Video v3",
VIDEO_ES, "MS MPEG-4 Video v3" }, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('c','o','l','0'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('C','O','L','0'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
{ VLC_FOURCC('c','o','l','0'),
VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* AngelPotion stuff */ /* AngelPotion stuff */
{ VLC_FOURCC('A','P','4','1'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('A','P','4','1'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* 3ivx doctered divx files */ /* 3ivx doctered divx files */
{ VLC_FOURCC('3','I','V','D'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('3','I','V','D'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
{ VLC_FOURCC('3','i','v','d'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v3" }, { VLC_FOURCC('3','i','v','d'),
VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
/* who knows? */ /* who knows? */
{ VLC_FOURCC('3','V','I','D'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, { VLC_FOURCC('3','V','I','D'),
VIDEO_ES, "MS MPEG-4 Video v3" }, VIDEO_ES, "MS MPEG-4 Video v3",
{ VLC_FOURCC('3','v','i','d'), DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
VIDEO_ES, "MS MPEG-4 Video v3" }, { VLC_FOURCC('3','v','i','d'),
VIDEO_ES, "MS MPEG-4 Video v3",
DAVINCI_DEC_MPEG4, DAVINCI_ENC_MPEG4, DAVINCI_XDM0_9 },
#endif #endif
#ifdef DAVINCI_HAS_H264_CODEC #ifdef DAVINCI_HAS_H264_CODEC
/* h264 */ /* h264 */
{ VLC_FOURCC('h','2','6','4'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, { VLC_FOURCC('h','2','6','4'),
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" }, VIDEO_ES, "H264 - MPEG-4 AVC (part 10)",
{ VLC_FOURCC('H','2','6','4'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" }, { VLC_FOURCC('H','2','6','4'),
{ VLC_FOURCC('x','2','6','4'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, VIDEO_ES, "H264 - MPEG-4 AVC (part 10)",
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" }, DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
{ VLC_FOURCC('X','2','6','4'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, { VLC_FOURCC('x','2','6','4'),
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" }, VIDEO_ES, "H264 - MPEG-4 AVC (part 10)",
DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
{ VLC_FOURCC('X','2','6','4'),
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)",
DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
/* avc1: special case h264 */ /* avc1: special case h264 */
{ VLC_FOURCC('a','v','c','1'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, { VLC_FOURCC('a','v','c','1'),
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" }, VIDEO_ES, "H264 - MPEG-4 AVC (part 10)",
{ VLC_FOURCC('A','V','C','1'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" }, { VLC_FOURCC('A','V','C','1'),
{ VLC_FOURCC('V','S','S','H'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, VIDEO_ES, "H264 - MPEG-4 AVC (part 10)",
VIDEO_ES, "Vanguard VSS H264" }, DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
{ VLC_FOURCC('V','S','S','W'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, { VLC_FOURCC('V','S','S','H'),
VIDEO_ES, "Vanguard VSS H264" }, VIDEO_ES, "Vanguard VSS H264",
{ VLC_FOURCC('v','s','s','h'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
VIDEO_ES, "Vanguard VSS H264" }, { VLC_FOURCC('V','S','S','W'),
{ VLC_FOURCC('D','A','V','C'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, VIDEO_ES, "Vanguard VSS H264",
VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" }, DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
{ VLC_FOURCC('d','a','v','c'), DAVINCI_DEC_H264, DAVINCI_ENC_H264, { VLC_FOURCC('v','s','s','h'),
VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" }, VIDEO_ES, "Vanguard VSS H264",
DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
{ VLC_FOURCC('D','A','V','C'),
VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC",
DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
{ VLC_FOURCC('d','a','v','c'),
VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC",
DAVINCI_DEC_H264, DAVINCI_ENC_H264, DAVINCI_XDM0_9 },
#endif #endif
#ifdef DAVINCI_HAS_VC1_CODEC #ifdef DAVINCI_HAS_VC1_CODEC
/* vc-1 */ /* vc-1 */
{ VLC_FOURCC('W','V','C','1'), DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, { VLC_FOURCC('W','V','C','1'),
VIDEO_ES, "Windows Media Video VC1" }, VIDEO_ES, "Windows Media Video VC1",
{ VLC_FOURCC('w','v','c','1'), DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_XDM0_9 },
VIDEO_ES, "Windows Media Video VC1" }, { VLC_FOURCC('w','v','c','1'),
{ VLC_FOURCC('v','c','-','1'), DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, VIDEO_ES, "Windows Media Video VC1",
VIDEO_ES, "Windows Media Video VC1" }, DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_XDM0_9 },
{ VLC_FOURCC('V','C','-','1'), DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, { VLC_FOURCC('v','c','-','1'),
VIDEO_ES, "Windows Media Video VC1" }, VIDEO_ES, "Windows Media Video VC1",
{ VLC_FOURCC('W','M','V','1'), DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_XDM0_9 },
VIDEO_ES, "Windows Media Video VC1" }, { VLC_FOURCC('V','C','-','1'),
/* WMVA is the VC-1 codec before the standardization proces, VIDEO_ES, "Windows Media Video VC1",
it is not bitstream compatible and deprecated */ DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_XDM0_9 },
{ VLC_FOURCC('W','M','V','A'), DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, { VLC_FOURCC('W','M','V','1'),
VIDEO_ES, "Windows Media Video Advanced Profile" }, VIDEO_ES, "Windows Media Video VC1",
DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_XDM0_9 },
#endif #endif
/* /*
* Audio Codecs * Audio Codecs
*/ */
#ifdef DAVINCI_HAS_VC1_CODEC
/* WMVA is the VC-1 codec before the standardization proces,
it is not bitstream compatible and deprecated */
{ VLC_FOURCC('W','M','V','A'),
AUDIO_ES, "Windows Media Video Advanced Profile",
DAVINCI_DEC_VC1, DAVINCI_ENC_VC1, DAVINCI_XDM0_9 },
#endif
#ifdef DAVINCI_HAS_MP3_CODEC #ifdef DAVINCI_HAS_MP3_CODEC
/* MPEG Audio layer 1/2/3 */ /* MPEG Audio layer 1/2/3 */
{ VLC_FOURCC('m','p','g','a'), DAVINIC_DEC_MP3, DAVINIC_NONE, { VLC_FOURCC('m','p','g','a'),
AUDIO_ES, "MPEG Audio layer 1/2" }, AUDIO_ES, "MPEG Audio layer 1/2",
{ VLC_FOURCC('m','p','3',' '), DAVINIC_DEC_MP3, DAVINIC_NONE, DAVINIC_DEC_MP3, DAVINCI_NONE, DAVINCI_XDM0_9 },
AUDIO_ES, "MPEG Audio layer 1/2/3" }, { VLC_FOURCC('m','p','3',' '),
{ VLC_FOURCC('.','m','p','3'), DAVINIC_DEC_MP3, DAVINIC_NONE, AUDIO_ES, "MPEG Audio layer 1/2/3",
AUDIO_ES, "MPEG Audio layer 1/2/3" }, DAVINIC_DEC_MP3, DAVINCI_NONE, DAVINCI_XDM0_9 },
{ VLC_FOURCC('M','P','3',' '), DAVINIC_DEC_MP3, DAVINIC_NONE, { VLC_FOURCC('.','m','p','3'),
AUDIO_ES, "MPEG Audio layer 1/2/3" }, AUDIO_ES, "MPEG Audio layer 1/2/3",
{ VLC_FOURCC('L','A','M','E'), DAVINIC_DEC_MP3, DAVINIC_NONE, DAVINIC_DEC_MP3, DAVINCI_NONE, DAVINCI_XDM0_9 },
AUDIO_ES, "MPEG Audio layer 1/2/3" }, { VLC_FOURCC('M','P','3',' '),
AUDIO_ES, "MPEG Audio layer 1/2/3",
DAVINIC_DEC_MP3, DAVINCI_NONE, DAVINCI_XDM0_9 },
{ VLC_FOURCC('L','A','M','E'),
AUDIO_ES, "MPEG Audio layer 1/2/3",
DAVINIC_DEC_MP3, DAVINCI_NONE, DAVINCI_XDM0_9 },
#endif #endif
#ifdef DAVINCI_HAS_AAC_CODEC #ifdef DAVINCI_HAS_AAC_CODEC
/* AAC audio */ /* AAC audio */
{ VLC_FOURCC('m','p','4','a'), DAVINCI_DEC_AAC, DAVINIC_NONE, { VLC_FOURCC('m','p','4','a'),
AUDIO_ES, "MPEG AAC Audio" }, AUDIO_ES, "MPEG AAC Audio",
{ VLC_FOURCC('a','a','c',' '), DAVINCI_DEC_AAC, DAVINIC_NONE, DAVINCI_DEC_AAC, DAVINCI_ENC_AAC, DAVINCI_XDM1_0 },
AUDIO_ES, "MPEG AAC Audio" }, { VLC_FOURCC('a','a','c',' '),
AUDIO_ES, "MPEG AAC Audio",
DAVINCI_DEC_AAC, DAVINCI_ENC_AAC, DAVINCI_XDM1_0 },
#endif #endif
#ifdef DAVINCI_HAS_G711_CODEC #ifdef DAVINCI_HAS_G711_CODEC
/* PCM Audio */ /* PCM Audio */
{ VLC_FOURCC('s','8',' ',' '), DAVINCI_DEC_G711, DAVINCI_ENC_G711, { VLC_FOURCC('s','8',' ',' '),
AUDIO_ES, "PCM S8" }, AUDIO_ES, "PCM S8",
{ VLC_FOURCC('u','8',' ',' '), DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
AUDIO_ES, "PCM U8" }, { VLC_FOURCC('u','8',' ',' '),
{ VLC_FOURCC('s','1','6','l'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, AUDIO_ES, "PCM U8",
AUDIO_ES, "PCM S16 LE" }, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('s','1','6','b'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, { VLC_FOURCC('s','1','6','l'),
AUDIO_ES, "PCM S16 BE" }, AUDIO_ES, "PCM S16 LE",
{ VLC_FOURCC('u','1','6','l'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
AUDIO_ES, "PCM U16 LE" }, { VLC_FOURCC('s','1','6','b'),
{ VLC_FOURCC('u','1','6','b'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, AUDIO_ES, "PCM S16 BE",
AUDIO_ES, "PCM U16 BE" }, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('s','2','4','l'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, { VLC_FOURCC('u','1','6','l'),
AUDIO_ES, "PCM S24 LE" }, AUDIO_ES, "PCM U16 LE",
{ VLC_FOURCC('s','2','4','b'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
AUDIO_ES, "PCM S24 BE" }, { VLC_FOURCC('u','1','6','b'),
{ VLC_FOURCC('u','2','4','l'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, AUDIO_ES, "PCM U16 BE",
AUDIO_ES, "PCM U24 LE" }, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('u','2','4','b'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, { VLC_FOURCC('s','2','4','l'),
AUDIO_ES, "PCM U24 BE" }, AUDIO_ES, "PCM S24 LE",
{ VLC_FOURCC('s','3','2','l'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
AUDIO_ES, "PCM S32 LE" }, { VLC_FOURCC('s','2','4','b'),
{ VLC_FOURCC('s','3','2','b'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, AUDIO_ES, "PCM S24 BE",
AUDIO_ES, "PCM S32 BE" }, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('u','3','2','l'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, { VLC_FOURCC('u','2','4','l'),
AUDIO_ES, "PCM U32 LE" }, AUDIO_ES, "PCM U24 LE",
{ VLC_FOURCC('u','3','2','b'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
AUDIO_ES, "PCM U32 BE" }, { VLC_FOURCC('u','2','4','b'),
{ VLC_FOURCC('a','l','a','w'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, AUDIO_ES, "PCM U24 BE",
AUDIO_ES, "PCM ALAW" }, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('u','l','a','w'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, { VLC_FOURCC('s','3','2','l'),
AUDIO_ES, "PCM ULAW" }, AUDIO_ES, "PCM S32 LE",
{ VLC_FOURCC('d','a','u','d'), DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
AUDIO_ES, "PCM ULAW" }, { VLC_FOURCC('s','3','2','b'),
AUDIO_ES, "PCM S32 BE",
DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('u','3','2','l'),
AUDIO_ES, "PCM U32 LE",
DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('u','3','2','b'),
AUDIO_ES, "PCM U32 BE",
DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('a','l','a','w'),
AUDIO_ES, "PCM ALAW",
DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('u','l','a','w'),
AUDIO_ES, "PCM ULAW",
DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
{ VLC_FOURCC('d','a','u','d'),
AUDIO_ES, "PCM ULAW",
DAVINCI_DEC_G711, DAVINCI_ENC_G711, DAVINCI_XDM0_9 },
#endif #endif
{ 0, "", "", 0, "" } { 0, 0, "", "", "", 0 }
}; };
bool GetDavinciDecoder( vlc_fourcc_t i_fourcc, int *pi_cat, bool GetDavinciDecoder( vlc_fourcc_t i_fourcc, int *pi_cat, int *pi_xdm,
const char **ppsz_codec, const char **ppsz_name ) const char **ppsz_codec, const char **ppsz_name )
{ {
for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ ) for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ )
...@@ -437,6 +589,7 @@ bool GetDavinciDecoder( vlc_fourcc_t i_fourcc, int *pi_cat, ...@@ -437,6 +589,7 @@ bool GetDavinciDecoder( vlc_fourcc_t i_fourcc, int *pi_cat,
if( codecs_table[i].i_fourcc == i_fourcc ) if( codecs_table[i].i_fourcc == i_fourcc )
{ {
if( pi_cat ) *pi_cat = codecs_table[i].i_cat; if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
if( pi_xdm ) *pi_xdm = codecs_table[i].i_xdm_version;
if( ppsz_codec ) *ppsz_codec = (char *)codecs_table[i].psz_decoder; if( ppsz_codec ) *ppsz_codec = (char *)codecs_table[i].psz_decoder;
if( ppsz_name ) *ppsz_name = (char *)codecs_table[i].psz_name; if( ppsz_name ) *ppsz_name = (char *)codecs_table[i].psz_name;
...@@ -446,7 +599,7 @@ bool GetDavinciDecoder( vlc_fourcc_t i_fourcc, int *pi_cat, ...@@ -446,7 +599,7 @@ bool GetDavinciDecoder( vlc_fourcc_t i_fourcc, int *pi_cat,
return false; return false;
} }
bool GetDavinciEncoder( vlc_fourcc_t i_fourcc, int *pi_cat, bool GetDavinciEncoder( vlc_fourcc_t i_fourcc, int *pi_cat, int *pi_xdm,
const char **ppsz_codec, const char **ppsz_name ) const char **ppsz_codec, const char **ppsz_name )
{ {
for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ ) for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ )
...@@ -454,6 +607,7 @@ bool GetDavinciEncoder( vlc_fourcc_t i_fourcc, int *pi_cat, ...@@ -454,6 +607,7 @@ bool GetDavinciEncoder( vlc_fourcc_t i_fourcc, int *pi_cat,
if( codecs_table[i].i_fourcc == i_fourcc ) if( codecs_table[i].i_fourcc == i_fourcc )
{ {
if( pi_cat ) *pi_cat = codecs_table[i].i_cat; if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
if( pi_xdm ) *pi_xdm = codecs_table[i].i_xdm_version;
if( ppsz_codec ) *ppsz_codec = (char *)codecs_table[i].psz_encoder; if( ppsz_codec ) *ppsz_codec = (char *)codecs_table[i].psz_encoder;
if( ppsz_name ) *ppsz_name = (char *)codecs_table[i].psz_name; if( ppsz_name ) *ppsz_name = (char *)codecs_table[i].psz_name;
...@@ -524,3 +678,4 @@ XDAS_Int32 VlcChromaToXdm( vlc_fourcc_t i_chroma ) ...@@ -524,3 +678,4 @@ XDAS_Int32 VlcChromaToXdm( vlc_fourcc_t i_chroma )
return XDM_CHROMA_NA; return XDM_CHROMA_NA;
} }
} }
...@@ -67,14 +67,14 @@ int OpenVideoDecoder( vlc_object_t *p_this ) ...@@ -67,14 +67,14 @@ int OpenVideoDecoder( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this; decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys; decoder_sys_t *p_sys;
Engine_Error err; Engine_Error err;
int i_cat; int i_cat, i_xdm;
char *psz_chroma = NULL; char *psz_chroma = NULL;
const char *psz_codec = NULL; const char *psz_codec = NULL;
const char *psz_namecodec = NULL; const char *psz_namecodec = NULL;
vlc_fourcc_t i_chroma = VLC_FOURCC('U','Y','V','Y'); vlc_fourcc_t i_chroma = VLC_FOURCC('U','Y','V','Y');
VIDDEC_Params params; VIDDEC_Params params;
if( !GetDavinciDecoder( p_dec->fmt_in.i_codec, &i_cat, if( !GetDavinciDecoder( p_dec->fmt_in.i_codec, &i_cat, &i_xdm,
&psz_codec, &psz_namecodec ) ) &psz_codec, &psz_namecodec ) )
return VLC_EGENERIC; return VLC_EGENERIC;
......
/*****************************************************************************
* encoder.c: video encoder module using the DaVinci DSP.
*****************************************************************************
* Copyright (C) 2008-2010 M2X BV
* $Id$
*
* Authors: Antoine Cellerier <dionoea at videolan dot org>
* Rafaël Carré <rcarre@m2x.nl>
* Jean-Paul Saman <jean-paul.saman at m2x dot nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_vout.h>
#include <vlc_aout.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
#include "davinci.h"
/* XDM 0.9 */
#include <ti/sdo/ce/video/videnc.h>
#include <assert.h>
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static block_t *EncodeVideo( encoder_t *, picture_t * );
static int GetVideoEncoderSettings( encoder_t *p_enc, const char *psz_codec );
/*****************************************************************************
* Encoder
*****************************************************************************/
struct xdm_sys_t
{
/* XDM 0.9 */
VIDENC_Handle handle;
XDM_BufDesc in;
XDM_BufDesc out;
};
/*****************************************************************************
*
*****************************************************************************/
int OpenEncoderVideo( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
p_sys->xdm = (xdm_sys_t *) calloc( 1, sizeof( xdm_sys_t ) );
if( !p_sys->xdm )
return VLC_ENOMEM;
if( GetVideoEncoderSettings( p_enc, p_sys->psz_codec ) != VLC_SUCCESS )
goto error;
p_sys->pf_encode_video = EncodeVideo;
return VLC_SUCCESS;
error:
free( p_sys->xdm );
p_sys->xdm = NULL;
return VLC_EGENERIC;
}
void CloseEncoderVideo( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
/* Delete video encoder */
if( p_enc->fmt_out.i_cat == VIDEO_ES )
VIDENC_delete( xdm->handle );
/* Free 'DaVinci compliant' buffers */
davinci_FreeBuffer( &xdm->in );
davinci_FreeBuffer( &xdm->out );
free( xdm );
xdm = NULL;
}
/*****************************************************************************
* Video Encoder: XDM 0.9 API
*****************************************************************************/
static int GetVideoEncoderSettings( encoder_t *p_enc, const char *psz_codec )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
VIDENC_Params params;
p_enc->i_iframes = var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "keyint" );
p_enc->i_tolerance = var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "tolerance" );
p_enc->i_tolerance *= 1024; /* bits per second */
#ifdef DEBUG_FPS
p_sys->i_fps = p_enc->i_iframes;
#endif
/* Configure encoder */
params.size = sizeof( params );
switch( var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "quality" ) )
{
case 1: params.encodingPreset = XDM_HIGH_QUALITY; break;
case 2: params.encodingPreset = XDM_HIGH_SPEED; break;
case 3: params.encodingPreset = XDM_USER_DEFINED; break;
default:
params.encodingPreset = XDM_DEFAULT;
break;
}
switch( var_CreateGetInteger( p_enc, ENC_CFG_PREFIX "rc" ) )
{
case 1: params.rateControlPreset = IVIDEO_LOW_DELAY; break;
case 2: params.rateControlPreset = IVIDEO_STORAGE; break;
case 3: params.rateControlPreset = IVIDEO_TWOPASS; break;
case 4: params.rateControlPreset = IVIDEO_NONE; break;
case 5: params.rateControlPreset = IVIDEO_USER_DEFINED; break;
default:
params.rateControlPreset = IVIDEO_RATECONTROLPRESET_DEFAULT;
break;
}
params.maxHeight = p_enc->fmt_in.video.i_height;
params.maxWidth = p_enc->fmt_in.video.i_width;
params.maxFrameRate = p_enc->fmt_out.video.i_frame_rate_base ?
p_enc->fmt_out.video.i_frame_rate * 1000 /
p_enc->fmt_out.video.i_frame_rate_base :
50000; /* Frames per 1000 seconds */
params.maxBitRate = p_enc->fmt_out.i_bitrate
+ p_enc->i_tolerance;
params.dataEndianness = XDM_BYTE;
params.maxInterFrameInterval = 0; /* NOTE: should be null */
params.inputChromaFormat = VlcChromaToXdm( p_enc->fmt_in.i_codec );
msg_Info( p_enc, "max %dx%d at %.3f fps (max bitrate %d kBps, I-Frame interval %d)\n",
(int)params.maxWidth, (int)params.maxHeight,
((float)params.maxFrameRate)/1000.,
((int)params.maxBitRate) / (8*1024),
(int)p_enc->i_iframes );
if( params.inputChromaFormat == XDM_CHROMA_NA )
{
msg_Warn( p_enc, "Unsupported input chroma (%4.4s), forcing I420.",
(const char *)&p_enc->fmt_in.i_codec );
params.inputChromaFormat = VlcChromaToXdm( VLC_FOURCC('I','4','2','0' ) );
}
/* NOTE: we don't know if it's progressive or interlaced
* until we get the first picture (p_pic->b_progressive).
* Thus let a knowledgeable user override this setting. */
if( var_CreateGetBool( p_enc, ENC_CFG_PREFIX "interlace" ) )
params.inputContentType = IVIDEO_INTERLACED;
else
params.inputContentType = IVIDEO_PROGRESSIVE;
/* Create encoder handle */
xdm->handle = VIDENC_create( p_sys->engine, (String)psz_codec, &params );
if( !xdm->handle )
return VLC_EGENERIC;
return VLC_SUCCESS;
}
static inline void davinci_CopyPictureToXDM( encoder_t *p_enc, XDM_BufDesc *p_buf, picture_t *p_pic )
{
VLC_UNUSED( p_enc );
/* Copy input picture */
assert( p_pic->i_planes == p_buf->numBufs );
assert( p_pic->i_planes == 1 );
for( int i = 0; i < p_pic->i_planes; i++ )
{
plane_t *p = p_pic->p + i;
memcpy( p_buf->bufs[i], p->p_pixels, p->i_pitch * p->i_visible_lines );
}
}
static int davinci_SetDynamicParams( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
VIDENC_DynamicParams dparams;
VIDENC_Status status;
dparams.size = sizeof( dparams );
memset( &status, 0, sizeof( status ) );
status.size = sizeof( status );
/* Configue the encoder */
dparams.inputHeight = p_enc->fmt_in.video.i_height;
dparams.inputWidth = p_enc->fmt_in.video.i_width;
dparams.refFrameRate = (p_enc->fmt_out.video.i_frame_rate_base != 0) ?
(p_enc->fmt_out.video.i_frame_rate * 1000) /
p_enc->fmt_out.video.i_frame_rate_base :
p_enc->i_iframes * 1000; /* Frames per 1000 seconds */
dparams.targetFrameRate = dparams.refFrameRate; /* input fps = output fps */
dparams.targetBitRate = p_enc->fmt_out.i_bitrate;
dparams.intraFrameInterval = p_enc->i_iframes;
dparams.generateHeader = XDM_ENCODE_AU; /* don't encode only the header */
dparams.captureWidth = 0;
dparams.forceIFrame = 1;
msg_Info( p_enc, "using %dx%d at %.3f fps (bitrate %d kBps, I-Frame interval %d)\n",
(int)dparams.inputWidth, (int)dparams.inputHeight,
((float)dparams.targetFrameRate)/1000.,
((int)dparams.targetBitRate) >> 13 /* / (8*1024)*/,
(int)dparams.intraFrameInterval );
if( VIDENC_control( xdm->handle, XDM_SETPARAMS, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters." );
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
static int davinci_InitVideoBuffers( encoder_t *p_enc )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
int i_ret = VLC_SUCCESS;
VIDENC_DynamicParams dparams;
VIDENC_Status status;
dparams.size = sizeof( dparams );
memset( &status, 0, sizeof( status ) );
status.size = sizeof( status );
/* Configue the encoder */
dparams.inputHeight = p_enc->fmt_in.video.i_height;
dparams.inputWidth = p_enc->fmt_in.video.i_width;
dparams.refFrameRate = (p_enc->fmt_out.video.i_frame_rate_base != 0) ?
(p_enc->fmt_out.video.i_frame_rate * 1000) /
p_enc->fmt_out.video.i_frame_rate_base :
p_enc->i_iframes * 1000; /* Frames per 1000 seconds */
dparams.targetFrameRate = dparams.refFrameRate; /* input fps = output fps */
dparams.targetBitRate = p_enc->fmt_out.i_bitrate;
dparams.intraFrameInterval = p_enc->i_iframes;
dparams.generateHeader = XDM_ENCODE_AU; /* don't encode only the header */
dparams.captureWidth = 0;
dparams.forceIFrame = 1;
msg_Info( p_enc, "using %dx%d at %.3f fps (bitrate %d kBps, I-Frame interval %d)\n",
(int)dparams.inputWidth, (int)dparams.inputHeight,
((float)dparams.targetFrameRate)/1000.,
((int)dparams.targetBitRate) >> 13 /* / (8*1024)*/,
(int)dparams.intraFrameInterval );
if( VIDENC_control( xdm->handle, XDM_SETPARAMS, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters." );
return VLC_EGENERIC;
}
/* Configure buffers */
if( VIDENC_control( xdm->handle, XDM_GETBUFINFO, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to get buffer info" );
return VLC_EGENERIC;
}
/* Allocate input buffer(s) */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &xdm->in ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate input buffers" );
return i_ret;
}
/* Allocate output buffer */
if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &xdm->out ))
!= VLC_SUCCESS )
{
msg_Err( p_enc, "Failed to allocate output buffers" );
return i_ret;
}
return i_ret;
}
static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
{
encoder_sys_t *p_sys = p_enc->p_sys;
xdm_sys_t *xdm = p_sys->xdm;
block_t *p_block;
VIDENC_InArgs in_args;
VIDENC_OutArgs out_args;
int i;
if( xdm->in.numBufs == 0 || xdm->out.numBufs == 0 )
{
if( davinci_InitVideoBuffers( p_enc ) != VLC_SUCCESS )
return NULL;
}
else if( p_sys->i_pics >= p_enc->i_iframes )
{
if( davinci_SetDynamicParams( p_enc ) != VLC_SUCCESS )
msg_Err( p_enc, "Encoding continues with previous settings" );
p_sys->i_pics = 0;
}
p_sys->i_pics++;
davinci_CopyPictureToXDM( p_enc, &xdm->in, p_pic );
/* Configure input */
in_args.size = sizeof( in_args );
/* Configure output */
memset( &out_args, 0, sizeof( out_args ) );
out_args.size = sizeof( out_args );
/* Encode the video */
i = VIDENC_process( xdm->handle, &xdm->in, &xdm->out,
&in_args, &out_args );
if( i != VIDENC_EOK )
{
msg_Err( p_enc, "Video encoding failed (%d): %s", i,
davinci_GetExtendedError( out_args.extendedError ) );
return NULL;
}
/* Print some info */
//msg_Dbg( p_enc, "Bytes generated: %d", (int)out_args.bytesGenerated );
#ifdef DEBUG_FPS
calculate_fps( p_enc );
#endif
/* Put everything in the block */
if( out_args.bytesGenerated <= 0 )
return NULL;
p_block = block_New( p_enc, out_args.bytesGenerated );
if( !p_block )
return NULL;
memcpy( p_block->p_buffer, xdm->out.bufs[0], out_args.bytesGenerated );
switch( out_args.encodedFrameType )
{
case IVIDEO_I_FRAME:
case IVIDEO_II_FRAME:
p_block->i_flags |= BLOCK_FLAG_TYPE_I;
break;
case IVIDEO_P_FRAME:
case IVIDEO_PP_FRAME:
p_block->i_flags |= BLOCK_FLAG_TYPE_P;
break;
case IVIDEO_B_FRAME:
case IVIDEO_BB_FRAME:
p_block->i_flags |= BLOCK_FLAG_TYPE_B;
break;
default:
msg_Warn( p_enc, "Unknown frame type" );
p_block->i_flags |= BLOCK_FLAG_TYPE_PB; /* Wild guess */
break;
}
p_block->i_dts = p_block->i_pts = p_pic->date;
/* Shamelessly copied from ffmpeg/encoder.c */
p_block->i_length = INT64_C(1000000) *
p_enc->fmt_in.video.i_frame_rate_base /
p_enc->fmt_in.video.i_frame_rate;
return p_block;
}
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