additional helper functions
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3722 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -194,3 +194,25 @@ frames_per_buffer(const media_multi_audio_format & format)
|
|||||||
}
|
}
|
||||||
return frames;
|
return frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bigtime_t
|
||||||
|
buffer_duration(const media_multi_audio_format & format)
|
||||||
|
{
|
||||||
|
bigtime_t duration = 0;
|
||||||
|
if (format.buffer_size > 0 && format.frame_rate > 0 && bytes_per_frame(format) > 0) {
|
||||||
|
duration = s_to_us((format.buffer_size / bytes_per_frame(format)) / format.frame_rate);
|
||||||
|
}
|
||||||
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
us_to_s(bigtime_t usecs)
|
||||||
|
{
|
||||||
|
return (usecs / 1000000.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bigtime_t
|
||||||
|
s_to_us(double secs)
|
||||||
|
{
|
||||||
|
return (bigtime_t) (secs * 1000000.0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ void CopySamples(float *_dst, int32 _dst_sample_offset,
|
|||||||
const float *_src, int32 _src_sample_offset,
|
const float *_src, int32 _src_sample_offset,
|
||||||
int32 _sample_count);
|
int32 _sample_count);
|
||||||
|
|
||||||
|
bigtime_t buffer_duration(const media_multi_audio_format & format);
|
||||||
|
|
||||||
int bytes_per_sample(const media_multi_audio_format & format);
|
int bytes_per_sample(const media_multi_audio_format & format);
|
||||||
|
|
||||||
int bytes_per_frame(const media_multi_audio_format & format);
|
int bytes_per_frame(const media_multi_audio_format & format);
|
||||||
@@ -22,3 +24,6 @@ bigtime_t duration_for_frames(double framerate, int64 frames);
|
|||||||
|
|
||||||
int ChannelMaskToChannelType(uint32 mask);
|
int ChannelMaskToChannelType(uint32 mask);
|
||||||
uint32 ChannelTypeToChannelMask(int type);
|
uint32 ChannelTypeToChannelMask(int type);
|
||||||
|
|
||||||
|
double us_to_s(bigtime_t usecs);
|
||||||
|
bigtime_t s_to_us(double secs);
|
||||||
|
|||||||
Reference in New Issue
Block a user