aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio_format.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* added prefix to header macrosMax Kellermann2008-10-311-2/+2
| | | | | | | "LOG_H" is a macro which is also used by ffmpeg/log.h. This is ffmpeg's fault, because short macros should be reserved for applications, but since it's always a good idea to choose prefixed macro names, even for applications, we are going to do that in MPD.
* audio_format: added audio_format_frame_size()Max Kellermann2008-10-101-1/+7
| | | | | | | A frame contains one sample per channel, thus it is sample_size * channels. This patch includes some cleanup for various locations where the sample size for 24 bit audio was still 3 bytes (instead of 4).
* audio_format: renamed sampleRate to sample_rateMax Kellermann2008-10-101-5/+5
| | | | | The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
* audio_format: unsigned integersMax Kellermann2008-10-101-2/+2
| | | | "bits" and "channels" cannot be negative.
* use the "bool" data type instead of "int"Max Kellermann2008-10-081-3/+4
| | | | "bool" should be used in C99 programs for boolean values.
* assume stdint.h and stddef.h are availableMax Kellermann2008-09-291-1/+1
| | | | | | Since we use a C99 compiler now, we can assert that the C99 standard headers are available, no need for complicated compile time checks. Kill mpd_types.h.
* switch to C99 types, part IIMax Kellermann2008-09-291-3/+3
| | | | | Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
* audio_format: added audio_format_sample_size()Max Kellermann2008-09-231-2/+15
| | | | | | The inline function audio_format_sample_size() calculates how many bytes each sample consumes. This function already takes into account that 24 bit samples are 4 bytes long, not 3.
* audio_format: added audio_format_clear() and audio_format_defined()Max Kellermann2008-09-101-0/+12
| | | | | | | | | audio_format_clear() sets an audio_format struct to an cleared (undefined) state, which is both faster and smaller than memset(0). audio_format_defined() checks if the audio_format struct actually has a defined value (i.e. non-zero). Both can be used to avoid pointers to audio_format, replacing the "NULL" value with an "undefined" audio_format.
* audio: moved cmpAudioFormat() to audio_format.hMax Kellermann2008-09-091-0/+8
| | | | | Rename it to audio_format_equals() and return "true" if they are equal.
* pack the struct audio_formatMax Kellermann2008-09-071-1/+1
| | | | | | Due to clumsy layout, the audio_format struct took 12 bytes. Move the "channels" to the end, so it can be merged into the same 32 bit slot as "bits", which reduces the struct size to 8 bytes.
* audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann2008-09-071-4/+4
| | | | | Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
* audio_format: volatile removalEric Wong2008-09-071-3/+3
| | | | | | | | | | | | | | | | | volatile provides absolutely no guarantee thread-safety in SMP environments. volatile was designed to access memory locations in peripheral hardware directly; not for SMP. If volatile is needed to work properly on SMP, then it is only hiding subtle bugs. volatile only prevents the /compiler/ from making optimizations when accessing variables. CPUs do their own optimizations at runtime so it cannot guarantee registers of CPUs are flushed to memory cache-coherent access on different CPUs. Furthermore, the thread-communication via condition variables between threads sharing audio formats already results in memory barriers.
* added inline function audio_format_time_to_size()Max Kellermann2008-08-261-0/+5
| | | | | Make the code more readable by hiding big formulas in an inline function with a nice name.
* moved struct AudioFormat to audio_format.hMax Kellermann2008-08-261-0/+35
We want to expose the AudioFormat structure to plugins; remove some clutter by moving its declaration to a separate header file.