本文整理汇总了C++中dbg_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ dbg_printf函数的具体用法?C++ dbg_printf怎么用?C++ dbg_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbg_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: compressAudio
ComponentResult compressAudio(GenericStreamPtr as)
{
ComponentResult err = noErr;
if (as->source.eos)
return noErr; //shouldn't be called here.
UInt32 ioPackets = 1; //I want to get only one packet at a put it in a simple block
AudioStreamPacketDescription *packetDesc = NULL;
packetDesc = (AudioStreamPacketDescription *)calloc(ioPackets, sizeof(AudioStreamPacketDescription));
AudioBufferList *audioBufferList = NULL;
_initAudioBufferList(as, &audioBufferList, ioPackets); //allocates memory
dbg_printf("[WebM] call SCAudioFillBuffer(%x,%x,%x,%x,%x, %x)\n", as->aud.vorbisComponentInstance, _fillBuffer_callBack,
(void *) as, &ioPackets,
audioBufferList, packetDesc);
err = SCAudioFillBuffer(as->aud.vorbisComponentInstance, _fillBuffer_callBack,
(void *) as, &ioPackets,
audioBufferList, packetDesc);
dbg_printf("[WebM] exit SCAudioFillBuffer %d packets, err = %d\n", ioPackets, err);
if (err == eofErr)
{
dbg_printf("[WebM] Total Frames in = %lld, Total Frames Out = %lld\n",
as->framesIn, as->framesOut);
if (ioPackets == 0)
as->source.eos = true;
err= noErr;
}
if (err) goto bail;
if (ioPackets > 0)
{
as->aud.buf.offset = 0;
int i = 0;
for (i = 0; i < ioPackets; i++)
{
dbg_printf("[WebM] packet is %ld bytes, %ld frames\n", packetDesc[i].mDataByteSize, packetDesc[i].mVariableFramesInPacket);
as->framesOut += packetDesc[i].mVariableFramesInPacket;
as->aud.buf.offset += packetDesc[i].mDataByteSize;
}
//add a Frame Buffer to the queue
if (as->aud.buf.offset >0)
{
UInt8* buf = malloc(as->aud.buf.offset);
UInt32 timeMs = as->framesOut * 1000 / as->aud.asbd.mSampleRate;
memcpy(buf, as->aud.buf.data, as->aud.buf.offset);
UInt16 frameType = KEY_FRAME + AUDIO_FRAME;
dbg_printf("[WebM] Output audio packet size %ld, time %lu\n", as->aud.buf.offset, timeMs);
addFrameToQueue(&as->frameQueue, buf,as->aud.buf.offset, timeMs, frameType, as->framesOut);
as->aud.buf.offset =0; //reset the buffer for writing
}
}
if (as->frameQueue.size == 0 && as->source.eos)
{
as->complete = true;
}
bail:
if (audioBufferList != NULL)
free(audioBufferList);
if (packetDesc != NULL)
free(packetDesc);
return err;
}
开发者ID:NextGenIntelligence,项目名称:webmquicktime,代码行数:75,代码来源:WebMAudioStream.c
示例2: search_embedfront_inmemory_init
void search_embedfront_inmemory_init() {
char *buffer;
long long buffer_max_size, i;
//
// (1) open the dict
//
dict_file = fopen(DICT_EMBEDFRONT_FILENAME, "rb");
if (!dict_file) {
fprintf(stderr, "ERROR open file %s\n", DICT_EMBEDFRONT_FILENAME);
exit(2);
}
//
// (2) read node_count
//
fread(&node_count, sizeof(node_count), 1, dict_file);
dbg_printf("node_count: %d\n", node_count);
// header term has a maximum length of MAX_WORD_LENGTH + 1
buffer_max_size = node_count * (MAX_WORD_LENGTH + 1 + sizeof(node_ptr_t));
buffer = (char *)malloc(buffer_max_size);
fread(buffer, buffer_max_size, 1, dict_file);
//
// (3) convert into proper header structures
//
headers_array = (dict_embedfront_t *) malloc(node_count * sizeof(dict_embedfront_t));
char *buffer_ptr = buffer;
for (i = 0; i < node_count; i++) {
strncpy(headers_array[i].term, buffer_ptr, strlen(buffer_ptr) + 1);
buffer_ptr += strlen(buffer_ptr) + 1;
memcpy(&headers_array[i].node_ptr, buffer_ptr, sizeof(node_ptr_t));
buffer_ptr += sizeof(node_ptr_t);
}
free(buffer);
#if 0
for (i = 0; i < node_count; i++) {
printf("(%lld): %s\n", i, headers_array[i].term);
}
#endif
//
// (4) read all nodes in memory
//
node_max_size = hd_sector_size * num_of_sectors;
all_nodes = (char *)malloc(node_max_size * node_count);
if (!all_nodes) {
perror("ERROR: malloc for all_nodes\n");
exit(2);
}
// reset the fd to the first node in the file
fseek(dict_file, headers_array[0].node_ptr, SEEK_SET);
fread(all_nodes, node_max_size, node_count, dict_file);
stats.io_time = 0;
stats.search_time = 0;
stats.bytes_read = 0;
}
开发者ID:snapbug,项目名称:atire,代码行数:61,代码来源:dict_embedfront.c
示例3: StartProg
void StartProg( char *cmd, char *prog, char *full_args, char *dos_args )
{
char exe_name[PATH_MAX];
pid_t save_pgrp;
pid_t pid;
int status;
MaxThread = 0;
GrowArrays( 1 );
HaveRdebug = false;
DbgDyn = NULL;
OrigPGrp = getpgrp();
Attached = true;
pid = Pid = SamplePid;
/* allow attaching to existing process by pid */
if( pid == 0 || ptrace( PTRACE_ATTACH, pid, NULL, NULL ) == -1 ) {
int num_args;
size_t len;
const char **argv;
Attached = false;
/* massage 'full_args' into argv format */
len = strlen( full_args );
num_args = SplitParms( full_args, NULL, len );
argv = alloca( ( num_args + 2 ) * sizeof( *argv ) );
argv[SplitParms( full_args, argv + 1, len ) + 1] = NULL;
argv[0] = prog;
Output( MsgArray[MSG_SAMPLE_1 - ERR_FIRST_MESSAGE] );
Output( prog );
Output( "\n" );
save_pgrp = getpgrp();
setpgid( 0, OrigPGrp );
pid = fork();
if( pid == -1 )
InternalError( MsgArray[MSG_SAMPLE_3 - ERR_FIRST_MESSAGE] );
if( pid == 0 ) {
int rc;
if( ptrace( PTRACE_TRACEME, 0, NULL, NULL ) < 0 ) {
InternalError( MsgArray[MSG_SAMPLE_4 - ERR_FIRST_MESSAGE] );
}
dbg_printf( "executing '%s'\n", prog );
for( rc = 0; argv[rc] != NULL; ++rc )
dbg_printf( "argv[%d] = '%s'\n", rc, argv[rc] );
rc = execve( prog, (char const * const *)argv, (char const * const *)environ );
dbg_printf( "execve() failed, returned %d\n", rc );
InternalError( MsgArray[MSG_SAMPLE_3 - ERR_FIRST_MESSAGE] ); // failsafe
}
setpgid( 0, save_pgrp );
strcpy( exe_name, prog );
} else if( pid ) {
GetExeNameFromPid( pid, exe_name, PATH_MAX );
Output( MsgArray[MSG_SAMPLE_1 - ERR_FIRST_MESSAGE] );
Output( exe_name );
Output( "\n" );
}
if( (pid != -1) && (pid != 0) ) {
/* wait until it hits _start (upon execve) or
gives us a SIGSTOP (if attached) */
if( waitpid( pid, &status, 0 ) < 0 )
goto fail;
if( !WIFSTOPPED( status ) )
goto fail;
if( Attached ) {
if( WSTOPSIG( status ) != SIGSTOP ) {
goto fail;
}
} else {
if( WSTOPSIG( status ) != SIGTRAP ) {
goto fail;
}
}
DbgDyn = GetDebuggeeDynSection( exe_name );
errno = 0;
}
if( errno != 0 ) {
pid = 0;
} else {
/* record information about main executable and initialize shared
* library tracking
*/
InitLibMap();
CodeLoad( exe_name, 0, SAMP_MAIN_LOAD );
SampleLoop( pid );
FiniLibMap();
}
return;
fail:
if( pid != 0 && pid != -1 ) {
if( Attached ) {
ptrace( PTRACE_DETACH, pid, NULL, NULL );
Attached = false;
//.........这里部分代码省略.........
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:101,代码来源:samplnx.c
示例4: dbg_printf
UInt32 CAOggFLACDecoder::ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
AudioStreamPacketDescription* outPacketDescription)
{
dbg_printf("[ oFD] >> [%08lx] ProduceOutputPackets(%ld [%ld])\n", (UInt32) this, ioNumberPackets, ioOutputDataByteSize);
UInt32 ret = kAudioCodecProduceOutputPacketSuccess;
if (mFramesBufferedList.empty()) {
ioOutputDataByteSize = 0;
ioNumberPackets = 0;
ret = kAudioCodecProduceOutputPacketNeedsMoreInputData;
dbg_printf("<!E [%08lx] CAOggFLACDecoder :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n", (UInt32) this,
ioNumberPackets, ioOutputDataByteSize, ret, FramesReady());
return ret;
}
OggPagePacket &opp = mFramesBufferedList.front();
UInt32 flac_frames = opp.packets;
UInt32 flac_bytes = opp.frames * mOutputFormat.mBytesPerFrame;
UInt32 ogg_packets = 0;
UInt32 flac_returned_data = ioOutputDataByteSize;
UInt32 flac_total_returned_data = 0;
Byte *the_data = static_cast<Byte*> (outOutputData);
Boolean empty_packet = false;
while (true) {
UInt32 flac_return = kAudioCodecProduceOutputPacketSuccess;
empty_packet = false;
if (complete_pages < 1) {
flac_return = kAudioCodecProduceOutputPacketNeedsMoreInputData;
flac_frames = 0;
flac_returned_data = 0;
} else if (flac_frames == 0) {
UInt32 one_flac_frame = 1;
empty_packet = true;
if (flac_bytes < flac_returned_data) {
flac_returned_data = flac_bytes;
}
flac_return = CAFLACDecoder::ProduceOutputPackets(the_data, flac_returned_data, one_flac_frame, NULL);
} else {
flac_return = CAFLACDecoder::ProduceOutputPackets(the_data, flac_returned_data, flac_frames, NULL);
}
if (flac_return == kAudioCodecProduceOutputPacketSuccess || flac_return == kAudioCodecProduceOutputPacketSuccessHasMore) {
if (flac_frames > 0)
opp.packets -= flac_frames;
if (flac_returned_data > 0)
opp.frames -= flac_returned_data / mOutputFormat.mBytesPerFrame;
dbg_printf("[ oFD] [%08lx] ProduceOutputPackets() p:%ld, f:%ld, c:%ld\n", (UInt32) this, opp.packets, opp.frames, complete_pages);
if (opp.packets <= 0 && opp.frames <= 0) {
ogg_packets++;
if (!empty_packet)
complete_pages--;
mFramesBufferedList.erase(mFramesBufferedList.begin());
opp = mFramesBufferedList.front();
}
flac_total_returned_data += flac_returned_data;
if (ogg_packets == ioNumberPackets || flac_total_returned_data == ioOutputDataByteSize ||
flac_return == kAudioCodecProduceOutputPacketSuccess)
{
ioNumberPackets = ogg_packets;
ioOutputDataByteSize = flac_total_returned_data;
if (!mFramesBufferedList.empty())
ret = kAudioCodecProduceOutputPacketSuccessHasMore;
else
ret = kAudioCodecProduceOutputPacketSuccess;
break;
} else {
the_data += flac_returned_data;
flac_returned_data = ioOutputDataByteSize - flac_total_returned_data;
flac_frames = opp.packets;
flac_bytes = opp.frames * mOutputFormat.mBytesPerFrame;
}
} else if (flac_return == kAudioCodecProduceOutputPacketNeedsMoreInputData) {
if (flac_frames > 0)
opp.packets -= flac_frames;
if (flac_returned_data > 0)
opp.frames -= flac_returned_data / mOutputFormat.mBytesPerFrame;
if (opp.packets <= 0 && opp.frames <= 0) {
ogg_packets++;
if (!empty_packet)
complete_pages--;
mFramesBufferedList.erase(mFramesBufferedList.begin());
//opp = mFramesBufferedList.front();
}
ret = kAudioCodecProduceOutputPacketNeedsMoreInputData;
ioOutputDataByteSize = flac_total_returned_data + flac_returned_data;
ioNumberPackets = ogg_packets;
break;
} else {
ret = kAudioCodecProduceOutputPacketFailure;
ioOutputDataByteSize = flac_total_returned_data;
//.........这里部分代码省略.........
开发者ID:mecke,项目名称:xiph-qt,代码行数:101,代码来源:CAOggFLACDecoder.cpp
示例5: build_embedfront
void build_embedfront() {
char one_byte = '\0';
char previous_term[MAX_WORD_LENGTH+1];
long long i;
dict_embedfront_t *one_header;
char *node_buffer = NULL, *postings_buffer = NULL, *term_buffer = NULL;
char *node_ptr = NULL, *postings_ptr = NULL, *term_ptr = NULL;
long long node_max_size;
long long needed_size, used_size;
if (block_size <= 0) {
fprintf(stderr, "ERROR: block size cannot be zero or less\n");
exit(2);
}
//
// (1) find the maximum size for the node and create temporary buffers
//
node_max_size = hd_sector_size * num_of_sectors;
printf(" node_max_size: %lld\n", node_max_size);
postings_buffer = (char *)malloc(node_max_size);
memset(postings_buffer, 0, node_max_size);
term_buffer = (char *)malloc(node_max_size);
printf("building embedfront......\n");
//
// (2) create lists for headers and nodes
//
headers_list = new Linked_list<dict_embedfront_t *>();
nodes_list = new Linked_list<char *> ();
//
// (3) read term_count
//
vocab_file = fopen(VOCAB_FILENAME, "rb");
dict_file = fopen(DICT_EMBEDFRONT_FILENAME, "wb");
fread(&term_count, sizeof(term_count), 1, vocab_file);
dbg_printf("term_count: %lld\n", term_count);
//
// (4) reall all terms, build up the headers and nodes
//
i = 0;
char filled_previously = TRUE;
char new_node = TRUE;
char node_is_full = FALSE, the_end = FALSE;
node_count = 0;
long long total_wasted = 0;
long long terms_start_at = 0;
term[0] = previous_term[0] = '\0';
while (true) {
//
// (4-1) make sure the previous term is filled in properly before read the next term from file
//
if (filled_previously) {
strcpy(previous_term, term);
fread(term, MAX_WORD_LENGTH+1, 1, vocab_file);
i++;
if (i == term_count) {
the_end = TRUE;
}
}
//
// (4-2) create a new header and the new associated node
//
if (new_node) {
//one_header = (dict_embed_t *) malloc(sizeof(*one_header));
one_header = new dict_embedfront_t;
strncpy(one_header->term, term, strlen(term) + 1);
headers_list->append(one_header);
node_count++;
//node_buffer = (char *)malloc(sizeof(*node_buffer)*max_node_size*512);
node_buffer = new char[node_max_size];
nodes_list ->append(node_buffer);
node_ptr = node_buffer;
postings_ptr = postings_buffer;
term_ptr = term_buffer;
node_length = 0;
new_node = FALSE;
node_is_full = FALSE;
previous_term[0] = '\0';
}
//
// (4-3) fill as many terms as possible in the node
//
// only need to store the prefix_count for the first term in the node
if (previous_term[0] == '\0') {
suffix_count = strlen(term);
needed_size = (long long)POSTING_PTR_SIZE + sizeof(suffix_count) + (sizeof(char) * suffix_count);
} else {
find_common_prefix(previous_term, term, &common_prefix_count);
suffix_count = strlen(term) - common_prefix_count;
needed_size = (long long)POSTING_PTR_SIZE + sizeof(common_prefix_count) + sizeof(suffix_count) + (sizeof(char) * suffix_count);
}
//.........这里部分代码省略.........
开发者ID:snapbug,项目名称:atire,代码行数:101,代码来源:dict_embedfront.c
示例6: set_option
/** \brief parse option from configuration file.
*
* \param[in,out] as Pointer to session handle
* \param[in] opt name of option to set (left of =)
* \param[in] param name of value for option (right of =)
* \param type type for param, currently unused
* \return 0 if parsing was successful, -1 if an error occured. currently
* always returns 0
*/
PRIVATE int set_option(auto_handle *as, const char *opt, const char *param, option_type type) {
int32_t numval;
int32_t result = SUCCESS;
dbg_printf(P_INFO2, "[config] %s=%s (type: %d)", opt, param, type);
assert(as != NULL);
if(!strcmp(opt, "url")) {
dbg_printf(P_ERROR, "the 'url' option is not supported any more, please use the 'feed' option instead!");
result = FAILURE;
} else if(!strcmp(opt, "feed")) {
result = parseFeed(&as->feeds, param);
} else if(!strcmp(opt, "transmission-home")) {
set_path(param, &as->transmission_path);
} else if(!strcmp(opt, "prowl-apikey")) {
as->prowl_key = am_strdup(param);
} else if(!strcmp(opt, "toasty-deviceid")) {
as->toasty_key = am_strdup(param);
} else if(!strcmp(opt, "pushalot-token")) {
as->pushalot_key = am_strdup(param);
} else if(!strcmp(opt, "transmission-version")) {
if (!strcmp(param, "external")) {
/* we should probably only set this when transmission-external is set */
as->transmission_version = AM_TRANSMISSION_EXTERNAL;
} else if(param[0] == '1' && param[1] == '.' && param[2] == '2') {
as->transmission_version = AM_TRANSMISSION_1_2;
} else if(param[0] == '1' && param[1] == '.' && param[2] == '3') {
as->transmission_version = AM_TRANSMISSION_1_3;
} else {
dbg_printf(P_ERROR, "Unknown parameter: %s=%s", opt, param);
}
} else if (!strcmp(opt, "transmission-external")) {
set_path(param, &as->transmission_external);
as->transmission_version = AM_TRANSMISSION_EXTERNAL;
} else if(!strcmp(opt, "torrent-folder")) {
set_path(param, &as->torrent_folder);
} else if(!strcmp(opt, "statefile")) {
set_path(param, &as->statefile);
} else if(!strcmp(opt, "rpc-host")) {
as->host = am_strdup(param);
} else if(!strcmp(opt, "rpc-auth")) {
as->auth = am_strdup(param);
} else if(!strcmp(opt, "upload-limit")) {
numval = parseUInt(param);
if(numval > 0) {
as->upspeed = (uint16_t)numval;
} else {
dbg_printf(P_ERROR, "Unknown parameter: %s=%s", opt, param);
}
} else if(!strcmp(opt, "rpc-port")) {
numval = parseUInt(param);
if (numval > 1024 && numval < 65535) {
as->rpc_port = numval;
} else if(numval != -1) {
dbg_printf(P_ERROR, "RPC port must be an integer between 1025 and 65535, reverting to default (%d)\n\t%s=%s", AM_DEFAULT_RPCPORT, opt, param);
} else {
dbg_printf(P_ERROR, "Unknown parameter: %s=%s", opt, param);
}
} else if(!strcmp(opt, "interval")) {
numval = parseUInt(param);
if(numval > 0) {
as->check_interval = numval;
} else if(numval != -1) {
dbg_printf(P_ERROR, "Interval must be 1 minute or more, reverting to default (%dmin)\n\t%s=%s", AM_DEFAULT_INTERVAL, opt, param);
} else {
dbg_printf(P_ERROR, "Unknown parameter: %s=%s", opt, param);
}
} else if(!strcmp(opt, "use-transmission")) {
if(!strncmp(param, "0", 1) || !strncmp(param, "no", 2)) {
as->use_transmission = 0;
} else if(!strncmp(param, "1", 1) || !strncmp(param, "yes", 3)) {
as->use_transmission = 1;
} else {
dbg_printf(P_ERROR, "Unknown parameter: %s=%s", opt, param);
}
} else if(!strcmp(opt, "start-torrents")) {
if(!strncmp(param, "0", 1) || !strncmp(param, "no", 2)) {
as->start_torrent = 0;
} else if(!strncmp(param, "1", 1) || !strncmp(param, "yes", 3)) {
as->start_torrent = 1;
} else {
dbg_printf(P_ERROR, "Unknown parameter for option '%s': '%s'", opt, param);
}
} else if(!strcmp(opt, "patterns")) {
dbg_printf(P_ERROR, "the 'patterns' option is not supported any more, please use the 'filter' option instead!");
result = FAILURE;
} else if(!strcmp(opt, "filter")) {
result = parseFilter(&as->filters, param);
} else {
dbg_printf(P_ERROR, "Unknown option: %s", opt);
}
//.........这里部分代码省略.........
开发者ID:Hans-Zhang28,项目名称:Automatic,代码行数:101,代码来源:config_parser.c
示例7: extract_archive_file
extern bool extract_archive_file(const char *archname, const char *archpath, const char *dest, t_copy_cb cb, t_copy_overwritecb ocb, void *data)
{
t_fs_filetype ft;
SceUID fd;
bool result = false;
buffer *archdata = NULL;
int buffer_cache;
char *ptr;
if (archname == NULL || archpath == NULL || dest == NULL)
return false;
ft = get_archive_type(archname);
if (ft == fs_filetype_unknown)
return false;
if (ocb != NULL) {
SceUID fd;
fd = sceIoOpen(dest, PSP_O_RDONLY, 0777);
if (fd >= 0) {
if (!ocb(dest, data)) {
sceIoClose(fd);
return false;
}
sceIoClose(fd);
}
}
dbg_printf(d, "extract_archive_file: %s %s %s, ft = %d", archname, archpath, dest, ft);
fd = sceIoOpen(dest, PSP_O_CREAT | PSP_O_RDWR, 0777);
if (fd < 0)
return false;
extract_archive_file_into_buffer(&archdata, archname, archpath, ft);
if (archdata == NULL || archdata->ptr == NULL)
goto exit;
buffer_cache = archdata->used >= 1024 * 1024 ? 1024 * 1024 : archdata->used;
ptr = archdata->ptr;
while (buffer_cache > 0) {
int bytes = sceIoWrite(fd, ptr, buffer_cache);
if (bytes < 0) {
goto exit;
}
buffer_cache = archdata->used - bytes >= 1024 * 1024 ? 1024 * 1024 : archdata->used - bytes;
ptr += bytes;
}
result = true;
exit:
sceIoClose(fd);
if (archdata != NULL) {
buffer_free(archdata);
}
return result;
}
开发者ID:DreamingPiggy,项目名称:xreader-hg,代码行数:66,代码来源:copy.c
示例8: be_ppc_fetch_integer
static int be_ppc_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
unsigned ext_sign, LONGLONG* ret)
{
dbg_printf("not done\n");
return FALSE;
}
开发者ID:Kelimion,项目名称:wine,代码行数:6,代码来源:be_ppc.c
示例9: be_ppc_fetch_float
static int be_ppc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
long double* ret)
{
dbg_printf("not done\n");
return FALSE;
}
开发者ID:Kelimion,项目名称:wine,代码行数:6,代码来源:be_ppc.c
示例10: be_ppc_clear_watchpoint
static void be_ppc_clear_watchpoint(CONTEXT* ctx, unsigned idx)
{
dbg_printf("not done\n");
}
开发者ID:Kelimion,项目名称:wine,代码行数:4,代码来源:be_ppc.c
示例11: be_ppc_adjust_pc_for_break
static int be_ppc_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
{
dbg_printf("not done\n");
return 0;
}
开发者ID:Kelimion,项目名称:wine,代码行数:5,代码来源:be_ppc.c
示例12: be_ppc_is_watchpoint_set
static unsigned be_ppc_is_watchpoint_set(const CONTEXT* ctx, unsigned idx)
{
dbg_printf("not done\n");
return FALSE;
}
开发者ID:Kelimion,项目名称:wine,代码行数:5,代码来源:be_ppc.c
示例13: dbg_printf
void CASpeexDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
{
dbg_printf(" >> [%08lx] CASpeexDecoder :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
switch(inPropertyID)
{
case kAudioCodecPropertyRequiresPacketDescription:
if(ioPropertyDataSize == sizeof(UInt32))
{
*reinterpret_cast<UInt32*>(outPropertyData) = 1;
}
else
{
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
case kAudioCodecPropertyHasVariablePacketByteSizes:
if(ioPropertyDataSize == sizeof(UInt32))
{
*reinterpret_cast<UInt32*>(outPropertyData) = 1;
}
else
{
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
case kAudioCodecPropertyPacketFrameSize:
if(ioPropertyDataSize == sizeof(UInt32))
{
UInt32 *outProp = reinterpret_cast<UInt32*>(outPropertyData);
if (!mCompressionInitialized)
*outProp = kSpeexFramesPerPacket;
else if (mSpeexHeader.frame_size != 0 * mSpeexHeader.frames_per_packet != 0)
*outProp = mSpeexHeader.frame_size * mSpeexHeader.frames_per_packet;
else
*outProp = 8192;
if (*outProp < 8192 && mInputFormat.mFormatID == kAudioFormatXiphOggFramedSpeex)
*outProp = 8192;
dbg_printf(" = [%08lx] CASpeexDecoder :: GetProperty('pakf'): %ld\n",
(UInt32) this, *outProp);
}
else
{
CODEC_THROW(kAudioCodecBadPropertySizeError);
}
break;
//case kAudioCodecPropertyQualitySetting: ???
#if TARGET_OS_MAC
case kAudioCodecPropertyNameCFString:
{
if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
CABundleLocker lock;
CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Xiph Speex decoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
*(CFStringRef*)outPropertyData = name;
break;
}
//case kAudioCodecPropertyManufacturerCFString:
#endif
default:
ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
}
dbg_printf("<.. [%08lx] CASpeexDecoder :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
}
开发者ID:mecke,项目名称:xiph-qt,代码行数:65,代码来源:CASpeexDecoder.cpp
示例14: write_vorbisPrivateData
ComponentResult write_vorbisPrivateData(GenericStreamPtr as, UInt8 **buf, UInt32 *bufSize)
{
ComponentResult err = noErr;
void *magicCookie = NULL;
UInt32 cookieSize = 0;
dbg_printf("[WebM] Get Vorbis Private Data\n");
err = QTGetComponentPropertyInfo(as->aud.vorbisComponentInstance,
kQTPropertyClass_SCAudio,
kQTSCAudioPropertyID_MagicCookie,
NULL, &cookieSize, NULL);
if (err) return err;
dbg_printf("[WebM] Cookie Size %d\n", cookieSize);
magicCookie = calloc(1, cookieSize);
err = QTGetComponentProperty(as->aud.vorbisComponentInstance,
kQTPropertyClass_SCAudio,
kQTSCAudioPropertyID_MagicCookie,
cookieSize, magicCookie, NULL);
if (err) goto bail;
UInt8 *ptrheader = (UInt8 *) magicCookie;
UInt8 *cend = ptrheader + cookieSize;
CookieAtomHeader *aheader = (CookieAtomHeader *) ptrheader;
WebMBuffer header, header_vc, header_cb;
header.size = header_vc.size = header_cb.size = 0;
while (ptrheader < cend)
{
aheader = (CookieAtomHeader *) ptrheader;
ptrheader += EndianU32_BtoN(aheader->size);
if (ptrheader > cend || EndianU32_BtoN(aheader->size) <= 0)
break;
switch (EndianS32_BtoN(aheader->type))
{
case kCookieTypeVorbisHeader:
header.size = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
header.data = aheader->data;
break;
case kCookieTypeVorbisComments:
header_vc.size = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
header_vc.data = aheader->data;
break;
case kCookieTypeVorbisCodebooks:
header_cb.size = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
header_cb.data = aheader->data;
break;
default:
break;
}
}
if (header.size == 0 || header_vc.size == 0 || header_cb.size == 0)
{
err = paramErr;
goto bail;
}
//1 + header1 /255 + header2 /255 + idheader.len +
*bufSize = 1; //the first byte which is always 0x02
*bufSize += (header.size - 1) / 255 + 1; //the header size lacing
*bufSize += (header_vc.size - 1) / 255 + 1; //the comment size lacing
*bufSize += header.size + header_vc.size + header_cb.size; //the packets
dbg_printf("[WebM]Packet headers %d %d %d -- total buffer %d\n",
header.size, header_vc.size , header_cb.size, *bufSize);
*buf = malloc(*bufSize);
UInt8 *ptr = *buf;
*ptr = 0x02;
ptr ++;
//using ogg lacing write out the size of the first two packets
_oggLacing(&ptr, header.size);
_oggLacing(&ptr, header_vc.size);
_dbg_printVorbisHeader(header.data);
memcpy(ptr, header.data, header.size);
ptr += header.size;
memcpy(ptr, header_vc.data, header_vc.size);
ptr += header_vc.size;
memcpy(ptr, header_cb.data, header_cb.size);
bail:
if (magicCookie != NULL)
{
free(magicCookie);
magicCookie = NULL;
}
return err;
}
开发者ID:NextGenIntelligence,项目名称:webmquicktime,代码行数:100,代码来源:WebMAudioStream.c
示例15: undo_write_tdb
//.........这里部分代码省略.........
/*
* Read one block using the backing I/O manager
* The backing I/O manager block size may be
* different from the tdb_data_size.
* Also we need to recalcuate the block number with respect
* to the backing I/O manager.
*/
offset = block_num * data->tdb_data_size +
(data->offset % data->tdb_data_size);
backing_blk_num = (offset - data->offset) / channel->block_size;
retval = ext2fs_get_mem(data->tdb_data_size, &read_ptr);
if (retval) {
return retval;
}
memset(read_ptr, 0, data->tdb_data_size);
actual_size = 0;
if ((data->tdb_data_size % channel->block_size) == 0)
sz = data->tdb_data_size / channel->block_size;
else
sz = -data->tdb_data_size;
retval = io_channel_read_blk64(data->real, backing_blk_num,
sz, read_ptr);
if (retval) {
if (retval != EXT2_ET_SHORT_READ) {
free(read_ptr);
return retval;
}
/*
* short read so update the record size
* accordingly
*/
data_size = actual_size;
} else {
data_size = data->tdb_data_size;
}
if (data_size == 0) {
free(read_ptr);
block_num++;
continue;
}
dbg_printf("Read %llu bytes from FS block %llu (blk=%llu cnt=%llu)\n",
data_size, backing_blk_num, block, data->tdb_data_size);
if ((data_size % data->undo_file->block_size) == 0)
sz = data_size / data->undo_file->block_size;
else
sz = -data_size;;
/* extend this key? */
if (data->keys_in_block) {
key = data->keyb->keys + data->keys_in_block - 1;
keysz = ext2fs_le32_to_cpu(key->size);
} else {
key = NULL;
keysz = 0;
}
if (key != NULL &&
(ext2fs_le64_to_cpu(key->fsblk) * channel->block_size +
channel->block_size - 1 +
keysz) / channel->block_size == backing_blk_num &&
E2UNDO_MAX_EXTENT_BLOCKS * data->tdb_data_size >
keysz + data_size) {
blk_crc = ext2fs_le32_to_cpu(key->blk_crc);
blk_crc = ext2fs_crc32c_le(blk_crc, read_ptr, data_size);
key->blk_crc = ext2fs_cpu_to_le32(blk_crc);
key->size = ext2fs_cpu_to_le32(keysz + data_size);
} else {
data->num_keys++;
key = data->keyb->keys + data->keys_in_block;
data->keys_in_block++;
key->fsblk = ext2fs_cpu_to_le64(backing_blk_num);
blk_crc = ext2fs_crc32c_le(~0, read_ptr, data_size);
key->blk_crc = ext2fs_cpu_to_le32(blk_crc);
key->size = ext2fs_cpu_to_le32(data_size);
}
dbg_printf("Writing block %llu to offset %llu size %d key %zu\n",
block_num,
data->undo_blk_num,
sz, data->num_keys - 1);
retval = io_channel_write_blk64(data->undo_file,
data->undo_blk_num, sz, read_ptr);
if (retval) {
free(read_ptr);
return retval;
}
data->undo_blk_num++;
free(read_ptr);
/* Write out the key block */
retval = write_undo_indexes(data, 0);
if (retval)
return retval;
/* Next block */
block_num++;
}
return retval;
}
开发者ID:MIPS,项目名称:external-e2fsprogs,代码行数:101,代码来源:undo_io.c
示例16: be_ppc_store_integer
static int be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
unsigned is_signed, LONGLONG val)
{
dbg_printf("be_ppc_store_integer: not done\n");
return FALSE;
}
开发者ID:Kelimion,项目名称:wine,代码行数:6,代码来源:be_ppc.c
示例17: parseMultiOption
PRIVATE simple_list parseMultiOption(const char *str) {
int tmp_pos;
uint32_t line_pos = 0;
uint32_t len = strlen(str);
simple_list options = NULL;
char tmp[MAX_PARAM_LEN];
int last_dbl_quote_pos;
int8_t parse_error = 0;
int32_t current_line_pos = 0;
if(len == 0) {
dbg_printf(P_ERROR, "[parseMultiOption] empty input string!");
return NULL;
}
while(line_pos < len) {
memset(&tmp, 0, sizeof(tmp));
// Skip any initial whitespace
while (line_pos < len && isspace(str[line_pos])) {
++line_pos;
}
tmp_pos = 0;
parse_error = 0;
last_dbl_quote_pos = -1;
while(line_pos < len && str[line_pos] != '\0') {
if(str[line_pos] == '\"') {
last_dbl_quote_pos = tmp_pos;
} else if(str[line_pos] == '\n') {
// Text is broken over multiple lines
if(str[line_pos - 1] == '\\' || str[line_pos - 1] == '+') {
// skip newline
line_pos++;
// skip whitespace at the beginning of the next line
while (line_pos < len && isspace(str[line_pos])) {
++line_pos;
}
if(str[line_pos] == '\"' && last_dbl_quote_pos != -1) {
// Reset the string index to the position of the last double-quote, and properly null-terminate it
tmp_pos = last_dbl_quote_pos;
tmp[tmp_pos] = '\0';
// Skip the double-quote on the new line as well
line_pos++;
} else {
tmp[tmp_pos] = '\0';
dbg_printf(P_ERROR, "[parseMultiOption] Parsing error at line '%s'", &tmp[current_line_pos]);
parse_error = 1;
break;
}
} else {
// If the character before the newline is not a backslash ('\'), consider this suboption complete
break;
}
current_line_pos = tmp_pos;
}
tmp[tmp_pos++] = str[line_pos++];
}
if(parse_error) {
break;
}
/* A suboption is finished, end it with a null terminator */
tmp[tmp_pos] = '\0';
/* store the line in our list */
if(tmp_pos != 0) {
suboption_t* i = parseSubOption(tmp);
if(i != NULL) {
addItem(i, &options);
} else {
dbg_printf(P_ERROR, "Invalid suboption string: '%s'", tmp);
}
}
}
return options;
}
开发者ID:Hans-Zhang28,项目名称:Automatic,代码行数:84,代码来源:config_parser.c
示例18: be_ppc_get_register_info
static unsigned be_ppc_get_register_info(int regno, enum be_cpu_addr* kind)
{
dbg_printf("not done\n");
return FALSE;
}
开发者ID:Kelimion,项目名称:wine,代码行数:5,代码来源:be_ppc.c
示例19: parse_config_file
/** \brief parse configuration file.
*
* \param[in,out] as Pointer to session handle
* \param[in] filename Path to the configuration file
* \return 0 if parsing was successful, -1 if an error occured.
*/
int parse_config_file(struct auto_handle *as, const char *filename) {
FILE *fp = NULL;
char *line = NULL;
char opt[MAX_OPT_LEN + 1];
char param[MAX_PARAM_LEN + 1];
char c; /* for the "" and '' check */
int line_num = 0;
int line_pos = 0;
int opt_pos;
int param_pos;
int parse_error = 0;
struct stat fs;
option_type type;
if ((fp = fopen(filename, "rb")) == NULL) {
perror("fopen");
return -1;
}
if(stat(filename, &fs) == -1) {
fclose(fp);
return -1;
}
if ((line = am_malloc(fs.st_size + 1)) == NULL) {
dbg_printf(P_ERROR, "Can't allocate memory for 'line': %s (%ldb)", strerror(errno), fs.st_size + 1);
fclose(fp);
return -1;
}
if(fread(line, fs.st_size, 1, fp) != 1) {
perror("fread");
fclose(fp);
am_free(line);
return -1;
}
/* NULL-terminate the result */
line[fs.st_size] = '\0';
if(fp) {
fclose(fp);
}
while(line_pos != fs.st_size) {
line_pos = SkipWhitespace(line, line_pos, &line_num);
if(line_pos < 0) {
parse_error = 1;
break;
}
if(line_pos >= fs.st_size) {
break;
}
/* comment */
if (line[line_pos] == '#') {
////dbg_printf(P_INFO2, "skipping comment (line %d)", line_num);
while (line[line_pos] != '\n') {
++line_pos;
}
++line_num;
++line_pos; /* skip the newline as well */
continue;
}
/* read option */
for (opt_pos = 0; isprint(line[line_pos]) && line[line_pos] != ' ' &&
line[line_pos] != '#' && line[line_pos] != '='; /* NOTHING */) {
opt[opt_pos++] = line[line_pos++];
if (opt_pos >= MAX_OPT_LEN) {
dbg_printf(P_ERROR, "too long option at line %d", line_num);
parse_error = 1;
}
}
if (opt_pos == 0 || parse_error == 1) {
dbg_printf(P_ERROR, "parse error at line %d (pos: %d)", line_num, line_pos);
parse_error = 1;
break;
} else {
opt[opt_pos] = '\0';
}
line_pos = SkipWhitespace(line, line_pos, &line_num);
if(line_pos < 0) {
parse_error = 1;
break;
}
if(line_pos >= fs.st_size) {
//.........这里部分代码省略.........
开发者ID:Hans-Zhang28,项目名称:Automatic,代码行数:101,代码来源:config_parser.c
示例20: be_ppc_print_context
static void be_ppc_print_context(HANDLE hThread, const CONTEXT* ctx, int all_regs)
{
dbg_printf("Context printing for PPC not done yet\n");
}
开发者ID:Kelimion,项目名称:wine,代码行数:4,代码来源:be_ppc.c
注:本文中的dbg_printf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理 |
请发表评论