* fixed a couple of regressions of r37670 concerning optional build targets

(bluetooth, ac3_decoder, netfs)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37672 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2010-07-21 23:10:57 +00:00
parent 0041b38214
commit 0ea1aab28a
4 changed files with 50 additions and 37 deletions
@@ -31,9 +31,9 @@
int32 api_version = B_CUR_DRIVER_API_VERSION; int32 api_version = B_CUR_DRIVER_API_VERSION;
// Modules // Modules
static char* usb_name = B_USB_MODULE_NAME; static const char* usb_name = B_USB_MODULE_NAME;
static char* hci_name = BT_HCI_MODULE_NAME; static const char* hci_name = BT_HCI_MODULE_NAME;
static char* btDevices_name = BT_HCI_MODULE_NAME; static const char* btDevices_name = BT_HCI_MODULE_NAME;
usb_module_info* usb = NULL; usb_module_info* usb = NULL;
@@ -21,9 +21,9 @@ extern "C" {
static int netfs_mount(nspace_id nsid, const char *device, ulong flags, static int netfs_mount(nspace_id nsid, const char *device, ulong flags,
void *parameters, size_t len, void **data, vnode_id *rootID); void *parameters, size_t len, void **data, vnode_id *rootID);
static int netfs_unmount(void *ns); static int netfs_unmount(void *ns);
static int netfs_sync(void *ns); //static int netfs_sync(void *ns);
static int netfs_read_fs_stat(void *ns, struct fs_info *info); static int netfs_read_fs_stat(void *ns, struct fs_info *info);
static int netfs_write_fs_stat(void *ns, struct fs_info *info, long mask); //static int netfs_write_fs_stat(void *ns, struct fs_info *info, long mask);
// vnodes // vnodes
static int netfs_read_vnode(void *ns, vnode_id vnid, char reenter, static int netfs_read_vnode(void *ns, vnode_id vnid, char reenter,
@@ -32,7 +32,7 @@ static int netfs_write_vnode(void *ns, void *node, char reenter);
static int netfs_remove_vnode(void *ns, void *node, char reenter); static int netfs_remove_vnode(void *ns, void *node, char reenter);
// nodes // nodes
static int netfs_fsync(void *ns, void *node); //static int netfs_fsync(void *ns, void *node);
static int netfs_read_stat(void *ns, void *node, struct stat *st); static int netfs_read_stat(void *ns, void *node, struct stat *st);
static int netfs_write_stat(void *ns, void *node, struct stat *st, static int netfs_write_stat(void *ns, void *node, struct stat *st,
long mask); long mask);
@@ -50,7 +50,7 @@ static int netfs_write(void *ns, void *node, void *cookie, off_t pos,
const void *buffer, size_t *bufferSize); const void *buffer, size_t *bufferSize);
static int netfs_ioctl(void *ns, void *node, void *cookie, int cmd, static int netfs_ioctl(void *ns, void *node, void *cookie, int cmd,
void *buffer, size_t bufferSize); void *buffer, size_t bufferSize);
static int netfs_setflags(void *ns, void *node, void *cookie, int flags); //static int netfs_setflags(void *ns, void *node, void *cookie, int flags);
// hard links / symlinks // hard links / symlinks
static int netfs_link(void *ns, void *dir, const char *name, void *node); static int netfs_link(void *ns, void *dir, const char *name, void *node);
@@ -239,6 +239,8 @@ netfs_unmount(void *ns)
return B_OK; return B_OK;
} }
#if 0 // not used
// netfs_sync // netfs_sync
static static
int int
@@ -259,6 +261,8 @@ netfs_sync(void *ns)
return error; return error;
} }
#endif
// netfs_read_fs_stat // netfs_read_fs_stat
static static
int int
@@ -279,6 +283,8 @@ netfs_read_fs_stat(void *ns, struct fs_info *info)
return error; return error;
} }
#if 0 // not used
// netfs_write_fs_stat // netfs_write_fs_stat
static static
int int
@@ -299,6 +305,8 @@ netfs_write_fs_stat(void *ns, struct fs_info *info, long mask)
return error; return error;
} }
#endif
// #pragma mark - // #pragma mark -
// #pragma mark ----- vnodes ----- // #pragma mark ----- vnodes -----
@@ -355,6 +363,8 @@ netfs_remove_vnode(void *ns, void *_node, char reenter)
// #pragma mark - // #pragma mark -
// #pragma mark ----- nodes ----- // #pragma mark ----- nodes -----
#if 0 // not used
// netfs_fsync // netfs_fsync
static static
int int
@@ -367,6 +377,8 @@ netfs_fsync(void *ns, void *_node)
return error; return error;
} }
#endif
// netfs_read_stat // netfs_read_stat
static static
int int
@@ -43,7 +43,7 @@ AC3Decoder::AC3Decoder()
{ {
fInputBuffer = malloc(INPUT_BUFFER_MAX_SIZE); fInputBuffer = malloc(INPUT_BUFFER_MAX_SIZE);
strcpy(fChannelInfo,"Unknown"); strcpy(fChannelInfo,"Unknown");
fState = a52_init(0); fState = a52_init(0);
if (fState) { if (fState) {
fSamples = a52_samples(fState); fSamples = a52_samples(fState);
@@ -84,7 +84,7 @@ AC3Decoder::Setup(media_format *ioEncodedFormat,
TRACE("AC3Decoder::Setup: couldn't get stream info\n"); TRACE("AC3Decoder::Setup: couldn't get stream info\n");
return B_ERROR; return B_ERROR;
} }
// Sample offsets of the output buffer are stored in fInterleaveOffset // Sample offsets of the output buffer are stored in fInterleaveOffset
// When a channel is not present, it is skipped, the rest is shifted left // When a channel is not present, it is skipped, the rest is shifted left
// The block of samples order presented by liba52 is // The block of samples order presented by liba52 is
@@ -253,7 +253,7 @@ AC3Decoder::NegotiateOutputFormat(media_format *ioDecodedFormat)
ioDecodedFormat->u.raw_audio.buffer_size = 6 * 256 * fFrameSize; ioDecodedFormat->u.raw_audio.buffer_size = 6 * 256 * fFrameSize;
ioDecodedFormat->u.raw_audio.channel_mask = fChannelMask; ioDecodedFormat->u.raw_audio.channel_mask = fChannelMask;
TRACE("AC3Decoder::NegotiateOutputFormat: fFlags 0x%x, fFrameRate %d, fBitRate %d, fChannelCount %d, fFrameSize %d\n", fFlags, fFrameRate, fBitRate, fChannelCount, fFrameSize); TRACE("AC3Decoder::NegotiateOutputFormat: fFlags 0x%x, fFrameRate %d, fBitRate %d, fChannelCount %d, fFrameSize %d\n", fFlags, fFrameRate, fBitRate, fChannelCount, fFrameSize);
return B_OK; return B_OK;
@@ -267,7 +267,7 @@ AC3Decoder::Seek(uint32 seekTo,
{ {
fInputChunkSize = 0; fInputChunkSize = 0;
fInputBufferSize = 0; fInputBufferSize = 0;
TRACE("AC3Decoder::Seek called\n"); TRACE("AC3Decoder::Seek called\n");
if (seekTo == B_MEDIA_SEEK_TO_TIME) { if (seekTo == B_MEDIA_SEEK_TO_TIME) {
@@ -297,7 +297,7 @@ AC3Decoder::Decode(void *buffer, int64 *frameCount,
TRACE("AC3Decoder::Decode: DecodeNext failed\n"); TRACE("AC3Decoder::Decode: DecodeNext failed\n");
return B_ERROR; return B_ERROR;
} }
/* /*
Every A/52 frame is composed of 6 blocks, each with an output of 256 Every A/52 frame is composed of 6 blocks, each with an output of 256
samples for each channel. The a52_block() function decodes the next samples for each channel. The a52_block() function decodes the next
@@ -305,10 +305,10 @@ AC3Decoder::Decode(void *buffer, int64 *frameCount,
audio in the frame. After each call, you should extract the audio data audio in the frame. After each call, you should extract the audio data
from the sample buffer. from the sample buffer.
*/ */
// fInterleaveOffset[] is used to provide a correct interleave of // fInterleaveOffset[] is used to provide a correct interleave of
// multi channel audio // multi channel audio
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
a52_block(fState); a52_block(fState);
for (int j = 0; j < fChannelCount; j++) { for (int j = 0; j < fChannelCount; j++) {
@@ -320,7 +320,7 @@ AC3Decoder::Decode(void *buffer, int64 *frameCount,
} }
} }
} }
mediaHeader->start_time = fStartTime; mediaHeader->start_time = fStartTime;
mediaHeader->type = B_MEDIA_RAW_AUDIO; mediaHeader->type = B_MEDIA_RAW_AUDIO;
mediaHeader->size_used = 6 * 256 * fFrameSize; mediaHeader->size_used = 6 * 256 * fFrameSize;
@@ -344,7 +344,8 @@ AC3Decoder::InputGetData(void **buffer, int size)
return true; return true;
} }
if (fInputChunkSize > 0) { if (fInputChunkSize > 0) {
int bytes = min_c(size - fInputBufferSize, fInputChunkSize); int bytes
= min_c((size_t)(size - fInputBufferSize), fInputChunkSize);
memcpy((char *)fInputBuffer + fInputBufferSize, (char *)fInputChunk + fInputChunkOffset, bytes); memcpy((char *)fInputBuffer + fInputBufferSize, (char *)fInputChunk + fInputChunkOffset, bytes);
fInputChunkOffset += bytes; fInputChunkOffset += bytes;
fInputChunkSize -= bytes; fInputChunkSize -= bytes;
@@ -368,7 +369,7 @@ void
AC3Decoder::InputRemoveData(int size) AC3Decoder::InputRemoveData(int size)
{ {
fInputBufferSize -= size; fInputBufferSize -= size;
if (fInputBufferSize) if (fInputBufferSize)
memmove(fInputBuffer, (char *)fInputBuffer + size, fInputBufferSize); memmove(fInputBuffer, (char *)fInputBuffer + size, fInputBufferSize);
} }
@@ -398,9 +399,9 @@ AC3Decoder::DecodeNext()
TRACE("AC3Decoder::DecodeNext: can't get 7 bytes\n"); TRACE("AC3Decoder::DecodeNext: can't get 7 bytes\n");
return false; return false;
} }
int flags, sample_rate, bit_rate; int flags, sample_rate, bit_rate;
int bytes = a52_syncinfo((uint8_t *)input, &flags, &sample_rate, &bit_rate); int bytes = a52_syncinfo((uint8_t *)input, &flags, &sample_rate, &bit_rate);
if (bytes == 0) { if (bytes == 0) {
TRACE("AC3Decoder::DecodeNext: syncinfo failed\n"); TRACE("AC3Decoder::DecodeNext: syncinfo failed\n");
@@ -414,23 +415,23 @@ AC3Decoder::DecodeNext()
TRACE("AC3Decoder::DecodeNext: can't get %d data bytes\n", bytes); TRACE("AC3Decoder::DecodeNext: can't get %d data bytes\n", bytes);
return false; return false;
} }
// printf("fFlags 0x%x, flags 0x%x\n", fFlags, flags); // printf("fFlags 0x%x, flags 0x%x\n", fFlags, flags);
flags = fFlags | A52_ADJUST_LEVEL; flags = fFlags | A52_ADJUST_LEVEL;
sample_t level = 1.0; sample_t level = 1.0;
if (0 != a52_frame(fState, (uint8_t *)input, &flags, &level, 0)) { if (0 != a52_frame(fState, (uint8_t *)input, &flags, &level, 0)) {
TRACE("AC3Decoder::DecodeNext: a52_frame failed\n"); TRACE("AC3Decoder::DecodeNext: a52_frame failed\n");
return false; return false;
} }
TRACE("decoded %d bytes, flags 0x%x\n", bytes, fFlags); TRACE("decoded %d bytes, flags 0x%x\n", bytes, fFlags);
InputRemoveData(bytes); InputRemoveData(bytes);
if (fDisableDynamicCompression) if (fDisableDynamicCompression)
a52_dynrng(fState, NULL, 0); a52_dynrng(fState, NULL, 0);
return true; return true;
} }
} }
+13 -13
View File
@@ -35,16 +35,16 @@ DeviceManager::MessageReceived(BMessage* msg)
entry_ref ref; entry_ref ref;
const char *name; const char *name;
BDirectory dir; BDirectory dir;
Output::Instance()->Post("Something new in the bus ... ", BLACKBOARD_DEVICEMANAGER); Output::Instance()->Post("Something new in the bus ... ", BLACKBOARD_DEVICEMANAGER);
if ((msg->FindInt32("device", &ref.device)!=B_OK) if ((msg->FindInt32("device", &ref.device)!=B_OK)
|| (msg->FindInt64("directory", &ref.directory)!=B_OK) || (msg->FindInt64("directory", &ref.directory)!=B_OK)
|| (msg->FindString("name", &name) != B_OK)) || (msg->FindString("name", &name) != B_OK))
return; return;
Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER, " -> %s\n", name); Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER, " -> %s\n", name);
ref.set_name(name); ref.set_name(name);
// Check if the entry is a File or a directory // Check if the entry is a File or a directory
@@ -53,7 +53,7 @@ DeviceManager::MessageReceived(BMessage* msg)
node_ref nref; node_ref nref;
dir.GetNodeRef(&nref); dir.GetNodeRef(&nref);
AddDirectory(&nref); AddDirectory(&nref);
} else { } else {
printf("%s: Entry %s is taken as a file\n", __FUNCTION__, name); printf("%s: Entry %s is taken as a file\n", __FUNCTION__, name);
AddDevice(&ref); AddDevice(&ref);
@@ -64,8 +64,8 @@ DeviceManager::MessageReceived(BMessage* msg)
{ {
Output::Instance()->Post("Something removed from the bus ...\n", Output::Instance()->Post("Something removed from the bus ...\n",
BLACKBOARD_DEVICEMANAGER); BLACKBOARD_DEVICEMANAGER);
} }
break; break;
case B_STAT_CHANGED: case B_STAT_CHANGED:
case B_ATTR_CHANGED: case B_ATTR_CHANGED:
@@ -95,13 +95,13 @@ DeviceManager::AddDirectory(node_ref *nref)
Output::Instance()->Post("AddDirectory::watch_node Failed\n", BLACKBOARD_DEVICEMANAGER); Output::Instance()->Post("AddDirectory::watch_node Failed\n", BLACKBOARD_DEVICEMANAGER);
return status; return status;
} }
// BPath path(*nref); // BPath path(*nref);
// BString str(path.Path()); // BString str(path.Path());
// //
// Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER, // Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER,
// "Exploring entries in %s\n", str.String()); // "Exploring entries in %s\n", str.String());
entry_ref ref; entry_ref ref;
status_t error; status_t error;
while ((error = directory.GetNextRef(&ref)) == B_OK) { while ((error = directory.GetNextRef(&ref)) == B_OK) {
@@ -109,7 +109,7 @@ DeviceManager::AddDirectory(node_ref *nref)
AddDevice(&ref); AddDevice(&ref);
} }
Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER, Output::Instance()->Postf(BLACKBOARD_DEVICEMANAGER,
"Finished exploring entries(%s)\n", strerror(error)); "Finished exploring entries(%s)\n", strerror(error));
return (error == B_OK || error == B_ENTRY_NOT_FOUND)?B_OK:error; return (error == B_OK || error == B_ENTRY_NOT_FOUND)?B_OK:error;
@@ -285,8 +285,8 @@ DeviceManager::StopMonitoringDevice(const char *device)
return err; return err;
// test if still monitored // test if still monitored
bool stillMonitored = false;
/* /*
bool stillMonitored = false;
int32 i = 0; int32 i = 0;
while ((tmpaddon = (_BDeviceAddOn_ *)fDeviceAddons.ItemAt(i++)) !=NULL) { while ((tmpaddon = (_BDeviceAddOn_ *)fDeviceAddons.ItemAt(i++)) !=NULL) {
if (addon == tmpaddon) if (addon == tmpaddon)