]> code.delx.au - pulseaudio/commitdiff
Merge commit 'origin/master-tx'
authorLennart Poettering <lennart@poettering.net>
Wed, 3 Sep 2008 21:13:26 +0000 (23:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 3 Sep 2008 21:13:26 +0000 (23:13 +0200)
51 files changed:
PROTOCOL
configure.ac
doxygen/doxygen.conf.in
src/Makefile.am
src/daemon/main.c
src/modules/alsa-util.c
src/modules/module-combine.c
src/modules/module-device-restore.c
src/modules/module-oss.c
src/modules/module-stream-restore.c
src/pulse/channelmap.h
src/pulse/context.c
src/pulse/def.h
src/pulse/ext-stream-restore.h
src/pulse/gccmacro.h
src/pulse/introspect.h
src/pulse/proplist.h
src/pulse/sample.h
src/pulse/simple.c
src/pulse/stream.c
src/pulse/stream.h
src/pulse/utf8.c
src/pulse/volume.c
src/pulse/volume.h
src/pulse/xmalloc.c
src/pulse/xmalloc.h
src/pulsecore/atomic.h
src/pulsecore/authkey.c
src/pulsecore/core-util.c
src/pulsecore/core-util.h
src/pulsecore/log.c
src/pulsecore/log.h
src/pulsecore/memblockq.h
src/pulsecore/module.c
src/pulsecore/object.h
src/pulsecore/pid.c
src/pulsecore/protocol-native.c
src/pulsecore/resampler.c
src/pulsecore/sample-util.c
src/pulsecore/sample-util.h
src/pulsecore/shm.c
src/pulsecore/sink-input.c
src/pulsecore/sink.c
src/pulsecore/socket-client.c
src/pulsecore/sound-file.c
src/pulsecore/source-output.c
src/pulsecore/source.c
src/pulsecore/tagstruct.c
src/tests/channelmap-test.c
src/tests/parec-simple.c
src/utils/padsp.c

index 581eeefadff35bdadf51e33b325be5f63e1f7953..1e2a832f51b06d1326a140bd4f5e8c8c6bb8b030 100644 (file)
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -126,7 +126,7 @@ New field for PA_COMMAND_CREATE_PLAYBACK_STREAM at the end:
 Buffer attributes for PA_COMMAND_CREATE_PLAYBACK_STREAM and
 PA_COMMAND_CREATE_RECORD_STREAM may now be 0 for default values.
 
-New filed for PA_COMMAND_SET_PLAYBACK_STREAM_BUFFER_ATTR,
+New field for PA_COMMAND_SET_PLAYBACK_STREAM_BUFFER_ATTR,
 PA_COMMAND_SET_RECORD_STREAM_BUFFER_ATTR at the end:
 
   adjust_latency (bool)
@@ -141,6 +141,15 @@ new message:
 
   PA_COMMAND_EXTENSION
 
-PA_COMMAND_CREATE_RECORD_STREAM, PA_COMMAND_CREATE_PLAYBACK_STREAM:
+PA_COMMAND_CREATE_PLAYBACK_STREAM:
 
   bool volume_set at the end
+
+PA_COMMAND_CREATE_RECORD_STREAM, PA_COMMAND_CREATE_PLAYBACK_STREAM:
+
+  bool early_requests at the end
+
+New field for PA_COMMAND_SET_PLAYBACK_STREAM_BUFFER_ATTR,
+PA_COMMAND_SET_RECORD_STREAM_BUFFER_ATTR at the end:
+
+  early_requests (bool)
index 568f43a2f6070f9cb00a6aa72e42f1fdb726579a..4a560b12db8ad6ee679f8837902a4bb8cf525f40 100644 (file)
@@ -99,7 +99,7 @@ if test "x$M4" = xno ; then
 fi
 
 dnl Compiler flags
-DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Wvla -Wno-overlength-strings -Wconversion -Wundef -Wformat -Wlogical-op -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter -ffast-math"
+DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Wvla -Wno-overlength-strings -Wconversion -Wundef -Wformat -Wlogical-op -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -ffast-math"
 
 for flag in $DESIRED_FLAGS ; do
   CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"])
@@ -407,6 +407,8 @@ AS_IF([test "$pulseaudio_cv_PTHREAD_PRIO_INHERIT" = "yes"], [
     AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])
   ])
 
+AC_DEFINE_UNQUOTED(PA_CFLAGS,"$CFLAGS", [The CFLAGS used during compilation])
+
 #### Large File-Support (LFS) ####
 
 AC_SYS_LARGEFILE
index 7ad5d2f31c9efcc68c1049c8493520784f212d47..6c2021ce62f5949e8b18d56b1425827fce4fcb10 100644 (file)
 # Project related configuration options
 #---------------------------------------------------------------------------
 
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
 # by quotes) that should identify the project.
 
 PROJECT_NAME           = PulseAudio
 
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
-# This could be handy for archiving the generated documentation or 
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
 PROJECT_NUMBER         = @PACKAGE_VERSION@
 
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
-# base path where the generated documentation will be put. 
-# If a relative path is entered, it will be relative to the location 
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
 # where doxygen was started. If left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       = 
+OUTPUT_DIRECTORY       =
 
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
-# 4096 sub-directories (in 2 levels) under the output directory of each output 
-# format and will distribute the generated files over these directories. 
-# Enabling this option can be useful when feeding doxygen a huge amount of source 
-# files, where putting all generated files in the same directory would otherwise 
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of source
+# files, where putting all generated files in the same directory would otherwise
 # cause performance problems for the file system.
 
 CREATE_SUBDIRS         = NO
 
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
-# documentation generated by doxygen is written. Doxygen will use this 
-# information to generate all constant output in the proper language. 
-# The default language is English, other supported languages are: 
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
 # Swedish, and Ukrainian.
 
 OUTPUT_LANGUAGE        = English
 
-# This tag can be used to specify the encoding used in the generated output. 
-# The encoding is not always determined by the language that is chosen, 
-# but also whether or not the output is meant for Windows or non-Windows users. 
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
-# forces the Windows encoding (this is the default for the Windows binary), 
-# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# This tag can be used to specify the encoding used in the generated output.
+# The encoding is not always determined by the language that is chosen,
+# but also whether or not the output is meant for Windows or non-Windows users.
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
+# forces the Windows encoding (this is the default for the Windows binary),
+# whereas setting the tag to NO uses a Unix-style encoding (the default for
 # all platforms other than Windows).
 
 USE_WINDOWS_ENCODING   = NO
 
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
-# include brief member descriptions after the members that are listed in 
-# the file and class documentation (similar to JavaDoc). 
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
 # Set to NO to disable this.
 
 BRIEF_MEMBER_DESC      = YES
 
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
-# the brief description of a member or function before the detailed description. 
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
 # brief descriptions will be completely suppressed.
 
 REPEAT_BRIEF           = YES
 
-# This tag implements a quasi-intelligent brief description abbreviator 
-# that is used to form the text in various listings. Each string 
-# in this list, if found as the leading text of the brief description, will be 
-# stripped from the text and the result after processing the whole list, is used 
-# as the annotated text. Otherwise, the brief description is used as-is. If left 
-# blank, the following values are used ("$name" is automatically replaced with the 
-# name of the entity): "The $name class" "The $name widget" "The $name file" 
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is used
+# as the annotated text. Otherwise, the brief description is used as-is. If left
+# blank, the following values are used ("$name" is automatically replaced with the
+# name of the entity): "The $name class" "The $name widget" "The $name file"
 # "is" "provides" "specifies" "contains" "represents" "a" "an" "the"
 
-ABBREVIATE_BRIEF       = 
+ABBREVIATE_BRIEF       =
 
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
-# Doxygen will generate a detailed section even if there is only a brief 
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
 # description.
 
 ALWAYS_DETAILED_SEC    = NO
 
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited 
-# members of a class in the documentation of that class as if those members were 
-# ordinary class members. Constructors, destructors and assignment operators of 
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
+# members of a class in the documentation of that class as if those members were
+# ordinary class members. Constructors, destructors and assignment operators of
 # the base classes will not be shown.
 
 INLINE_INHERITED_MEMB  = NO
 
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
-# path before files name in the file list and in the header files. If set 
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
 # to NO the shortest path that makes the file name unique will be used.
 
 FULL_PATH_NAMES        = NO
 
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
-# can be used to strip a user-defined part of the path. Stripping is 
-# only done if one of the specified strings matches the left-hand part of 
-# the path. The tag can be used to show relative paths in the file list. 
-# If left blank the directory from which doxygen is run is used as the 
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
 # path to strip.
 
-STRIP_FROM_PATH        = 
+STRIP_FROM_PATH        =
 
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
-# the path mentioned in the documentation of a class, which tells 
-# the reader which header file to include in order to use a class. 
-# If left blank only the name of the header file containing the class 
-# definition is used. Otherwise one should specify the include paths that 
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
 # are normally passed to the compiler using the -I flag.
 
-STRIP_FROM_INC_PATH    = 
+STRIP_FROM_INC_PATH    =
 
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
-# (but less readable) file names. This can be useful is your file systems 
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
 # doesn't support long names like on DOS, Mac, or CD-ROM.
 
 SHORT_NAMES            = NO
 
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
-# will interpret the first line (until the first dot) of a JavaDoc-style 
-# comment as the brief description. If set to NO, the JavaDoc 
-# comments will behave just like the Qt-style comments (thus requiring an 
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
 # explicit @brief command for a brief description.
 
 JAVADOC_AUTOBRIEF      = YES
 
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
-# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
-# comments) as a brief description. This used to be the default behaviour. 
-# The new default is to treat a multi-line C++ comment block as a detailed 
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
 # description. Set this tag to YES if you prefer the old behaviour instead.
 
 MULTILINE_CPP_IS_BRIEF = NO
 
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
 # will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member 
+# If set to NO, the detailed description appears after the member
 # documentation.
 
 DETAILS_AT_TOP         = NO
 
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
-# member inherits the documentation from any documented member that it 
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
 # re-implements.
 
 INHERIT_DOCS           = YES
 
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
-# tag is set to YES, then doxygen will reuse the documentation of the first 
-# member in the group (if any) for the other members of the group. By default 
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
 # all members of a group must be documented explicitly.
 
 DISTRIBUTE_GROUP_DOC   = NO
 
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
 # Doxygen uses this value to replace tabs by spaces in code fragments.
 
 TAB_SIZE               = 4
 
-# This tag can be used to specify a number of aliases that acts 
-# as commands in the documentation. An alias has the form "name=value". 
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
-# put the command \sideeffect (or @sideeffect) in the documentation, which 
-# will result in a user-defined paragraph with heading "Side Effects:". 
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
 # You can put \n's in the value part of an alias to insert newlines.
 
-ALIASES                = 
+ALIASES                =
 
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources 
-# only. Doxygen will then generate output that is more tailored for C. 
-# For instance, some of the names that are used will be different. The list 
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
 # of all members will be omitted, etc.
 
 OPTIMIZE_OUTPUT_FOR_C  = YES
 
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
-# only. Doxygen will then generate output that is more tailored for Java. 
-# For instance, namespaces will be presented as packages, qualified scopes 
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
+# only. Doxygen will then generate output that is more tailored for Java.
+# For instance, namespaces will be presented as packages, qualified scopes
 # will look different, etc.
 
 OPTIMIZE_OUTPUT_JAVA   = NO
 
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
-# the same type (for instance a group of public functions) to be put as a 
-# subgroup of that type (e.g. under the Public Functions section). Set it to 
-# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
 # the \nosubgrouping command.
 
 SUBGROUPING            = YES
@@ -207,162 +207,162 @@ SUBGROUPING            = YES
 # Build related configuration options
 #---------------------------------------------------------------------------
 
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
-# documentation are documented, even if no documentation was available. 
-# Private class members and static file members will be hidden unless 
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
 # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
 
 EXTRACT_ALL            = YES
 
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
 # will be included in the documentation.
 
 EXTRACT_PRIVATE        = NO
 
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
 # will be included in the documentation.
 
 EXTRACT_STATIC         = NO
 
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
-# defined locally in source files will be included in the documentation. 
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
 # If set to NO only classes defined in header files are included.
 
 EXTRACT_LOCAL_CLASSES  = YES
 
-# This flag is only useful for Objective-C code. When set to YES local 
-# methods, which are defined in the implementation section but not in 
-# the interface are included in the documentation. 
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
 # If set to NO (the default) only methods in the interface are included.
 
 EXTRACT_LOCAL_METHODS  = NO
 
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
 # This option has no effect if EXTRACT_ALL is enabled.
 
 HIDE_UNDOC_MEMBERS     = NO
 
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
-# undocumented classes that are normally visible in the class hierarchy. 
-# If set to NO (the default) these classes will be included in the various 
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
 # overviews. This option has no effect if EXTRACT_ALL is enabled.
 
 HIDE_UNDOC_CLASSES     = NO
 
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
-# friend (class|struct|union) declarations. 
-# If set to NO (the default) these declarations will be included in the 
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
 # documentation.
 
 HIDE_FRIEND_COMPOUNDS  = NO
 
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
-# documentation blocks found inside the body of a function. 
-# If set to NO (the default) these blocks will be appended to the 
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
 # function's detailed documentation block.
 
 HIDE_IN_BODY_DOCS      = NO
 
-# The INTERNAL_DOCS tag determines if documentation 
-# that is typed after a \internal command is included. If the tag is set 
-# to NO (the default) then the documentation will be excluded. 
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
 # Set it to YES to include the internal documentation.
 
 INTERNAL_DOCS          = NO
 
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
-# file names in lower-case letters. If set to YES upper-case letters are also 
-# allowed. This is useful if you have classes or files whose names only differ 
-# in case and if your file system supports case sensitive file names. Windows 
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
 # and Mac users are advised to set this option to NO.
 
 CASE_SENSE_NAMES       = YES
 
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
-# will show members with their full class and namespace scopes in the 
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
 # documentation. If set to YES the scope will be hidden.
 
 HIDE_SCOPE_NAMES       = NO
 
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
-# will put a list of the files that are included by a file in the documentation 
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
 # of that file.
 
 SHOW_INCLUDE_FILES     = NO
 
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
 # is inserted in the documentation for inline members.
 
 INLINE_INFO            = YES
 
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
-# will sort the (detailed) documentation of file and class members 
-# alphabetically by member name. If set to NO the members will appear in 
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
 # declaration order.
 
 SORT_MEMBER_DOCS       = YES
 
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
-# brief documentation of file, namespace and class members alphabetically 
-# by member name. If set to NO (the default) the members will appear in 
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
 # declaration order.
 
 SORT_BRIEF_DOCS        = NO
 
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
-# sorted by fully-qualified names, including namespaces. If set to 
-# NO (the default), the class list will be sorted only by class name, 
-# not including the namespace part. 
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
 # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the 
+# Note: This option applies only to the class list, not to the
 # alphabetical list.
 
 SORT_BY_SCOPE_NAME     = NO
 
-# The GENERATE_TODOLIST tag can be used to enable (YES) or 
-# disable (NO) the todo list. This list is created by putting \todo 
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
 # commands in the documentation.
 
 GENERATE_TODOLIST      = NO
 
-# The GENERATE_TESTLIST tag can be used to enable (YES) or 
-# disable (NO) the test list. This list is created by putting \test 
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
 # commands in the documentation.
 
 GENERATE_TESTLIST      = NO
 
-# The GENERATE_BUGLIST tag can be used to enable (YES) or 
-# disable (NO) the bug list. This list is created by putting \bug 
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
 # commands in the documentation.
 
 GENERATE_BUGLIST       = NO
 
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
-# disable (NO) the deprecated list. This list is created by putting 
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
 # \deprecated commands in the documentation.
 
 GENERATE_DEPRECATEDLIST= NO
 
-# The ENABLED_SECTIONS tag can be used to enable conditional 
+# The ENABLED_SECTIONS tag can be used to enable conditional
 # documentation sections, marked by \if sectionname ... \endif.
 
-ENABLED_SECTIONS       = 
+ENABLED_SECTIONS       =
 
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
-# the initial value of a variable or define consists of for it to appear in 
-# the documentation. If the initializer consists of more lines than specified 
-# here it will be hidden. Use a value of 0 to hide initializers completely. 
-# The appearance of the initializer of individual variables and defines in the 
-# documentation can be controlled using \showinitializer or \hideinitializer 
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
 # command in the documentation regardless of this setting.
 
 MAX_INITIALIZER_LINES  = 30
 
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
-# at the bottom of the documentation of classes and structs. If set to YES the 
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
 # list will mention the files that were used to generate the documentation.
 
 SHOW_USED_FILES        = YES
@@ -371,133 +371,133 @@ SHOW_USED_FILES        = YES
 # configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
 
-# The QUIET tag can be used to turn on/off the messages that are generated 
+# The QUIET tag can be used to turn on/off the messages that are generated
 # by doxygen. Possible values are YES and NO. If left blank NO is used.
 
 QUIET                  = NO
 
-# The WARNINGS tag can be used to turn on/off the warning messages that are 
-# generated by doxygen. Possible values are YES and NO. If left blank 
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
 # NO is used.
 
 WARNINGS               = YES
 
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
 # automatically be disabled.
 
 WARN_IF_UNDOCUMENTED   = YES
 
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
-# potential errors in the documentation, such as not documenting some 
-# parameters in a documented function, or documenting parameters that 
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
 # don't exist or using markup commands wrongly.
 
 WARN_IF_DOC_ERROR      = YES
 
-# The WARN_FORMAT tag determines the format of the warning messages that 
-# doxygen can produce. The string should contain the $file, $line, and $text 
-# tags, which will be replaced by the file and line number from which the 
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
 # warning originated and the warning text.
 
 WARN_FORMAT            = "$file:$line: $text"
 
-# The WARN_LOGFILE tag can be used to specify a file to which warning 
-# and error messages should be written. If left blank the output is written 
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
 # to stderr.
 
-WARN_LOGFILE           = 
+WARN_LOGFILE           =
 
 #---------------------------------------------------------------------------
 # configuration options related to the input files
 #---------------------------------------------------------------------------
 
-# The INPUT tag can be used to specify the files and/or directories that contain 
-# documented source files. You may enter file names like "myfile.cpp" or 
-# directories like "/usr/src/myproject". Separate the files or directories 
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  = ../src/pulse/context.h ../src/pulse/stream.h ../src/pulse/pulseaudio.h ../src/pulse/sample.h ../src/pulse/def.h ../src/pulse/subscribe.h ../src/pulse/introspect.h ../src/pulse/scache.h ../src/pulse/mainloop-api.h ../src/pulse/glib-mainloop.h ../src/pulse/mainloop.h ../src/pulse/mainloop-signal.h ../src/pulse/error.h ../src/pulse/operation.h ../src/pulse/simple.h ../src/pulse/version.h ../src/pulse/volume.h ../src/pulse/channelmap.h ../src/pulse/thread-mainloop.h ../src/pulse/xmalloc.h ../src/pulse/utf8.h ../src/pulse/util.h ../src/pulse/timeval.h ../src/pulse/proplist.h ../src/pulse/gccmacro.h
+INPUT                  = ../src/pulse/context.h ../src/pulse/stream.h ../src/pulse/pulseaudio.h ../src/pulse/sample.h ../src/pulse/def.h ../src/pulse/subscribe.h ../src/pulse/introspect.h ../src/pulse/scache.h ../src/pulse/mainloop-api.h ../src/pulse/glib-mainloop.h ../src/pulse/mainloop.h ../src/pulse/mainloop-signal.h ../src/pulse/error.h ../src/pulse/operation.h ../src/pulse/simple.h ../src/pulse/version.h ../src/pulse/volume.h ../src/pulse/channelmap.h ../src/pulse/thread-mainloop.h ../src/pulse/xmalloc.h ../src/pulse/utf8.h ../src/pulse/util.h ../src/pulse/timeval.h ../src/pulse/proplist.h ../src/pulse/gccmacro.h ../src/pulse/ext-stream-restore.h
 
-# If the value of the INPUT tag contains directories, you can use the 
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank the following patterns are tested: 
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp 
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
 # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
 
-FILE_PATTERNS          = 
+FILE_PATTERNS          =
 
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
-# should be searched for input files as well. Possible values are YES and NO. 
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
 # If left blank NO is used.
 
 RECURSIVE              = NO
 
-# The EXCLUDE tag can be used to specify files and/or directories that should 
-# excluded from the INPUT source files. This way you can easily exclude a 
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
 # subdirectory from a directory tree whose root is specified with the INPUT tag.
 
-EXCLUDE                = 
+EXCLUDE                =
 
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories 
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
 # that are symbolic links (a Unix filesystem feature) are excluded from the input.
 
 EXCLUDE_SYMLINKS       = NO
 
-# If the value of the INPUT tag contains directories, you can use the 
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
 # certain files from those directories.
 
-EXCLUDE_PATTERNS       = 
+EXCLUDE_PATTERNS       =
 
-# The EXAMPLE_PATH tag can be used to specify one or more files or 
-# directories that contain example code fragments that are included (see 
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
 # the \include command).
 
 EXAMPLE_PATH           = ../src/utils ../src/tests
 
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
 # blank all files are included.
 
-EXAMPLE_PATTERNS       = 
+EXAMPLE_PATTERNS       =
 
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
-# searched for input files to be used with the \include or \dontinclude 
-# commands irrespective of the value of the RECURSIVE tag. 
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
 # Possible values are YES and NO. If left blank NO is used.
 
 EXAMPLE_RECURSIVE      = NO
 
-# The IMAGE_PATH tag can be used to specify one or more files or 
-# directories that contain image that are included in the documentation (see 
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
 # the \image command).
 
-IMAGE_PATH             = 
+IMAGE_PATH             =
 
-# The INPUT_FILTER tag can be used to specify a program that doxygen should 
-# invoke to filter for each input file. Doxygen will invoke the filter program 
-# by executing (via popen()) the command <filter> <input-file>, where <filter> 
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
-# input file. Doxygen will then use the output that the filter program writes 
-# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be
 # ignored.
 
-INPUT_FILTER           = 
+INPUT_FILTER           =
 
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
-# basis.  Doxygen will compare the file name with each pattern and apply the 
-# filter if there is a match.  The filters are a list of the form: 
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.  Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.  The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
 # is applied to all files.
 
-FILTER_PATTERNS        = 
+FILTER_PATTERNS        =
 
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
-# INPUT_FILTER) will be used to filter the input files when producing source 
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
 # files to browse (i.e. when SOURCE_BROWSER is set to YES).
 
 FILTER_SOURCE_FILES    = NO
@@ -506,38 +506,38 @@ FILTER_SOURCE_FILES    = NO
 # configuration options related to source browsing
 #---------------------------------------------------------------------------
 
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
-# be generated. Documented entities will be cross-referenced with these sources. 
-# Note: To get rid of all source code in the generated output, make sure also 
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
 # VERBATIM_HEADERS is set to NO.
 
 SOURCE_BROWSER         = NO
 
