Commit d637a795 authored by Rafaël Carré's avatar Rafaël Carré Committed by Jean-Paul Saman

davinci encoder & decoder : use the same engine, defined in davinci.h

Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent 6287861a
...@@ -76,7 +76,6 @@ int OpenAudioDecoder( vlc_object_t *p_this ) ...@@ -76,7 +76,6 @@ int OpenAudioDecoder( vlc_object_t *p_this )
decoder_sys_t *p_sys; decoder_sys_t *p_sys;
Engine_Error err; Engine_Error err;
char *psz_codec = NULL; char *psz_codec = NULL;
char *psz_engine = NULL;
AUDDEC_Params params; AUDDEC_Params params;
psz_codec = config_GetPsz( p_this, "davinci-auddec-codec" ); psz_codec = config_GetPsz( p_this, "davinci-auddec-codec" );
...@@ -128,16 +127,15 @@ int OpenAudioDecoder( vlc_object_t *p_this ) ...@@ -128,16 +127,15 @@ int OpenAudioDecoder( vlc_object_t *p_this )
CERuntime_init(); CERuntime_init();
/* Create an engine handle */ /* Create an engine handle */
psz_engine = config_GetPsz( p_dec, "davinci-auddec-engine" ); p_sys->e = Engine_open( TI_ENGINE, NULL /*&Engine_ATTRS*/, &err );
p_sys->e = Engine_open( psz_engine, NULL /*&Engine_ATTRS*/, &err );
if( err != Engine_EOK ) if( err != Engine_EOK )
{ {
msg_Err( p_dec, "Error while opening engine `%s': %s", msg_Err( p_dec, "Error while opening engine `%s': %s",
psz_engine, ppsz_engine_error[err] ); TI_ENGINE, ppsz_engine_error[err] );
goto error; goto error;
} }
PrintAvailableAlgorithms( p_this, psz_engine ); PrintAvailableAlgorithms( p_this, TI_ENGINE );
/* Create audio decoder */ /* Create audio decoder */
params.size = sizeof( params ); params.size = sizeof( params );
...@@ -169,14 +167,12 @@ int OpenAudioDecoder( vlc_object_t *p_this ) ...@@ -169,14 +167,12 @@ int OpenAudioDecoder( vlc_object_t *p_this )
p_dec->fmt_out.audio.i_bitspersample = 16; p_dec->fmt_out.audio.i_bitspersample = 16;
free( psz_codec ); free( psz_codec );
free( psz_engine );
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
if( p_sys->e ) Engine_close( p_sys->e ); if( p_sys->e ) Engine_close( p_sys->e );
free( p_sys ); free( p_sys );
free( psz_codec ); free( psz_codec );
free( psz_engine );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -126,7 +126,7 @@ const char *ppsz_engine_error[] = { ...@@ -126,7 +126,7 @@ const char *ppsz_engine_error[] = {
[Engine_EOK] = "Ok", [Engine_EOK] = "Ok",
[Engine_EEXIST] = "Engine name doesn't exist", [Engine_EEXIST] = "Engine name doesn't exist",
[Engine_ENOMEM] = "Can't allocate engine memory", [Engine_ENOMEM] = "Can't allocate engine memory",
[Engine_EDSPLOAD] = "Unable to load the DSP image. This probably means that you are already runing a different engine on the DSP. Since the DSP doesn't support multiple engines at the same time this will fail. If you have another engine available with support for all the encoders and decoders that you will need simultaneously, force it's use with the --davinci-*-engine command line options. See vlc -p davinci --advanced --help-verbose for information about those command line options.", [Engine_EDSPLOAD] = "Unable to load the DSP image, did you try to open 2 different engines because you can only have one on the DSP, but you can access it with multiple threads.",
[Engine_ENOCOMM] = "Can't create communication connection to DSP", [Engine_ENOCOMM] = "Can't create communication connection to DSP",
[Engine_ENOSERVER] = "Can't locate the server on the DSP", [Engine_ENOSERVER] = "Can't locate the server on the DSP",
[Engine_ECOMALLOC] = "Can't allocate communication buffer", [Engine_ECOMALLOC] = "Can't allocate communication buffer",
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define DEBUG_DAVINCI #define DEBUG_DAVINCI
#define DAVINCI_HACK /* directly resize and output the decoded video */ #define DAVINCI_HACK /* directly resize and output the decoded video */
#define TI_ENGINE "encodedecode"
int OpenVideoDecoder( vlc_object_t * ); int OpenVideoDecoder( vlc_object_t * );
void CloseVideoDecoder( vlc_object_t * ); void CloseVideoDecoder( vlc_object_t * );
......
...@@ -369,16 +369,15 @@ int OpenVideoDecoder( vlc_object_t *p_this ) ...@@ -369,16 +369,15 @@ int OpenVideoDecoder( vlc_object_t *p_this )
CERuntime_init(); CERuntime_init();
/* Create an engine handle */ /* Create an engine handle */
#define ti_engine "encodedecode" p_sys->e = Engine_open( TI_ENGINE, NULL /*&Engine_ATTRS*/, &err );
p_sys->e = Engine_open( ti_engine, NULL /*&Engine_ATTRS*/, &err );
if( err != Engine_EOK ) if( err != Engine_EOK )
{ {
msg_Err( p_dec, "Error while opening engine `%s': %s", msg_Err( p_dec, "Error while opening engine `%s': %s",
ti_engine, ppsz_engine_error[err] ); TI_ENGINE, ppsz_engine_error[err] );
goto error; goto error;
} }
PrintAvailableAlgorithms( p_this, ti_engine ); PrintAvailableAlgorithms( p_this, TI_ENGINE );
/* Get user supplied chroma setting */ /* Get user supplied chroma setting */
psz_chroma = config_GetPsz( p_dec, "davinci-viddec-chroma" ); psz_chroma = config_GetPsz( p_dec, "davinci-viddec-chroma" );
......
...@@ -98,16 +98,15 @@ int OpenVideoEncoder( vlc_object_t *p_this ) ...@@ -98,16 +98,15 @@ int OpenVideoEncoder( vlc_object_t *p_this )
CERuntime_init(); CERuntime_init();
/* Create an engine handle */ /* Create an engine handle */
#define ti_engine "encodedecode" p_sys->e = Engine_open( TI_ENGINE, NULL /*&Engine_ATTRS*/, &err );
p_sys->e = Engine_open( 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",
ti_engine, ppsz_engine_error[err] ); TI_ENGINE, ppsz_engine_error[err] );
goto error; goto error;
} }
PrintAvailableAlgorithms( p_this, ti_engine ); PrintAvailableAlgorithms( p_this, TI_ENGINE );
/* Configure encoder */ /* Configure encoder */
params.size = sizeof( params ); params.size = sizeof( params );
......
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