本文整理汇总了C++中VLC_FOURCC函数的典型用法代码示例。如果您正苦于以下问题:C++ VLC_FOURCC函数的具体用法?C++ VLC_FOURCC怎么用?C++ VLC_FOURCC使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VLC_FOURCC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenVideo
//.........这里部分代码省略.........
((unsigned char*)&cinfo.typeName)[0],
((unsigned char*)&cinfo.typeName)+1 );
/* make a yuy2 gworld */
p_sys->OutBufferRect.top = 0;
p_sys->OutBufferRect.left = 0;
p_sys->OutBufferRect.right = p_dec->fmt_in.video.i_width;
p_sys->OutBufferRect.bottom = p_dec->fmt_in.video.i_height;
/* codec data FIXME use codec not SVQ3 */
msg_Dbg( p_dec, "vide = %d", i_vide );
id = malloc( sizeof( ImageDescription ) + ( i_vide - 70 ) );
id->idSize = sizeof( ImageDescription ) + ( i_vide - 70 );
id->cType = FCC( fcc[0], fcc[1], fcc[2], fcc[3] );
id->version = GetWBE ( p_vide + 0 );
id->revisionLevel = GetWBE ( p_vide + 2 );
id->vendor = GetDWBE( p_vide + 4 );
id->temporalQuality = GetDWBE( p_vide + 8 );
id->spatialQuality = GetDWBE( p_vide + 12 );
id->width = GetWBE ( p_vide + 16 );
id->height = GetWBE ( p_vide + 18 );
id->hRes = GetDWBE( p_vide + 20 );
id->vRes = GetDWBE( p_vide + 24 );
id->dataSize = GetDWBE( p_vide + 28 );
id->frameCount = GetWBE ( p_vide + 32 );
memcpy( &id->name, p_vide + 34, 32 );
id->depth = GetWBE ( p_vide + 66 );
id->clutID = GetWBE ( p_vide + 68 );
if( i_vide > 70 )
{
memcpy( ((char*)&id->clutID) + 2, p_vide + 70, i_vide - 70 );
}
msg_Dbg( p_dec, "idSize=%ld ver=%d rev=%d vendor=%ld tempQ=%d "
"spaQ=%d w=%d h=%d dpi=%d%d dataSize=%d frameCount=%d clutID=%d",
id->idSize, id->version, id->revisionLevel, id->vendor,
(int)id->temporalQuality, (int)id->spatialQuality,
id->width, id->height,
(int)id->hRes, (int)id->vRes,
(int)id->dataSize,
id->frameCount,
id->clutID );
p_sys->framedescHandle =
(ImageDescriptionHandle) p_sys->NewHandleClear( id->idSize );
memcpy( *p_sys->framedescHandle, id, id->idSize );
p_sys->plane = malloc( p_dec->fmt_in.video.i_width * p_dec->fmt_in.video.i_height * 3 );
i_result = p_sys->QTNewGWorldFromPtr( &p_sys->OutBufferGWorld,
/*pixel format of new GWorld==YUY2 */
kYUVSPixelFormat,
/* we should benchmark if yvu9 is
* faster for svq3, too */
&p_sys->OutBufferRect,
0, 0, 0,
p_sys->plane,
p_dec->fmt_in.video.i_width * 2 );
msg_Dbg( p_dec, "NewGWorldFromPtr returned:%ld\n",
65536 - ( i_result&0xffff ) );
memset( &p_sys->decpar, 0, sizeof( CodecDecompressParams ) );
p_sys->decpar.imageDescription = p_sys->framedescHandle;
p_sys->decpar.startLine = 0;
p_sys->decpar.stopLine = ( **p_sys->framedescHandle ).height;
p_sys->decpar.frameNumber = 1;
p_sys->decpar.matrixFlags = 0;
p_sys->decpar.matrixType = 0;
p_sys->decpar.matrix = 0;
p_sys->decpar.capabilities = &p_sys->codeccap;
p_sys->decpar.accuracy = codecNormalQuality;
p_sys->decpar.srcRect = p_sys->OutBufferRect;
p_sys->decpar.transferMode = srcCopy;
p_sys->decpar.dstPixMap = **p_sys->GetGWorldPixMap( p_sys->OutBufferGWorld );/*destPixmap; */
cres = p_sys->ImageCodecPreDecompress( p_sys->ci, &p_sys->decpar );
msg_Dbg( p_dec, "quicktime_video: ImageCodecPreDecompress cres=0x%X\n",
(int)cres );
p_dec->fmt_out.i_codec = VLC_FOURCC( 'Y', 'U', 'Y', '2' );
p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
p_dec->fmt_out.video.i_height= p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height;
vlc_mutex_unlock( lockval.p_address );
return VLC_SUCCESS;
exit_error:
#ifdef LOADER
Restore_LDT_Keeper( p_sys->ldt_fs );
#endif
vlc_mutex_unlock( lockval.p_address );
#endif /* !WIN32 */
return VLC_EGENERIC;
}
示例2: Init
/*****************************************************************************
* Init: initialize video thread
*****************************************************************************/
static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
vlc_value_t val;
char* psz_chroma;
int i_chroma;
int i_width;
int i_height;
int i_datasize;
i_width = config_GetInt( p_vout, "snapshot-width" );
i_height = config_GetInt( p_vout, "snapshot-height" );
psz_chroma = config_GetPsz( p_vout, "snapshot-chroma" );
if( psz_chroma )
{
if( strlen( psz_chroma ) < 4 )
{
msg_Err( p_vout, "snapshot-chroma should be 4 characters long." );
return VLC_EGENERIC;
}
i_chroma = VLC_FOURCC( psz_chroma[0], psz_chroma[1],
psz_chroma[2], psz_chroma[3] );
free( psz_chroma );
}
else
{
msg_Err( p_vout, "Cannot find chroma information." );
return VLC_EGENERIC;
}
I_OUTPUTPICTURES = 0;
/* Initialize the output structure */
p_vout->output.i_chroma = i_chroma;
p_vout->output.pf_setpalette = NULL;
p_vout->output.i_width = i_width;
p_vout->output.i_height = i_height;
p_vout->output.i_aspect = p_vout->output.i_width
* VOUT_ASPECT_FACTOR / p_vout->output.i_height;
/* Define the bitmasks */
switch( i_chroma )
{
case VLC_FOURCC( 'R','V','1','5' ):
p_vout->output.i_rmask = 0x001f;
p_vout->output.i_gmask = 0x03e0;
p_vout->output.i_bmask = 0x7c00;
break;
case VLC_FOURCC( 'R','V','1','6' ):
p_vout->output.i_rmask = 0x001f;
p_vout->output.i_gmask = 0x07e0;
p_vout->output.i_bmask = 0xf800;
break;
case VLC_FOURCC( 'R','V','2','4' ):
p_vout->output.i_rmask = 0xff0000;
p_vout->output.i_gmask = 0x00ff00;
p_vout->output.i_bmask = 0x0000ff;
break;
case VLC_FOURCC( 'R','V','3','2' ):
p_vout->output.i_rmask = 0xff0000;
p_vout->output.i_gmask = 0x00ff00;
p_vout->output.i_bmask = 0x0000ff;
break;
}
/* Try to initialize 1 direct buffer */
p_pic = NULL;
/* Find an empty picture slot */
for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
{
if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
{
p_pic = p_vout->p_picture + i_index;
break;
}
}
/* Allocate the picture */
if( p_pic == NULL )
{
return VLC_SUCCESS;
}
vout_AllocatePicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_aspect );
if( p_pic->i_planes == 0 )
{
return VLC_EGENERIC;
//.........这里部分代码省略.........
示例3: GetFOURCC
static vlc_fourcc_t GetFOURCC( const uint8_t *p_buff )
{
return VLC_FOURCC( p_buff[0], p_buff[1], p_buff[2], p_buff[3] );
}
示例4: OpenDecoder
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
*****************************************************************************/
static int OpenDecoder( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
char *psz_tmp;
int pitch;
if( p_dec->fmt_in.i_codec != VLC_FOURCC('f','a','k','e'))
{
return VLC_EGENERIC;
}
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t)) ) == NULL )
return VLC_ENOMEM;
// get parameters
char* chromaStr = var_CreateGetString( p_dec, "invmem-chroma" );
p_sys->i_width = var_CreateGetInteger( p_this, "invmem-width" );
p_sys->i_height = var_CreateGetInteger( p_this, "invmem-height" );
if( p_sys->i_width == 0 || p_sys->i_height == 0 )
{
msg_Err( p_dec, "--invmem-width and --invmem-height must be > 0" );
goto error;
}
psz_tmp = var_CreateGetString( p_dec, "invmem-lock" );
p_sys->pf_lock = (void * (*) (void *))(intptr_t)atoll( psz_tmp );
free( psz_tmp );
psz_tmp = var_CreateGetString( p_dec, "invmem-unlock" );
p_sys->pf_unlock = (void (*) (void *))(intptr_t)atoll( psz_tmp );
free( psz_tmp );
psz_tmp = var_CreateGetString( p_dec, "invmem-data" );
p_sys->p_data = (void *)(intptr_t)atoll( psz_tmp );
free( psz_tmp );
if( !p_sys->pf_lock || !p_sys->pf_unlock )
{
msg_Err( p_dec, "Invalid lock or unlock callbacks" );
goto error;
}
if ( chromaStr == NULL )
{
msg_Err( p_dec, "Invalid invmem-chroma string." );
goto error;
}
const vlc_fourcc_t chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, chromaStr );
if ( !chroma )
{
msg_Err( p_dec, "invmem-chroma should be 4 characters long." );
goto error;
}
/* Set output properties */
switch (chroma)
{
case VLC_CODEC_RGB15:
p_dec->fmt_out.video.i_rmask = 0x001f;
p_dec->fmt_out.video.i_gmask = 0x03e0;
p_dec->fmt_out.video.i_bmask = 0x7c00;
pitch = p_sys->i_width * 2;
break;
case VLC_CODEC_RGB16:
p_dec->fmt_out.video.i_rmask = 0x001f;
p_dec->fmt_out.video.i_gmask = 0x07e0;
p_dec->fmt_out.video.i_bmask = 0xf800;
pitch = p_sys->i_width * 2;
break;
case VLC_CODEC_RGB24:
p_dec->fmt_out.video.i_rmask = 0xff0000;
p_dec->fmt_out.video.i_gmask = 0x00ff00;
p_dec->fmt_out.video.i_bmask = 0x0000ff;
pitch = p_sys->i_width * 3;
break;
case VLC_CODEC_RGB32:
p_dec->fmt_out.video.i_rmask = 0xff0000;
p_dec->fmt_out.video.i_gmask = 0x00ff00;
p_dec->fmt_out.video.i_bmask = 0x0000ff;
pitch = p_sys->i_width * 4;
break;
default:
p_dec->fmt_out.video.i_rmask = 0;
p_dec->fmt_out.video.i_gmask = 0;
p_dec->fmt_out.video.i_bmask = 0;
pitch = 0;
msg_Warn( p_dec, "Unknown chroma %s", chromaStr );
goto error;
}
free( chromaStr );
p_dec->fmt_out.i_codec = chroma;
p_dec->fmt_out.video.i_width = p_dec->p_sys->i_width;
//.........这里部分代码省略.........
示例5: ffmpeg_PixFmtToChroma
/* Returns a new picture buffer */
static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
AVCodecContext *p_context )
{
decoder_sys_t *p_sys = p_dec->p_sys;
picture_t *p_pic;
p_dec->fmt_out.video.i_width = p_context->width;
p_dec->fmt_out.video.i_height = p_context->height;
p_dec->fmt_out.i_codec = ffmpeg_PixFmtToChroma( p_context->pix_fmt );
if( !p_context->width || !p_context->height )
{
return NULL; /* invalid display size */
}
if( !p_dec->fmt_out.i_codec )
{
/* we make conversion if possible*/
p_dec->fmt_out.i_codec = VLC_FOURCC('I','4','2','0');
}
/* If an aspect-ratio was specified in the input format then force it */
if( p_dec->fmt_in.video.i_aspect )
{
p_dec->fmt_out.video.i_aspect = p_dec->fmt_in.video.i_aspect;
}
else
{
#if LIBAVCODEC_BUILD >= 4687
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * ( av_q2d(p_context->sample_aspect_ratio) *
p_context->width / p_context->height );
#else
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_context->aspect_ratio;
#endif
if( p_dec->fmt_out.video.i_aspect == 0 )
{
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_context->width / p_context->height;
}
}
if( p_context->frame_rate > 0 && p_context->frame_rate_base > 0 )
{
p_dec->fmt_out.video.i_frame_rate = p_context->frame_rate;
p_dec->fmt_out.video.i_frame_rate_base = p_context->frame_rate_base;
}
p_pic = p_dec->pf_vout_buffer_new( p_dec );
#ifdef LIBAVCODEC_PP
if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init )
{
E_(InitPostproc)( p_dec, p_sys->p_pp, p_context->width,
p_context->height, p_context->pix_fmt );
p_sys->b_pp_init = VLC_TRUE;
}
#endif
return p_pic;
}
示例6: E_
/*****************************************************************************
* InitVideo: initialize the video decoder
*****************************************************************************
* the ffmpeg codec will be opened, some memory allocated. The vout is not yet
* opened (done after the first decoded frame).
*****************************************************************************/
int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
AVCodec *p_codec, int i_codec_id, char *psz_namecodec )
{
decoder_sys_t *p_sys;
vlc_value_t lockval;
vlc_value_t val;
var_Get( p_dec->p_libvlc, "avcodec", &lockval );
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys =
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
{
msg_Err( p_dec, "out of memory" );
return VLC_EGENERIC;
}
p_dec->p_sys->p_context = p_context;
p_dec->p_sys->p_codec = p_codec;
p_dec->p_sys->i_codec_id = i_codec_id;
p_dec->p_sys->psz_namecodec = psz_namecodec;
p_sys->p_ff_pic = avcodec_alloc_frame();
/* ***** Fill p_context with init values ***** */
/* FIXME: remove when ffmpeg deals properly with avc1 */
if( p_dec->fmt_in.i_codec != VLC_FOURCC('a','v','c','1') )
/* End FIXME */
p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_codec );
p_sys->p_context->width = p_dec->fmt_in.video.i_width;
p_sys->p_context->height = p_dec->fmt_in.video.i_height;
p_sys->p_context->bits_per_sample = p_dec->fmt_in.video.i_bits_per_pixel;
/* ***** Get configuration of ffmpeg plugin ***** */
p_sys->p_context->workaround_bugs =
config_GetInt( p_dec, "ffmpeg-workaround-bugs" );
p_sys->p_context->error_resilience =
config_GetInt( p_dec, "ffmpeg-error-resilience" );
var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "grayscale", &val );
if( val.b_bool ) p_sys->p_context->flags |= CODEC_FLAG_GRAY;
var_Create( p_dec, "ffmpeg-vismv", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-vismv", &val );
#if LIBAVCODEC_BUILD >= 4698
if( val.i_int ) p_sys->p_context->debug_mv = val.i_int;
#endif
var_Create( p_dec, "ffmpeg-lowres", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-lowres", &val );
#if LIBAVCODEC_BUILD >= 4723
if( val.i_int > 0 && val.i_int <= 2 ) p_sys->p_context->lowres = val.i_int;
#endif
/* ***** ffmpeg frame skipping ***** */
var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-hurry-up", &val );
p_sys->b_hurry_up = val.b_bool;
/* ***** ffmpeg direct rendering ***** */
p_sys->b_direct_rendering = 0;
var_Create( p_dec, "ffmpeg-dr", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-dr", &val );
if( val.b_bool && (p_sys->p_codec->capabilities & CODEC_CAP_DR1) &&
ffmpeg_PixFmtToChroma( p_sys->p_context->pix_fmt ) &&
/* Apparently direct rendering doesn't work with YUV422P */
p_sys->p_context->pix_fmt != PIX_FMT_YUV422P &&
/* H264 uses too many reference frames */
p_sys->i_codec_id != CODEC_ID_H264 &&
!(p_sys->p_context->width % 16) && !(p_sys->p_context->height % 16) &&
#if LIBAVCODEC_BUILD >= 4698
!p_sys->p_context->debug_mv )
#else
1 )
#endif
{
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
* so we need to do another check in ffmpeg_GetFrameBuf() */
p_sys->b_direct_rendering = 1;
}
#ifdef LIBAVCODEC_PP
p_sys->p_pp = NULL;
p_sys->b_pp = p_sys->b_pp_async = p_sys->b_pp_init = VLC_FALSE;
p_sys->p_pp = E_(OpenPostproc)( p_dec, &p_sys->b_pp_async );
#endif
/* ffmpeg doesn't properly release old pictures when frames are skipped */
//if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = 0;
if( p_sys->b_direct_rendering )
{
msg_Dbg( p_dec, "using direct rendering" );
p_sys->p_context->flags |= CODEC_FLAG_EMU_EDGE;
}
//.........这里部分代码省略.........
示例7: WaveOutThread
/*****************************************************************************
* WaveOutThread: this thread will capture play notification events.
*****************************************************************************
* We use this thread to feed new audio samples to the sound card because
* we are not authorized to use waveOutWrite() directly in the waveout
* callback.
*****************************************************************************/
static void WaveOutThread( notification_thread_t *p_notif )
{
aout_instance_t *p_aout = p_notif->p_aout;
aout_sys_t *p_sys = p_aout->output.p_sys;
aout_buffer_t *p_buffer = NULL;
WAVEHDR *p_waveheader = p_sys->waveheader;
int i, i_queued_frames;
vlc_bool_t b_sleek;
/* We don't want any resampling when using S/PDIF */
b_sleek = p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i');
while( 1 )
{
WaitForSingleObject( p_sys->event, INFINITE );
/* Cleanup and find out the current latency */
i_queued_frames = 0;
for( i = 0; i < FRAMES_NUM; i++ )
{
if( (p_waveheader[i].dwFlags & WHDR_DONE) &&
p_waveheader[i].dwUser )
{
/* Unprepare and free the buffers which has just been played */
waveOutUnprepareHeader( p_sys->h_waveout, &p_waveheader[i],
sizeof(WAVEHDR) );
if( p_waveheader[i].dwUser != 1 )
aout_BufferFree( (aout_buffer_t *)p_waveheader[i].dwUser );
p_waveheader[i].dwUser = 0;
}
/* Check if frame buf is available */
if( !(p_waveheader[i].dwFlags & WHDR_DONE) )
{
i_queued_frames++;
}
}
if( p_aout->b_die ) return;
/* Try to fill in as many frame buffers as possible */
for( i = 0; i < FRAMES_NUM; i++ )
{
/* Check if frame buf is available */
if( p_waveheader[i].dwFlags & WHDR_DONE )
{
/* Take into account the latency */
p_buffer = aout_OutputNextBuffer( p_aout,
mdate() + 1000000 * i_queued_frames /
p_aout->output.output.i_rate * p_aout->output.i_nb_samples,
b_sleek );
if( !p_buffer && i_queued_frames )
{
/* We aren't late so no need to play a blank sample */
break;
}
/* Do the channel reordering */
if( p_buffer && p_sys->b_chan_reorder )
{
aout_ChannelReorder( p_buffer->p_buffer,
p_buffer->i_nb_bytes,
p_sys->waveformat.Format.nChannels,
p_sys->pi_chan_table,
p_sys->waveformat.Format.wBitsPerSample );
}
PlayWaveOut( p_aout, p_sys->h_waveout,
&p_waveheader[i], p_buffer );
i_queued_frames++;
}
}
}
}
示例8: SetupESDS
static void SetupESDS( demux_t *p_demux, mp4_track_t *p_track, const MP4_descriptor_decoder_config_t *p_decconfig )
{
/* First update information based on i_objectTypeIndication */
switch( p_decconfig->i_objectProfileIndication )
{
case( 0x20 ): /* MPEG4 VIDEO */
p_track->fmt.i_codec = VLC_CODEC_MP4V;
break;
case( 0x21 ): /* H.264 */
p_track->fmt.i_codec = VLC_CODEC_H264;
break;
case( 0x40):
p_track->fmt.i_codec = VLC_CODEC_MP4A;
if( p_decconfig->i_decoder_specific_info_len >= 2 &&
p_decconfig->p_decoder_specific_info[0] == 0xF8 &&
(p_decconfig->p_decoder_specific_info[1]&0xE0) == 0x80 )
{
p_track->fmt.i_codec = VLC_CODEC_ALS;
}
break;
case( 0x60):
case( 0x61):
case( 0x62):
case( 0x63):
case( 0x64):
case( 0x65): /* MPEG2 video */
p_track->fmt.i_codec = VLC_CODEC_MPGV;
break;
/* Theses are MPEG2-AAC */
case( 0x66): /* main profile */
case( 0x67): /* Low complexity profile */
case( 0x68): /* Scaleable Sampling rate profile */
p_track->fmt.i_codec = VLC_CODEC_MP4A;
break;
/* True MPEG 2 audio */
case( 0x69):
p_track->fmt.i_codec = VLC_CODEC_MPGA;
break;
case( 0x6a): /* MPEG1 video */
p_track->fmt.i_codec = VLC_CODEC_MPGV;
break;
case( 0x6b): /* MPEG1 audio */
p_track->fmt.i_codec = VLC_CODEC_MPGA;
break;
case( 0x6c ): /* jpeg */
p_track->fmt.i_codec = VLC_CODEC_JPEG;
break;
case( 0x6d ): /* png */
p_track->fmt.i_codec = VLC_CODEC_PNG;
break;
case( 0x6e ): /* jpeg2000 */
p_track->fmt.i_codec = VLC_FOURCC( 'M','J','2','C' );
break;
case( 0xa3 ): /* vc1 */
p_track->fmt.i_codec = VLC_CODEC_VC1;
break;
case( 0xa4 ):
p_track->fmt.i_codec = VLC_CODEC_DIRAC;
break;
case( 0xa5 ):
p_track->fmt.i_codec = VLC_CODEC_A52;
break;
case( 0xa6 ):
p_track->fmt.i_codec = VLC_CODEC_EAC3;
break;
case( 0xa9 ): /* dts */
case( 0xaa ): /* DTS-HD HRA */
case( 0xab ): /* DTS-HD Master Audio */
p_track->fmt.i_codec = VLC_CODEC_DTS;
break;
case( 0xDD ):
p_track->fmt.i_codec = VLC_CODEC_VORBIS;
break;
/* Private ID */
case( 0xe0 ): /* NeroDigital: dvd subs */
if( p_track->fmt.i_cat == SPU_ES )
{
p_track->fmt.i_codec = VLC_CODEC_SPU;
if( p_track->i_width > 0 )
p_track->fmt.subs.spu.i_original_frame_width = p_track->i_width;
if( p_track->i_height > 0 )
p_track->fmt.subs.spu.i_original_frame_height = p_track->i_height;
break;
}
case( 0xe1 ): /* QCelp for 3gp */
if( p_track->fmt.i_cat == AUDIO_ES )
{
p_track->fmt.i_codec = VLC_CODEC_QCELP;
}
break;
/* Fallback */
default:
/* Unknown entry, but don't touch i_fourcc */
msg_Warn( p_demux,
"unknown objectProfileIndication(0x%x) (Track[ID 0x%x])",
p_decconfig->i_objectProfileIndication,
p_track->i_track_ID );
break;
//.........这里部分代码省略.........
示例9: OpenWaveOut
/*****************************************************************************
* OpenWaveOut: open the waveout sound device
****************************************************************************/
static int OpenWaveOut( aout_instance_t *p_aout, int i_format,
int i_channels, int i_nb_channels, int i_rate,
vlc_bool_t b_probe )
{
MMRESULT result;
unsigned int i;
/* Set sound format */
#define waveformat p_aout->output.p_sys->waveformat
waveformat.dwChannelMask = 0;
for( i = 0; i < sizeof(pi_channels_src)/sizeof(uint32_t); i++ )
{
if( i_channels & pi_channels_src[i] )
waveformat.dwChannelMask |= pi_channels_in[i];
}
switch( i_format )
{
case VLC_FOURCC('s','p','d','i'):
i_nb_channels = 2;
/* To prevent channel re-ordering */
waveformat.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
waveformat.Format.wBitsPerSample = 16;
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
break;
case VLC_FOURCC('f','l','3','2'):
waveformat.Format.wBitsPerSample = sizeof(float) * 8;
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
break;
case VLC_FOURCC('s','1','6','l'):
waveformat.Format.wBitsPerSample = 16;
waveformat.Samples.wValidBitsPerSample =
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_PCM;
waveformat.SubFormat = __KSDATAFORMAT_SUBTYPE_PCM;
break;
}
waveformat.Format.nChannels = i_nb_channels;
waveformat.Format.nSamplesPerSec = i_rate;
waveformat.Format.nBlockAlign =
waveformat.Format.wBitsPerSample / 8 * i_nb_channels;
waveformat.Format.nAvgBytesPerSec =
waveformat.Format.nSamplesPerSec * waveformat.Format.nBlockAlign;
/* Only use the new WAVE_FORMAT_EXTENSIBLE format for multichannel audio */
if( i_nb_channels <= 2 )
{
waveformat.Format.cbSize = 0;
}
else
{
waveformat.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
waveformat.Format.cbSize =
sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
}
/* Open the device */
result = waveOutOpen( &p_aout->output.p_sys->h_waveout, WAVE_MAPPER,
(WAVEFORMATEX *)&waveformat,
(DWORD_PTR)WaveOutCallback, (DWORD_PTR)p_aout,
CALLBACK_FUNCTION | (b_probe?WAVE_FORMAT_QUERY:0) );
if( result == WAVERR_BADFORMAT )
{
msg_Warn( p_aout, "waveOutOpen failed WAVERR_BADFORMAT" );
return VLC_EGENERIC;
}
if( result == MMSYSERR_ALLOCATED )
{
msg_Warn( p_aout, "waveOutOpen failed WAVERR_ALLOCATED" );
return VLC_EGENERIC;
}
if( result != MMSYSERR_NOERROR )
{
msg_Warn( p_aout, "waveOutOpen failed" );
return VLC_EGENERIC;
}
p_aout->output.p_sys->b_chan_reorder =
aout_CheckChannelReorder( pi_channels_in, pi_channels_out,
waveformat.dwChannelMask, i_nb_channels,
p_aout->output.p_sys->pi_chan_table );
if( p_aout->output.p_sys->b_chan_reorder )
{
msg_Dbg( p_aout, "channel reordering needed" );
}
//.........这里部分代码省略.........
示例10: Probe
/*****************************************************************************
* Probe: probe the audio device for available formats and channels
*****************************************************************************/
static void Probe( aout_instance_t * p_aout )
{
vlc_value_t val, text;
int i_format;
unsigned int i_physical_channels;
var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
text.psz_string = _("Audio Device");
var_Change( p_aout, "audio-device", VLC_VAR_SETTEXT, &text, NULL );
/* Test for 5.1 support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT |
AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE;
if( p_aout->output.output.i_physical_channels == i_physical_channels )
{
if( OpenWaveOutPCM( p_aout, &i_format,
i_physical_channels, 6,
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_5_1;
text.psz_string = N_("5.1");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 5.1 channels" );
}
}
/* Test for 2 Front 2 Rear support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
if( ( p_aout->output.output.i_physical_channels & i_physical_channels )
== i_physical_channels )
{
if( OpenWaveOutPCM( p_aout, &i_format,
i_physical_channels, 4,
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_2F2R;
text.psz_string = N_("2 Front 2 Rear");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 4 channels" );
}
}
/* Test for stereo support */
i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
if( OpenWaveOutPCM( p_aout, &i_format,
i_physical_channels, 2,
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_STEREO;
text.psz_string = N_("Stereo");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 2 channels" );
}
/* Test for mono support */
i_physical_channels = AOUT_CHAN_CENTER;
if( OpenWaveOutPCM( p_aout, &i_format,
i_physical_channels, 1,
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
val.i_int = AOUT_VAR_MONO;
text.psz_string = N_("Mono");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
msg_Dbg( p_aout, "device supports 1 channel" );
}
/* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) )
{
if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_TRUE )
== VLC_SUCCESS )
{
msg_Dbg( p_aout, "device supports A/52 over S/PDIF" );
val.i_int = AOUT_VAR_SPDIF;
text.psz_string = N_("A/52 over S/PDIF");
var_Change( p_aout, "audio-device",
VLC_VAR_ADDCHOICE, &val, &text );
if( config_GetInt( p_aout, "spdif" ) )
var_Set( p_aout, "audio-device", val );
}
}
var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int <= 0 )
{
/* Probe() has failed. */
//.........这里部分代码省略.........
示例11: Open
/*****************************************************************************
* Open: open the audio device
*****************************************************************************
* This function opens and setups Win32 waveOut
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
vlc_value_t val;
int i;
/* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL )
{
msg_Err( p_aout, "out of memory" );
return VLC_EGENERIC;
}
p_aout->output.pf_play = Play;
p_aout->b_die = VLC_FALSE;
if( var_Type( p_aout, "audio-device" ) == 0 )
{
Probe( p_aout );
}
if( var_Get( p_aout, "audio-device", &val ) < 0 )
{
/* Probe() has failed. */
free( p_aout->output.p_sys );
return VLC_EGENERIC;
}
var_Create( p_aout, "waveout-float32", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* Open the device */
if( val.i_int == AOUT_VAR_SPDIF )
{
p_aout->output.output.i_format = VLC_FOURCC('s','p','d','i');
if( OpenWaveOut( p_aout, VLC_FOURCC('s','p','d','i'),
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_FALSE )
!= VLC_SUCCESS )
{
msg_Err( p_aout, "cannot open waveout audio device" );
free( p_aout->output.p_sys );
return VLC_EGENERIC;
}
/* Calculate the frame size in bytes */
p_aout->output.i_nb_samples = A52_FRAME_NB;
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->output.output.i_frame_length = A52_FRAME_NB;
p_aout->output.p_sys->i_buffer_size =
p_aout->output.output.i_bytes_per_frame;
aout_VolumeNoneInit( p_aout );
}
else
{
if( val.i_int == AOUT_VAR_5_1 )
{
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
| AOUT_CHAN_LFE;
}
else if( val.i_int == AOUT_VAR_2F2R )
{
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
}
else if( val.i_int == AOUT_VAR_MONO )
{
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER;
}
else
{
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
if( OpenWaveOutPCM( p_aout, &p_aout->output.output.i_format,
p_aout->output.output.i_physical_channels,
aout_FormatNbChannels( &p_aout->output.output ),
p_aout->output.output.i_rate, VLC_FALSE )
!= VLC_SUCCESS )
{
msg_Err( p_aout, "cannot open waveout audio device" );
free( p_aout->output.p_sys );
return VLC_EGENERIC;
}
/* Calculate the frame size in bytes */
p_aout->output.i_nb_samples = FRAME_SIZE;
//.........这里部分代码省略.........
示例12: Open
/*****************************************************************************
* Open: probe the decoder and return score
*****************************************************************************
* Tries to launch a decoder and return score so that the interface is able
* to choose.
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
switch( p_dec->fmt_in.i_codec )
{
case VLC_CODEC_COOK:
case VLC_CODEC_ATRAC3:
case VLC_FOURCC('s','i','p','r'):
break;
default:
return VLC_EGENERIC;
}
/* Channel detection */
if( p_dec->fmt_in.audio.i_channels <= 0 ||
p_dec->fmt_in.audio.i_channels > 6 )
{
msg_Err( p_dec, "invalid number of channels (not between 1 and 6): %i",
p_dec->fmt_in.audio.i_channels );
return VLC_EGENERIC;
}
p_dec->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
if( !p_sys )
return VLC_ENOMEM;
/* Flavor for SIPR codecs */
p_sys->i_codec_flavor = -1;
if( p_dec->fmt_in.i_codec == VLC_FOURCC('s','i','p','r') )
{
p_sys->i_codec_flavor = p_dec->fmt_in.audio.i_flavor;
msg_Dbg( p_dec, "Got sipr flavor %d", p_sys->i_codec_flavor );
}
if( OpenDll( p_dec ) != VLC_SUCCESS )
{
free( p_sys );
return VLC_EGENERIC;
}
#ifdef LOADER
if( p_sys->win32_dll ) Close( p_this );
#endif
es_format_Init( &p_dec->fmt_out, AUDIO_ES, VLC_CODEC_S16N );
p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
p_dec->fmt_out.audio.i_channels = p_dec->fmt_in.audio.i_channels;
p_dec->fmt_out.audio.i_bitspersample =
p_dec->fmt_in.audio.i_bitspersample;
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels =
pi_channels_maps[p_dec->fmt_out.audio.i_channels];
date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 );
date_Set( &p_sys->end_date, 0 );
p_dec->pf_decode_audio = Decode;
p_sys->p_out = malloc( 4096 * 10 );
if( !p_sys->p_out )
{
free( p_sys );
return VLC_ENOMEM;
}
p_sys->i_out = 0;
return VLC_SUCCESS;
}
示例13: Open
/*****************************************************************************
* Open: probe the packetizer and return score
* When opening after demux, the packetizer is only loaded AFTER the decoder
* That means that what you set in fmt_out is ignored by the decoder in this special case
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
int i;
const bool b_avc = (p_dec->fmt_in.i_original_fourcc == VLC_FOURCC( 'a', 'v', 'c', '1' ));
if( p_dec->fmt_in.i_codec != VLC_CODEC_H264 )
return VLC_EGENERIC;
if( b_avc && p_dec->fmt_in.i_extra < 7 )
return VLC_EGENERIC;
/* Allocate the memory needed to store the decoder's structure */
if( ( p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) ) ) == NULL )
{
return VLC_ENOMEM;
}
p_sys->p_ccs = cc_storage_new();
if( unlikely(!p_sys->p_ccs) )
{
free( p_dec->p_sys );
return VLC_ENOMEM;
}
packetizer_Init( &p_sys->packetizer,
p_h264_startcode, sizeof(p_h264_startcode), startcode_FindAnnexB,
p_h264_startcode, 1, 5,
PacketizeReset, PacketizeParse, PacketizeValidate, p_dec );
p_sys->b_slice = false;
p_sys->p_frame = NULL;
p_sys->pp_frame_last = &p_sys->p_frame;
p_sys->b_frame_sps = false;
p_sys->b_frame_pps = false;
p_sys->b_header= false;
p_sys->b_sps = false;
p_sys->b_pps = false;
for( i = 0; i <= H264_SPS_ID_MAX; i++ )
p_sys->pp_sps[i] = NULL;
for( i = 0; i <= H264_PPS_ID_MAX; i++ )
p_sys->pp_pps[i] = NULL;
p_sys->i_recovery_frames = -1;
p_sys->slice.i_nal_type = -1;
p_sys->slice.i_nal_ref_idc = -1;
p_sys->slice.i_idr_pic_id = -1;
p_sys->slice.i_frame_num = -1;
p_sys->slice.i_frame_type = 0;
p_sys->slice.i_pic_parameter_set_id = -1;
p_sys->slice.i_field_pic_flag = 0;
p_sys->slice.i_bottom_field_flag = -1;
p_sys->slice.i_pic_order_cnt_lsb = -1;
p_sys->slice.i_delta_pic_order_cnt_bottom = -1;
p_sys->b_timing_info_present_flag = false;
p_sys->b_pic_struct_present_flag = false;
p_sys->b_cpb_dpb_delays_present_flag = false;
p_sys->i_cpb_removal_delay_length_minus1 = 0;
p_sys->i_dpb_output_delay_length_minus1 = 0;
p_sys->b_even_frame = false;
p_sys->i_frame_dts = VLC_TS_INVALID;
p_sys->i_frame_pts = VLC_TS_INVALID;
p_sys->i_prev_dts = VLC_TS_INVALID;
p_sys->i_prev_pts = VLC_TS_INVALID;
p_sys->i_dpb_output_delay = 0;
/* Setup properties */
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
p_dec->fmt_out.i_codec = VLC_CODEC_H264;
p_dec->fmt_out.b_packetized = true;
if( b_avc )
{
/* This type of stream is produced by mp4 and matroska
* when we want to store it in another streamformat, you need to convert
* The fmt_in.p_extra should ALWAYS contain the avcC
* The fmt_out.p_extra should contain all the SPS and PPS with 4 byte startcodes */
if( h264_isavcC( p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra ) )
{
free( p_dec->fmt_out.p_extra );
size_t i_size;
p_dec->fmt_out.p_extra = h264_avcC_to_AnnexB_NAL( p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra,
&i_size,
&p_sys->i_avcC_length_size );
p_dec->fmt_out.i_extra = i_size;
p_sys->b_header = !!p_dec->fmt_out.i_extra;
if(!p_dec->fmt_out.p_extra)
{
msg_Err( p_dec, "Invalid AVC extradata");
//.........这里部分代码省略.........
示例14: AV_VERSION_INT
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 15, 0 )
{ VLC_CODEC_PRORES, CODEC_ID_PRORES, VIDEO_ES },
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 32, 0 )
{ VLC_CODEC_INDEO4, CODEC_ID_INDEO4, VIDEO_ES },
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 53, 17, 0 )
{ VLC_CODEC_BMVVIDEO, CODEC_ID_BMV_VIDEO, VIDEO_ES },
#endif
#if 0
/* UNTESTED VideoGames*/
{ VLC_FOURCC('W','C','3','V'), CODEC_ID_XAN_WC3,
VIDEO_ES, "XAN wc3 Video" },
{ VLC_FOURCC('W','C','4','V'), CODEC_ID_XAN_WC4,
VIDEO_ES, "XAN wc4 Video" },
{ VLC_FOURCC('S','T','3','C'), CODEC_ID_TXD,
VIDEO_ES, "Renderware TeXture Dictionary" },
{ VLC_FOURCC('V','Q','A','V'), CODEC_ID_WS_VQA,
VIDEO_ES, "WestWood Vector Quantized Animation" },
{ VLC_FOURCC('T','S','E','Q'), CODEC_ID_TIERTEXSEQVIDEO,
VIDEO_ES, "Tiertex SEQ Video" },
{ VLC_FOURCC('D','X','A','1'), CODEC_ID_DXA,
VIDEO_ES, "Feeble DXA Video" },
{ VLC_FOURCC('D','C','I','V'), CODEC_ID_DSICINVIDEO,
VIDEO_ES, "Delphine CIN Video" },
{ VLC_FOURCC('T','H','P','V'), CODEC_ID_THP,
VIDEO_ES, "THP Video" },
示例15: Open
/*****************************************************************************
* Open
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
ModPlug_Settings settings;
/* We accept file based on extension match */
if( !p_demux->obj.force )
{
const char *psz_ext = p_demux->psz_filepath ? strrchr( p_demux->psz_filepath, '.' )
: NULL;
if( psz_ext )
psz_ext++;
if( Validate( p_demux, psz_ext ) )
{
msg_Dbg( p_demux, "MOD validation failed (ext=%s)", psz_ext ? psz_ext : "");
return VLC_EGENERIC;
}
}
const int64_t i_size = stream_Size( p_demux->s );
if( i_size <= 0 || i_size >= MOD_MAX_FILE_SIZE )
return VLC_EGENERIC;
p_sys = vlc_obj_malloc( p_this, sizeof (*p_sys) );
if( !p_sys )
return VLC_ENOMEM;
msg_Dbg( p_demux, "loading complete file (could be long)" );
p_sys->i_data = i_size;
p_sys->p_data = vlc_obj_malloc( p_this, p_sys->i_data );
if( unlikely(p_sys->p_data == NULL) )
return VLC_ENOMEM;
p_sys->i_data = vlc_stream_Read( p_demux->s, p_sys->p_data,
p_sys->i_data );
if( p_sys->i_data <= 0 )
{
msg_Err( p_demux, "failed to read the complete file" );
return VLC_EGENERIC;
}
/* Configure modplug before loading the file */
vlc_mutex_lock( &libmodplug_lock );
ModPlug_GetSettings( &settings );
settings.mFlags = MODPLUG_ENABLE_OVERSAMPLING;
settings.mChannels = 2;
settings.mBits = 16;
settings.mFrequency = 44100;
settings.mResamplingMode = MODPLUG_RESAMPLE_FIR;
if( var_InheritBool( p_demux, "mod-noisereduction" ) )
settings.mFlags |= MODPLUG_ENABLE_NOISE_REDUCTION;
if( var_InheritBool( p_demux, "mod-reverb" ) )
settings.mFlags |= MODPLUG_ENABLE_REVERB;
settings.mReverbDepth = var_InheritInteger( p_demux, "mod-reverb-level" );
settings.mReverbDelay = var_InheritInteger( p_demux, "mod-reverb-delay" );
if( var_InheritBool( p_demux, "mod-megabass" ) )
settings.mFlags |= MODPLUG_ENABLE_MEGABASS;
settings.mBassAmount = var_InheritInteger( p_demux, "mod-megabass-level" );
settings.mBassRange = var_InheritInteger( p_demux, "mod-megabass-range" );
if( var_InheritBool( p_demux, "mod-surround" ) )
settings.mFlags |= MODPLUG_ENABLE_SURROUND;
settings.mSurroundDepth = var_InheritInteger( p_demux, "mod-surround-level" );
settings.mSurroundDelay = var_InheritInteger( p_demux, "mod-surround-delay" );
ModPlug_SetSettings( &settings );
p_sys->f = ModPlug_Load( p_sys->p_data, p_sys->i_data );
vlc_mutex_unlock( &libmodplug_lock );
if( !p_sys->f )
{
msg_Err( p_demux, "failed to understand the file" );
return VLC_EGENERIC;
}
/* init time */
date_Init( &p_sys->pts, settings.mFrequency, 1 );
date_Set( &p_sys->pts, VLC_TICK_0 );
p_sys->i_length = VLC_TICK_FROM_MS( ModPlug_GetLength( p_sys->f ) );
msg_Dbg( p_demux, "MOD loaded name=%s length=%"PRId64"ms",
ModPlug_GetName( p_sys->f ),
MS_FROM_VLC_TICK( p_sys->i_length ) );
#ifdef WORDS_BIGENDIAN
es_format_Init( &p_sys->fmt, AUDIO_ES, VLC_FOURCC( 't', 'w', 'o', 's' ) );
#else
es_format_Init( &p_sys->fmt, AUDIO_ES, VLC_FOURCC( 'a', 'r', 'a', 'w' ) );
#endif
p_sys->fmt.audio.i_rate = settings.mFrequency;
p_sys->fmt.audio.i_channels = settings.mChannels;
//.........这里部分代码省略.........