-# Setting the INLINE_SOURCES tag to YES will include the body 
+# Setting the INLINE_SOURCES tag to YES will include the body
 # of functions and classes directly in the documentation.
 
 INLINE_SOURCES         = NO
 
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
-# doxygen to hide any special comment blocks from generated source code 
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
 # fragments. Normal C and C++ comments will always remain visible.
 
 STRIP_CODE_COMMENTS    = YES
 
-# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
-# then for each documented function all documented 
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
 # functions referencing it will be listed.
 
 REFERENCED_BY_RELATION = YES
 
-# If the REFERENCES_RELATION tag is set to YES (the default) 
-# then for each documented function all documented entities 
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
 # called/used by that function will be listed.
 
 REFERENCES_RELATION    = YES
 
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
-# will generate a verbatim copy of the header file for each class for 
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
 # which an include is specified. Set to NO to disable this.
 
 VERBATIM_HEADERS       = YES
@@ -546,21 +546,21 @@ VERBATIM_HEADERS       = YES
 # configuration options related to the alphabetical class index
 #---------------------------------------------------------------------------
 
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
-# of all compounds will be generated. Enable this if the project 
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
 # contains a lot of classes, structs, unions or interfaces.
 
 ALPHABETICAL_INDEX     = YES
 
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
 # in which this list will be split (can be a number in the range [1..20])
 
 COLS_IN_ALPHA_INDEX    = 5
 
-# In case all classes in a project start with a common prefix, all 
-# classes will be put under the same header in the alphabetical index. 
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
 # should be ignored while generating the index headers.
 
 IGNORE_PREFIX          = pa_ PA_
@@ -569,110 +569,110 @@ IGNORE_PREFIX          = pa_ PA_
 # configuration options related to the HTML output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
 # generate HTML output.
 
 GENERATE_HTML          = YES
 
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
 # put in front of it. If left blank `html' will be used as the default path.
 
 HTML_OUTPUT            = html
 
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
 # doxygen will generate files with .html extension.
 
 HTML_FILE_EXTENSION    = .html
 
-# The HTML_HEADER tag can be used to specify a personal HTML header for 
-# each generated HTML page. If it is left blank doxygen will generate a 
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
 # standard header.
 
-HTML_HEADER            = 
+HTML_HEADER            =
 
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
-# each generated HTML page. If it is left blank doxygen will generate a 
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
 # standard footer.
 
-HTML_FOOTER            = 
+HTML_FOOTER            =
 
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
-# style sheet that is used by each HTML page. It can be used to 
-# fine-tune the look of the HTML output. If the tag is left blank doxygen 
-# will generate a default style sheet. Note that doxygen will try to copy 
-# the style sheet file to the HTML output directory, so don't put your own 
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
 # stylesheet in the HTML output directory as well, or it will be erased!
 
-HTML_STYLESHEET        = 
+HTML_STYLESHEET        =
 
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
 # NO a bullet list will be used.
 
 HTML_ALIGN_MEMBERS     = YES
 
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
-# will be generated that can be used as input for tools like the 
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
 # of the generated HTML documentation.
 
 GENERATE_HTMLHELP      = NO
 
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
-# be used to specify the file name of the resulting .chm file. You 
-# can add a path in front of the file if the result should not be 
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
 # written to the html output directory.
 
-CHM_FILE               = 
+CHM_FILE               =
 
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
-# be used to specify the location (absolute path including file name) of 
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
 # the HTML help compiler on the generated index.hhp.
 
-HHC_LOCATION           = 
+HHC_LOCATION           =
 
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
-# controls if a separate .chi index file is generated (YES) or that 
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
 # it should be included in the master .chm file (NO).
 
 GENERATE_CHI           = NO
 
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
-# controls whether a binary table of contents is generated (YES) or a 
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
 # normal table of contents (NO) in the .chm file.
 
 BINARY_TOC             = NO
 
-# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
 # to the contents of the HTML help documentation and to the tree view.
 
 TOC_EXPAND             = NO
 
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
-# top of each HTML page. The value NO (the default) enables the index and 
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
 # the value YES disables it.
 
 DISABLE_INDEX          = NO
 
-# This tag can be used to set the number of enum values (range [1..20]) 
+# This tag can be used to set the number of enum values (range [1..20])
 # that doxygen will group on one line in the generated HTML documentation.
 
 ENUM_VALUES_PER_LINE   = 1
 
 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that 
-# is generated for HTML Help). For this to work a browser that supports 
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
 # probably better off using the HTML help feature.
 
 GENERATE_TREEVIEW      = YES
 
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
-# used to set the initial width (in pixels) of the frame in which the tree 
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
 # is shown.
 
 TREEVIEW_WIDTH         = 250
@@ -681,74 +681,74 @@ TREEVIEW_WIDTH         = 250
 # configuration options related to the LaTeX output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
 # generate Latex output.
 
 GENERATE_LATEX         = NO
 
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
 # put in front of it. If left blank `latex' will be used as the default path.
 
 LATEX_OUTPUT           = latex
 
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
 # invoked. If left blank `latex' will be used as the default command name.
 
 LATEX_CMD_NAME         = latex
 
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
-# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
 # default command name.
 
 MAKEINDEX_CMD_NAME     = makeindex
 
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
-# LaTeX documents. This may be useful for small projects and may help to 
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
 # save some trees in general.
 
 COMPACT_LATEX          = NO
 
-# The PAPER_TYPE tag can be used to set the paper type that is used 
-# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
 # executive. If left blank a4wide will be used.
 
 PAPER_TYPE             = a4wide
 
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
 # packages that should be included in the LaTeX output.
 
-EXTRA_PACKAGES         = 
+EXTRA_PACKAGES         =
 
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
-# the generated latex document. The header should contain everything until 
-# the first chapter. If it is left blank doxygen will generate a 
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
 # standard header. Notice: only use this tag if you know what you are doing!
 
-LATEX_HEADER           = 
+LATEX_HEADER           =
 
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
-# contain links (just like the HTML output) instead of page references 
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
 # This makes the output suitable for online browsing using a pdf viewer.
 
 PDF_HYPERLINKS         = NO
 
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
-# plain latex in the generated Makefile. Set this option to YES to get a 
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
 # higher quality PDF documentation.
 
 USE_PDFLATEX           = NO
 
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
-# command to the generated LaTeX files. This will instruct LaTeX to keep 
-# running if errors occur, instead of asking the user for help. 
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
 # This option is also used when generating formulas in HTML.
 
 LATEX_BATCHMODE        = NO
 
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
-# include the index chapters (such as File Index, Compound Index, etc.) 
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
 # in the output.
 
 LATEX_HIDE_INDICES     = NO
@@ -757,68 +757,68 @@ LATEX_HIDE_INDICES     = NO
 # configuration options related to the RTF output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
-# The RTF output is optimized for Word 97 and may not look very pretty with 
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
 # other RTF readers or editors.
 
 GENERATE_RTF           = NO
 
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
 # put in front of it. If left blank `rtf' will be used as the default path.
 
 RTF_OUTPUT             = rtf
 
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
-# RTF documents. This may be useful for small projects and may help to 
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
 # save some trees in general.
 
 COMPACT_RTF            = NO
 
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
-# will contain hyperlink fields. The RTF file will 
-# contain links (just like the HTML output) instead of page references. 
-# This makes the output suitable for online browsing using WORD or other 
-# programs which support those fields. 
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
 # Note: wordpad (write) and others do not support links.
 
 RTF_HYPERLINKS         = NO
 
-# Load stylesheet definitions from file. Syntax is similar to doxygen's 
-# config file, i.e. a series of assignments. You only have to provide 
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
 # replacements, missing definitions are set to their default value.
 
-RTF_STYLESHEET_FILE    = 
+RTF_STYLESHEET_FILE    =
 
-# Set optional variables used in the generation of an rtf document. 
+# Set optional variables used in the generation of an rtf document.
 # Syntax is similar to doxygen's config file.
 
-RTF_EXTENSIONS_FILE    = 
+RTF_EXTENSIONS_FILE    =
 
 #---------------------------------------------------------------------------
 # configuration options related to the man page output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
 # generate man pages
 
 GENERATE_MAN           = NO
 
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
 # put in front of it. If left blank `man' will be used as the default path.
 
 MAN_OUTPUT             = man
 
-# The MAN_EXTENSION tag determines the extension that is added to 
+# The MAN_EXTENSION tag determines the extension that is added to
 # the generated man pages (default is the subroutine's section .3)
 
 MAN_EXTENSION          = .3
 
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
-# then it will generate one additional man file for each entity 
-# documented in the real man page(s). These additional files 
-# only source the real man page, but without them the man command 
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
 # would be unable to find the correct page. The default is NO.
 
 MAN_LINKS              = NO
@@ -827,33 +827,33 @@ MAN_LINKS              = NO
 # configuration options related to the XML output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_XML tag is set to YES Doxygen will 
-# generate an XML file that captures the structure of 
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
 # the code including all documentation.
 
 GENERATE_XML           = NO
 
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
 # put in front of it. If left blank `xml' will be used as the default path.
 
 XML_OUTPUT             = xml
 
-# The XML_SCHEMA tag can be used to specify an XML schema, 
-# which can be used by a validating XML parser to check the 
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
 # syntax of the XML files.
 
-XML_SCHEMA             = 
+XML_SCHEMA             =
 
-# The XML_DTD tag can be used to specify an XML DTD, 
-# which can be used by a validating XML parser to check the 
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
 # syntax of the XML files.
 
-XML_DTD                = 
+XML_DTD                =
 
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
-# dump the program listings (including syntax highlighting 
-# and cross-referencing information) to the XML output. Note that 
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
 # enabling this will significantly increase the size of the XML output.
 
 XML_PROGRAMLISTING     = YES
@@ -862,10 +862,10 @@ XML_PROGRAMLISTING     = YES
 # configuration options for the AutoGen Definitions output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
-# generate an AutoGen Definitions (see autogen.sf.net) file 
-# that captures the structure of the code including all 
-# documentation. Note that this feature is still experimental 
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
 # and incomplete at the moment.
 
 GENERATE_AUTOGEN_DEF   = NO
@@ -874,283 +874,282 @@ GENERATE_AUTOGEN_DEF   = NO
 # configuration options related to the Perl module output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
-# generate a Perl module file that captures the structure of 
-# the code including all documentation. Note that this 
-# feature is still experimental and incomplete at the 
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
 # moment.
 
 GENERATE_PERLMOD       = NO
 
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
 # to generate PDF and DVI output from the Perl module output.
 
 PERLMOD_LATEX          = NO
 
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
-# nicely formatted so it can be parsed by a human reader.  This is useful 
-# if you want to understand what is going on.  On the other hand, if this 
-# tag is set to NO the size of the Perl module output will be much smaller 
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.  This is useful
+# if you want to understand what is going on.  On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
 # and Perl will parse it just the same.
 
 PERLMOD_PRETTY         = YES
 
-# The names of the make variables in the generated doxyrules.make file 
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
-# This is useful so different doxyrules.make files included by the same 
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
 # Makefile don't overwrite each other's variables.
 
-PERLMOD_MAKEVAR_PREFIX = 
+PERLMOD_MAKEVAR_PREFIX =
 
 #---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
+# Configuration options related to the preprocessor
 #---------------------------------------------------------------------------
 
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
-# evaluate all C-preprocessor directives found in the sources and include 
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
 # files.
 
 ENABLE_PREPROCESSING   = YES
 
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
-# names in the source code. If set to NO (the default) only conditional 
-# compilation will be performed. Macro expansion can be done in a controlled 
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
 # way by setting EXPAND_ONLY_PREDEF to YES.
 
 MACRO_EXPANSION        = YES
 
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
-# then the macro expansion is limited to the macros specified with the 
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
 # PREDEFINED and EXPAND_AS_PREDEFINED tags.
 
 EXPAND_ONLY_PREDEF     = YES
 
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
 # in the INCLUDE_PATH (see below) will be search if a #include is found.
 
 SEARCH_INCLUDES        = YES
 
-# The INCLUDE_PATH tag can be used to specify one or more directories that 
-# contain include files that are not input files but should be processed by 
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
 # the preprocessor.
 
-INCLUDE_PATH           = 
+INCLUDE_PATH           =
 
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
-# patterns (like *.h and *.hpp) to filter out the header-files in the 
-# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
 # be used.
 
-INCLUDE_FILE_PATTERNS  = 
+INCLUDE_FILE_PATTERNS  =
 
-# The PREDEFINED tag can be used to specify one or more macro names that 
-# are defined before the preprocessor is started (similar to the -D option of 
-# gcc). The argument of the tag is a list of macros of the form: name 
-# or name=definition (no spaces). If the definition and the = are 
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
 # omitted =1 is assumed.
 
 PREDEFINED             = PA_C_DECL_BEGIN= PA_C_DECL_END=
 
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
-# this tag can be used to specify a list of macro names that should be expanded. 
-# The macro definition that is found in the sources will be used. 
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
 # Use the PREDEFINED tag if you want to use a different macro definition.
 
 #EXPAND_AS_DEFINED      = PA_C_DECL_BEGIN, PA_C_DECL_END
 
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
-# doxygen's preprocessor will remove all function-like macros that are alone 
-# on a line, have an all uppercase name, and do not end with a semicolon. Such 
-# function macros are typically used for boiler-plate code, and will confuse the 
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse the
 # parser if not removed.
 
 SKIP_FUNCTION_MACROS   = YES
 
 #---------------------------------------------------------------------------
-# Configuration::additions related to external references   
+# Configuration::additions related to external references
 #---------------------------------------------------------------------------
 
-# The TAGFILES option can be used to specify one or more tagfiles. 
-# Optionally an initial location of the external documentation 
-# can be added for each tagfile. The format of a tag file without 
-# this location is as follows: 
-#   TAGFILES = file1 file2 ... 
-# Adding location for the tag files is done as follows: 
-#   TAGFILES = file1=loc1 "file2 = loc2" ... 
-# where "loc1" and "loc2" can be relative or absolute paths or 
-# URLs. If a location is present for each tag, the installdox tool 
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#   TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#   TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
 # does not have to be run to correct the links.
 # Note that each tag file must have a unique name
 # (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen 
+# If a tag file is not located in the directory in which doxygen
 # is run, you must also specify the path to the tagfile here.
 
-TAGFILES               = 
+TAGFILES               =
 
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
 # a tag file that is based on the input files it reads.
 
-GENERATE_TAGFILE       = 
+GENERATE_TAGFILE       =
 
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
-# in the class index. If set to NO only the inherited external classes 
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
 # will be listed.
 
 ALLEXTERNALS           = NO
 
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
-# in the modules index. If set to NO, only the current project's groups will 
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
 # be listed.
 
 EXTERNAL_GROUPS        = YES
 
-# The PERL_PATH should be the absolute path and name of the perl script 
+# The PERL_PATH should be the absolute path and name of the perl script
 # interpreter (i.e. the result of `which perl').
 
 PERL_PATH              = /usr/bin/perl
 
 #---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
+# Configuration options related to the dot tool
 #---------------------------------------------------------------------------
 
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or 
-# super classes. Setting the tag to NO turns the diagrams off. Note that this 
-# option is superseded by the HAVE_DOT option below. This is only a fallback. It is 
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or
+# super classes. Setting the tag to NO turns the diagrams off. Note that this
+# option is superseded by the HAVE_DOT option below. This is only a fallback. It is
 # recommended to install and use dot, since it yields more powerful graphs.
 
 CLASS_DIAGRAMS         = YES
 
-# If set to YES, the inheritance and collaboration graphs will hide 
-# inheritance and usage relations if the target is undocumented 
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
 # or is not a class.
 
 HIDE_UNDOC_RELATIONS   = YES
 
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
-# available from the path. This tool is part of Graphviz, a graph visualization 
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
 # have no effect if this option is set to NO (the default)
 
 HAVE_DOT               = NO
 
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect inheritance relations. Setting this tag to YES will force the 
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
 # the CLASS_DIAGRAMS tag to NO.
 
 CLASS_GRAPH            = YES
 
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect implementation dependencies (inheritance, containment, and 
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
 # class references variables) of the class with other documented classes.
 
 COLLABORATION_GRAPH    = YES
 
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
-# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
 # Language.
 
 UML_LOOK               = NO
 
-# If set to YES, the inheritance and collaboration graphs will show the 
+# If set to YES, the inheritance and collaboration graphs will show the
 # relations between templates and their instances.
 
 TEMPLATE_RELATIONS     = NO
 
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
-# tags are set to YES then doxygen will generate a graph for each documented 
-# file showing the direct and indirect include dependencies of the file with 
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
 # other documented files.
 
 INCLUDE_GRAPH          = YES
 
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
-# documented header file showing the documented files that directly or 
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
 # indirectly include this file.
 
 INCLUDED_BY_GRAPH      = YES
 
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
-# generate a call dependency graph for every global function or class method. 
-# Note that enabling this option will significantly increase the time of a run. 
-# So in most cases it will be better to enable call graphs for selected 
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
 # functions only using the \callgraph command.
 
 CALL_GRAPH             = NO
 
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
 # will graphical hierarchy of all classes instead of a textual one.
 
 GRAPHICAL_HIERARCHY    = YES
 
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
 # generated by dot. Possible values are png, jpg, or gif
 # If left blank png will be used.
 
 DOT_IMAGE_FORMAT       = png
 
-# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
 # found. If left blank, it is assumed the dot tool can be found on the path.
 
-DOT_PATH               = 
+DOT_PATH               =
 
-# The DOTFILE_DIRS tag can be used to specify one or more directories that 
-# contain dot files that are included in the documentation (see the 
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
 # \dotfile command).
 
-DOTFILE_DIRS           = 
+DOTFILE_DIRS           =
 
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
 # large images.
 
 MAX_DOT_GRAPH_WIDTH    = 1024
 
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
 # large images.
 
 MAX_DOT_GRAPH_HEIGHT   = 1024
 
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
-# graphs generated by dot. A depth value of 3 means that only nodes reachable 
-# from the root by following a path via at most 3 edges will be shown. Nodes that 
-# lay further from the root node will be omitted. Note that setting this option to 
-# 1 or 2 may greatly reduce the computation time needed for large code bases. Also 
-# note that a graph may be further truncated if the graph's image dimensions are 
-# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). 
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes that
+# lay further from the root node will be omitted. Note that setting this option to
+# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that a graph may be further truncated if the graph's image dimensions are
+# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
 # If 0 is used for the depth value (the default), the graph is not depth-constrained.
 
 MAX_DOT_GRAPH_DEPTH    = 0
 
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
-# generate a legend page explaining the meaning of the various boxes and 
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
 # arrows in the dot generated graphs.
 
 GENERATE_LEGEND        = YES
 
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
-# remove the intermediate dot files that are used to generate 
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
 # the various graphs.
 
 DOT_CLEANUP            = YES
 
 #---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
+# Configuration::additions related to the search engine
 #---------------------------------------------------------------------------
 
-# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# The SEARCHENGINE tag specifies whether or not a search engine should be
 # used. If set to NO the values of all tags below this one will be ignored.
 
 SEARCHENGINE           = NO
 
 SHOW_DIRECTORIES=NO
-
index 21584ad96eeb0480a8d556b712486f77f02c3d98..a20c7c458e3e3ba4cc10953bf4ddc22ca9e18cc6 100644 (file)
@@ -201,22 +201,22 @@ paplay_LDADD = $(AM_LDADD) libpulse.la $(LIBSNDFILE_LIBS)
 paplay_CFLAGS = $(AM_CFLAGS) $(LIBSNDFILE_CFLAGS)
 paplay_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-pactl_SOURCES = utils/pactl.c pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h pulsecore/log.c pulsecore/log.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
+pactl_SOURCES = utils/pactl.c pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h pulsecore/log.c pulsecore/log.h pulsecore/rtclock.c pulsecore/rtclock.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
 pactl_LDADD = $(AM_LDADD) libpulse.la $(LIBSNDFILE_LIBS)
 pactl_CFLAGS = $(AM_CFLAGS) $(LIBSNDFILE_CFLAGS)
 pactl_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-pasuspender_SOURCES = utils/pasuspender.c pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h pulsecore/log.c pulsecore/log.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
+pasuspender_SOURCES = utils/pasuspender.c pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h pulsecore/log.c pulsecore/log.h pulsecore/rtclock.c pulsecore/rtclock.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
 pasuspender_LDADD = $(AM_LDADD) libpulse.la $(LIBSNDFILE_LIBS)
 pasuspender_CFLAGS = $(AM_CFLAGS) $(LIBSNDFILE_CFLAGS)
 pasuspender_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-pacmd_SOURCES = utils/pacmd.c pulsecore/pid.c pulsecore/pid.h pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h pulsecore/log.c pulsecore/log.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
+pacmd_SOURCES = utils/pacmd.c pulsecore/pid.c pulsecore/pid.h pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h pulsecore/log.c pulsecore/log.h pulsecore/rtclock.c pulsecore/rtclock.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
 pacmd_CFLAGS = $(AM_CFLAGS)
 pacmd_LDADD = $(AM_LDADD) libpulse.la
 pacmd_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
 
-pax11publish_SOURCES = utils/pax11publish.c pulsecore/x11prop.c pulsecore/x11prop.h pulse/client-conf.c pulse/client-conf.h pulsecore/authkey.h pulsecore/authkey.c pulsecore/random.h pulsecore/random.c pulsecore/conf-parser.c pulsecore/conf-parser.h pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h  pulsecore/log.c pulsecore/log.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
+pax11publish_SOURCES = utils/pax11publish.c pulsecore/x11prop.c pulsecore/x11prop.h pulse/client-conf.c pulse/client-conf.h pulsecore/authkey.h pulsecore/authkey.c pulsecore/random.h pulsecore/random.c pulsecore/conf-parser.c pulsecore/rtclock.c pulsecore/rtclock.h pulsecore/conf-parser.h pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h  pulsecore/log.c pulsecore/log.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
 pax11publish_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS)
 pax11publish_LDADD = $(AM_LDADD) libpulse.la $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS)
 pax11publish_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
@@ -618,13 +618,14 @@ libpulse_simple_la_SOURCES = \
                pulsecore/core-util.c pulsecore/core-util.h  \
                pulsecore/core-error.c pulsecore/core-error.h \
                pulsecore/once.c pulsecore/once.h \
