/*
* 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 <stdio.h>
// class AudioExtent methods
// class AudioExtent Constructor
double s, // start time
double e): // end time
{
SetEnd(e);
}
// class AudioExtent Destructor
~AudioExtent()
{
}
// Get referenced object
Audio* AudioExtent::
GetRef() const
{
return (ref);
}
// Set referenced object
void AudioExtent::
Audio* r) // new audio object
{
if (ref == r) // object is not changing
return;
if (r != 0) {
ref = r;
} else {
Fatal);
}
}
// Get start time
GetStart() const
{
return (start);
}
// Set start time
void AudioExtent::
Double s) // start time, in seconds
{
if (Undefined(s) || (s < 0.))
start = 0.;
else
start = s;
}
// Get end time
GetEnd() const
{
// If determinate endpoint, return it
return (end);
// Otherwise, return the endpoint of the underlying object
}
// Set end time
void AudioExtent::
Double e) // end time, in seconds
{
// If known endpoint and object has known size, do not exceed size
if (!Undefined(e)) {
e = len;
}
end = e;
}
// Get the length of an audio extent
GetLength() const
{
Double x;
// If extent end is indeterminate, use the end of the target object
x = GetEnd();
// If the object length is indeterminate, then the length is
if (Undefined(x))
return (x);
return (x - start);
}
// Construct a name for the list
char *AudioExtent::
GetName() const
{
// XXX - construct a better name
}
// Get the audio header for the current read position
{
}
// Get the audio header for the given position
{
}
// Copy data from extent into specified buffer.
// No data format translation takes place.
// The object's read position is not updated.
//
// Since the extent could refer to a list of extents of differing encodings,
// clients should always use GetHeader() in combination with ReadData()
void* buf, // destination buffer address
{
// Save buffer size and zero transfer count
len = 0;
// Position must be valid
return (RaiseError(AUDIO_ERR_BADARG));
// If the end is determinate, check start position and length
// If starting beyond eof, give up now
return (err);
}
// If the read would extend beyond end-of-extent, shorten it
if (buflen == 0) {
return (err);
}
}
// Zero-length reads are easy
if (cnt == 0) {
err = AUDIO_SUCCESS;
return (err);
}
// Save the offset, read data, and update the returned position
return (err);
}
// Write to AudioExtent is (currently) prohibited
void*, // destination buffer address
Double&) // start position (updated)
{
len = 0;
return (RaiseError(AUDIO_ERR_NOEFFECT));
}