/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1993-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <AudioExtent.h>
#include <AudioList.h>
#include <AudioDebug.h>
// class AudioList methods
// class AudioListEntry Constructor
{
// A NULL object is only valid in dummy entries, such as list heads
}
// class AudioListEntry Destructor
{
newptr(0);
if (next != 0) {
}
if (prev != 0) {
}
}
// Set a new extent pointer in an AudioListEntry
void AudioList::AudioListEntry::
{
if (aptr != 0)
aptr->Dereference();
if (aptr != 0)
}
// Link object into list
// Link in a new AudioListEntry
void AudioList::AudioListEntry::
link(
{
// Link object into list
if (next != 0)
}
// Split an AudioListEntry at the specified offset
void AudioList::AudioListEntry::
{
// Create two extents referencing this object
// Set the current entry to the first extent and append the second
}
// class AudioList Constructor
const char *local_name): // name string
{
}
// class AudioList Destructor
~AudioList()
{
// Delete all entries in the list
while (first() != 0)
delete first();
}
// Get the first entry in the list
first() const
{
}
// Get the extent and offset corresponding to a given position
// Return FALSE if no extents in list or position is beyond eof
{
// Position must be specified
return (FALSE);
// Get the first extent in the list
while (ep != 0) {
// Get length of extent
// Can't determine sizes beyond this
return (TRUE);
}
// If the remaining offset is inside the current extent
return (TRUE);
// Move on to the next extent
}
return (FALSE);
}
// Get the total length of the audio list
GetLength() const
{
Double x;
// Accumulate times for each extent
// Indeterminate extents screw up the calculation
if (Undefined(x))
return (x);
sum += x;
}
return (sum);
}
// Construct a name for the list
char *AudioList::
GetName() const
{
// XXX - construct a better name
}
// Get the audio header for the current read position
{
return (GetHeader(ReadPosition()));
}
// Get the audio header for the given position
{
// Get the extent pointer for the given position
AudioHdr h;
if (pos != 0.) {
"AudioHdr:GetHeader()...position is beyond eof"),
Warning);
return (h);
}
return (h);
}
// Get the header for the proper offset in the extent
}
// Copy data from list into specified buffer.
// No data format translation takes place.
// The object's read position is not updated.
//
// Since list could contain extents of differing encodings,
// clients should always use GetHeader() in combination with ReadData()
void* buf, // destination buffer address
{
// Save buffer size
// Position must be valid
return (RaiseError(AUDIO_ERR_BADARG));
// Loop until data is returned or error
// XXX - THIS IS WRONG! THE HEADER COULD CHANGE!
do {
len = 0;
return (err);
}
// Save the offset and read some data
// If no eof on this list entry, or no more data, we're done
break;
}
// Advance to next list entry
// XXX - Is this problemmatic, too?
} while (TRUE);
// Update the byte count and position
return (err);
}
// Write to AudioList is (currently) prohibited
void*, // destination buffer address
Double&) // start position (updated)
{
len = 0;
return (RaiseError(AUDIO_ERR_NOEFFECT));
}
// Insert an entry at the start
{
}
// Insert an entry at a specified position
{
// Find the insertion point
if (first() == 0) {
} else {
if (pos == 0.) {
// Append extent to end of list
} else {
return (RaiseError(AUDIO_ERR_BADARG));
}
} else if (pos != 0.) {
// The insertion is in an extent, split it in two
} else {
// Insert before the current position
}
}
// Create object and link into list
return (AUDIO_SUCCESS);
}
// Append an entry to a list
{
// Find the last extent in the list
continue;
// Create object and link into list
return (AUDIO_SUCCESS);
}
// Copy routine for lists
{
// Loop until data is returned or error
// XXX - THIS IS WRONG! THE HEADER COULD CHANGE!
do {
// Get the extent and offset for the read position
// nothing written, limit should reflect this
limit = 0.0;
return (err);
}
// Save the offset and do a copy
// If no eof on this list entry, or no more data, we're done
break;
}
// Advance to next list entry
// XXX - Is this problemmatic, too?
} while (TRUE);
// Update the byte count and position
return (err);
}