+               pulsecore/rtclock.c pulsecore/rtclock.h \
                $(PA_THREAD_OBJS)
 
 libpulse_simple_la_CFLAGS = $(AM_CFLAGS)
 libpulse_simple_la_LIBADD = $(AM_LIBADD) libpulse.la
 libpulse_simple_la_LDFLAGS = -version-info $(LIBPULSE_SIMPLE_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file
 
-libpulse_browse_la_SOURCES = pulse/browser.c pulse/browser.h pulsecore/avahi-wrap.c pulsecore/avahi-wrap.h pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h  pulsecore/log.c pulsecore/log.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
+libpulse_browse_la_SOURCES = pulse/browser.c pulse/browser.h pulsecore/avahi-wrap.c pulsecore/avahi-wrap.h pulsecore/core-util.c pulsecore/core-util.h pulsecore/core-error.c pulsecore/core-error.h  pulsecore/log.c pulsecore/log.h pulsecore/rtclock.c pulsecore/rtclock.h pulsecore/once.c pulsecore/once.h $(PA_THREAD_OBJS)
 libpulse_browse_la_CFLAGS = $(AM_CFLAGS) $(AVAHI_CFLAGS)
 libpulse_browse_la_LIBADD = $(AM_LIBADD) libpulse.la $(AVAHI_LIBS)
 libpulse_browse_la_LDFLAGS = -version-info $(LIBPULSE_BROWSE_VERSION_INFO) -Wl,-version-script=$(srcdir)/map-file
@@ -632,6 +633,7 @@ libpulse_browse_la_LDFLAGS = -version-info $(LIBPULSE_BROWSE_VERSION_INFO) -Wl,-
 libpulse_mainloop_glib_la_SOURCES = \
                pulse/glib-mainloop.h pulse/glib-mainloop.c \
                pulsecore/log.c pulsecore/log.h \
+               pulsecore/rtclock.c pulsecore/rtclock.h \
                pulsecore/core-util.c pulsecore/core-util.h  \
                pulsecore/core-error.c pulsecore/core-error.h \
                pulsecore/once.c pulsecore/once.h \
@@ -1371,7 +1373,7 @@ module_x11_bell_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA
 module_x11_publish_la_SOURCES = modules/module-x11-publish.c
 module_x11_publish_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS)
 module_x11_publish_la_LDFLAGS = -module -avoid-version
-module_x11_publish_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) libx11wrap.la libauthkey.la libauth-cookie.la libx11prop.la libstrlist.la libpulsecore.la
+module_x11_publish_la_LIBADD = $(AM_LIBADD) $(X_PRE_LIBS) -lX11 $(X_LIBS) $(X_EXTRA_LIBS) libx11wrap.la libauthkey.la libauth-cookie.la libx11prop.la libstrlist.la libprotocol-native.la libpulsecore.la
 
 module_x11_xsmp_la_SOURCES = modules/module-x11-xsmp.c
 module_x11_xsmp_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS)
@@ -1471,7 +1473,7 @@ module_device_restore_la_CFLAGS = $(AM_CFLAGS)
 # Stream volume/muted/device restore module
 module_stream_restore_la_SOURCES = modules/module-stream-restore.c
 module_stream_restore_la_LDFLAGS = -module -avoid-version
-module_stream_restore_la_LIBADD = $(AM_LIBADD) libpulsecore.la -lgdbm
+module_stream_restore_la_LIBADD = $(AM_LIBADD) libtagstruct.la libprotocol-native.la libpulsecore.la -lgdbm
 module_stream_restore_la_CFLAGS = $(AM_CFLAGS)
 
 # Default sink/source restore module
index b57a74a2c895e9e891a671cc8dbfdfd46c74ccd6..c8eda398d81dc6596c1f0851f26685b95fec4ce8 100644 (file)
@@ -348,6 +348,9 @@ int main(int argc, char *argv[]) {
     int autospawn_fd = -1;
     pa_bool_t autospawn_locked = FALSE;
 
+    pa_log_set_maximal_level(PA_LOG_INFO);
+    pa_log_set_ident("pulseaudio");
+
 #if defined(__linux__) && defined(__OPTIMIZE__)
     /*
        Disable lazy relocations to make usage of external libraries
@@ -410,9 +413,6 @@ int main(int argc, char *argv[]) {
     setlocale(LC_ALL, "");
     pa_init_i18n();
 
-    pa_log_set_maximal_level(PA_LOG_INFO);
-    pa_log_set_ident("pulseaudio");
-
     conf = pa_daemon_conf_new();
 
     if (pa_daemon_conf_load(conf, NULL) < 0)
@@ -778,6 +778,20 @@ int main(int argc, char *argv[]) {
     pa_set_env("PULSE_SYSTEM", conf->system_instance ? "1" : "0");
 
     pa_log_info(_("This is PulseAudio %s"), PACKAGE_VERSION);
+    pa_log_debug(_("Compilation CFLAGS: %s"), PA_CFLAGS);
+
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+    pa_log_debug(_("Compiled with Valgrind support: yes"));
+#else
+    pa_log_debug(_("Compiled with Valgrind support: no"));
+#endif
+
+#ifdef __OPTIMIZE__
+    pa_log_debug(_("Optimized build: yes"));
+#else
+    pa_log_debug(_("Optimized build: no"));
+#endif
+
     pa_log_info(_("Page size is %lu bytes"), (unsigned long) PA_PAGE_SIZE);
 
     if (!(s = pa_machine_id())) {
index e8c7e1468fc5279f88bd27a106e9f03055662f2e..8fa405ddfddc300ad58ac077fb690474261e0235 100644 (file)
@@ -421,6 +421,8 @@ int pa_alsa_set_hw_params(
 
     ret = 0;
 
+    snd_pcm_nonblock(pcm_handle, 1);
+
 finish:
 
     return ret;
@@ -569,40 +571,60 @@ snd_pcm_t *pa_alsa_open_by_device_id(
             continue;
 
         d = pa_sprintf_malloc("%s:%s", device_table[i].name, dev_id);
-        pa_log_debug("Trying %s...", d);
 
-        if ((err = snd_pcm_open(&pcm_handle, d, mode,
-                                SND_PCM_NONBLOCK|
-                                SND_PCM_NO_AUTO_RESAMPLE|
-                                SND_PCM_NO_AUTO_CHANNELS|
-                                SND_PCM_NO_AUTO_FORMAT |
-                                SND_PCM_NO_SOFTVOL)) < 0) {
-            pa_log_info("Couldn't open PCM device %s: %s", d, snd_strerror(err));
-            pa_xfree(d);
-            continue;
-        }
+        for (;;) {
+            pa_log_debug("Trying %s...", d);
+
+            /* We don't pass SND_PCM_NONBLOCK here, since alsa-lib <=
+             * 1.0.17a would then ignore the SND_PCM_NO_xxx
+             * flags. Instead we enable nonblock mode afterwards via
+             * snd_pcm_nonblock(). Also see
+             * http://mailman.alsa-project.org/pipermail/alsa-devel/2008-August/010258.html */
+
+            if ((err = snd_pcm_open(&pcm_handle, d, mode,
+                                    /* SND_PCM_NONBLOCK| */
+                                    SND_PCM_NO_AUTO_RESAMPLE|
+                                    SND_PCM_NO_AUTO_CHANNELS|
+                                    SND_PCM_NO_AUTO_FORMAT)) < 0) {
+                pa_log_info("Couldn't open PCM device %s: %s", d, snd_strerror(err));
+                break;
+            }
 
-        try_ss.channels = device_table[i].map.channels;
-        try_ss.rate = ss->rate;
-        try_ss.format = ss->format;
+            try_ss.channels = device_table[i].map.channels;
+            try_ss.rate = ss->rate;
+            try_ss.format = ss->format;
 
-        if ((err = pa_alsa_set_hw_params(pcm_handle, &try_ss, nfrags, period_size, tsched_size, use_mmap, use_tsched, TRUE)) < 0) {
-            pa_log_info("PCM device %s refused our hw parameters: %s", d, snd_strerror(err));
-            pa_xfree(d);
-            snd_pcm_close(pcm_handle);
-            continue;
+            if ((err = pa_alsa_set_hw_params(pcm_handle, &try_ss, nfrags, period_size, tsched_size, use_mmap, use_tsched, TRUE)) < 0) {
+
+                if (!pa_startswith(d, "plug:") && !pa_startswith(d, "plughw:")) {
+                    char *t;
+
+                    t = pa_sprintf_malloc("plug:%s", d);
+                    pa_xfree(d);
+                    d = t;
+
+                    snd_pcm_close(pcm_handle);
+                    continue;
+                }
+
+                pa_log_info("PCM device %s refused our hw parameters: %s", d, snd_strerror(err));
+                snd_pcm_close(pcm_handle);
+                break;
+            }
+
+            *ss = try_ss;
+            *map = device_table[i].map;
+            pa_assert(map->channels == ss->channels);
+            *dev = d;
+            return pcm_handle;
         }
 
-        *ss = try_ss;
-        *map = device_table[i].map;
-        pa_assert(map->channels == ss->channels);
-        *dev = d;
-        return pcm_handle;
+        pa_xfree(d);
     }
 
     /* OK, we didn't find any good device, so let's try the raw plughw: stuff */
 
-    d = pa_sprintf_malloc("plughw:%s", dev_id);
+    d = pa_sprintf_malloc("hw:%s", dev_id);
     pa_log_debug("Trying %s as last resort...", d);
     pcm_handle = pa_alsa_open_by_device_string(d, dev, ss, map, mode, nfrags, period_size, tsched_size, use_mmap, use_tsched);
     pa_xfree(d);
