Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
2c38d19a
Commit
2c38d19a
authored
Oct 10, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audio_format: add function attributes
For better optimization.
parent
311e6274
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
audio_check.h
src/audio_check.h
+1
-0
audio_format.h
src/audio_format.h
+9
-0
No files found.
src/audio_check.h
View file @
2c38d19a
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
/**
/**
* The GLib quark used for errors reported by this library.
* The GLib quark used for errors reported by this library.
*/
*/
G_GNUC_CONST
static
inline
GQuark
static
inline
GQuark
audio_format_quark
(
void
)
audio_format_quark
(
void
)
{
{
...
...
src/audio_format.h
View file @
2c38d19a
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#ifndef MPD_AUDIO_FORMAT_H
#ifndef MPD_AUDIO_FORMAT_H
#define MPD_AUDIO_FORMAT_H
#define MPD_AUDIO_FORMAT_H
#include <glib.h>
#include <stdint.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdbool.h>
#include <assert.h>
#include <assert.h>
...
@@ -189,6 +190,7 @@ audio_valid_channel_count(unsigned channels)
...
@@ -189,6 +190,7 @@ audio_valid_channel_count(unsigned channels)
* Returns false if the format is not valid for playback with MPD.
* Returns false if the format is not valid for playback with MPD.
* This function performs some basic validity checks.
* This function performs some basic validity checks.
*/
*/
G_GNUC_PURE
static
inline
bool
audio_format_valid
(
const
struct
audio_format
*
af
)
static
inline
bool
audio_format_valid
(
const
struct
audio_format
*
af
)
{
{
return
audio_valid_sample_rate
(
af
->
sample_rate
)
&&
return
audio_valid_sample_rate
(
af
->
sample_rate
)
&&
...
@@ -200,6 +202,7 @@ static inline bool audio_format_valid(const struct audio_format *af)
...
@@ -200,6 +202,7 @@ static inline bool audio_format_valid(const struct audio_format *af)
* Returns false if the format mask is not valid for playback with
* Returns false if the format mask is not valid for playback with
* MPD. This function performs some basic validity checks.
* MPD. This function performs some basic validity checks.
*/
*/
G_GNUC_PURE
static
inline
bool
audio_format_mask_valid
(
const
struct
audio_format
*
af
)
static
inline
bool
audio_format_mask_valid
(
const
struct
audio_format
*
af
)
{
{
return
(
af
->
sample_rate
==
0
||
return
(
af
->
sample_rate
==
0
||
...
@@ -237,6 +240,7 @@ audio_format_mask_apply(struct audio_format *af,
...
@@ -237,6 +240,7 @@ audio_format_mask_apply(struct audio_format *af,
assert
(
audio_format_valid
(
af
));
assert
(
audio_format_valid
(
af
));
}
}
G_GNUC_CONST
static
inline
unsigned
static
inline
unsigned
sample_format_size
(
enum
sample_format
format
)
sample_format_size
(
enum
sample_format
format
)
{
{
...
@@ -265,6 +269,7 @@ sample_format_size(enum sample_format format)
...
@@ -265,6 +269,7 @@ sample_format_size(enum sample_format format)
/**
/**
* Returns the size of each (mono) sample in bytes.
* Returns the size of each (mono) sample in bytes.
*/
*/
G_GNUC_PURE
static
inline
unsigned
audio_format_sample_size
(
const
struct
audio_format
*
af
)
static
inline
unsigned
audio_format_sample_size
(
const
struct
audio_format
*
af
)
{
{
return
sample_format_size
((
enum
sample_format
)
af
->
format
);
return
sample_format_size
((
enum
sample_format
)
af
->
format
);
...
@@ -273,6 +278,7 @@ static inline unsigned audio_format_sample_size(const struct audio_format *af)
...
@@ -273,6 +278,7 @@ static inline unsigned audio_format_sample_size(const struct audio_format *af)
/**
/**
* Returns the size of each full frame in bytes.
* Returns the size of each full frame in bytes.
*/
*/
G_GNUC_PURE
static
inline
unsigned
static
inline
unsigned
audio_format_frame_size
(
const
struct
audio_format
*
af
)
audio_format_frame_size
(
const
struct
audio_format
*
af
)
{
{
...
@@ -283,6 +289,7 @@ audio_format_frame_size(const struct audio_format *af)
...
@@ -283,6 +289,7 @@ audio_format_frame_size(const struct audio_format *af)
* Returns the floating point factor which converts a time span to a
* Returns the floating point factor which converts a time span to a
* storage size in bytes.
* storage size in bytes.
*/
*/
G_GNUC_PURE
static
inline
double
audio_format_time_to_size
(
const
struct
audio_format
*
af
)
static
inline
double
audio_format_time_to_size
(
const
struct
audio_format
*
af
)
{
{
return
af
->
sample_rate
*
audio_format_frame_size
(
af
);
return
af
->
sample_rate
*
audio_format_frame_size
(
af
);
...
@@ -295,6 +302,7 @@ static inline double audio_format_time_to_size(const struct audio_format *af)
...
@@ -295,6 +302,7 @@ static inline double audio_format_time_to_size(const struct audio_format *af)
* @param format a #sample_format enum value
* @param format a #sample_format enum value
* @return the string
* @return the string
*/
*/
G_GNUC_PURE
G_GNUC_MALLOC
const
char
*
const
char
*
sample_format_to_string
(
enum
sample_format
format
);
sample_format_to_string
(
enum
sample_format
format
);
...
@@ -306,6 +314,7 @@ sample_format_to_string(enum sample_format format);
...
@@ -306,6 +314,7 @@ sample_format_to_string(enum sample_format format);
* @param s a buffer to print into
* @param s a buffer to print into
* @return the string, or NULL if the #audio_format object is invalid
* @return the string, or NULL if the #audio_format object is invalid
*/
*/
G_GNUC_PURE
G_GNUC_MALLOC
const
char
*
const
char
*
audio_format_to_string
(
const
struct
audio_format
*
af
,
audio_format_to_string
(
const
struct
audio_format
*
af
,
struct
audio_format_string
*
s
);
struct
audio_format_string
*
s
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment