本文整理汇总了C++中codec_init函数的典型用法代码示例。如果您正苦于以下问题:C++ codec_init函数的具体用法?C++ codec_init怎么用?C++ codec_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了codec_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: codecs_init
static void codecs_init(void *base, u32 codec_mask)
{
int i;
for (i = 2; i >= 0; i--) {
if (codec_mask & (1 << i))
codec_init(base, i);
}
}
开发者ID:RafaelRMachado,项目名称:Coreboot,代码行数:8,代码来源:hda.c
示例2: es_format_Init
/* PT=32
* MPV: MPEG Video (RFC2250, §3.5)
*/
static void *mpv_init (demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, VIDEO_ES, VLC_CODEC_MPGV);
fmt.b_packetized = false;
return codec_init (demux, &fmt);
}
开发者ID:CSRedRat,项目名称:vlc,代码行数:11,代码来源:rtp.c
示例3: codecs_init
static void codecs_init(struct device *dev, u8 *base, u32 codec_mask)
{
int i;
for (i = 2; i >= 0; i--) {
if (codec_mask & (1 << i))
codec_init(dev, base, i);
}
}
开发者ID:canistation,项目名称:coreboot,代码行数:8,代码来源:azalia.c
示例4: codec_run
/* this is called for each file to process */
enum codec_status codec_run(void)
{
size_t n;
unsigned char *filebuf;
int sample_loc;
intptr_t param;
if (codec_init())
return CODEC_ERROR;
ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
codec_set_replaygain(ci->id3);
/* Intialise the A52 decoder and check for success */
state = a52_init(0);
samplesdone = 0;
/* The main decoding loop */
if (ci->id3->offset) {
if (ci->seek_buffer(ci->id3->offset)) {
samplesdone = (ci->id3->offset / ci->id3->bytesperframe) *
A52_SAMPLESPERFRAME;
ci->set_elapsed(samplesdone/(ci->id3->frequency / 1000));
}
}
else {
ci->seek_buffer(ci->id3->first_frame_offset);
ci->set_elapsed(0);
}
while (1) {
enum codec_command_action action = ci->get_command(¶m);
if (action == CODEC_ACTION_HALT)
break;
if (action == CODEC_ACTION_SEEK_TIME) {
sample_loc = param/1000 * ci->id3->frequency;
if (ci->seek_buffer((sample_loc/A52_SAMPLESPERFRAME)*ci->id3->bytesperframe)) {
samplesdone = sample_loc;
ci->set_elapsed(samplesdone/(ci->id3->frequency/1000));
}
ci->seek_complete();
}
filebuf = ci->request_buffer(&n, BUFFER_SIZE);
if (n == 0) /* End of Stream */
break;
a52_decode_data(filebuf, filebuf + n);
ci->advance_buffer(n);
}
return CODEC_OK;
}
开发者ID:ifroz,项目名称:rockbox,代码行数:59,代码来源:a52.c
示例5: es_format_Init
/* PT=14
* MPA: MPEG Audio (RFC2250, §3.4)
*/
static void *mpa_init (demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA);
fmt.audio.i_channels = 2;
fmt.b_packetized = false;
return codec_init (demux, &fmt);
}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:12,代码来源:rtp.c
示例6: es_format_Init
/* PT=10,11
* L16: 16-bits (network byte order) PCM
*/
static void *l16s_init (demux_t *demux)
{
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
fmt.audio.i_rate = 44100;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
return codec_init (demux, &fmt);
}
开发者ID:Geal,项目名称:vlc,代码行数:13,代码来源:rtp.c
示例7: codec_main
/* this is the codec entry point */
enum codec_status codec_main(enum codec_entry_call_reason reason)
{
if (reason == CODEC_LOAD) {
if (codec_init())
return CODEC_ERROR;
ci->configure(DSP_SET_SAMPLE_DEPTH, 24);
}
return CODEC_OK;
}
开发者ID:4nykey,项目名称:rockbox,代码行数:11,代码来源:vorbis.c
示例8: init_all
void init_all(void)
{
GPIO_init();
DAC_DMA_init();
P24_init();
vdisplay_init();
codec_init();
codec_ctrl_init();
TIM6_init(); /* Initialize timer */
TIM3_init(); /* interrupts last... */
TIM4_init();
}
开发者ID:mauzybroadway,项目名称:mycrosinth,代码行数:12,代码来源:init.c
示例9: tosh_init
/*
* Initialize the driver.
*/
static int
tosh_init( struct wm_drive *d )
{
extern int min_volume;
/* Sun use Toshiba drives as well */
#if defined(SYSV) && defined(CODEC)
codec_init();
#endif
min_volume = 0;
return ( 0 );
}
开发者ID:d-torrance,项目名称:dockapps,代码行数:15,代码来源:drv_toshiba.c
示例10: S_Init
void S_Init( void )
{
cvar_t *cv;
qboolean started = qfalse;
Com_Printf("%s", _( "------ Initializing Sound -----\n" ));
cv = Cvar_Get( "s_initsound", "1", 0 );
if ( !cv->integer )
{
Com_Printf( "Sound Disabled\n" );
return;
}
else
{
codec_init();
s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE );
s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE );
s_separation = Cvar_Get( "s_separation", "0.5", CVAR_ARCHIVE );
s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE );
s_khz = Cvar_Get( "s_khz", "22", CVAR_ARCHIVE );
s_mixahead = Cvar_Get( "s_mixahead", "0.2", CVAR_ARCHIVE );
s_mixPreStep = Cvar_Get( "s_mixPreStep", "0.05", CVAR_ARCHIVE );
s_show = Cvar_Get( "s_show", "0", CVAR_CHEAT );
s_testsound = Cvar_Get( "s_testsound", "0", CVAR_CHEAT );
cv = Cvar_Get( "s_usemodule", "1", CVAR_ARCHIVE );
if( cv->integer )
{
started = S_AL_Init( &si );
}
if( !started )
{
Com_Printf( "Using builtin sound backend\n" );
S_Base_Init( &si );
}
else
{
Com_Printf( "Using OpenAL sound backend\n" );
}
Cmd_AddCommand( "play", S_Play_f );
Cmd_AddCommand( "music", S_Music_f );
Cmd_AddCommand( "s_list", S_SoundList_f );
Cmd_AddCommand( "s_info", S_SoundInfo_f );
Cmd_AddCommand( "s_stop", S_StopAllSounds );
}
Com_Printf( "------------------------------------\n" );
}
开发者ID:Wattos,项目名称:Unvanquished,代码行数:52,代码来源:snd_main.c
示例11: aml_setup
int aml_setup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
codecParam.stream_type = STREAM_TYPE_ES_VIDEO;
codecParam.has_video = 1;
codecParam.noblock = 0;
codecParam.am_sysinfo.param = 0;
switch (videoFormat) {
case VIDEO_FORMAT_H264:
if (width > 1920 || height > 1080) {
codecParam.video_type = VFORMAT_H264_4K2K;
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_H264_4K2K;
} else {
codecParam.video_type = VFORMAT_H264;
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_H264;
// Workaround for decoding special case of C1, 1080p, H264
int major, minor;
struct utsname name;
uname(&name);
int ret = sscanf(name.release, "%d.%d", &major, &minor);
if (!(major > 3 || (major == 3 && minor >= 14)) && width == 1920 && height == 1080)
codecParam.am_sysinfo.param = (void*) UCODE_IP_ONLY_PARAM;
}
break;
case VIDEO_FORMAT_H265:
codecParam.video_type = VFORMAT_HEVC;
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_HEVC;
break;
default:
printf("Video format not supported\n");
return -1;
}
codecParam.am_sysinfo.width = width;
codecParam.am_sysinfo.height = height;
codecParam.am_sysinfo.rate = 96000 / redrawRate;
codecParam.am_sysinfo.param = (void*) ((size_t) codecParam.am_sysinfo.param | SYNC_OUTSIDE);
int ret;
if ((ret = codec_init(&codecParam)) != 0) {
fprintf(stderr, "codec_init error: %x\n", ret);
return -2;
}
if ((ret = codec_set_freerun_mode(&codecParam, 1)) != 0) {
fprintf(stderr, "Can't set Freerun mode: %x\n", ret);
return -2;
}
return 0;
}
开发者ID:AreaScout,项目名称:moonlight-embedded,代码行数:51,代码来源:aml.c
示例12: codecs_init
static void codecs_init(struct device *dev, u32 base, u32 codec_mask)
{
int i;
for (i = 3; i >= 0; i--) {
if (codec_mask & (1 << i))
codec_init(dev, base, i);
}
for (i = 0; i < pc_beep_verbs_size; i++) {
if (wait_for_ready(base) == -1)
return;
write32(base + 0x60, pc_beep_verbs[i]);
if (wait_for_valid(base) == -1)
return;
}
}
开发者ID:0ida,项目名称:coreboot,代码行数:18,代码来源:azalia.c
示例13: gst_set_vstream_info
static gboolean
gst_set_vstream_info(GstAmlVdec *amlvdec, GstCaps * caps)
{
GstStructure *structure;
const char *name;
gint32 ret = CODEC_ERROR_NONE;
AmlStreamInfo *videoinfo = NULL;
int coordinate[4] = {0, 0, 0, 0};
structure = gst_caps_get_structure(caps, 0);
name = gst_structure_get_name(structure);
videoinfo = amlVstreamInfoInterface(name);
if (NULL == name) {
return FALSE;
}
amlvdec->info = videoinfo;
videoinfo->init(videoinfo, amlvdec->pcodec, structure);
if (amlvdec->pcodec && amlvdec->pcodec->stream_type == STREAM_TYPE_ES_VIDEO) {
if (!amlvdec->codec_init_ok) {
ret = codec_init(amlvdec->pcodec);
if (ret != CODEC_ERROR_NONE) {
GST_ERROR("codec init failed, ret=-0x%x", -ret);
return FALSE;
}
set_fb0_blank(1);
set_fb1_blank(1);
set_tsync_enable(1);
set_display_axis(coordinate);
//set_video_axis(coordinate);
amlvdec->codec_init_ok = 1;
if (amlvdec->trickRate > 0) {
if (amlvdec->pcodec && amlvdec->pcodec->cntl_handle) {
//T codec_set_video_playrate(amlvdec->pcodec, (int) (amlvdec->trickRate * (1 << 16)));
}
}
GST_DEBUG_OBJECT(amlvdec, "video codec_init ok");
}
}
return TRUE;
}
开发者ID:vitmod,项目名称:buildroot-aml,代码行数:41,代码来源:gstamlvdec.c
示例14: memset
bool CTsPlayer::StartPlay()
{
int ret;
memset(pcodec,0,sizeof(*pcodec));
pcodec->stream_type=STREAM_TYPE_TS;
pcodec->video_type = vPara.vFmt;
pcodec->has_video=1;
pcodec->audio_type= aPara.aFmt;
pcodec->has_audio=1;
pcodec->video_pid=(int)vPara.pid;
pcodec->audio_pid=(int)aPara.pid;
//pcodec->audio_channels = 1;
//pcodec->audio_samplerate = 48000;
// 解决AC3无声的问题
if(IS_AUIDO_NEED_EXT_INFO(pcodec->audio_type)){
pcodec->audio_info.valid = 1;
LOGI("set audio_info.valid to 1");
}
if (pcodec->video_type == VFORMAT_H264) {
pcodec->am_sysinfo.format = VIDEO_DEC_FORMAT_H264;
pcodec->am_sysinfo.param = (void *)(0);
}
else if(pcodec->video_type ==VFORMAT_MPEG12){
pcodec->am_sysinfo.param = (void *)(0);
}
printf("set %d,%d,%d,%d\n",vPara.vFmt,aPara.aFmt,vPara.pid,aPara.pid);
pcodec->noblock = 0;
/*other setting*/
ret=codec_init(pcodec);
#if DUMP_TSPACKET1
m_fStream = fopen("/data/data/novel.supertv.dvb/new_1.ts","wb");
#endif
return !ret;
}
开发者ID:cg8530,项目名称:WorkSplace,代码行数:36,代码来源:TsPlayer.cpp
示例15: xiph_decode
//.........这里部分代码省略.........
if (pkts > 0 || block->i_buffer < 2)
goto drop;
size_t fraglen = GetWBE (block->p_buffer);
if (block->i_buffer < (fraglen + 2))
goto drop; /* Invalid payload length */
block->i_buffer = fraglen;
if (fragtype == 1)/* Keep first fragment */
{
block->i_buffer += 2;
self->block = block;
}
else
{ /* Append non-first fragment */
size_t len = self->block->i_buffer;
self->block = block_Realloc (self->block, 0, len + fraglen);
if (!self->block)
{
block_Release (block);
return;
}
memcpy (self->block->p_buffer + len, block->p_buffer + 2,
fraglen);
block_Release (block);
}
if (fragtype < 3)
return; /* Non-last fragment */
/* Last fragment reached, process it */
block = self->block;
self->block = NULL;
SetWBE (block->p_buffer, block->i_buffer - 2);
pkts = 1;
}
/* RTP payload packets processing */
while (pkts > 0)
{
if (block->i_buffer < 2)
goto drop;
size_t len = GetWBE (block->p_buffer);
block->i_buffer -= 2;
block->p_buffer += 2;
if (block->i_buffer < len)
goto drop;
switch (datatype)
{
case 0: /* Raw payload */
{
if (self->ident != ident)
{
msg_Warn (demux, self->vorbis ?
"ignoring raw Vorbis payload without configuration" :
"ignoring raw Theora payload without configuration");
break;
}
block_t *raw = block_Alloc (len);
memcpy (raw->p_buffer, block->p_buffer, len);
raw->i_pts = block->i_pts; /* FIXME: what about pkts > 1 */
codec_decode (demux, self->id, raw);
break;
}
case 1: /* Packed configuration frame (§3.1.1) */
{
if (self->ident == ident)
break; /* Ignore config retransmission */
void *extv;
ssize_t extc = xiph_header (&extv, block->p_buffer, len);
if (extc < 0)
break;
es_format_t fmt;
es_format_Init (&fmt, self->vorbis ? AUDIO_ES : VIDEO_ES,
self->vorbis ? VLC_CODEC_VORBIS
: VLC_CODEC_THEORA);
fmt.p_extra = extv;
fmt.i_extra = extc;
codec_destroy (demux, self->id);
msg_Dbg (demux, self->vorbis ?
"Vorbis packed configuration received (%06"PRIx32")" :
"Theora packed configuration received (%06"PRIx32")",
ident);
self->ident = ident;
self->id = (es_out_id_t *)codec_init (demux, &fmt); // sunqueen modify
break;
}
}
block->i_buffer -= len;
block->p_buffer += len;
pkts--;
}
drop:
block_Release (block);
}
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:101,代码来源:xiph.c
示例16: codec_main
/* this is the codec entry point */
enum codec_status codec_main(void)
{
size_t n;
unsigned char *filebuf;
int sample_loc;
int retval;
/* Generic codec initialisation */
ci->configure(DSP_SET_STEREO_MODE, STEREO_NONINTERLEAVED);
ci->configure(DSP_SET_SAMPLE_DEPTH, 28);
next_track:
retval = CODEC_OK;
if (codec_init()) {
retval = CODEC_ERROR;
goto exit;
}
if (codec_wait_taginfo() != 0)
goto request_next_track;
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
codec_set_replaygain(ci->id3);
/* Intialise the A52 decoder and check for success */
state = a52_init(0);
/* The main decoding loop */
if (ci->id3->offset) {
if (ci->seek_buffer(ci->id3->offset)) {
samplesdone = (ci->id3->offset / ci->id3->bytesperframe) *
A52_SAMPLESPERFRAME;
ci->set_elapsed(samplesdone/(ci->id3->frequency / 1000));
}
}
else {
samplesdone = 0;
}
while (1) {
if (ci->stop_codec || ci->new_track)
break;
if (ci->seek_time) {
sample_loc = (ci->seek_time - 1)/1000 * ci->id3->frequency;
if (ci->seek_buffer((sample_loc/A52_SAMPLESPERFRAME)*ci->id3->bytesperframe)) {
samplesdone = sample_loc;
ci->set_elapsed(samplesdone/(ci->id3->frequency/1000));
}
ci->seek_complete();
}
filebuf = ci->request_buffer(&n, BUFFER_SIZE);
if (n == 0) /* End of Stream */
break;
a52_decode_data(filebuf, filebuf + n);
ci->advance_buffer(n);
}
request_next_track:
if (ci->request_next_track())
goto next_track;
exit:
a52_free(state);
return retval;
}
开发者ID:claymodel,项目名称:rockbox,代码行数:72,代码来源:a52.c
示例17: CS43L22_Config
//.........这里部分代码省略.........
GPIO_Init(STM32F4D_I2S_SD_PORT, &GPIO_InitStructure);
GPIO_PinAFConfig(STM32F4D_I2S_SD_PORT, STM32F4D_I2S_SD_PINSRC, GPIO_AF_SPI3);
GPIO_InitStructure.GPIO_Pin = STM32F4D_I2S_MCLK_PIN;
GPIO_Init(STM32F4D_I2S_MCLK_PORT, &GPIO_InitStructure);
GPIO_PinAFConfig(STM32F4D_I2S_MCLK_PORT, STM32F4D_I2S_MCLK_PINSRC, GPIO_AF_SPI3);
// configure I2C pins to access the CS43L22 configuration registers
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Pin = CODEC_I2C_SCL_PIN;
GPIO_Init(CODEC_I2C_SCL_PORT, &GPIO_InitStructure);
GPIO_PinAFConfig(CODEC_I2C_SCL_PORT, GPIO_PinSource6, GPIO_AF_I2C1);
GPIO_InitStructure.GPIO_Pin = CODEC_I2C_SDA_PIN;
GPIO_Init(CODEC_I2C_SDA_PORT, &GPIO_InitStructure);
GPIO_PinAFConfig(CODEC_I2C_SDA_PORT, GPIO_PinSource9, GPIO_AF_I2C1);
// CS43L22 reset pin
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Pin = CODEC_RESET_PIN;
GPIO_Init(CODEC_RESET_PORT, &GPIO_InitStructure);
GPIO_ResetBits(CODEC_RESET_PORT, CODEC_RESET_PIN); // activate reset
// I2S initialisation
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI3, ENABLE);
RCC_PLLI2SCmd(ENABLE); // new for STM32F4: enable I2S PLL
SPI_I2S_DeInit(SPI3);
I2S_InitTypeDef I2S_InitStructure;
I2S_StructInit(&I2S_InitStructure);
I2S_InitStructure.I2S_Standard = STM32F4D_I2S_STANDARD;
I2S_InitStructure.I2S_DataFormat = STM32F4D_I2S_DATA_FORMAT;
I2S_InitStructure.I2S_MCLKOutput = STM32F4D_I2S_MCLK_ENABLE ? I2S_MCLKOutput_Enable : I2S_MCLKOutput_Disable;
I2S_InitStructure.I2S_AudioFreq = (u16)(STM32F4D_I2S_AUDIO_FREQ);
I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low; // configuration required as well?
I2S_InitStructure.I2S_Mode = I2S_Mode_MasterTx;
I2S_Init(SPI3, &I2S_InitStructure);
I2S_Cmd(SPI3, ENABLE);
// DMA Configuration for SPI Tx Event
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);
DMA_InitTypeDef DMA_InitStructure;
DMA_StructInit(&DMA_InitStructure);
DMA_Cmd(DMA1_Stream5, DISABLE);
DMA_ClearFlag(DMA1_Stream5, DMA_FLAG_TCIF5 | DMA_FLAG_TEIF5 | DMA_FLAG_HTIF5 | DMA_FLAG_FEIF5);
DMA_InitStructure.DMA_Channel = DMA_Channel_0;
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&SPI3->DR;
// DMA_InitStructure.DMA_MemoryBaseAddr = ...; // configured in CS43L22_Start
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
// DMA_InitStructure.DMA_BufferSize = ...; // configured in CS43L22_Start
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_Init(DMA1_Stream5, &DMA_InitStructure);
// DMA_Cmd(DMA1_Stream5, ENABLE); // done on CS43L22_Start
DMA_ITConfig(DMA1_Stream5, DMA_IT_TE | DMA_IT_FE, DISABLE);
// trigger interrupt when transfer half complete/complete
DMA_ITConfig(DMA1_Stream5, DMA_IT_HT | DMA_IT_TC, ENABLE);
// enable SPI interrupts to DMA
SPI_I2S_DMACmd(SPI3, SPI_I2S_DMAReq_Tx, ENABLE);
// Configure and enable DMA interrupt
/* Configure the DMA IRQ handler priority */
NVIC_SetPriority(DMA1_Stream5_IRQn, 0x0);
NVIC_EnableIRQ(DMA1_Stream5_IRQn);
// configure I2C
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
I2C_DeInit(CODEC_I2C);
I2C_InitTypeDef I2C_InitStructure;
I2C_StructInit(&I2C_InitStructure);
I2C_InitStructure.I2C_ClockSpeed = 100000;
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_OwnAddress1 = CORE_I2C_ADDRESS;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_Cmd(CODEC_I2C, ENABLE);
I2C_Init(CODEC_I2C, &I2C_InitStructure);
codec_init();
}
开发者ID:norbim1,项目名称:preenFM2,代码行数:101,代码来源:PreenFM_init.c
示例18: codec_run
/* this is called for each file to process */
enum codec_status codec_run(void)
{
static size_t buff_size;
int datasize, res, frame_counter, total_frames, seek_frame_offset;
uint8_t *bit_buffer;
int elapsed = 0;
size_t resume_offset;
intptr_t param;
long action;
if (codec_init()) {
DEBUGF("codec init failed\n");
return CODEC_ERROR;
}
action = CODEC_ACTION_NULL;
param = ci->id3->elapsed;
resume_offset = ci->id3->offset;
codec_set_replaygain(ci->id3);
ci->memset(&q,0,sizeof(ATRAC3Context));
ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
ci->configure(DSP_SET_SAMPLE_DEPTH, 17); /* Remark: atrac3 uses s15.0 by default, s15.2 was hacked. */
ci->configure(DSP_SET_STEREO_MODE, ci->id3->channels == 1 ?
STEREO_MONO : STEREO_NONINTERLEAVED);
ci->seek_buffer(0);
res = atrac3_decode_init(&q, ci->id3);
if(res < 0) {
DEBUGF("failed to initialize OMA atrac decoder\n");
return CODEC_ERROR;
}
total_frames = (ci->id3->filesize - ci->id3->first_frame_offset) / FRAMESIZE;
frame_counter = 0;
/* check for a mid-track resume and force a seek time accordingly */
if (resume_offset) {
resume_offset -= MIN(resume_offset, ci->id3->first_frame_offset);
/* calculate resume_offset in frames */
param = (resume_offset/FRAMESIZE) * ((FRAMESIZE * 8)/BITRATE);
}
if ((unsigned long)param) {
action = CODEC_ACTION_SEEK_TIME;
}
else {
ci->set_elapsed(0);
ci->seek_buffer(ci->id3->first_frame_offset);
}
/* The main decoder loop */
while(frame_counter < total_frames)
{
if (action == CODEC_ACTION_NULL)
action = ci->get_command(¶m);
if (action == CODEC_ACTION_HALT)
break;
if (action == CODEC_ACTION_SEEK_TIME) {
/* Do not allow seeking beyond the file's length */
if ((unsigned long) param > ci->id3->length) {
ci->set_elapsed(ci->id3->length);
ci->seek_complete();
break;
}
/* Seek to the start of the track */
if (param == 0) {
elapsed = 0;
ci->set_elapsed(0);
ci->seek_buffer(ci->id3->first_frame_offset);
ci->seek_complete();
action = CODEC_ACTION_NULL;
continue;
}
seek_frame_offset = (param * BITRATE) / (8 * FRAMESIZE);
frame_counter = seek_frame_offset;
ci->seek_buffer(ci->id3->first_frame_offset + seek_frame_offset* FRAMESIZE);
elapsed = param;
ci->set_elapsed(elapsed);
ci->seek_complete();
}
action = CODEC_ACTION_NULL;
bit_buffer = (uint8_t *) ci->request_buffer(&buff_size, FRAMESIZE);
res = atrac3_decode_frame(FRAMESIZE, &q, &datasize, bit_buffer, FRAMESIZE);
if(res != (int)FRAMESIZE) {
DEBUGF("codec error\n");
return CODEC_ERROR;
}
//.........这里部分代码省略.........
开发者ID:Rockbox,项目名称:rockbox,代码行数:101,代码来源:atrac3_oma.c
示例19: main
int
main(int argc, char *argv[])
{
const char *codec_name, *repair_name;
codec_id_t cid;
repair_id_t rid;
struct s_sndfile *sf_in = NULL, *sf_out = NULL;
sndfile_fmt_t sff;
double drop = 0.0;
int ac, did_query = FALSE;
int csra = TRUE; /* codec specific repair allowed */
long seed = 100;
codec_init();
ac = 1;
while(ac < argc && argv[ac][0] == '-') {
if (strlen(argv[ac]) > 2) {
/* should be -codecs or -repairs */
switch(argv[ac][1]) {
case 'c':
list_codecs();
break;
case 'r':
list_repairs();
break;
default:
usage();
}
did_query = TRUE;
} else {
if (argc - ac < 1) {
usage();
}
switch(argv[ac][1]) {
case 's':
seed = atoi(argv[++ac]);
break;
case 'd':
drop = strtod(argv[++ac], NULL);
break;
case 'c':
cid = codec_get_by_name(argv[++ac]);
codec_name = argv[ac];
break;
case 'n':
csra = FALSE;
break;
case 'r':
resolve_repair(argv[++ac], &rid, &repair_name);
break;
case 'u':
units_per_packet = atoi(argv[++ac]);
break;
default:
usage();
}
}
ac++;
}
if (did_query == TRUE) {
/* Not sensible to be running query and executing test */
exit(-1);
}
if (argc - ac != 2) {
usage();
}
if (snd_read_open(&sf_in, argv[ac], NULL) == FALSE) {
fprintf(stderr, "Could not open %s\n", argv[ac]);
exit(-1);
}
ac++;
if (snd_get_format(sf_in, &sff) == FALSE) {
fprintf(stderr, "Failed to get format of %s\n", argv[ac]);
exit(-1);
}
if (snd_write_open(&sf_out, argv[ac], "au", &sff) == FALSE) {
fprintf(stderr, "Could not open %s\n", argv[ac]);
exit(-1);
}
if (file_and_codec_compatible(&sff, cid) == FALSE) {
fprintf(stderr, "Codec and file type are not compatible\n");
exit(-1);
}
printf("# Parameters
#\tseed: %ld
#\tdrop: %.2f
#\tcodec: %s
#\tunits per packet: %d
#\trepair: %s
#\tcodec specific repair (when available): %d
#\tsource file: %s
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:bonephone,代码行数:101,代码来源:test_repair.c
示例20: codec_run
/* this is called for each file to process */
enum codec_status codec_run(void)
{
WavpackContext *wpc;
char error [80];
/* rockbox: comment 'set but unused' variables
int bps;
*/
int nchans, sr_100;
intptr_t param;
if (codec_init())
return CODEC_ERROR;
ci->seek_buffer (ci->id3->offset);
/* Create a decoder instance */
wpc = WavpackOpenFileInput (read_callback, error);
if (!wpc)
return CODEC_ERROR;
ci->configure(DSP_SWITCH_FREQUENCY, WavpackGetSampleRate (wpc));
codec_set_replaygain(ci->id3);
/* bps = WavpackGetBytesPerSample (wpc); */
nchans = WavpackGetReducedChannels (wpc);
ci->configure(DSP_SET_STEREO_MODE, nchans == 2 ? STEREO_INTERLEAVED : STEREO_MONO);
sr_100 = ci->id3->frequency / 100;
ci->set_elapsed (WavpackGetSampleIndex (wpc) / sr_100 * 10);
/* The main decoder loop */
while (1) {
int32_t nsamples;
enum codec_command_action action = ci->get_command(¶m);
if (action == CODEC_ACTION_HALT)
break;
if (action == CODEC_ACTION_SEEK_TIME) {
int curpos_ms = WavpackGetSampleIndex (wpc) / sr_100 * 10;
int n, d, skip;
if (param > curpos_ms) {
n = param - curpos_ms;
d = ci->id3->length - curpos_ms;
skip = (int)((int64_t)(ci->filesize - ci->curpos) * n / d);
ci->seek_buffer (ci->curpos + skip);
}
else if (curpos_ms != 0) {
n = curpos_ms - param;
d = curpos_ms;
skip = (int)((int64_t) ci->curpos * n / d);
ci->seek_buffer (ci->curpos - skip);
}
wpc = WavpackOpenFileInput (read_callback, error);
if (!wpc)
{
ci->seek_complete();
break;
}
ci->set_elapsed (WavpackGetSampleIndex (wpc) / sr_100 * 10);
ci->seek_complete();
}
nsamples = WavpackUnpackSamples (wpc, temp_buffer, BUFFER_SIZE / nchans);
if (!nsamples)
break;
ci->pcmbuf_insert (temp_buffer, NULL, nsamples);
ci->set_elapsed (WavpackGetSampleIndex (wpc) / sr_100 * 10);
}
return CODEC_OK;
}
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:79,代码来源:wavpack.c
注:本文中的codec_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论