@@ -636,8 +658,16 @@ snd_pcm_t *pa_alsa_open_by_device_string(
     d = pa_xstrdup(device);
 
     for (;;) {
+        pa_log_debug("Trying %s...", d);
 
-        if ((err = snd_pcm_open(&pcm_handle, d, mode, SND_PCM_NONBLOCK|
+        /* We don't pass SND_PCM_NONBLOCK here, since alsa-lib <=
+         * 1.0.17a would then ignore the SND_PCM_NO_xxx flags. Instead
+         * we enable nonblock mode afterwards via
+         * snd_pcm_nonblock(). Also see
+         * http://mailman.alsa-project.org/pipermail/alsa-devel/2008-August/010258.html */
+
+        if ((err = snd_pcm_open(&pcm_handle, d, mode,
+                                /*SND_PCM_NONBLOCK|*/
                                 SND_PCM_NO_AUTO_RESAMPLE|
                                 SND_PCM_NO_AUTO_CHANNELS|
                                 SND_PCM_NO_AUTO_FORMAT)) < 0) {
@@ -648,24 +678,23 @@ snd_pcm_t *pa_alsa_open_by_device_string(
 
         if ((err = pa_alsa_set_hw_params(pcm_handle, ss, nfrags, period_size, tsched_size, use_mmap, use_tsched, FALSE)) < 0) {
 
-            if (err == -EPERM) {
-                /* Hmm, some hw is very exotic, so we retry with plug, if without it didn't work */
+            /* Hmm, some hw is very exotic, so we retry with plug, if without it didn't work */
 
-                if (pa_startswith(d, "hw:")) {
-                    char *t = pa_sprintf_malloc("plughw:%s", d+3);
-                    pa_log_debug("Opening the device as '%s' didn't work, retrying with '%s'.", d, t);
-                    pa_xfree(d);
-                    d = t;
+            if (!pa_startswith(d, "plug:") && !pa_startswith(d, "plughw:")) {
+                char *t;
 
-                    snd_pcm_close(pcm_handle);
-                    continue;
-                }
-
-                pa_log("Failed to set hardware parameters on %s: %s", d, snd_strerror(err));
+                t = pa_sprintf_malloc("plug:%s", d);
                 pa_xfree(d);
+                d = t;
+
                 snd_pcm_close(pcm_handle);
-                return NULL;
+                continue;
             }
+
+            pa_log("Failed to set hardware parameters on %s: %s", d, snd_strerror(err));
+            pa_xfree(d);
+            snd_pcm_close(pcm_handle);
+            return NULL;
         }
 
         *dev = d;
@@ -896,12 +925,17 @@ void pa_alsa_dump_status(snd_pcm_t *pcm) {
 
 static void alsa_error_handler(const char *file, int line, const char *function, int err, const char *fmt,...) {
     va_list ap;
+    char *alsa_file;
+
+    alsa_file = pa_sprintf_malloc("(alsa-lib)%s", file);
 
     va_start(ap, fmt);
 
-    pa_log_levelv_meta(PA_LOG_WARN, file, line, function, fmt, ap);
+    pa_log_levelv_meta(PA_LOG_INFO, alsa_file, line, function, fmt, ap);
 
     va_end(ap);
+
+    pa_xfree(alsa_file);
 }
 
 static pa_atomic_t n_error_handler_installed = PA_ATOMIC_INIT(0);
index 9fd12e30476376928886464666e8adb41b526bf4..d61d127a628976f3efa5b9929a790e40ca0032e7 100644 (file)
@@ -233,7 +233,7 @@ static void time_callback(pa_mainloop_api*a, pa_time_event* e, const struct time
     adjust_rates(u);
 
     pa_gettimeofday(&n);
-    n.tv_sec += u->adjust_time;
+    n.tv_sec += (time_t) u->adjust_time;
     u->sink->core->mainloop->time_restart(e, &n);
 }
 
@@ -1159,7 +1159,7 @@ int pa__init(pa_module*m) {
     if (u->adjust_time > 0) {
         struct timeval tv;
         pa_gettimeofday(&tv);
-        tv.tv_sec += u->adjust_time;
+        tv.tv_sec += (time_t) u->adjust_time;
         u->time_event = m->core->mainloop->time_new(m->core->mainloop, &tv, time_callback, u);
     }
 
index 920b4517b8167399e7add6a07222fbb91aa61053..86a788104544ed2ccc0d41d4deae1890486adaa6 100644 (file)
@@ -288,6 +288,7 @@ int pa__init(pa_module*m) {
     pa_source *source;
     uint32_t idx;
     pa_bool_t restore_volume = TRUE, restore_muted = TRUE;
+    int gdbm_cache_size;
 
     pa_assert(m);
 
@@ -337,6 +338,10 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
+    /* By default the cache of gdbm is rather large, let's reduce it a bit to save memory */
+    gdbm_cache_size = 10;
+    gdbm_setopt(u->gdbm_file, GDBM_CACHESIZE, &gdbm_cache_size, sizeof(gdbm_cache_size));
+
     pa_log_info("Sucessfully opened database file '%s'.", fname);
     pa_xfree(fname);
 
index 3333eb833f60154d32eb0479e7f027c1b8d1663a..23a325499da569e1c15d8309f73b26d84e844b8d 100644 (file)
@@ -899,7 +899,7 @@ static void thread_func(void *userdata) {
                 ssize_t l;
                 pa_bool_t loop = FALSE, work_done = FALSE;
 
-                l = u->out_fragment_size;
+                l = (ssize_t) u->out_fragment_size;
 
                 if (u->use_getospace) {
                     audio_buf_info info;
@@ -920,14 +920,14 @@ static void thread_func(void *userdata) {
                 /* Round down to multiples of the fragment size,
                  * because OSS needs that (at least some versions
                  * do) */
-                l = (l/u->out_fragment_size) * u->out_fragment_size;
+                l = (l/(ssize_t) u->out_fragment_size) * (ssize_t) u->out_fragment_size;
 
                 /* Hmm, so poll() signalled us that we can read
                  * something, but GETOSPACE told us there was nothing?
                  * Hmm, make the best of it, try to read some data, to
                  * avoid spinning forever. */
                 if (l <= 0 && (revents & POLLOUT)) {
-                    l = u->out_fragment_size;
+                    l = (ssize_t) u->out_fragment_size;
                     loop = FALSE;
                 }
 
@@ -1010,7 +1010,7 @@ static void thread_func(void *userdata) {
                 pa_memchunk memchunk;
                 pa_bool_t loop = FALSE, work_done = FALSE;
 
-                l = u->in_fragment_size;
+                l = (ssize_t) u->in_fragment_size;
 
                 if (u->use_getispace) {
                     audio_buf_info info;
@@ -1024,10 +1024,10 @@ static void thread_func(void *userdata) {
                     }
                 }
 
-                l = (l/u->in_fragment_size) * u->in_fragment_size;
+                l = (l/(ssize_t) u->in_fragment_size) * (ssize_t) u->in_fragment_size;
 
                 if (l <= 0 && (revents & POLLIN)) {
-                    l = u->in_fragment_size;
+                    l = (ssize_t) u->in_fragment_size;
                     loop = FALSE;
                 }
 
index 37e8b067905678c97a6844cdf921bc35ba96b30e..47f5d83680a79a892558ede6fed73d170a5de48b 100644 (file)
@@ -686,6 +686,7 @@ int pa__init(pa_module*m) {
     pa_source_output *so;
     uint32_t idx;
     pa_bool_t restore_device = TRUE, restore_volume = TRUE, restore_muted = TRUE;
+    int gdbm_cache_size;
 
     pa_assert(m);
 
@@ -746,6 +747,10 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
+    /* By default the cache of gdbm is rather large, let's reduce it a bit to save memory */
+    gdbm_cache_size = 10;
+    gdbm_setopt(u->gdbm_file, GDBM_CACHESIZE, &gdbm_cache_size, sizeof(gdbm_cache_size));
+
     pa_log_info("Sucessfully opened database file '%s'.", fname);
     pa_xfree(fname);
 
index 7c32b8684a4ccb81b93c56b957e44781dcb2c0b2..f9086d1961b0f919921c9088035a167585b04bb7 100644 (file)
@@ -142,21 +142,34 @@ typedef enum pa_channel_position {
 
 /** A list of channel mapping definitions for pa_channel_map_init_auto() */
 typedef enum pa_channel_map_def {
-    PA_CHANNEL_MAP_AIFF,   /**< The mapping from RFC3551, which is based on AIFF-C */
-    PA_CHANNEL_MAP_ALSA,   /**< The default mapping used by ALSA */
-    PA_CHANNEL_MAP_AUX,    /**< Only aux channels */
-    PA_CHANNEL_MAP_WAVEEX, /**< Microsoft's WAVEFORMATEXTENSIBLE mapping */
-    PA_CHANNEL_MAP_OSS,    /**< The default channel mapping used by OSS as defined in the OSS 4.0 API specs */
+    PA_CHANNEL_MAP_AIFF,
+    /**< The mapping from RFC3551, which is based on AIFF-C */
 
-    PA_CHANNEL_MAP_DEFAULT = PA_CHANNEL_MAP_AIFF /**< The default channel map */
+    PA_CHANNEL_MAP_ALSA,
+    /**< The default mapping used by ALSA */
+
+    PA_CHANNEL_MAP_AUX,
+    /**< Only aux channels */
+
+    PA_CHANNEL_MAP_WAVEEX,
+    /**< Microsoft's WAVEFORMATEXTENSIBLE mapping */
+
+    PA_CHANNEL_MAP_OSS,
+    /**< The default channel mapping used by OSS as defined in the OSS 4.0 API specs */
+
+    PA_CHANNEL_MAP_DEFAULT = PA_CHANNEL_MAP_AIFF
+    /**< The default channel map */
 } pa_channel_map_def_t;
 
 /** A channel map which can be used to attach labels to specific
  * channels of a stream. These values are relevant for conversion and
  * mixing of streams */
 typedef struct pa_channel_map {
-    uint8_t channels; /**< Number of channels */
-    pa_channel_position_t map[PA_CHANNELS_MAX]; /**< Channel labels */
+    uint8_t channels;
+    /**< Number of channels */
+
+    pa_channel_position_t map[PA_CHANNELS_MAX];
+    /**< Channel labels */
 } pa_channel_map;
 
 /** Initialize the specified channel map and return a pointer to it */
index 99a47a18c09fb631b3c7f7df3133b00e4acb9727..f1aa49873743b3bdf6d5a0bba8249298a9e8a83b 100644 (file)
@@ -201,7 +201,7 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
     if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm))) {
 
         if (!c->conf->disable_shm)
-            c->mempool = pa_mempool_new(0);
+            c->mempool = pa_mempool_new(FALSE);
 
         if (!c->mempool) {
             context_free(c);
index aa07d1c90f2cee50c1c5e71e8e8095f494ba765d..66d9aff820a0f03e1e76e19c8199e3bf6599e121 100644 (file)
@@ -57,7 +57,7 @@ static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) {
 
 /** The state of a stream */
 typedef enum pa_stream_state {
-    PA_STREAM_UNCONNECTED, /**< The stream is not yet connected to any sink or source */
+    PA_STREAM_UNCONNECTED,  /**< The stream is not yet connected to any sink or source */
     PA_STREAM_CREATING,     /**< The stream is being created */
     PA_STREAM_READY,        /**< The stream is established, you may pass audio data to it now */
     PA_STREAM_FAILED,       /**< An error occured that made the stream invalid */
@@ -83,9 +83,15 @@ typedef enum pa_operation_state {
 
 /** Some special flags for contexts. */
 typedef enum pa_context_flags {
-    PA_CONTEXT_NOAUTOSPAWN = 1 /**< Disabled autospawning of the PulseAudio daemon if required */
+    PA_CONTEXT_NOAUTOSPAWN = 1
+    /**< Disabled autospawning of the PulseAudio daemon if required */
 } pa_context_flags_t;
 
+/** \cond fulldocs */
+/* Allow clients to check with #ifdef for those flags */
+#define PA_CONTEXT_NOAUTOSPAWN PA_CONTEXT_NOAUTOSPAWN
+/** \endcond */
+
 /** The direction of a pa_stream object */
 typedef enum pa_stream_direction {
     PA_STREAM_NODIRECTION,   /**< Invalid direction */
@@ -96,237 +102,210 @@ typedef enum pa_stream_direction {
 
 /** Some special flags for stream connections. */
 typedef enum pa_stream_flags {
-    PA_STREAM_START_CORKED = 1,       /**< Create the stream corked, requiring an explicit pa_stream_cork() call to uncork it. */
-    PA_STREAM_INTERPOLATE_TIMING = 2, /**< Interpolate the latency for
-                                       * this stream. When enabled,
-                                       * pa_stream_get_latency() and
-                                       * pa_stream_get_time() will try
-                                       * to estimate the current
-                                       * record/playback time based on
-                                       * the local time that passed
-                                       * since the last timing info
-                                       * update.  Using this option
-                                       * has the advantage of not
-                                       * requiring a whole roundtrip
-                                       * when the current
-                                       * playback/recording time is
-                                       * needed. Consider using this
-                                       * option when requesting
-                                       * latency information
-                                       * frequently. This is
-                                       * especially useful on long
-                                       * latency network
-                                       * connections. It makes a lot
-                                       * of sense to combine this
-                                       * option with
-                                       * PA_STREAM_AUTO_TIMING_UPDATE. */
-    PA_STREAM_NOT_MONOTONIC = 4,    /**< Don't force the time to
-                                      * increase monotonically. If
-                                      * this option is enabled,
-                                      * pa_stream_get_time() will not
-                                      * necessarily return always
-                                      * monotonically increasing time
-                                      * values on each call. This may
-                                      * confuse applications which
-                                      * cannot deal with time going
-                                      * 'backwards', but has the
-                                      * advantage that bad transport
-                                      * latency estimations that
-                                      * caused the time to to jump
-                                      * ahead can be corrected
-                                      * quickly, without the need to
-                                      * wait. (Please note that this
-                                      * flag was named
-                                      * PA_STREAM_NOT_MONOTONOUS in
-                                      * releases prior to 0.9.11. The
-                                      * old name is still defined too,
-                                      * for compatibility reasons. */
-    PA_STREAM_AUTO_TIMING_UPDATE = 8, /**< If set timing update requests
-                                       * are issued periodically
-                                       * automatically. Combined with
-                                       * PA_STREAM_INTERPOLATE_TIMING
-                                       * you will be able to query the
-                                       * current time and latency with
-                                       * pa_stream_get_time() and
-                                       * pa_stream_get_latency() at
-                                       * all times without a packet
-                                       * round trip.*/
-    PA_STREAM_NO_REMAP_CHANNELS = 16, /**< Don't remap channels by
-                                       * their name, instead map them
-                                       * simply by their
-                                       * index. Implies
-                                       * PA_STREAM_NO_REMIX_CHANNELS. Only
-                                       * supported when the server is
-                                       * at least PA 0.9.8. It is
-                                       * ignored on older
-                                       * servers.\since 0.9.8 */
-    PA_STREAM_NO_REMIX_CHANNELS = 32, /**< When remapping channels by
-                                       * name, don't upmix or downmix
-                                       * them to related
-                                       * channels. Copy them into
-                                       * matching channels of the
-                                       * device 1:1. Only supported
-                                       * when the server is at least
-                                       * PA 0.9.8. It is ignored on
-                                       * older servers. \since
-                                       * 0.9.8 */
-    PA_STREAM_FIX_FORMAT = 64, /**< Use the sample format of the
-                                * sink/device this stream is being
-                                * connected to, and possibly ignore
-                                * the format the sample spec contains
-                                * -- but you still have to pass a
-                                * valid value in it as a hint to
-                                * PulseAudio what would suit your
-                                * stream best. If this is used you
-                                * should query the used sample format
-                                * after creating the stream by using
-                                * pa_stream_get_sample_spec(). Also,
-                                * if you specified manual buffer
-                                * metrics it is recommended to update
-                                * them with
-                                * pa_stream_set_buffer_attr() to
-                                * compensate for the changed frame
-                                * sizes. Only supported when the
-                                * server is at least PA 0.9.8. It is
-                                * ignored on older servers. \since
-                                * 0.9.8 */
-
-    PA_STREAM_FIX_RATE = 128, /**< Use the sample rate of the sink,
-                               * and possibly ignore the rate the
-                               * sample spec contains. Usage similar
-                               * to PA_STREAM_FIX_FORMAT.Only
-                               * supported when the server is at least
-                               * PA 0.9.8. It is ignored on older
-                               * servers. \since 0.9.8 */
-
-    PA_STREAM_FIX_CHANNELS = 256, /**< Use the number of channels and
-                               * the channel map of the sink, and
-                               * possibly ignore the number of
-                               * channels and the map the sample spec
-                               * and the passed channel map
-                               * contains. Usage similar to
-                               * PA_STREAM_FIX_FORMAT. Only supported
-                               * when the server is at least PA
-                               * 0.9.8. It is ignored on older
-                               * servers. \since 0.9.8 */
-    PA_STREAM_DONT_MOVE = 512, /**< Don't allow moving of this stream to
-                              * another sink/device. Useful if you use
-                              * any of the PA_STREAM_FIX_ flags and
-                              * want to make sure that resampling
-                              * never takes place -- which might
-                              * happen if the stream is moved to
-                              * another sink/source whith a different
-                              * sample spec/channel map. Only
-                              * supported when the server is at least
-                              * PA 0.9.8. It is ignored on older
-                              * servers. \since 0.9.8 */
-    PA_STREAM_VARIABLE_RATE = 1024, /**< Allow dynamic changing of the
-                                     * sampling rate during playback
-                                     * with
-                                     * pa_stream_update_sample_rate(). Only
-                                     * supported when the server is at
-                                     * least PA 0.9.8. It is ignored
-                                     * on older servers. \since
-                                     * 0.9.8 */
-    PA_STREAM_PEAK_DETECT = 2048, /**< Find peaks instead of
-                                   * resampling. \since 0.9.11 */
-
-    PA_STREAM_START_MUTED = 4096,  /**< Create in muted state. \since 0.9.11 */
-
-    PA_STREAM_ADJUST_LATENCY = 8192, /**< Try to adjust the latency of
-                                      * the sink/source based on the
-                                      * requested buffer metrics and
-                                      * adjust buffer metrics
-                                      * accordingly. See pa_buffer_attr \since 0.9.11 */
+
+    PA_STREAM_START_CORKED = 0x0001U,
+    /**< Create the stream corked, requiring an explicit
+     * pa_stream_cork() call to uncork it. */
+
+    PA_STREAM_INTERPOLATE_TIMING = 0x0002U,
+    /**< Interpolate the latency for this stream. When enabled,
+     * pa_stream_get_latency() and pa_stream_get_time() will try to
+     * estimate the current record/playback time based on the local
+     * time that passed since the last timing info update.  Using this
+     * option has the advantage of not requiring a whole roundtrip
+     * when the current playback/recording time is needed. Consider
+     * using this option when requesting latency information
+     * frequently. This is especially useful on long latency network
+     * connections. It makes a lot of sense to combine this option
+     * with PA_STREAM_AUTO_TIMING_UPDATE. */
+
+    PA_STREAM_NOT_MONOTONIC = 0x0004U,
+    /**< Don't force the time to increase monotonically. If this
+     * option is enabled, pa_stream_get_time() will not necessarily
+     * return always monotonically increasing time values on each
+     * call. This may confuse applications which cannot deal with time
+     * going 'backwards', but has the advantage that bad transport
+     * latency estimations that caused the time to to jump ahead can
+     * be corrected quickly, without the need to wait. (Please note
+     * that this flag was named PA_STREAM_NOT_MONOTONOUS in releases
+     * prior to 0.9.11. The old name is still defined too, for
+     * compatibility reasons. */
+
+    PA_STREAM_AUTO_TIMING_UPDATE = 0x0008U,
+    /**< If set timing update requests are issued periodically
+     * automatically. Combined with PA_STREAM_INTERPOLATE_TIMING you
+     * will be able to query the current time and latency with
+     * pa_stream_get_time() and pa_stream_get_latency() at all times
+     * without a packet round trip.*/
+
+    PA_STREAM_NO_REMAP_CHANNELS = 0x0010U,
+    /**< Don't remap channels by their name, instead map them simply
+     * by their index. Implies PA_STREAM_NO_REMIX_CHANNELS. Only
+     * supported when the server is at least PA 0.9.8. It is ignored
+     * on older servers.\since 0.9.8 */
+
+    PA_STREAM_NO_REMIX_CHANNELS = 0x0020U,
+    /**< When remapping channels by name, don't upmix or downmix them
+     * to related channels. Copy them into matching channels of the
+     * device 1:1. Only supported when the server is at least PA
+     * 0.9.8. It is ignored on older servers. \since 0.9.8 */
+
+    PA_STREAM_FIX_FORMAT = 0x0040U,
+    /**< Use the sample format of the sink/device this stream is being
+     * connected to, and possibly ignore the format the sample spec
+     * contains -- but you still have to pass a valid value in it as a
+     * hint to PulseAudio what would suit your stream best. If this is
+     * used you should query the used sample format after creating the
+     * stream by using pa_stream_get_sample_spec(). Also, if you
+     * specified manual buffer metrics it is recommended to update
+     * them with pa_stream_set_buffer_attr() to compensate for the
+     * changed frame sizes. Only supported when the server is at least
+     * PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
+
+    PA_STREAM_FIX_RATE = 0x0080U,
+    /**< Use the sample rate of the sink, and possibly ignore the rate
+     * the sample spec contains. Usage similar to
+     * PA_STREAM_FIX_FORMAT.Only supported when the server is at least
+     * PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
+
+    PA_STREAM_FIX_CHANNELS = 0x0100,
+    /**< Use the number of channels and the channel map of the sink,
+     * and possibly ignore the number of channels and the map the
+     * sample spec and the passed channel map contains. Usage similar
+     * to PA_STREAM_FIX_FORMAT. Only supported when the server is at
+     * least PA 0.9.8. It is ignored on older servers. \since 0.9.8 */
+
+    PA_STREAM_DONT_MOVE = 0x0200U,
+    /**< Don't allow moving of this stream to another
+     * sink/device. Useful if you use any of the PA_STREAM_FIX_ flags
+     * and want to make sure that resampling never takes place --
+     * which might happen if the stream is moved to another
+     * sink/source whith a different sample spec/channel map. Only
+     * supported when the server is at least PA 0.9.8. It is ignored
+     * on older servers. \since 0.9.8 */
+
+    PA_STREAM_VARIABLE_RATE = 0x0400U,
+    /**< Allow dynamic changing of the sampling rate during playback
+     * with pa_stream_update_sample_rate(). Only supported when the
+     * server is at least PA 0.9.8. It is ignored on older
+     * servers. \since 0.9.8 */
+
+    PA_STREAM_PEAK_DETECT = 0x0800U,
+    /**< Find peaks instead of resampling. \since 0.9.11 */
+
+    PA_STREAM_START_MUTED = 0x1000U,
+    /**< Create in muted state. \since 0.9.11 */
+
+    PA_STREAM_ADJUST_LATENCY = 0x2000U,
+    /**< Try to adjust the latency of the sink/source based on the
+     * requested buffer metrics and adjust buffer metrics
+     * accordingly. Also see pa_buffer_attr. This option may not be
+     * specified at the same time as PA_STREAM_EARLY_REQUESTS. \since
+     * 0.9.11 */
+
+    PA_STREAM_EARLY_REQUESTS = 0x4000U
+    /**< Enable compatibility mode for legacy clients that rely on a
+     * "classic" hardware device fragment-style playback model. If
+     * this option is set, the minreq value of the buffer metrics gets
+     * a new meaning: instead of just specifying that no requests
+     * asking for less new data than this value will be made to the
+     * client it will also guarantee that requests are generated as
+     * early as this limit is reached. This flag should only be set in
+     * very few situations where compatiblity with a fragment-based
+     * playback model needs to be kept and the client applications
+     * cannot deal with data requests that are delayed to the latest
+     * moment possible. (Usually these are programs that use usleep()
+     * or a similar call in their playback loops instead of sleeping
+     * on the device itself.) Also see pa_buffer_attr. This option may
+     * not be specified at the same time as
+     * PA_STREAM_ADJUST_LATENCY. \since 0.9.12 */
+
 } pa_stream_flags_t;
 
+/** \cond fulldocs */
 
-/** English is an evil language */
+/* English is an evil language */
 #define PA_STREAM_NOT_MONOTONOUS PA_STREAM_NOT_MONOTONIC
 
+/* Allow clients to check with #ifdef for those flags */
+#define PA_STREAM_START_CORKED PA_STREAM_START_CORKED
+#define PA_STREAM_INTERPOLATE_TIMING PA_STREAM_INTERPOLATE_TIMING
+#define PA_STREAM_NOT_MONOTONIC PA_STREAM_NOT_MONOTONIC
+#define PA_STREAM_AUTO_TIMING_UPDATE PA_STREAM_AUTO_TIMING_UPDATE
+#define PA_STREAM_NO_REMAP_CHANNELS PA_STREAM_NO_REMAP_CHANNELS
+#define PA_STREAM_NO_REMIX_CHANNELS PA_STREAM_NO_REMIX_CHANNELS
+#define PA_STREAM_FIX_FORMAT PA_STREAM_FIX_FORMAT
+#define PA_STREAM_FIX_RATE PA_STREAM_FIX_RATE
+#define PA_STREAM_FIX_CHANNELS PA_STREAM_FIX_CHANNELS
+#define PA_STREAM_DONT_MOVE PA_STREAM_DONT_MOVE
+#define PA_STREAM_VARIABLE_RATE PA_STREAM_VARIABLE_RATE
+#define PA_STREAM_PEAK_DETECT PA_STREAM_PEAK_DETECT
+#define PA_STREAM_START_MUTED PA_STREAM_START_MUTED
+#define PA_STREAM_ADJUST_LATENCY PA_STREAM_ADJUST_LATENCY
+#define PA_STREAM_EARLY_REQUESTS PA_STREAM_EARLY_REQUESTS
+
+/** \endcond */
+
 /** Playback and record buffer metrics */
 typedef struct pa_buffer_attr {
-    uint32_t maxlength;      /**< Maximum length of the
-                              * buffer. Setting this to (uint32_t) -1 will
-                              * initialize this to the maximum value
-                              * supported by server, which is
-                              * recommended. */
-    uint32_t tlength;        /**< Playback only: target length of the
-                              * buffer. The server tries to assure
-                              * that at least tlength bytes are always
-                              * available in the per-stream
-                              * server-side playback buffer. It is
-                              * recommended to set this to (uint32_t)
-                              * -1, which will initialize this to a
-                              * value that is deemed sensible by the
-                              * server. However, this value will
-                              * default to something like 2s, i.e. for
-                              * applications that have specific
-                              * latency requirements this value should
-                              * be set to the maximum latency that the
-                              * application can deal with. When
-                              * PA_STREAM_ADJUST_LATENCY is not set
-                              * this value will influence only the
-                              * per-stream playback buffer size. When
-                              * PA_STREAM_ADJUST_LATENCY is set the
-                              * overall latency of the sink plus the
-                              * playback buffer size is configured to
-                              * this value. Set
-                              * PA_STREAM_ADJUST_LATENCY if you are
-                              * interested in adjusting the overall
-                              * latency. Don't set it if you are
-                              * interested in configuring the
-                              * server-sider per-stream playback
-                              * buffer size. */
-    uint32_t prebuf;         /**< Playback only: pre-buffering. The
-                              * server does not start with playback
-                              * before at least prebug bytes are
-                              * available in the buffer. It is
-                              * recommended to set this to (uint32_t)
-                              * -1, which will initialize this to the
-                              * same value as tlength, whatever that
-                              * may be. Initialize to 0 to enable
-                              * manual start/stop control of the
-                              * stream. This means that playback will
-                              * not stop on underrun and playback will
-                              * not start automatically. Instead
-                              * pa_stream_corked() needs to be called
-                              * explicitly. If you set this value to 0
-                              * you should also set
-                              * PA_STREAM_START_CORKED. */
-    uint32_t minreq;         /**< Playback only: minimum request. The
-                              * server does not request less than
-                              * minreq bytes from the client, instead
-                              * waits until the buffer is free enough
-                              * to request more bytes at once. It is
-                              * recommended to set this to (uint32_t)
-                              * -1, which will initialize this to a
-                              * value that is deemed sensible by the
-                              * server. This should be set to a value
-                              * that gives PulseAudio enough time to
-                              * move the data from the per-stream
-                              * playback buffer into the hardware
-                              * playback buffer. */
-    uint32_t fragsize;       /**< Recording only: fragment size. The
-                              * server sends data in blocks of
-                              * fragsize bytes size. Large values
-                              * deminish interactivity with other
-                              * operations on the connection context
-                              * but decrease control overhead. It is
-                              * recommended to set this to (uint32_t)
-                              * -1, which will initialize this to a
-                              * value that is deemed sensible by the
-                              * server. However, this value will
-                              * default to something like 2s, i.e. for
-                              * applications that have specific
-                              * latency requirements this value should
-                              * be set to the maximum latency that the
-                              * application can deal with. If
-                              * PA_STREAM_ADJUST_LATENCY is set the
-                              * overall source latency will be
-                              * adjusted according to this value. If
-                              * it is not set the source latency is
-                              * left unmodified. */
+    uint32_t maxlength;
+    /**< Maximum length of the buffer. Setting this to (uint32_t) -1
+     * will initialize this to the maximum value supported by server,
+     * which is recommended. */
+
+    uint32_t tlength;
+    /**< Playback only: target length of the buffer. The server tries
+     * to assure that at least tlength bytes are always available in
+     * the per-stream server-side playback buffer. It is recommended
+     * to set this to (uint32_t) -1, which will initialize this to a
+     * value that is deemed sensible by the server. However, this
+     * value will default to something like 2s, i.e. for applications
+     * that have specific latency requirements this value should be
+     * set to the maximum latency that the application can deal
+     * with. When PA_STREAM_ADJUST_LATENCY is not set this value will
+     * influence only the per-stream playback buffer size. When
+     * PA_STREAM_ADJUST_LATENCY is set the overall latency of the sink
+     * plus the playback buffer size is configured to this value. Set
+     * PA_STREAM_ADJUST_LATENCY if you are interested in adjusting the
+     * overall latency. Don't set it if you are interested in
+     * configuring the server-sider per-stream playback buffer
+     * size. */
+
+    uint32_t prebuf;
+    /**< Playback only: pre-buffering. The server does not start with
+     * playback before at least prebug bytes are available in the
+     * buffer. It is recommended to set this to (uint32_t) -1, which
+     * will initialize this to the same value as tlength, whatever
+     * that may be. Initialize to 0 to enable manual start/stop
+     * control of the stream. This means that playback will not stop
+     * on underrun and playback will not start automatically. Instead
+     * pa_stream_corked() needs to be called explicitly. If you set
+     * this value to 0 you should also set PA_STREAM_START_CORKED. */
+
+    uint32_t minreq;
+    /**< Playback only: minimum request. The server does not request
+     * less than minreq bytes from the client, instead waits until the
+     * buffer is free enough to request more bytes at once. It is
+     * recommended to set this to (uint32_t) -1, which will initialize
+     * this to a value that is deemed sensible by the server. This
+     * should be set to a value that gives PulseAudio enough time to
+     * move the data from the per-stream playback buffer into the
+     * hardware playback buffer. */
+
+    uint32_t fragsize;
+    /**< Recording only: fragment size. The server sends data in
+     * blocks of fragsize bytes size. Large values deminish
+     * interactivity with other operations on the connection context
+     * but decrease control overhead. It is recommended to set this to
+     * (uint32_t) -1, which will initialize this to a value that is
+     * deemed sensible by the server. However, this value will default
+     * to something like 2s, i.e. for applications that have specific
+     * latency requirements this value should be set to the maximum
+     * latency that the application can deal with. If
+     * PA_STREAM_ADJUST_LATENCY is set the overall source latency will
+     * be adjusted according to this value. If it is not set the
+     * source latency is left unmodified. */
+
 } pa_buffer_attr;
 
 /** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */
@@ -358,36 +337,84 @@ enum {
 
 /** Subscription event mask, as used by pa_context_subscribe() */
 typedef enum pa_subscription_mask {
-    PA_SUBSCRIPTION_MASK_NULL = 0,               /**< No events */
-    PA_SUBSCRIPTION_MASK_SINK = 1,               /**< Sink events */
-    PA_SUBSCRIPTION_MASK_SOURCE = 2,             /**< Source events */
-    PA_SUBSCRIPTION_MASK_SINK_INPUT = 4,         /**< Sink input events */
-    PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 8,      /**< Source output events */
-    PA_SUBSCRIPTION_MASK_MODULE = 16,            /**< Module events */
-    PA_SUBSCRIPTION_MASK_CLIENT = 32,            /**< Client events */
-    PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 64,      /**< Sample cache events */
-    PA_SUBSCRIPTION_MASK_SERVER = 128,           /**< Other global server changes. */
-    PA_SUBSCRIPTION_MASK_AUTOLOAD = 256,         /**< Autoload table events. */
-    PA_SUBSCRIPTION_MASK_ALL = 511               /**< Catch all events */
+    PA_SUBSCRIPTION_MASK_NULL = 0x0000U,
+    /**< No events */
+
+    PA_SUBSCRIPTION_MASK_SINK = 0x0001U,
+    /**< Sink events */
+
+    PA_SUBSCRIPTION_MASK_SOURCE = 0x0002U,
+    /**< Source events */
+
+    PA_SUBSCRIPTION_MASK_SINK_INPUT = 0x0004U,
+    /**< Sink input events */
+
+    PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 0x0008U,
+    /**< Source output events */
+
+    PA_SUBSCRIPTION_MASK_MODULE = 0x0010U,
+    /**< Module events */
+
+    PA_SUBSCRIPTION_MASK_CLIENT = 0x0020U,
+    /**< Client events */
+
+    PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 0x0040U,
+    /**< Sample cache events */
+
+    PA_SUBSCRIPTION_MASK_SERVER = 0x0080U,
+    /**< Other global server changes. */
+
+    PA_SUBSCRIPTION_MASK_AUTOLOAD = 0x0100U,
+    /**< Autoload table events. */
+
+    PA_SUBSCRIPTION_MASK_ALL = 0x01ffU
+    /**< Catch all events */
 } pa_subscription_mask_t;
 
 /** Subscription event types, as used by pa_context_subscribe() */
 typedef enum pa_subscription_event_type {
-    PA_SUBSCRIPTION_EVENT_SINK = 0,           /**< Event type: Sink */
-    PA_SUBSCRIPTION_EVENT_SOURCE = 1,         /**< Event type: Source */
-    PA_SUBSCRIPTION_EVENT_SINK_INPUT = 2,     /**< Event type: Sink input */
-    PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 3,  /**< Event type: Source output */
-    PA_SUBSCRIPTION_EVENT_MODULE = 4,         /**< Event type: Module */
-    PA_SUBSCRIPTION_EVENT_CLIENT = 5,         /**< Event type: Client */
-    PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 6,   /**< Event type: Sample cache item */
-    PA_SUBSCRIPTION_EVENT_SERVER = 7,         /**< Event type: Global server change, only occuring with PA_SUBSCRIPTION_EVENT_CHANGE. */
-    PA_SUBSCRIPTION_EVENT_AUTOLOAD = 8,       /**< Event type: Autoload table changes. */
-    PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 15, /**< A mask to extract the event type from an event value */
-
-    PA_SUBSCRIPTION_EVENT_NEW = 0,            /**< A new object was created */
-    PA_SUBSCRIPTION_EVENT_CHANGE = 16,        /**< A property of the object was modified */
-    PA_SUBSCRIPTION_EVENT_REMOVE = 32,        /**< An object was removed */
-    PA_SUBSCRIPTION_EVENT_TYPE_MASK = 16+32   /**< A mask to extract the event operation from an event value */
+    PA_SUBSCRIPTION_EVENT_SINK = 0x0000U,
+    /**< Event type: Sink */
+
+    PA_SUBSCRIPTION_EVENT_SOURCE = 0x0001U,
+    /**< Event type: Source */
+
+    PA_SUBSCRIPTION_EVENT_SINK_INPUT = 0x0002U,
+    /**< Event type: Sink input */
+
+    PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 0x0003U,
+    /**< Event type: Source output */
+
+    PA_SUBSCRIPTION_EVENT_MODULE = 0x0004U,
+    /**< Event type: Module */
+
+    PA_SUBSCRIPTION_EVENT_CLIENT = 0x0005U,
+    /**< Event type: Client */
+
+    PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 0x0006U,
+    /**< Event type: Sample cache item */
+
+    PA_SUBSCRIPTION_EVENT_SERVER = 0x0007U,
+    /**< Event type: Global server change, only occuring with PA_SUBSCRIPTION_EVENT_CHANGE. */
+
+    PA_SUBSCRIPTION_EVENT_AUTOLOAD = 0x0008U,
+    /**< Event type: Autoload table changes. */
+
+    PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 0x000FU,
+    /**< A mask to extract the event type from an event value */
+
+    PA_SUBSCRIPTION_EVENT_NEW = 0x0000U,
+    /**< A new object was created */
+
+    PA_SUBSCRIPTION_EVENT_CHANGE = 0x0010U,
+    /**< A property of the object was modified */
+
+    PA_SUBSCRIPTION_EVENT_REMOVE = 0x0020U,
+    /**< An object was removed */
+
+    PA_SUBSCRIPTION_EVENT_TYPE_MASK = 0x0030U,
+    /**< A mask to extract the event operation from an event value */
+
 } pa_subscription_event_type_t;
 
 /** Return one if an event type t matches an event mask bitfield */
@@ -412,69 +439,71 @@ typedef enum pa_subscription_event_type {
  * note that this structure can be extended as part of evolutionary
  * API updates at any time in any new release.*/
 typedef struct pa_timing_info {
-    struct timeval timestamp; /**< The time when this timing info structure was current */
-    int synchronized_clocks;  /**< Non-zero if the local and the
-                               * remote machine have synchronized
-                               * clocks. If synchronized clocks are
-                               * detected transport_usec becomes much
-                               * more reliable. However, the code that
-                               * detects synchronized clocks is very
-                               * limited und unreliable itself. */
-
-    pa_usec_t sink_usec;      /**< Time in usecs a sample takes to be played on the sink. For playback streams and record streams connected to a monitor source. */
-    pa_usec_t source_usec;    /**< Time in usecs a sample takes from being recorded to being delivered to the application. Only for record streams. */
-    pa_usec_t transport_usec; /**< Estimated time in usecs a sample takes to be transferred to/from the daemon. For both playback and record streams. */
-
-    int playing;              /**< Non-zero when the stream is
-                               * currently not underrun and data is
-                               * being passed on to the device. Only
-                               * for playback streams. This field does
-                               * not say whether the data is actually
-                               * already being played. To determine
-                               * this check whether since_underrun
-                               * (converted to usec) is larger than
-                               * sink_usec.*/
-
-    int write_index_corrupt;  /**< Non-zero if write_index is not
-                               * up-to-date because a local write
-                               * command that corrupted it has been
-                               * issued in the time since this latency
-                               * info was current . Only write
-                               * commands with SEEK_RELATIVE_ON_READ
-                               * and SEEK_RELATIVE_END can corrupt
-                               * write_index. */
-    int64_t write_index;      /**< Current write index into the
-                               * playback buffer in bytes. Think twice before
-                               * using this for seeking purposes: it
-                               * might be out of date a the time you
-                               * want to use it. Consider using
-                               * PA_SEEK_RELATIVE instead.  */
-
-    int read_index_corrupt;   /**< Non-zero if read_index is not
-                               * up-to-date because a local pause or
-                               * flush request that corrupted it has
-                               * been issued in the time since this
-                               * latency info was current. */
-
-    int64_t read_index;       /**< Current read index into the
-                               * playback buffer in bytes. Think twice before
-                               * using this for seeking purposes: it
-                               * might be out of date a the time you
-                               * want to use it. Consider using
-                               * PA_SEEK_RELATIVE_ON_READ
-                               * instead. */
-
-    pa_usec_t configured_sink_usec;   /**< The configured latency for
-                                * the sink. \since 0.9.11 */
-    pa_usec_t configured_source_usec; /**< The configured latency for
-                                * the source. \since 0.9.11 */
-
-    int64_t since_underrun;    /**< Bytes that were handed to the sink
-                                  since the last underrun happened, or
-                                  since playback started again after
-                                  the last underrun. playing will tell
-                                  you which case it is. \since
-                                  0.9.11 */
+    struct timeval timestamp;
+    /**< The time when this timing info structure was current */
+
+    int synchronized_clocks;
+    /**< Non-zero if the local and the remote machine have
+     * synchronized clocks. If synchronized clocks are detected
+     * transport_usec becomes much more reliable. However, the code
+     * that detects synchronized clocks is very limited und unreliable
+     * itself. */
+
+    pa_usec_t sink_usec;
+    /**< Time in usecs a sample takes to be played on the sink. For
+     * playback streams and record streams connected to a monitor
+     * source. */
+
+    pa_usec_t source_usec;
+    /**< Time in usecs a sample takes from being recorded to being
+     * delivered to the application. Only for record streams. */
+
+    pa_usec_t transport_usec;
+    /**< Estimated time in usecs a sample takes to be transferred
+     * to/from the daemon. For both playback and record streams. */
+
+    int playing;
+    /**< Non-zero when the stream is currently not underrun and data
+     * is being passed on to the device. Only for playback
+     * streams. This field does not say whether the data is actually
+     * already being played. To determine this check whether
+     * since_underrun (converted to usec) is larger than sink_usec.*/
+
+    int write_index_corrupt;
+    /**< Non-zero if write_index is not up-to-date because a local
+     * write command that corrupted it has been issued in the time
+     * since this latency info was current . Only write commands with
+     * SEEK_RELATIVE_ON_READ and SEEK_RELATIVE_END can corrupt
+     * write_index. */
+
+    int64_t write_index;
+    /**< Current write index into the playback buffer in bytes. Think
+     * twice before using this for seeking purposes: it might be out
+     * of date a the time you want to use it. Consider using
+     * PA_SEEK_RELATIVE instead. */
+
+    int read_index_corrupt;
+    /**< Non-zero if read_index is not up-to-date because a local
+     * pause or flush request that corrupted it has been issued in the
+     * time since this latency info was current. */
+
+    int64_t read_index;
+    /**< Current read index into the playback buffer in bytes. Think
+     * twice before using this for seeking purposes: it might be out
+     * of date a the time you want to use it. Consider using
+     * PA_SEEK_RELATIVE_ON_READ instead. */
+
+    pa_usec_t configured_sink_usec;
+    /**< The configured latency for the sink. \since 0.9.11 */
+
+    pa_usec_t configured_source_usec;
+    /**< The configured latency for * the source. \since 0.9.11 */
+
+    int64_t since_underrun;
+    /**< Bytes that were handed to the sink since the last underrun
+     * happened, or since playback started again after the last
+     * underrun. playing will tell you which case it is. \since
+     * 0.9.11 */
 
 } pa_timing_info;
 
@@ -486,45 +515,101 @@ typedef struct pa_timing_info {
  * thread compatible way. You might have to do this in
  * prefork/postfork. */
 typedef struct pa_spawn_api {
-    void (*prefork)(void);     /**< Is called just before the fork in the parent process. May be NULL. */
-    void (*postfork)(void);    /**< Is called immediately after the fork in the parent process. May be NULL.*/
-    void (*atfork)(void);      /**< Is called immediately after the
-                                * fork in the child process. May be
-                                * NULL. It is not safe to close all
-                                * file descriptors in this function
-                                * unconditionally, since a UNIX socket
-                                * (created using socketpair()) is
-                                * passed to the new process. */
+    void (*prefork)(void);
+    /**< Is called just before the fork in the parent process. May be
+     * NULL. */
+
+    void (*postfork)(void);
+    /**< Is called immediately after the fork in the parent
+     * process. May be NULL.*/
+
+    void (*atfork)(void);
+    /**< Is called immediately after the fork in the child
+     * process. May be NULL. It is not safe to close all file
+     * descriptors in this function unconditionally, since a UNIX
+     * socket (created using socketpair()) is passed to the new
+     * process. */
 } pa_spawn_api;
 
 /** Seek type for pa_stream_write(). */
 typedef enum pa_seek_mode {
-    PA_SEEK_RELATIVE = 0,           /**< Seek relatively to the write index */
-    PA_SEEK_ABSOLUTE = 1,           /**< Seek relatively to the start of the buffer queue */
-    PA_SEEK_RELATIVE_ON_READ = 2,   /**< Seek relatively to the read index.  */
-    PA_SEEK_RELATIVE_END = 3        /**< Seek relatively to the current end of the buffer queue. */
+    PA_SEEK_RELATIVE = 0,
+    /**< Seek relatively to the write index */
+
+    PA_SEEK_ABSOLUTE = 1,
+    /**< Seek relatively to the start of the buffer queue */
+
+    PA_SEEK_RELATIVE_ON_READ = 2,
+    /**< Seek relatively to the read index.  */
+
+    PA_SEEK_RELATIVE_END = 3
+    /**< Seek relatively to the current end of the buffer queue. */
 } pa_seek_mode_t;
 
 /** Special sink flags. */
 typedef enum pa_sink_flags {
-    PA_SINK_HW_VOLUME_CTRL = 1,   /**< Supports hardware volume control */
-    PA_SINK_LATENCY = 2,          /**< Supports latency querying */
-    PA_SINK_HARDWARE = 4,         /**< Is a hardware sink of some kind, in contrast to "virtual"/software sinks \since 0.9.3 */
-    PA_SINK_NETWORK = 8,          /**< Is a networked sink of some kind. \since 0.9.7 */
-    PA_SINK_HW_MUTE_CTRL = 16,    /**< Supports hardware mute control \since 0.9.11 */
-    PA_SINK_DECIBEL_VOLUME = 32   /**< Volume can be translated to dB with pa_sw_volume_to_dB() \since 0.9.11 */
+    PA_SINK_HW_VOLUME_CTRL = 0x0001U,
+    /**< Supports hardware volume control */
+
+    PA_SINK_LATENCY = 0x0002U,
+    /**< Supports latency querying */
+
+    PA_SINK_HARDWARE = 0x0004U,
+    /**< Is a hardware sink of some kind, in contrast to
+     * "virtual"/software sinks \since 0.9.3 */
+
+    PA_SINK_NETWORK = 0x0008U,
+    /**< Is a networked sink of some kind. \since 0.9.7 */
+
+    PA_SINK_HW_MUTE_CTRL = 0x0010U,
+    /**< Supports hardware mute control \since 0.9.11 */
+
+    PA_SINK_DECIBEL_VOLUME = 0x0020U
+    /**< Volume can be translated to dB with pa_sw_volume_to_dB()
+     * \since 0.9.11 */
 } pa_sink_flags_t;
 
+/** \cond fulldocs */
+#define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
+#define PA_SINK_LATENCY PA_SINK_LATENCY
+#define PA_SINK_HARDWARE PA_SINK_HARDWARE
+#define PA_SINK_NETWORK PA_SINK_NETWORK
+#define PA_SINK_HW_VOLUME_CTRL PA_SINK_HW_VOLUME_CTRL
+#define PA_SINK_DECIBEL_VOLUME PA_SINK_DECIBEL_VOLUME
+/** \endcond */
+
 /** Special source flags.  */
 typedef enum pa_source_flags {
-    PA_SOURCE_HW_VOLUME_CTRL = 1,  /**< Supports hardware volume control */
-    PA_SOURCE_LATENCY = 2,         /**< Supports latency querying */
-    PA_SOURCE_HARDWARE = 4,        /**< Is a hardware source of some kind, in contrast to "virtual"/software source \since 0.9.3 */
-    PA_SOURCE_NETWORK = 8,         /**< Is a networked sink of some kind. \since 0.9.7 */
-    PA_SOURCE_HW_MUTE_CTRL = 16,   /**< Supports hardware mute control \since 0.9.11 */
-    PA_SOURCE_DECIBEL_VOLUME = 32  /**< Volume can be translated to dB with pa_sw_volume_to_dB() \since 0.9.11 */
+    PA_SOURCE_HW_VOLUME_CTRL = 0x0001U,
+    /**< Supports hardware volume control */
+
+    PA_SOURCE_LATENCY = 0x0002U,
+    /**< Supports latency querying */
+
+    PA_SOURCE_HARDWARE = 0x0004U,
+    /**< Is a hardware source of some kind, in contrast to
+     * "virtual"/software source \since 0.9.3 */
+
+    PA_SOURCE_NETWORK = 0x0008U,
+    /**< Is a networked sink of some kind. \since 0.9.7 */
+
+    PA_SOURCE_HW_MUTE_CTRL = 0x0010U,
+    /**< Supports hardware mute control \since 0.9.11 */
+
+    PA_SOURCE_DECIBEL_VOLUME = 0x0020U
+    /**< Volume can be translated to dB with pa_sw_volume_to_dB()
+     * \since 0.9.11 */
 } pa_source_flags_t;
 
+/** \cond fulldocs */
+#define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
+#define PA_SOURCE_LATENCY PA_SOURCE_LATENCY
+#define PA_SOURCE_HARDWARE PA_SOURCE_HARDWARE
+#define PA_SOURCE_NETWORK PA_SOURCE_NETWORK
+#define PA_SOURCE_HW_VOLUME_CTRL PA_SOURCE_HW_VOLUME_CTRL
+#define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME
+/** \endcond */
+
 /** A generic free() like callback prototype */
 typedef void (*pa_free_cb_t)(void *p);
 
index a8eceaf173336795964b8290af32a55ffcece810..2038eb4a1776ae43c0d5b4c39859caa1eb28cd07 100644 (file)
 
 #include <pulse/context.h>
 
+/** \file
+ *
+ * Routines for controlling module-stream-restore
+ */
+
 PA_C_DECL_BEGIN
 
+/** Stores information about one entry in the stream database that is
+ * maintained by module-stream-restore. \since 0.9.12 */
 typedef struct pa_ext_stream_restore_info {
-    const char *name;
-    pa_channel_map channel_map;
-    pa_cvolume volume;
-    const char *device;
-    int mute;
+    const char *name;            /**< Identifier string of the stream. A string like "sink-input-by-role:" or similar followed by some arbitrary property value. */
+    pa_channel_map channel_map;  /**< The channel map for the volume field */
+    pa_cvolume volume;           /**< The volume of the stream when it was seen last, if applicable */
+    const char *device;          /**< The sink/source of the stream when it was last seen */
+    int mute;                    /**< The boolean mute state of the stream when it was last seen, if applicable */
 } pa_ext_stream_restore_info;
 
+/** Callback prototype for pa_ext_stream_restore_test(). \since 0.9.12 */
 typedef void (*pa_ext_stream_restore_test_cb_t)(
         pa_context *c,
         uint32_t version,
         void *userdata);
 
+/** Test if this extension module is available in the server. \since 0.9.12 */
 pa_operation *pa_ext_stream_restore_test(
         pa_context *c,
         pa_ext_stream_restore_test_cb_t cb,
         void *userdata);
 
+/** Callback prototype for pa_ext_stream_restore_read(). \since 0.9.12 */
 typedef void (*pa_ext_stream_restore_read_cb_t)(
         pa_context *c,
         const pa_ext_stream_restore_info *info,
         int eol,
         void *userdata);
 
+/** Read all entries from the stream database. \since 0.9.12 */
 pa_operation *pa_ext_stream_restore_read(
         pa_context *c,
         pa_ext_stream_restore_read_cb_t cb,
         void *userdata);
 
+/** Store entries in the stream database. \since 0.9.12 */
 pa_operation *pa_ext_stream_restore_write(
         pa_context *c,
         pa_update_mode_t mode,
@@ -64,22 +76,27 @@ pa_operation *pa_ext_stream_restore_write(
         pa_context_success_cb_t cb,
         void *userdata);
 
+/** Delete entries from the stream database. \since 0.9.12 */
 pa_operation *pa_ext_stream_restore_delete(
         pa_context *c,
         const char *const s[],
         pa_context_success_cb_t cb,
         void *userdata);
 
+/** Subscribe to changes in the stream database. \since 0.9.12 */
 pa_operation *pa_ext_stream_restore_subscribe(
         pa_context *c,
         int enable,
         pa_context_success_cb_t cb,
         void *userdata);
 
+/** Callback prototype for pa_ext_stream_restore_set_subscribe_cb(). \since 0.9.12 */
 typedef void (*pa_ext_stream_restore_subscribe_cb_t)(
         pa_context *c,
         void *userdata);
 
+/** Set the subscription callback that is called when
+ * pa_ext_stream_restore_subscribe() was called. \since 0.9.12 */
 void pa_ext_stream_restore_set_subscribe_cb(
         pa_context *c,
         pa_ext_stream_restore_subscribe_cb_t cb,
index e4062033e028ef87fe5d087c9b88780b24d57b11..0533b10915c581e06848a6844e834b3b598ee3bf 100644 (file)
 #endif
 #endif
 
+#ifndef PA_GCC_ALLOC_SIZE
+#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
+#define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
+#define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
+#else
+/** Macro for usage of GCC's alloc_size attribute */
+#define PA_GCC_ALLOC_SIZE(x)
+#define PA_GCC_ALLOC_SIZE2(x,y)
+#endif
+#endif
+
+#ifndef PA_GCC_MALLOC
+#ifdef __GNUCC__
+#define PA_GCC_MALLOC __attribute__ ((malloc))
+#else
+/** Macro for usage of GCC's malloc attribute */
+#define PA_GCC_MALLOC
+#endif
+#endif
+
 #endif
index ca79f5b75d9b73cee06916f9bf5b894bf31406f9..087bd9f902ae176a61d5d4596a666f7c955957b3 100644 (file)
@@ -561,7 +561,7 @@ typedef enum pa_autoload_type {
 typedef struct pa_autoload_info {
     uint32_t index;               /**< Index of this autoload entry */
     const char *name;             /**< Name of the sink or source */
-    pa_autoload_type_t type;   /**< Type of the autoload entry */
+    pa_autoload_type_t type;      /**< Type of the autoload entry */
     const char *module;           /**< Module name to load */
     const char *argument;         /**< Argument string for module */
 } pa_autoload_info;
index 39d533033e7f1757e7da19522f438d89f147f0fb..c23ef238a412dab26a2fe871302084295a34f780 100644 (file)
@@ -168,9 +168,19 @@ int pa_proplist_get(pa_proplist *p, const char *key, const void **data, size_t *
 
 /** Update mode enum for pa_proplist_update(). \since 0.9.11 */
 typedef enum pa_update_mode {
-    PA_UPDATE_SET,  /*< Replace the entirey property list with the new one. Don't keep any of the old data around */
-    PA_UPDATE_MERGE, /*< Merge new property list into the existing one, not replacing any old entries if they share a common key with the new property list. */
-    PA_UPDATE_REPLACE /*< Merge new property list into the existing one, replacing all old entries that share a common key with  the new property list. */
+    PA_UPDATE_SET,
+    /*< Replace the entirey property list with the new one. Don't keep
+     *  any of the old data around */
+
+    PA_UPDATE_MERGE,
+    /*< Merge new property list into the existing one, not replacing
+     *  any old entries if they share a common key with the new
+     *  property list. */
+
+    PA_UPDATE_REPLACE
+    /*< Merge new property list into the existing one, replacing all
+     *  old entries that share a common key with the new property
+     *  list. */
 } pa_update_mode_t;
 
 /** Merge property list "other" into "p", adhering the merge mode as
index 2680cf7ed8e2b1685393503805f1c41809ca501c..3f1b2fcf33ed5c7319346b03061db6319af7f5bf 100644 (file)
@@ -120,17 +120,38 @@ PA_C_DECL_BEGIN
 
 /** Sample format */
 typedef enum pa_sample_format {
-    PA_SAMPLE_U8,              /**< Unsigned 8 Bit PCM */
-    PA_SAMPLE_ALAW,            /**< 8 Bit a-Law */
-    PA_SAMPLE_ULAW,            /**< 8 Bit mu-Law */
-    PA_SAMPLE_S16LE,           /**< Signed 16 Bit PCM, little endian (PC) */
-    PA_SAMPLE_S16BE,           /**< Signed 16 Bit PCM, big endian */
-    PA_SAMPLE_FLOAT32LE,       /**< 32 Bit IEEE floating point, little endian, range -1 to 1 */
-    PA_SAMPLE_FLOAT32BE,       /**< 32 Bit IEEE floating point, big endian, range -1 to 1 */
-    PA_SAMPLE_S32LE,           /**< Signed 32 Bit PCM, little endian (PC) */
-    PA_SAMPLE_S32BE,           /**< Signed 32 Bit PCM, big endian (PC) */
-    PA_SAMPLE_MAX,             /**< Upper limit of valid sample types */
-    PA_SAMPLE_INVALID = -1     /**< An invalid value */
+    PA_SAMPLE_U8,
+    /**< Unsigned 8 Bit PCM */
+
+    PA_SAMPLE_ALAW,
+    /**< 8 Bit a-Law */
+
+    PA_SAMPLE_ULAW,
+    /**< 8 Bit mu-Law */
+
+    PA_SAMPLE_S16LE,
+    /**< Signed 16 Bit PCM, little endian (PC) */
+
+    PA_SAMPLE_S16BE,
+    /**< Signed 16 Bit PCM, big endian */
+
+    PA_SAMPLE_FLOAT32LE,
+    /**< 32 Bit IEEE floating point, little endian, range -1 to 1 */
+
+    PA_SAMPLE_FLOAT32BE,
+    /**< 32 Bit IEEE floating point, big endian, range -1 to 1 */
+
+    PA_SAMPLE_S32LE,
+    /**< Signed 32 Bit PCM, little endian (PC) */
+
+    PA_SAMPLE_S32BE,
+    /**< Signed 32 Bit PCM, big endian (PC) */
+
+    PA_SAMPLE_MAX,
+    /**< Upper limit of valid sample types */
+
+    PA_SAMPLE_INVALID = -1
+    /**< An invalid value */
 } pa_sample_format_t;
 
 #ifdef WORDS_BIGENDIAN
@@ -164,11 +185,29 @@ typedef enum pa_sample_format {
 /** A Shortcut for PA_SAMPLE_FLOAT32NE */
 #define PA_SAMPLE_FLOAT32 PA_SAMPLE_FLOAT32NE
 
+/** \cond fulldocs */
+/* Allow clients to check with #ifdef for thse sample formats */
+#define PA_SAMPLE_U8 PA_SAMPLE_U8
+#define PA_SAMPLE_ALAW PA_SAMPLE_ALAW
+#define PA_SAMPLE_ULAW PA_SAMPLE_ULAW
+#define PA_SAMPLE_S16LE PA_SAMPLE_S16LE
+#define PA_SAMPLE_S16BE PA_SAMPLE_S16BE
+#define PA_SAMPLE_FLOAT32LE PA_SAMPLE_FLOAT32LE
+#define PA_SAMPLE_FLOAT32BE PA_SAMPLE_FLOAT32BE
+#define PA_SAMPLE_S32LE PA_SAMPLE_S32LE
+#define PA_SAMPLE_S32BE PA_SAMPLE_S32BE
+/** \endcond */
+
 /** A sample format and attribute specification */
 typedef struct pa_sample_spec {
-    pa_sample_format_t format;     /**< The sample format */
-    uint32_t rate;                 /**< The sample rate. (e.g. 44100) */
-    uint8_t channels;              /**< Audio channels. (1 for mono, 2 for stereo, ...) */
+    pa_sample_format_t format;
+    /**< The sample format */
+
+    uint32_t rate;
+    /**< The sample rate. (e.g. 44100) */
+
+    uint8_t channels;
+    /**< Audio channels. (1 for mono, 2 for stereo, ...) */
 } pa_sample_spec;
 
 /** Type for usec specifications (unsigned). Always 64 bit. */
@@ -183,10 +222,14 @@ size_t pa_frame_size(const pa_sample_spec *spec) PA_GCC_PURE;
 /** Return the size of a sample with the specific sample type */
 size_t pa_sample_size(const pa_sample_spec *spec) PA_GCC_PURE;
 
-/** Calculate the time the specified bytes take to play with the specified sample type */
+/** Calculate the time the specified bytes take to play with the
+ * specified sample type. The return value will always be rounded
+ * down for non-integral return values. */
 pa_usec_t pa_bytes_to_usec(uint64_t length, const pa_sample_spec *spec) PA_GCC_PURE;
 
-/** Calculates the number of bytes that are required for the specified time. \since 0.9 */
+/** Calculates the number of bytes that are required for the specified
+ * time. The return value will always be rounded down for non-integral
+ * return values. \since 0.9 */
 size_t pa_usec_to_bytes(pa_usec_t t, const pa_sample_spec *spec) PA_GCC_PURE;
 
 /** Return non-zero when the sample type specification is valid */
index 51160ad7264646178a545b82a8aba69053e13fe9..79e39ebbc9782caf5bcdce776406fc20a3d82ce8 100644 (file)
@@ -272,7 +272,7 @@ int pa_simple_write(pa_simple *p, const void*data, size_t length, int *rerror) {
         if (l > length)
             l = length;
 
-        r = pa_stream_write(p->stream, data, l, NULL, 0, PA_SEEK_RELATIVE);
+        r = pa_stream_write(p->stream, data, l, NULL, 0LL, PA_SEEK_RELATIVE);
         CHECK_SUCCESS_GOTO(p, rerror, r >= 0, unlock_and_fail);
 
         data = (const uint8_t*) data + l;
index 536a82cea75c3f951326a1f034be4b02bdde73dc..d0c7d67e52ba65aee4751ee780aa7dfd643aba94 100644 (file)
@@ -886,7 +886,8 @@ static int create_stream(
                                               PA_STREAM_VARIABLE_RATE|
                                               PA_STREAM_PEAK_DETECT|
                                               PA_STREAM_START_MUTED|
-                                              PA_STREAM_ADJUST_LATENCY)), PA_ERR_INVALID);
+                                              PA_STREAM_ADJUST_LATENCY|
+                                              PA_STREAM_EARLY_REQUESTS)), PA_ERR_INVALID);
 
     PA_CHECK_VALIDITY(s->context, s->context->version >= 12 || !(flags & PA_STREAM_VARIABLE_RATE), PA_ERR_NOTSUPPORTED);
     PA_CHECK_VALIDITY(s->context, s->context->version >= 13 || !(flags & PA_STREAM_PEAK_DETECT), PA_ERR_NOTSUPPORTED);
@@ -899,6 +900,7 @@ static int create_stream(
     PA_CHECK_VALIDITY(s->context, direction == PA_STREAM_RECORD || !(flags & (PA_STREAM_PEAK_DETECT)), PA_ERR_INVALID);
     PA_CHECK_VALIDITY(s->context, !volume || volume->channels == s->sample_spec.channels, PA_ERR_INVALID);
     PA_CHECK_VALIDITY(s->context, !sync_stream || (direction == PA_STREAM_PLAYBACK && sync_stream->direction == PA_STREAM_PLAYBACK), PA_ERR_INVALID);
+    PA_CHECK_VALIDITY(s->context, (flags & (PA_STREAM_ADJUST_LATENCY|PA_STREAM_EARLY_REQUESTS)) != (PA_STREAM_ADJUST_LATENCY|PA_STREAM_EARLY_REQUESTS), PA_ERR_INVALID);
 
     pa_stream_ref(s);
 
@@ -997,13 +999,12 @@ static int create_stream(
             pa_tagstruct_putu32(t, s->direct_on_input);
     }
 
-    if (s->context->version >= 14 &&
-        s->direction == PA_STREAM_PLAYBACK) {
+    if (s->context->version >= 14) {
 
-        pa_tagstruct_put(
-                t,
-                PA_TAG_BOOLEAN, volume_set,
-                PA_TAG_INVALID);
+        if (s->direction == PA_STREAM_PLAYBACK)
+            pa_tagstruct_put_boolean(t, volume_set);
+
+        pa_tagstruct_put_boolean(t, flags & PA_STREAM_EARLY_REQUESTS);
     }
 
     pa_pstream_send_tagstruct(s->context->pstream, t);
@@ -1962,7 +1963,7 @@ const pa_timing_info* pa_stream_get_timing_info(pa_stream *s) {
 
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
     PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
-    PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->timing_info_valid, PA_ERR_BADSTATE);
+    PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->timing_info_valid, PA_ERR_NODATA);
 
     return &s->timing_info;
 }
@@ -2079,6 +2080,9 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr
     if (s->context->version >= 13)
         pa_tagstruct_put_boolean(t, !!(s->flags & PA_STREAM_ADJUST_LATENCY));
 
+    if (s->context->version >= 14)
+        pa_tagstruct_put_boolean(t, !!(s->flags & PA_STREAM_EARLY_REQUESTS));
+
     pa_pstream_send_tagstruct(s->context->pstream, t);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_set_buffer_attr_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
index 2a8f7a8b1f601e7887c72a5e772dab65f7627be0..6cb363c8b1a9c343fde31eec9651d3e583b8ac34 100644 (file)
@@ -473,7 +473,7 @@ void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, vo
 
 /** Set the callback function that is called when a the server starts
  * playback after an underrun or on initial startup. This only informs
- * that audio is flowing again, it is no indication that audio startet
+ * that audio is flowing again, it is no indication that audio started
  * to reach the speakers already. (Only for playback streams). \since
  * 0.9.11 */
 void pa_stream_set_started_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
index 91aa9c815b32fe3b9e2545f066b265f913634043..7671be464cb16b2e058df475ae04abb586f1b40e 100644 (file)
 
 #define FILTER_CHAR '_'
 
-static inline int is_unicode_valid(uint32_t ch) {
+static inline pa_bool_t is_unicode_valid(uint32_t ch) {
 
     if (ch >= 0x110000) /* End of unicode space */
-        return 0;
+        return FALSE;
     if ((ch & 0xFFFFF800) == 0xD800) /* Reserved area for UTF-16 */
-        return 0;
+        return FALSE;
     if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) /* Reserved */
-        return 0;
+        return FALSE;
     if ((ch & 0xFFFE) == 0xFFFE) /* BOM (Byte Order Mark) */
-        return 0;
+        return FALSE;
 
-    return 1;
+    return TRUE;
 }
 
-static inline int is_continuation_char(uint8_t ch) {
+static inline pa_bool_t is_continuation_char(uint8_t ch) {
     if ((ch & 0xc0) != 0x80) /* 10xxxxxx */
-        return 0;
-    return 1;
+        return FALSE;
+    return TRUE;
 }
 
 static inline void merge_continuation_char(uint32_t *u_ch, uint8_t ch) {
index 768bf49c2a40a27cc3b2b9bcfbcb836132f620dc..15938cbc74ec7baa42fd67ffff3e324904913aab 100644 (file)
@@ -122,7 +122,7 @@ double pa_sw_volume_to_linear(pa_volume_t v) {
     if (v == PA_VOLUME_MUTED)
         return 0;
 
-    return pow(10, pa_sw_volume_to_dB(v)/20);
+    return pow(10.0, pa_sw_volume_to_dB(v)/20.0);
 }
 
 char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) {
index a356f749ac038a73b7d440bc882a827ed4630a14..d612c7f91b87c5cef8c673e08e9d3d87ef77100f 100644 (file)
@@ -62,7 +62,7 @@
  *
  * The functions described above are only valid when used with
  * software volumes. Hence it is usually a better idea to treat all
- * volume values as opaque with a range from PA_VOLUME_MUTE (0%) to
+ * volume values as opaque with a range from PA_VOLUME_MUTED (0%) to
  * PA_VOLUME_NORM (100%) and to refrain from any calculations with
  * them.
  *
index d1138d65889e79d7048fb5b4c3479f861212b41c..c570e40f635b235467487bc53076a0a781729aa0 100644 (file)
@@ -36,7 +36,7 @@
 #include "xmalloc.h"
 
 /* Make sure not to allocate more than this much memory. */
-#define MAX_ALLOC_SIZE (1024*1024*20) /* 20MB */
+#define MAX_ALLOC_SIZE (1024*1024*96) /* 96MB */
 
 /* #undef malloc */
 /* #undef free */
@@ -46,7 +46,7 @@
 
 static void oom(void) PA_GCC_NORETURN;
 
-/** called in case of an OOM situation. Prints an error message and
+/* called in case of an OOM situation. Prints an error message and
  * exits */
 static void oom(void) {
     static const char e[] = "Not enough memory\n";
index c453138b7cde77c9d95abacbd056ddd16c199a05..b2643588df8d4682fed10e1a3c20ba63f1aa0a79 100644 (file)
@@ -26,7 +26,9 @@
 #include <stdlib.h>
 #include <limits.h>
 #include <assert.h>
+
 #include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
 
 /** \file
  * Memory allocation functions.
 PA_C_DECL_BEGIN
 
 /** Allocate the specified number of bytes, just like malloc() does. However, in case of OOM, terminate */
-void* pa_xmalloc(size_t l);
+void* pa_xmalloc(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1);
 
 /** Same as pa_xmalloc(), but initialize allocated memory to 0 */
-void *pa_xmalloc0(size_t l);
+void *pa_xmalloc0(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1);
 
 /**  The combination of pa_xmalloc() and realloc() */
-void *pa_xrealloc(void *ptr, size_t size);
+void *pa_xrealloc(void *ptr, size_t size) PA_GCC_ALLOC_SIZE(2);
 
 /** Free allocated memory */
 void pa_xfree(void *p);
 
 /** Duplicate the specified string, allocating memory with pa_xmalloc() */
-char *pa_xstrdup(const char *s);
+char *pa_xstrdup(const char *s) PA_GCC_MALLOC;
 
 /** Duplicate the specified string, but truncate after l characters */
-char *pa_xstrndup(const char *s, size_t l);
+char *pa_xstrndup(const char *s, size_t l) PA_GCC_MALLOC;
 
 /** Duplicate the specified memory block */
-void* pa_xmemdup(const void *p, size_t l);
+void* pa_xmemdup(const void *p, size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(2);
 
 /** Internal helper for pa_xnew() */
-static inline void* pa_xnew_internal(unsigned n, size_t k) {
+static void* _pa_xnew_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2);
+
+static inline void* _pa_xnew_internal(size_t n, size_t k) {
     assert(n < INT_MAX/k);
     return pa_xmalloc(n*k);
 }
 
 /** Allocate n new structures of the specified type. */
-#define pa_xnew(type, n) ((type*) pa_xnew_internal((n), sizeof(type)))
+#define pa_xnew(type, n) ((type*) _pa_xnew_internal((n), sizeof(type)))
 
 /** Internal helper for pa_xnew0() */
-static inline void* pa_xnew0_internal(unsigned n, size_t k) {
+static void* _pa_xnew0_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2);
+
+static inline void* _pa_xnew0_internal(size_t n, size_t k) {
     assert(n < INT_MAX/k);
     return pa_xmalloc0(n*k);
 }
 
 /** Same as pa_xnew() but set the memory to zero */
-#define pa_xnew0(type, n) ((type*) pa_xnew0_internal((n), sizeof(type)))
+#define pa_xnew0(type, n) ((type*) _pa_xnew0_internal((n), sizeof(type)))
 
 /** Internal helper for pa_xnew0() */
-static inline void* pa_xnewdup_internal(const void *p, unsigned n, size_t k) {
+static void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3);
+
+static inline void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) {
     assert(n < INT_MAX/k);
     return pa_xmemdup(p, n*k);
 }
 
 /** Same as pa_xnew() but set the memory to zero */
-#define pa_xnewdup(type, p, n) ((type*) pa_xnewdup_internal((p), (n), sizeof(type)))
+#define pa_xnewdup(type, p, n) ((type*) _pa_xnewdup_internal((p), (n), sizeof(type)))
 
 PA_C_DECL_END
 
index a91c4d56ab16004dfd3e584176fa99f6accc650e..9c58c661e59ba31bc39be82af90d0c92cae19659 100644 (file)
@@ -23,6 +23,8 @@
   USA.
 ***/
 
+#include <pulsecore/macro.h>
+
 /*
  * atomic_ops guarantees us that sizeof(AO_t) == sizeof(void*).  It is
  * not guaranteed however, that sizeof(AO_t) == sizeof(size_t).
@@ -35,7 +37,7 @@
  * On gcc >= 4.1 we use the builtin atomic functions. otherwise we use
  * libatomic_ops
  */
-#
+
 #ifndef PACKAGE
 #error "Please include config.h before including this file!"
 #endif
@@ -80,8 +82,8 @@ static inline int pa_atomic_dec(pa_atomic_t *a) {
     return pa_atomic_sub(a, 1);
 }
 
-/* Returns non-zero when the operation was successful. */
-static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
+/* Returns TRUE when the operation was successful. */
+static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
     return __sync_bool_compare_and_swap(&a->value, old_i, new_i);
 }
 
@@ -101,13 +103,13 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) {
     __sync_synchronize();
 }
 
-static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
+static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
     return __sync_bool_compare_and_swap(&a->value, (long) old_p, (long) new_p);
 }
 
 #elif defined(__GNUC__) && (defined(__amd64__) || defined(__x86_64__))
 
-#error "The native atomic operations implementation for AMD64 has not been tested. libatomic_ops is known to not work properly on AMD64 and your gcc version is too old for the gcc-builtin atomic ops support. You have three options now: make the native atomic operations implementation for AMD64 work, fix libatomic_ops, or upgrade your GCC."
+#warn "The native atomic operations implementation for AMD64 has not been tested thoroughly. libatomic_ops is known to not work properly on AMD64 and your gcc version is too old for the gcc-builtin atomic ops support. You have three options now: test the native atomic operations implementation for AMD64, fix libatomic_ops, or upgrade your GCC."
 
 /* Addapted from glibc */
 
@@ -147,14 +149,14 @@ static inline int pa_atomic_dec(pa_atomic_t *a) {
     return pa_atomic_sub(a, 1);
 }
 
-static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
+static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
     int result;
 
     __asm__ __volatile__ ("lock; cmpxchgl %2, %1"
                           : "=a" (result), "=m" (a->value)
                           : "r" (new_i), "m" (a->value), "0" (old_i));
 
-    return result == oldval;
+    return result == old_i;
 }
 
 typedef struct pa_atomic_ptr {
@@ -171,14 +173,14 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) {
     a->value = (unsigned long) p;
 }
 
-static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
+static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
     void *result;
 
     __asm__ __volatile__ ("lock; cmpxchgq %q2, %1"
                           : "=a" (result), "=m" (a->value)
                           : "r" (new_p), "m" (a->value), "0" (old_p));
 
-    return result;
+    return result == old_p;
 }
 
 #elif defined(ATOMIC_ARM_INLINE_ASM)
@@ -255,7 +257,7 @@ static inline int pa_atomic_dec(pa_atomic_t *a) {
     return pa_atomic_sub(a, 1);
 }
 
-static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
+static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
     unsigned long not_equal, not_exclusive;
 
     pa_memory_barrier();
@@ -289,7 +291,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) {
     pa_memory_barrier();
 }
 
-static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
+static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
     unsigned long not_equal, not_exclusive;
 
     pa_memory_barrier();
@@ -377,8 +379,8 @@ static inline int pa_atomic_dec(pa_atomic_t *a) {
     return pa_atomic_sub(a, 1);
 }
 
-/* Returns non-zero when the operation was successful. */
-static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
+/* Returns TRUE when the operation was successful. */
+static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
     pa_bool_t failed;
     do {
       failed = !!__kernel_cmpxchg(old_i, new_i, &a->value);
@@ -402,7 +404,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) {
     pa_memory_barrier();
 }
 
-static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
+static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
     pa_bool_t failed;
     do {
         failed = !!__kernel_cmpxchg_u((unsigned long) old_p, (unsigned long) new_p, &a->value);
@@ -420,7 +422,7 @@ typedef struct pa_atomic {
     volatile AO_t value;
 } pa_atomic_t;
 
-#define PA_ATOMIC_INIT(v) { .value = (v) }
+#define PA_ATOMIC_INIT(v) { .value = (AO_t) (v) }
 
 static inline int pa_atomic_load(const pa_atomic_t *a) {
     return (int) AO_load_full((AO_t*) &a->value);
@@ -431,23 +433,23 @@ static inline void pa_atomic_store(pa_atomic_t *a, int i) {
 }
 
 static inline int pa_atomic_add(pa_atomic_t *a, int i) {
-    return AO_fetch_and_add_full(&a->value, (AO_t) i);
+    return (int) AO_fetch_and_add_full(&a->value, (AO_t) i);
 }
 
 static inline int pa_atomic_sub(pa_atomic_t *a, int i) {
-    return AO_fetch_and_add_full(&a->value, (AO_t) -i);
+    return (int) AO_fetch_and_add_full(&a->value, (AO_t) -i);
 }
 
 static inline int pa_atomic_inc(pa_atomic_t *a) {
-    return AO_fetch_and_add1_full(&a->value);
+    return (int) AO_fetch_and_add1_full(&a->value);
 }
 
 static inline int pa_atomic_dec(pa_atomic_t *a) {
-    return AO_fetch_and_sub1_full(&a->value);
+    return (int) AO_fetch_and_sub1_full(&a->value);
 }
 
-static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
-    return AO_compare_and_swap_full(&a->value, old_i, new_i);
+static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
+    return AO_compare_and_swap_full(&a->value, (unsigned long) old_i, (unsigned long) new_i);
 }
 
 typedef struct pa_atomic_ptr {
@@ -464,7 +466,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) {
     AO_store_full(&a->value, (AO_t) p);
 }
 
-static inline int pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
+static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) {
     return AO_compare_and_swap_full(&a->value, (AO_t) old_p, (AO_t) new_p);
 }
 
index f3f40f8004d5d6aba3f16b598d435ebb374bb351..b122feeeb44c9663f0425ffc56ce7e437fcc903c 100644 (file)
@@ -54,8 +54,8 @@ static int generate(int fd, void *ret_data, size_t length) {
 
     pa_random(ret_data, length);
 
-    lseek(fd, 0, SEEK_SET);
-    (void) ftruncate(fd, 0);
+    lseek(fd, (off_t) 0, SEEK_SET);
+    (void) ftruncate(fd, (off_t) 0);
 
     if ((r = pa_loop_write(fd, ret_data, length, NULL)) < 0 || (size_t) r != length) {
         pa_log("Failed to write cookie file: %s", pa_cstrerror(errno));
@@ -88,7 +88,7 @@ static int load(const char *fn, void *data, size_t length) {
     if ((fd = open(fn, O_RDWR|O_CREAT|O_BINARY|O_NOCTTY, S_IRUSR|S_IWUSR)) < 0) {
 
         if (errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY|O_NOCTTY)) < 0) {
-            pa_log("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
+            pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
             goto finish;
         } else
             writable = 0;
@@ -105,7 +105,7 @@ static int load(const char *fn, void *data, size_t length) {
         pa_log_debug("Got %d bytes from cookie file '%s', expected %d", (int) r, fn, (int) length);
 
         if (!writable) {
-            pa_log("Unable to write cookie to read only file");
+            pa_log_warn("Unable to write cookie to read-only file");
             goto finish;
         }
 
@@ -140,7 +140,7 @@ int pa_authkey_load(const char *path, void *data, size_t length) {
     pa_assert(length > 0);
 
     if ((ret = load(path, data, length)) < 0)
-        pa_log("Failed to load authorization key '%s': %s", path, (ret < 0) ? pa_cstrerror(errno) : "File corrupt");
+        pa_log_warn("Failed to load authorization key '%s': %s", path, (ret < 0) ? pa_cstrerror(errno) : "File corrupt");
 
     return ret;
 }
@@ -206,7 +206,7 @@ int pa_authkey_save(const char *fn, const void *data, size_t length) {
         return -2;
 
     if ((fd = open(p, O_RDWR|O_CREAT|O_NOCTTY, S_IRUSR|S_IWUSR)) < 0) {
-        pa_log("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
+        pa_log_warn("Failed to open cookie file '%s': %s", fn, pa_cstrerror(errno));
         goto finish;
     }
 
index 41a3104266970370f08775d3ff891362b9d030e8..ad00f4f43519c4904fcb3e45e625470fe014ddbc 100644 (file)
@@ -398,7 +398,15 @@ int pa_close(int fd) {
     }
 #endif
 
-    return close(fd);
+    for (;;) {
+        int r;
+
+        if ((r = close(fd)) >= 0)
+            return r;
+
+        if (errno != EINTR)
+            return r;
+    }
 }
 
 /* Print a warning messages in case that the given signal is not
@@ -2041,7 +2049,7 @@ void *pa_will_need(const void *p, size_t l) {
         return (void*) p;
     }
 
-    bs = PA_PAGE_ALIGN(rlim.rlim_cur);
+    bs = PA_PAGE_ALIGN((size_t) rlim.rlim_cur);
 #else
     bs = PA_PAGE_SIZE*4;
 #endif
@@ -2383,18 +2391,29 @@ char *pa_machine_id(void) {
     FILE *f;
     size_t l;
 
+    /* The returned value is supposed be some kind of ascii identifier
+     * that is unique and stable across reboots. */
+
+    /* First we try the D-Bus UUID, which is the best option we have,
+     * since it fits perfectly our needs and is not as volatile as the
+     * hostname which might be set from dhcp. */
+
     if ((f = fopen(PA_MACHINE_ID, "r"))) {
         char ln[34] = "", *r;
 
         r = fgets(ln, sizeof(ln)-1, f);
         fclose(f);
 
-        if (r)
-            return pa_xstrdup(pa_strip_nl(ln));
+        pa_strip_nl(ln);
+
+        if (ln[0])
+            return pa_xstrdup(ln);
     }
 
-    l = 100;
+    /* The we fall back to the host name. It supposed to be somewhat
+     * unique, at least in a network, but may change. */
 
+    l = 100;
     for (;;) {
         char *c;
 
@@ -2402,17 +2421,18 @@ char *pa_machine_id(void) {
 
         if (!pa_get_host_name(c, l)) {
 
-            if (errno == EINVAL || errno == ENAMETOOLONG) {
+            if (errno != EINVAL && errno != ENAMETOOLONG)
+                break;
+
+        } else if (strlen(c) < l-1) {
+
+            if (*c == 0) {
                 pa_xfree(c);
-                l *= 2;
-                continue;
+                break;
             }
 
-            return NULL;
-        }
-
-        if (strlen(c) < l-1)
             return c;
+        }
 
         /* Hmm, the hostname is as long the space we offered the
          * function, we cannot know if it fully fit in, so let's play
@@ -2421,4 +2441,9 @@ char *pa_machine_id(void) {
         pa_xfree(c);
         l *= 2;
     }
+
+    /* If no hostname was set we use the POSIX hostid. It's usually
+     * the IPv4 address.  Mit not be that stable. */
+    return pa_sprintf_malloc("%08lx", (unsigned long) gethostid);
+
 }
index 7167972bffebb849613bc9e259cfee49e2cc39e7..c9e307f5da131ea2efb5ee691ed5a5cb02c7a83d 100644 (file)
@@ -142,29 +142,35 @@ static inline int pa_is_power_of_two(unsigned n) {
     return !(n & (n - 1));
 }
 
-static inline unsigned pa_make_power_of_two(unsigned n) {
-    unsigned j = n;
+static inline unsigned pa_ulog2(unsigned n) {
 
-    if (pa_is_power_of_two(n))
-        return n;
+    if (n <= 1)
+        return 0;
 
-    while (j) {
-        j = j >> 1;
-        n = n | j;
-    }
+#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+    return 8U * (unsigned) sizeof(unsigned) - (unsigned) __builtin_clz(n) - 1;
+#else
+{
+    unsigned r = 0;
 
-    return n + 1;
-}
+    for (;;) {
+        n = n >> 1;
 
-static inline unsigned pa_ulog2(unsigned n) {
-    unsigned r = 0;
+        if (!n)
+            return r;
 
-    while (n) {
         r++;
-        n = n >> 1;
     }
+}
+#endif
+}
+
+static inline unsigned pa_make_power_of_two(unsigned n) {
+
+    if (pa_is_power_of_two(n))
+        return n;
 
-    return r;
+    return 1U << (pa_ulog2(n) + 1);
 }
 
 void pa_close_pipe(int fds[2]);
index 5eda4f655d437beb88b89ddb717027f23747bccf..d73180815d4e18e1b35d1197f32a101799601fdb 100644 (file)
 #include <pulse/utf8.h>
 #include <pulse/xmalloc.h>
 #include <pulse/util.h>
+#include <pulse/timeval.h>
 
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
+#include <pulsecore/rtclock.h>
+#include <pulsecore/once.h>
 
 #include "log.h"
 
 #define ENV_LOGLEVEL "PULSE_LOG"
 #define ENV_LOGMETA "PULSE_LOG_META"
+#define ENV_LOGTIME "PULSE_LOG_TIME"
 
 static char *log_ident = NULL, *log_ident_local = NULL;
 static pa_log_target_t log_target = PA_LOG_STDERR;
-static void (*user_log_func)(pa_log_level_t l, const char *s) = NULL;
-static pa_log_level_t maximal_level = PA_LOG_NOTICE;
+static pa_log_func_t user_log_func = NULL;
+static pa_log_level_t maximal_level = PA_LOG_ERROR;
 
 #ifdef HAVE_SYSLOG_H
 static const int level_to_syslog[] = {
@@ -91,7 +95,7 @@ void pa_log_set_maximal_level(pa_log_level_t l) {
     maximal_level = l;
 }
 
-void pa_log_set_target(pa_log_target_t t, void (*func)(pa_log_level_t l, const char*s)) {
+void pa_log_set_target(pa_log_target_t t, pa_log_func_t func) {
     pa_assert(t == PA_LOG_USER || !func);
 
     log_target = t;
@@ -112,7 +116,7 @@ void pa_log_levelv_meta(
 
     /* We don't use dynamic memory allocation here to minimize the hit
      * in RT threads */
-    char text[1024], location[128];
+    char text[1024], location[128], timestamp[32];
 
     pa_assert(level < PA_LOG_LEVEL_MAX);
     pa_assert(format);
@@ -134,6 +138,33 @@ void pa_log_levelv_meta(
     else
         location[0] = 0;
 
+    if (getenv(ENV_LOGTIME)) {
+        static pa_usec_t start, last;
+        pa_usec_t u, a, r;
+
+        u = pa_rtclock_usec();
+
+        PA_ONCE_BEGIN {
+            start = u;
+            last = u;
+        } PA_ONCE_END;
+
+        r = u - last;
+        a = u - start;
+
+        /* This is not thread safe, but this is a debugging tool only
+         * anyway. */
+        last = u;
+
+        pa_snprintf(timestamp, sizeof(timestamp), "(%4llu.%03llu|%4llu.%03llu) ",
+                    (unsigned long long) (a / PA_USEC_PER_SEC),
+                    (unsigned long long) (((a / PA_USEC_PER_MSEC)) % 1000),
+                    (unsigned long long) (r / PA_USEC_PER_SEC),
+                    (unsigned long long) (((r / PA_USEC_PER_MSEC)) % 1000));
+
+    } else
+        timestamp[0] = 0;
+
     if (!pa_utf8_valid(text))
         pa_log_level(level, __FILE__": invalid UTF-8 string following below:");
 
@@ -168,9 +199,9 @@ void pa_log_levelv_meta(
                  * minimize the hit in RT threads */
                 local_t = pa_utf8_to_locale(t);
                 if (!local_t)
-                    fprintf(stderr, "%c: %s%s%s%s\n", level_to_char[level], location, prefix, t, suffix);
+                    fprintf(stderr, "%s%c: %s%s%s%s\n", timestamp, level_to_char[level], location, prefix, t, suffix);
                 else {
-                    fprintf(stderr, "%c: %s%s%s%s\n", level_to_char[level], location, prefix, local_t, suffix);
+                    fprintf(stderr, "%s%c: %s%s%s%s\n", timestamp, level_to_char[level], location, prefix, local_t, suffix);
                     pa_xfree(local_t);
                 }
 
@@ -185,9 +216,9 @@ void pa_log_levelv_meta(
 
                 local_t = pa_utf8_to_locale(t);
                 if (!local_t)
-                    syslog(level_to_syslog[level], "%s%s", location, t);
+                    syslog(level_to_syslog[level], "%s%s%s", timestamp, location, t);
                 else {
-                    syslog(level_to_syslog[level], "%s%s", location, local_t);
+                    syslog(level_to_syslog[level], "%s%s%s", timestamp, location, local_t);
                     pa_xfree(local_t);
                 }
 
@@ -199,7 +230,7 @@ void pa_log_levelv_meta(
             case PA_LOG_USER: {
                 char x[1024];
 
-                pa_snprintf(x, sizeof(x), "%s%s", location, t);
+                pa_snprintf(x, sizeof(x), "%s%s%s", timestamp, location, t);
                 user_log_func(level, x);
 
                 break;
index 2047696e5bb59f67d54cf98c04baab5ffc2d83d8..633227f306eb7bdae9efb3c272d71659d94bdd54 100644 (file)
@@ -49,8 +49,10 @@ typedef enum pa_log_level {
 /* Set an identification for the current daemon. Used when logging to syslog. */
 void pa_log_set_ident(const char *p);
 
+typedef void (*pa_log_func_t)(pa_log_level_t t, const char*s);
+
 /* Set another log target. If t is PA_LOG_USER you may specify a function that is called every log string */
-void pa_log_set_target(pa_log_target_t t, void (*func)(pa_log_level_t t, const char*s));
+void pa_log_set_target(pa_log_target_t t, pa_log_func_t func);
 
 /* Minimal log level */
 void pa_log_set_maximal_level(pa_log_level_t l);
index 4b9450f6cc77ee72b5b3709c0193beaa10438b89..31f908dfc2a6fe44d46513a4110617484e550a36 100644 (file)
@@ -155,7 +155,7 @@ void pa_memblockq_set_maxlength(pa_memblockq *memblockq, size_t maxlength); /* m
 void pa_memblockq_set_tlength(pa_memblockq *memblockq, size_t tlength); /* might modify minreq, too */
 void pa_memblockq_set_prebuf(pa_memblockq *memblockq, size_t prebuf); /* might modify minreq, too */
 void pa_memblockq_set_minreq(pa_memblockq *memblockq, size_t minreq);
-void pa_memblockq_set_maxrewind(pa_memblockq *memblockq, size_t rewind); /* Set the maximum history size */
+void pa_memblockq_set_maxrewind(pa_memblockq *memblockq, size_t maxrewind); /* Set the maximum history size */
 void pa_memblockq_set_silence(pa_memblockq *memblockq, pa_memchunk *silence);
 
 /* Call pa_memchunk_willneed() for every chunk in the queue from the current read pointer to the end */
index 29003af87713edcc6173eaed90135d1b10e6bb34..9b17cb91591e604cfc47d6a1ce935f2070c295c2 100644 (file)
@@ -59,7 +59,7 @@ static void timeout_callback(pa_mainloop_api *m, pa_time_event*e, const struct t
     pa_module_unload_unused(c);
 
     pa_gettimeofday(&ntv);
-    pa_timeval_add(&ntv, UNLOAD_POLL_TIME*1000000);
+    pa_timeval_add(&ntv, UNLOAD_POLL_TIME*PA_USEC_PER_SEC);
     m->time_restart(e, &ntv);
 }
 
@@ -124,7 +124,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
     if (m->auto_unload && !c->module_auto_unload_event) {
         struct timeval ntv;
         pa_gettimeofday(&ntv);
-        pa_timeval_add(&ntv, UNLOAD_POLL_TIME*1000000);
+        pa_timeval_add(&ntv, UNLOAD_POLL_TIME*PA_USEC_PER_SEC);
         c->module_auto_unload_event = c->mainloop->time_new(c->mainloop, &ntv, timeout_callback, c);
     }
 
index 7dcfa2eb291b02cb5fd73b0876ddef18d417bbee..2ee4fc31ff42cf76766fcaa315862957148f4e75 100644 (file)
@@ -42,7 +42,7 @@ struct pa_object {
 pa_object *pa_object_new_internal(size_t size, const char *type_name, int (*check_type)(const char *type_name));
 #define pa_object_new(type) ((type*) pa_object_new_internal(sizeof(type), #type, type##_check_type)
 
-#define pa_object_free ((void (*) (pa_object* o)) pa_xfree)
+#define pa_object_free ((void (*) (pa_object* _obj)) pa_xfree)
 
 int pa_object_check_type(const char *type);
 
index 1c0851baeb64c250739bb9a38decd2ad8c581549..ce8ef19bf1f043da1cf29e80e03509e71c14feb7 100644 (file)
@@ -235,7 +235,7 @@ int pa_pid_file_create(const char *procname) {
     }
 
     /* Overwrite the current PID file */
-    if (lseek(fd, 0, SEEK_SET) == (off_t) -1 || ftruncate(fd, 0) < 0) {
+    if (lseek(fd, (off_t) 0, SEEK_SET) == (off_t) -1 || ftruncate(fd, (off_t) 0) < 0) {
         pa_log("Failed to truncate PID file '%s': %s", fn, pa_cstrerror(errno));
         goto fail;
     }
@@ -288,7 +288,7 @@ int pa_pid_file_remove(void) {
         goto fail;
     }
 
-    if (ftruncate(fd, 0) < 0) {
+    if (ftruncate(fd, (off_t) 0) < 0) {
         pa_log_warn("Failed to truncate PID file '%s': %s", fn, pa_cstrerror(errno));
         goto fail;
     }
index d4694a059869d7d2de1112e2a0d1a1401b7db42d..6ccee571413ed5639ec0830201d21a269f5e47df 100644 (file)
@@ -469,44 +469,95 @@ static int record_stream_process_msg(pa_msgobject *o, int code, void*userdata, i
     return 0;
 }
 
-static void fix_record_buffer_attr_pre(record_stream *s, pa_bool_t adjust_latency, uint32_t *maxlength, uint32_t *fragsize) {
+static void fix_record_buffer_attr_pre(
+        record_stream *s,
+        pa_bool_t adjust_latency,
+        pa_bool_t early_requests,
+        uint32_t *maxlength,
+        uint32_t *fragsize) {
+
+    size_t frame_size;
+    pa_usec_t orig_fragsize_usec, fragsize_usec, source_usec;
+
     pa_assert(s);
     pa_assert(maxlength);
     pa_assert(fragsize);
 
+    frame_size = pa_frame_size(&s->source_output->sample_spec);
+
     if (*maxlength == (uint32_t) -1 || *maxlength > MAX_MEMBLOCKQ_LENGTH)
         *maxlength = MAX_MEMBLOCKQ_LENGTH;
     if (*maxlength <= 0)
-        *maxlength = (uint32_t) pa_frame_size(&s->source_output->sample_spec);
+        *maxlength = (uint32_t) frame_size;
 
     if (*fragsize == (uint32_t) -1)
         *fragsize = (uint32_t) pa_usec_to_bytes(DEFAULT_FRAGSIZE_MSEC*PA_USEC_PER_MSEC, &s->source_output->sample_spec);
     if (*fragsize <= 0)
-        *fragsize = (uint32_t) pa_frame_size(&s->source_output->sample_spec);
+        *fragsize = (uint32_t) frame_size;
+
+    orig_fragsize_usec = fragsize_usec = pa_bytes_to_usec(*fragsize, &s->source_output->sample_spec);
+
+    if (early_requests) {
 
-    if (adjust_latency) {
-        pa_usec_t fragsize_usec;
+        /* In early request mode we need to emulate the classic
+         * fragment-based playback model. We do this setting the source
+         * latency to the fragment size. */
+
+        source_usec = fragsize_usec;
+
+    } else if (adjust_latency) {
 
         /* So, the user asked us to adjust the latency according to
          * what the source can provide. Half the latency will be
          * spent on the hw buffer, half of it in the async buffer
          * queue we maintain for each client. */
 
-        fragsize_usec = pa_bytes_to_usec(*fragsize, &s->source_output->sample_spec);
+        source_usec = fragsize_usec/2;
+
+    } else {
+
+        /* Ok, the user didn't ask us to adjust the latency, hence we
+         * don't */
+
+        source_usec = 0;
+    }
+
+    if (source_usec > 0)
+        s->source_latency = pa_source_output_set_requested_latency(s->source_output, source_usec);
+    else
+        s->source_latency = 0;
+
+    if (early_requests) {
+
+        /* Ok, we didn't necessarily get what we were asking for, so
+         * let's tell the user */
 
-        s->source_latency = pa_source_output_set_requested_latency(s->source_output, fragsize_usec/2);
+        fragsize_usec = s->source_latency;
+
+    } else if (adjust_latency) {
+
+        /* Now subtract what we actually got */
 
         if (fragsize_usec >= s->source_latency*2)
             fragsize_usec -= s->source_latency;
         else
             fragsize_usec = s->source_latency;
+    }
+
+    if (pa_usec_to_bytes(orig_fragsize_usec, &s->source_output->sample_spec) !=
+        pa_usec_to_bytes(fragsize_usec, &s->source_output->sample_spec))
 
         *fragsize = (uint32_t) pa_usec_to_bytes(fragsize_usec, &s->source_output->sample_spec);
-    } else
-        s->source_latency = 0;
+
+    if (*fragsize <= 0)
+        *fragsize = (uint32_t) frame_size;
 }
 
-static void fix_record_buffer_attr_post(record_stream *s, uint32_t *maxlength, uint32_t *fragsize) {
+static void fix_record_buffer_attr_post(
+        record_stream *s,
+        uint32_t *maxlength,
+        uint32_t *fragsize) {
+
     size_t base;
 
     pa_assert(s);
@@ -538,7 +589,8 @@ static record_stream* record_stream_new(
         pa_source_output_flags_t flags,
         pa_proplist *p,
         pa_bool_t adjust_latency,
-        pa_sink_input *direct_on_input) {
+        pa_sink_input *direct_on_input,
+        pa_bool_t early_requests) {
 
     record_stream *s;
     pa_source_output *source_output;
@@ -584,7 +636,7 @@ static record_stream* record_stream_new(
     s->source_output->suspend = source_output_suspend_cb;
     s->source_output->userdata = s;
 
-    fix_record_buffer_attr_pre(s, adjust_latency, maxlength, fragsize);
+    fix_record_buffer_attr_pre(s, adjust_latency, early_requests, maxlength, fragsize);
 
     s->memblockq = pa_memblockq_new(
             0,
@@ -690,6 +742,8 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata,
         case PLAYBACK_STREAM_MESSAGE_UNDERFLOW: {
             pa_tagstruct *t;
 
+/*             pa_log("signalling underflow"); */
+
             /* Report that we're empty */
             t = pa_tagstruct_new(NULL, 0);
             pa_tagstruct_putu32(t, PA_COMMAND_UNDERFLOW);
@@ -734,9 +788,17 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata,
     return 0;
 }
 
-static void fix_playback_buffer_attr_pre(playback_stream *s, pa_bool_t adjust_latency, uint32_t *maxlength, uint32_t *tlength, uint32_t* prebuf, uint32_t* minreq) {
+static void fix_playback_buffer_attr_pre(
+        playback_stream *s,
+        pa_bool_t adjust_latency,
+        pa_bool_t early_requests,
+        uint32_t *maxlength,
+        uint32_t *tlength,
+        uint32_t* prebuf,
+        uint32_t* minreq) {
+
     size_t frame_size;
-    pa_usec_t tlength_usec, minreq_usec, sink_usec;
+    pa_usec_t orig_tlength_usec, tlength_usec, orig_minreq_usec, minreq_usec, sink_usec;
 
     pa_assert(s);
     pa_assert(maxlength);
@@ -752,26 +814,36 @@ static void fix_playback_buffer_attr_pre(playback_stream *s, pa_bool_t adjust_la
         *maxlength = (uint32_t) frame_size;
 
     if (*tlength == (uint32_t) -1)
-        *tlength = (uint32_t) pa_usec_to_bytes(DEFAULT_TLENGTH_MSEC*PA_USEC_PER_MSEC, &s->sink_input->sample_spec);
+        *tlength = (uint32_t) pa_usec_to_bytes_round_up(DEFAULT_TLENGTH_MSEC*PA_USEC_PER_MSEC, &s->sink_input->sample_spec);
     if (*tlength <= 0)
         *tlength = (uint32_t) frame_size;
 
     if (*minreq == (uint32_t) -1)
-        *minreq = (uint32_t) pa_usec_to_bytes(DEFAULT_PROCESS_MSEC*PA_USEC_PER_MSEC, &s->sink_input->sample_spec);
+        *minreq = (uint32_t) pa_usec_to_bytes_round_up(DEFAULT_PROCESS_MSEC*PA_USEC_PER_MSEC, &s->sink_input->sample_spec);
     if (*minreq <= 0)
         *minreq = (uint32_t) frame_size;
 
     if (*tlength < *minreq+frame_size)
         *tlength = *minreq+(uint32_t) frame_size;
 
-    tlength_usec = pa_bytes_to_usec(*tlength, &s->sink_input->sample_spec);
-    minreq_usec = pa_bytes_to_usec(*minreq, &s->sink_input->sample_spec);
+    orig_tlength_usec = tlength_usec = pa_bytes_to_usec(*tlength, &s->sink_input->sample_spec);
+    orig_minreq_usec = minreq_usec = pa_bytes_to_usec(*minreq, &s->sink_input->sample_spec);
 
     pa_log_info("Requested tlength=%0.2f ms, minreq=%0.2f ms",
                 (double) tlength_usec / PA_USEC_PER_MSEC,
                 (double) minreq_usec / PA_USEC_PER_MSEC);
 
-    if (adjust_latency) {
+    if (early_requests) {
+
+        /* In early request mode we need to emulate the classic
+         * fragment-based playback model. We do this setting the sink
+         * latency to the fragment size. */
+
+        sink_usec = minreq_usec;
+
+        pa_log_debug("Early requests mode enabled, configuring sink latency to minreq.");
+
+    } else if (adjust_latency) {
 
         /* So, the user asked us to adjust the latency of the stream
          * buffer according to the what the sink can provide. The
@@ -795,6 +867,8 @@ static void fix_playback_buffer_attr_pre(playback_stream *s, pa_bool_t adjust_la
         else
             sink_usec = 0;
 
+        pa_log_debug("Adjust latency mode enabled, configuring sink latency to half of overall latency.");
+
     } else {
 
         /* Ok, the user didn't ask us to adjust the latency, but we
@@ -805,11 +879,21 @@ static void fix_playback_buffer_attr_pre(playback_stream *s, pa_bool_t adjust_la
             sink_usec = (tlength_usec - minreq_usec*2);
         else
             sink_usec = 0;
+
+        pa_log_debug("Traditional mode enabled, modifying sink usec only for compat with minreq.");
     }
 
     s->sink_latency = pa_sink_input_set_requested_latency(s->sink_input, sink_usec);
 
-    if (adjust_latency) {
+    if (early_requests) {
+
+        /* Ok, we didn't necessarily get what we were asking for, so
+         * let's tell the user */
+
+        minreq_usec = s->sink_latency;
+
+    } else if (adjust_latency) {
+
         /* Ok, we didn't necessarily get what we were asking for, so
          * let's subtract from what we asked for for the remaining
          * buffer space */
@@ -823,11 +907,16 @@ static void fix_playback_buffer_attr_pre(playback_stream *s, pa_bool_t adjust_la
     if (tlength_usec < s->sink_latency + 2*minreq_usec)
         tlength_usec = s->sink_latency + 2*minreq_usec;
 
-    *tlength = (uint32_t) pa_usec_to_bytes(tlength_usec, &s->sink_input->sample_spec);
-    *minreq = (uint32_t) pa_usec_to_bytes(minreq_usec, &s->sink_input->sample_spec);
+    if (pa_usec_to_bytes_round_up(orig_tlength_usec, &s->sink_input->sample_spec) !=
+        pa_usec_to_bytes_round_up(tlength_usec, &s->sink_input->sample_spec))
+        *tlength = (uint32_t) pa_usec_to_bytes_round_up(tlength_usec, &s->sink_input->sample_spec);
+
+    if (pa_usec_to_bytes(orig_minreq_usec, &s->sink_input->sample_spec) !=
+        pa_usec_to_bytes(minreq_usec, &s->sink_input->sample_spec))
+        *minreq = (uint32_t) pa_usec_to_bytes(minreq_usec, &s->sink_input->sample_spec);
 
     if (*minreq <= 0) {
-        *minreq += (uint32_t) frame_size;
+        *minreq = (uint32_t) frame_size;
         *tlength += (uint32_t) frame_size*2;
     }
 
@@ -838,7 +927,13 @@ static void fix_playback_buffer_attr_pre(playback_stream *s, pa_bool_t adjust_la
         *prebuf = *tlength;
 }
 
-static void fix_playback_buffer_attr_post(playback_stream *s, uint32_t *maxlength, uint32_t *tlength, uint32_t* prebuf, uint32_t* minreq) {
+static void fix_playback_buffer_attr_post(
+        playback_stream *s,
+        uint32_t *maxlength,
+        uint32_t *tlength,
+        uint32_t* prebuf,
+        uint32_t* minreq) {
+
     pa_assert(s);
     pa_assert(maxlength);
     pa_assert(tlength);
@@ -868,7 +963,8 @@ static playback_stream* playback_stream_new(
         uint32_t *missing,
         pa_sink_input_flags_t flags,
         pa_proplist *p,
-        pa_bool_t adjust_latency) {
+        pa_bool_t adjust_latency,
+        pa_bool_t early_requests) {
 
     playback_stream *s, *ssync;
     pa_sink_input *sink_input;
@@ -949,7 +1045,7 @@ static playback_stream* playback_stream_new(
 
     start_index = ssync ? pa_memblockq_get_read_index(ssync->memblockq) : 0;
 
-    fix_playback_buffer_attr_pre(s, adjust_latency, maxlength, tlength, prebuf, minreq);
+    fix_playback_buffer_attr_pre(s, adjust_latency, early_requests, maxlength, tlength, prebuf, minreq);
     pa_sink_input_get_silence(sink_input, &silence);
 
     s->memblockq = pa_memblockq_new(
@@ -982,7 +1078,6 @@ static playback_stream* playback_stream_new(
     return s;
 }
 
-
 /* Called from thread context */
 static void playback_stream_request_bytes(playback_stream *s) {
     size_t m, previous_missing;
@@ -1142,7 +1237,7 @@ static void handle_seek(playback_stream *s, int64_t indexw) {
 
             pa_log_debug("Requesting rewind due to end of underrun.");
             pa_sink_input_request_rewind(s->sink_input,
-                                         s->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : s->sink_input->thread_info.underrun_for,
+                                         (size_t) (s->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : s->sink_input->thread_info.underrun_for),
                                          FALSE, TRUE);
         }
 
@@ -1426,7 +1521,7 @@ static void sink_input_moved_cb(pa_sink_input *i) {
     prebuf = (uint32_t) pa_memblockq_get_prebuf(s->memblockq);
     minreq = (uint32_t) pa_memblockq_get_minreq(s->memblockq);
 
-    fix_playback_buffer_attr_pre(s, TRUE, &maxlength, &tlength, &prebuf, &minreq);
+    fix_playback_buffer_attr_pre(s, TRUE, FALSE, &maxlength, &tlength, &prebuf, &minreq);
     pa_memblockq_set_maxlength(s->memblockq, maxlength);
     pa_memblockq_set_tlength(s->memblockq, tlength);
     pa_memblockq_set_prebuf(s->memblockq, prebuf);
@@ -1525,7 +1620,7 @@ static void source_output_moved_cb(pa_source_output *o) {
     fragsize = (uint32_t) s->fragment_size;
     maxlength = (uint32_t) pa_memblockq_get_length(s->memblockq);
 
-    fix_record_buffer_attr_pre(s, TRUE, &maxlength, &fragsize);
+    fix_record_buffer_attr_pre(s, TRUE, FALSE, &maxlength, &fragsize);
     pa_memblockq_set_maxlength(s->memblockq, maxlength);
     fix_record_buffer_attr_post(s, &maxlength, &fragsize);
 
@@ -1592,7 +1687,8 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
         no_move = FALSE,
         variable_rate = FALSE,
         muted = FALSE,
-        adjust_latency = FALSE;
+        adjust_latency = FALSE,
+        early_requests = FALSE;
 
     pa_sink_input_flags_t flags = 0;
     pa_proplist *p;
@@ -1665,7 +1761,8 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
 
     if (c->version >= 14) {
 
-        if (pa_tagstruct_get_boolean(t, &volume_set) < 0) {
+        if (pa_tagstruct_get_boolean(t, &volume_set) < 0 ||
+            pa_tagstruct_get_boolean(t, &early_requests) < 0) {
             protocol_error(c);
             pa_proplist_free(p);
             return;
@@ -1705,7 +1802,7 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
         (no_move ?  PA_SINK_INPUT_DONT_MOVE : 0) |
         (variable_rate ?  PA_SINK_INPUT_VARIABLE_RATE : 0);
 
-    s = playback_stream_new(c, sink, &ss, &map, &maxlength, &tlength, &prebuf, &minreq, volume_set ? &volume : NULL, muted, syncid, &missing, flags, p, adjust_latency);
+    s = playback_stream_new(c, sink, &ss, &map, &maxlength, &tlength, &prebuf, &minreq, volume_set ? &volume : NULL, muted, syncid, &missing, flags, p, adjust_latency, early_requests);
     pa_proplist_free(p);
 
     CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_INVALID);
@@ -1825,7 +1922,8 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
         no_move = FALSE,
         variable_rate = FALSE,
         adjust_latency = FALSE,
-        peak_detect = FALSE;
+        peak_detect = FALSE,
+        early_requests = FALSE;
     pa_source_output_flags_t flags = 0;
     pa_proplist *p;
     uint32_t direct_on_input_idx = PA_INVALID_INDEX;
@@ -1888,6 +1986,15 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
         }
     }
 
+    if (c->version >= 14) {
+
+        if (pa_tagstruct_get_boolean(t, &early_requests) < 0) {
+            protocol_error(c);
+            pa_proplist_free(p);
+            return;
+        }
+    }
+
     if (!pa_tagstruct_eof(t)) {
         protocol_error(c);
         pa_proplist_free(p);
@@ -1930,7 +2037,7 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
         (no_move ?  PA_SOURCE_OUTPUT_DONT_MOVE : 0) |
         (variable_rate ?  PA_SOURCE_OUTPUT_VARIABLE_RATE : 0);
 
-    s = record_stream_new(c, source, &ss, &map, peak_detect, &maxlength, &fragment_size, flags, p, adjust_latency, direct_on_input);
+    s = record_stream_new(c, source, &ss, &map, peak_detect, &maxlength, &fragment_size, flags, p, adjust_latency, direct_on_input, early_requests);
     pa_proplist_free(p);
 
     CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_INVALID);
@@ -1990,7 +2097,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta
     pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
     const void*cookie;
     pa_tagstruct *reply;
-    pa_bool_t shm_on_remote, do_shm;
+    pa_bool_t shm_on_remote = FALSE, do_shm;
 
     pa_native_connection_assert_ref(c);
     pa_assert(t);
@@ -2684,7 +2791,7 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
     pa_sink_input *si = NULL;
     pa_source_output *so = NULL;
     pa_scache_entry *sce = NULL;
-    const char *name;
+    const char *name = NULL;
     pa_tagstruct *reply;
 
     pa_native_connection_assert_ref(c);
@@ -3167,7 +3274,7 @@ static void command_set_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, u
 
     if (command == PA_COMMAND_SET_PLAYBACK_STREAM_BUFFER_ATTR) {
         playback_stream *s;
-        pa_bool_t adjust_latency = FALSE;
+        pa_bool_t adjust_latency = FALSE, early_requests = FALSE;
 
         s = pa_idxset_get_by_index(c->output_streams, idx);
         CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
@@ -3181,12 +3288,13 @@ static void command_set_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, u
                     PA_TAG_U32, &minreq,
                     PA_TAG_INVALID) < 0 ||
             (c->version >= 13 && pa_tagstruct_get_boolean(t, &adjust_latency) < 0) ||
+            (c->version >= 14 && pa_tagstruct_get_boolean(t, &early_requests) < 0) ||
             !pa_tagstruct_eof(t)) {
             protocol_error(c);
             return;
         }
 
-        fix_playback_buffer_attr_pre(s, adjust_latency, &maxlength, &tlength, &prebuf, &minreq);
+        fix_playback_buffer_attr_pre(s, adjust_latency, early_requests, &maxlength, &tlength, &prebuf, &minreq);
         pa_memblockq_set_maxlength(s->memblockq, maxlength);
         pa_memblockq_set_tlength(s->memblockq, tlength);
         pa_memblockq_set_prebuf(s->memblockq, prebuf);
@@ -3204,7 +3312,7 @@ static void command_set_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, u
 
     } else {
         record_stream *s;
-        pa_bool_t adjust_latency = FALSE;
+        pa_bool_t adjust_latency = FALSE, early_requests = FALSE;
         pa_assert(command == PA_COMMAND_SET_RECORD_STREAM_BUFFER_ATTR);
 
         s = pa_idxset_get_by_index(c->record_streams, idx);
@@ -3216,12 +3324,13 @@ static void command_set_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, u
                     PA_TAG_U32, &fragsize,
                     PA_TAG_INVALID) < 0 ||
             (c->version >= 13 && pa_tagstruct_get_boolean(t, &adjust_latency) < 0) ||
+            (c->version >= 14 && pa_tagstruct_get_boolean(t, &early_requests) < 0) ||
             !pa_tagstruct_eof(t)) {
             protocol_error(c);
             return;
         }
 
-        fix_record_buffer_attr_pre(s, adjust_latency, &maxlength, &fragsize);
+        fix_record_buffer_attr_pre(s, adjust_latency, early_requests, &maxlength, &fragsize);
         pa_memblockq_set_maxlength(s->memblockq, maxlength);
         fix_record_buffer_attr_post(s, &maxlength, &fragsize);
 
@@ -3947,6 +4056,8 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
         return;
     }
 
+/*     pa_log("got %lu bytes", (unsigned long) chunk->length); */
+
     if (playback_stream_isinstance(stream)) {
         playback_stream *ps = PLAYBACK_STREAM(stream);
 
index ee953652ca7290f0fa890cd42cf9c5697fc45df9..45cd68c1cf051c20181ec05331274677f306fb0f 100644 (file)
@@ -1047,7 +1047,7 @@ static pa_memchunk *remap_channels(pa_resampler *r, pa_memchunk *input) {
                                 (int16_t*) dst + oc, o_skip,
                                 (int16_t*) src + ic, i_skip,
                                 (int) n_frames,
-                                1.0, r->map_table[oc][ic]);
+                                1.0f, r->map_table[oc][ic]);
                 }
             }
 
@@ -1178,10 +1178,10 @@ static void libsamplerate_resample(pa_resampler *r, const pa_memchunk *input, un
     memset(&data, 0, sizeof(data));
 
     data.data_in = (float*) ((uint8_t*) pa_memblock_acquire(input->memblock) + input->index);
-    data.input_frames = in_n_frames;
+    data.input_frames = (long int) in_n_frames;
 
     data.data_out = (float*) ((uint8_t*) pa_memblock_acquire(output->memblock) + output->index);
-    data.output_frames = *out_n_frames;
+    data.output_frames = (long int) *out_n_frames;
 
     data.src_ratio = (double) r->o_ss.rate / r->i_ss.rate;
     data.end_of_input = 0;
index 4b2efe5e89d4f6557371eb249cfe289d6d39f167..b4234af5f71e0c1e3425bad8dadd78818cb78089 100644 (file)
@@ -31,6 +31,8 @@
 #include <liboil/liboilfuncs.h>
 #include <liboil/liboil.h>
 
+#include <pulse/timeval.h>
+
 #include <pulsecore/log.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/g711.h>
@@ -981,3 +983,34 @@ void pa_sample_clamp(pa_sample_format_t format, void *dst, size_t dstr, const vo
         }
     }
 }
+
+/* Similar to pa_bytes_to_usec() but rounds up, not down */
+
+pa_usec_t pa_bytes_to_usec_round_up(uint64_t length, const pa_sample_spec *spec) {
+    size_t fs;
+    pa_usec_t usec;
+
+    pa_assert(spec);
+
+    fs = pa_frame_size(spec);
+    length = (length + fs - 1) / fs;
+
+    usec = (pa_usec_t) length * PA_USEC_PER_SEC;
+
+    return (usec + spec->rate - 1) / spec->rate;
+}
+
+/* Similar to pa_usec_to_bytes() but rounds up, not down */
+
+size_t pa_usec_to_bytes_round_up(pa_usec_t t, const pa_sample_spec *spec) {
+    uint64_t u;
+    pa_assert(spec);
+
+    u = (uint64_t) t * (uint64_t) spec->rate;
+
+    u = (u + PA_USEC_PER_SEC - 1) / PA_USEC_PER_SEC;
+
+    u *= pa_frame_size(spec);
+
+    return (size_t) u;
+}
index cef7075067d34019b19ec9ad420d80cfb859c7b3..06ecb72473e7f44fa9960d6b48dcc5b411d06b79 100644 (file)
@@ -78,4 +78,7 @@ void pa_deinterleave(const void *src, void *dst[], unsigned channels, size_t ss,
 
 void pa_sample_clamp(pa_sample_format_t format, void *dst, size_t dstr, const void *src, size_t sstr, unsigned n);
 
+pa_usec_t pa_bytes_to_usec_round_up(uint64_t length, const pa_sample_spec *spec);
+size_t pa_usec_to_bytes_round_up(pa_usec_t t, const pa_sample_spec *spec);
+
 #endif
index b08702023b4d663ce4d296899f5f1702da365b01..b2997575d99cc91d2df966bf5573d0e804532eef 100644 (file)
@@ -105,7 +105,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
         m->size = size;
 
 #ifdef MAP_ANONYMOUS
-        if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
+        if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (off_t) 0)) == MAP_FAILED) {
             pa_log("mmap() failed: %s", pa_cstrerror(errno));
             goto fail;
         }
@@ -143,7 +143,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
             goto fail;
         }
 
-        if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == MAP_FAILED) {
+        if ((m->ptr = mmap(NULL, m->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, (off_t) 0)) == MAP_FAILED) {
             pa_log("mmap() failed: %s", pa_cstrerror(errno));
             goto fail;
         }
@@ -291,7 +291,7 @@ int pa_shm_attach_ro(pa_shm *m, unsigned id) {
 
     m->size = (size_t) st.st_size;
 
-    if ((m->ptr = mmap(NULL, m->size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
+    if ((m->ptr = mmap(NULL, m->size, PROT_READ, MAP_SHARED, fd, (off_t) 0)) == MAP_FAILED) {
         pa_log("mmap() failed: %s", pa_cstrerror(errno));
         goto fail;
     }
index f4e803d0aa110df0a0bfd5bfaa6de8bbf5fb83f0..7d80242f44ea5e0eb6ac85f36b51528a1f62f3a1 100644 (file)
@@ -756,14 +756,11 @@ pa_usec_t pa_sink_input_set_requested_latency(pa_sink_input *i, pa_usec_t usec)
 
     if (PA_SINK_INPUT_IS_LINKED(i->state))
         pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_REQUESTED_LATENCY, &usec, 0, NULL) == 0);
-    else {
+    else
         /* If this sink input is not realized yet, we have to touch
          * the thread info data directly */
 
-        usec = fixup_latency(i->sink, usec);
         i->thread_info.requested_sink_latency = usec;
-        i->sink->thread_info.requested_latency_valid = FALSE;
-    }
 
     return usec;
 }
index 24fb8913bb809404a9099031d4ff50bc822846b4..6fa22dc246abce69227da4fd42b66229f6821e09 100644 (file)
@@ -1042,11 +1042,15 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
 
             pa_sink_input_set_state_within_thread(i, i->state);
 
+            /* The requested latency of the sink input needs to be
+             * fixed up and then configured on the sink */
+
+            if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
+                pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
+
             pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
             pa_sink_input_update_max_request(i, s->thread_info.max_request);
 
-            pa_sink_invalidate_requested_latency(s);
-
             /* We don't rewind here automatically. This is left to the
              * sink input implementor because some sink inputs need a
              * slow start, i.e. need some time to buffer client
@@ -1158,11 +1162,12 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
             if (i->attach)
                 i->attach(i);
 
+            if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
+                pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
+
             pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
             pa_sink_input_update_max_request(i, s->thread_info.max_request);
 
-            pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
-
             if (i->thread_info.state != PA_SINK_INPUT_CORKED) {
                 pa_usec_t usec = 0;
                 size_t nbytes;
@@ -1424,7 +1429,6 @@ void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
 
 /* Called from IO thread */
 void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
-    pa_sink_input *i;
     void *state = NULL;
 
     pa_sink_assert_ref(s);
@@ -1435,6 +1439,8 @@ void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
     s->thread_info.max_request = max_request;
 
     if (PA_SINK_IS_LINKED(s->thread_info.state)) {
+        pa_sink_input *i;
+
         while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL)))
             pa_sink_input_update_max_request(i, s->thread_info.max_request);
     }
index 3bde40d00fb202fe6d0c7714033130e7ee962901..6739effd8176d0666e0547f55aa721042686b4d1 100644 (file)
@@ -437,7 +437,7 @@ static void start_timeout(pa_socket_client *c) {
     pa_assert(!c->timeout_event);
 
     pa_gettimeofday(&tv);
-    pa_timeval_add(&tv, CONNECT_TIMEOUT * 1000000);
+    pa_timeval_add(&tv, CONNECT_TIMEOUT * PA_USEC_PER_SEC);
     c->timeout_event = c->mainloop->time_new(c->mainloop, &tv, timeout_cb, c);
 }
 
index 74338f9a01412ef7d4c81ae02874613b468ad9df..380cef1631a527dd7e845db380d16e35a4182327 100644 (file)
@@ -89,7 +89,7 @@ int pa_sound_file_load(
         case SF_FORMAT_PCM_U8:
         case SF_FORMAT_PCM_S8:
             ss->format = PA_SAMPLE_S16NE;
-            readf_function = (sf_count_t (*)(SNDFILE *sndfile, void *ptr, sf_count_t frames)) sf_readf_short;
+            readf_function = (sf_count_t (*)(SNDFILE *sndfile, void *_ptr, sf_count_t frames)) sf_readf_short;
             break;
 
         case SF_FORMAT_ULAW:
@@ -104,7 +104,7 @@ int pa_sound_file_load(
         case SF_FORMAT_DOUBLE:
         default:
             ss->format = PA_SAMPLE_FLOAT32NE;
-            readf_function = (sf_count_t (*)(SNDFILE *sndfile, void *ptr, sf_count_t frames)) sf_readf_float;
+            readf_function = (sf_count_t (*)(SNDFILE *sndfile, void *_ptr, sf_count_t frames)) sf_readf_float;
             break;
     }
 
index 4257154e591653d7705ae9f6ec73d9fc2c54d8e1..5df950a87d22e7e7b5281af2ce012382f210b45d 100644 (file)
@@ -511,14 +511,11 @@ pa_usec_t pa_source_output_set_requested_latency(pa_source_output *o, pa_usec_t
 
     if (PA_SOURCE_OUTPUT_IS_LINKED(o->state))
         pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o), PA_SOURCE_OUTPUT_MESSAGE_SET_REQUESTED_LATENCY, &usec, 0, NULL) == 0);
-    else {
+    else
         /* If this source output is not realized yet, we have to touch
          * the thread info data directly */
 
-        usec = fixup_latency(o->source, usec);
         o->thread_info.requested_source_latency = usec;
-        o->source->thread_info.requested_latency_valid = FALSE;
-    }
 
     return usec;
 }
index 7ed32e92e942e934f3181e24f4cdb9e48d0ea995..edbbf017e86af04c81bed97669fa55962a355987 100644 (file)
@@ -670,6 +670,9 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_
 
             pa_source_output_set_state_within_thread(o, o->state);
 
+            if (o->thread_info.requested_source_latency != (pa_usec_t) -1)
+                pa_source_output_set_requested_latency_within_thread(o, o->thread_info.requested_source_latency);
+
             pa_source_output_update_max_rewind(o, s->thread_info.max_rewind);
 
             /* We don't just invalidate the requested latency here,
index e5b228e9e92a0d7f5bb775cf50d2726c8377b166..62a30144d40ce3ec06529ff594b25d54f2650558 100644 (file)
@@ -435,9 +435,9 @@ int pa_tagstruct_get_timeval(pa_tagstruct*t, struct timeval *tv) {
         return -1;
 
     memcpy(&tv->tv_sec, t->data+t->rindex+1, 4);
-    tv->tv_sec = ntohl((uint32_t) tv->tv_sec);
+    tv->tv_sec = (time_t) ntohl((uint32_t) tv->tv_sec);
     memcpy(&tv->tv_usec, t->data+t->rindex+5, 4);
-    tv->tv_usec = ntohl((uint32_t) tv->tv_usec);
+    tv->tv_usec = (suseconds_t) ntohl((uint32_t) tv->tv_usec);
     t->rindex += 9;
     return 0;
 }
index 12b39f10cd5f9ae84cd41176a7927c5c83e7ff5e..6cf58fb02db84b586aeb070b8de8a10fece91dcd 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 
index 0312005d09efd9cff7daf6dc3442d45ed8159feb..c9d3bef510c74d35cced3cb230e3549c1b60187b 100644 (file)
@@ -72,7 +72,6 @@ int main(int argc, char*argv[]) {
 
     for (;;) {
         uint8_t buf[BUFSIZE];
-        ssize_t r;
 
         /* Record some data ... */
         if (pa_simple_read(s, buf, sizeof(buf), &error) < 0) {
@@ -80,11 +79,8 @@ int main(int argc, char*argv[]) {
             goto finish;
         }
 
-        if (r == 0)
-            break;
-
         /* And write it to STDOUT */
-        if ((r = loop_write(STDOUT_FILENO, buf, sizeof(buf))) <= 0) {
+        if (loop_write(STDOUT_FILENO, buf, sizeof(buf)) != sizeof(buf)) {
             fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
             goto finish;
         }
index 134a7e5864ad7772f039aa7ae8634ee803e316a6..f2fdede491e4d5577d1019ac436b1e6bbe0667c8 100644 (file)
@@ -864,7 +864,7 @@ static int fd_info_copy_data(fd_info *i, int force) {
                 return -1;
             }
 
-            if (pa_stream_write(i->play_stream, i->buf, (size_t) r, free, 0, PA_SEEK_RELATIVE) < 0) {
+            if (pa_stream_write(i->play_stream, i->buf, (size_t) r, free, 0LL, PA_SEEK_RELATIVE) < 0) {
                 debug(DEBUG_LEVEL_NORMAL, __FILE__": pa_stream_write(): %s\n", pa_strerror(pa_context_errno(i->context)));
                 return -1;
             }
@@ -1003,7 +1003,7 @@ static int create_playback_stream(fd_info *i) {
     attr.prebuf = (uint32_t) i->fragment_size;
     attr.minreq = (uint32_t) i->fragment_size;
 
-    flags = PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE;
+    flags = PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_EARLY_REQUESTS;
     if (i->play_precork) {
         flags |= PA_STREAM_START_CORKED;
         debug(DEBUG_LEVEL_NORMAL, __FILE__": creating stream corked\n");