Commit graph

46 commits

Author SHA1 Message Date
Arun Raghavan
6d7a266e0e format: Expose pa_format_info convenience getters in API
We move over helper functions to get rate, channels, channel map and
sample format (if PCM) in the public API, so users of the extended API
are more easily able to pull out these values from pa_format_info.
2018-07-23 19:29:19 +05:30
Pierre-Louis Bossart
cdeac17801 format: Add support for Dolby TrueHD and DTS-HD HBR passthrough
Add definitions and fixups for channel count

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2018-06-21 06:29:32 +05:30
Arun Raghavan
e3148f9ac2 json: Drop refcounting of json objects
We don't actually use the refcounting bits.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30
Arun Raghavan
c692ec3afd format: Drop dependency on json-c
json-c has a symbol clash (json_object_get_type) with json-glib (which
at least a number of our GNOME clients use). This patch moves to our own
JSON parser so that we can avoid this kind of situation altogether.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
2016-06-22 21:04:47 +05:30
Arun Raghavan
d1730ab65a Revert "format: Make pa_format_info_valid() stricter for PCM"
This reverts commit 12a202c510.

This is needed for now to avoid a clash in clients using json-glib. The
commit added a call to json_object_get_type() in client code that didn't
exist before, and this breaks some apps like Rhythmbox and Totem. This
will be fixed in the future by possibly dropping json-c as a dep.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=95135
2016-04-29 17:38:37 +05:30
Arun Raghavan
12a202c510 format: Make pa_format_info_valid() stricter for PCM
We should do stricter validation when we can.
2016-01-22 13:25:29 +05:30
Ondrej Holecek
5effc83479 update FSF addresses to FSF web page
FSF addresses used in PA sources are no longer valid and rpmlint
generates numerous warnings during packaging because of this.
This patch changes all FSF addresses to FSF web page according to
the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html

Done automatically by sed-ing through sources.
2015-01-14 22:20:40 +02:00
Peter Meerwald
3a04554f9e format: Don't use deprecated json-c is_error() macro
json_tokener_parse() simply returns NULL on error these days

latest json-c (post 0.12) doesn't automatically include json-c/bits.h anymore
causing compilation errors

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-08-22 15:36:01 +02:00
Peter Meerwald
a940877224 format: Use json_object_object_get_ex() instead of deprecated json_object_object_get()
pulse/format.c: In function 'pa_format_info_get_prop_type':
pulse/format.c:252:5: warning: implicit declaration of function 'is_error' [-Wimplicit-function-declaration]
pulse/format.c:287:13: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:293:13: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c: In function 'pa_format_info_get_prop_int_range':
pulse/format.c:364:5: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:369:5: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c: In function 'pa_format_info_prop_compatible':
pulse/format.c:676:9: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:680:9: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]

json-c 0.10 (released 20120530) added json_object_object_get_ex()
json-c 0.12 (released 20140410) deprecated json_object_object_get()

PulseAudio depends on json 0.9 or json-c 0.11, drop support for json 0.9
in a subsequent patch and require json-c 0.11 (this will also avoids confusion
which json package is needed due to the upstream rename)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-08-22 15:35:33 +02:00
Peter Meerwald
514766a79f format: Don't _put() objects obtained with json_object_object_get() or json_object_array_get_idx()
json-c documentation states that "No reference counts will be changed.
There is no need to manually adjust reference counts through the
json_object_put/json_object_get methods unless..."

hence fix pa_format_info_get_prop_type() and pa_format_info_get_prop_int_range();
note that pa_format_info_prop_compatible() is OK

the json_object_array_get_idx() bug reported by Arun, thanks!

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Arun Raghavan <arun@accosted.net>
2014-08-22 15:35:24 +02:00
Tanu Kaskinen
56e007ebfb format: Add some error logging 2014-01-08 21:32:02 +02:00
Tanu Kaskinen
a3a795ef3d format, core-format: Constify some function parameters 2014-01-08 21:26:40 +02:00
Tanu Kaskinen
dfa3c50700 format: Simplify pa_format_info_to_sample_spec() 2014-01-08 21:26:39 +02:00
Tanu Kaskinen
3a5a0f6652 core-format: Add pa_format_info_get_channel_map() 2014-01-08 21:26:39 +02:00
Tanu Kaskinen
066dd942aa core-format: Add pa_format_info_get_channels()
This also fixes an issue in pa_format_info_to_sample_spec(): it did
no validation for the channels value. Now the validation is taken care
of in pa_format_info_get_channels().
2014-01-08 21:26:39 +02:00
Tanu Kaskinen
85a3f560d1 core-format: Add pa_format_info_get_rate()
This also fixes an issue in pa_format_info_to_sample_spec(): it did
no validation for the rate value. Now the validation is taken care of
in pa_format_info_get_rate().
2014-01-08 21:26:39 +02:00
Tanu Kaskinen
eae16f41a4 core-format: Add pa_format_info_get_sample_format() 2014-01-08 21:26:39 +02:00
Tanu Kaskinen
d2c9b46aca Move pa_format_info_to_sample_spec_fake() to core-format
I will need to use the function from outside libpulse.

I added the channel map argument, because the function will be called
from another function that is expected to initialize the channel map.
I don't know if it's in practice necessary, but it shouldn't do any
harm either.
2014-01-08 21:26:38 +02:00
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
poljar (Damir Jelić)
e95d054e40 Style fix: Remove new lines from opening brackets
This patch replaces every occurrence of ')\n{' with ') {'.

Command used for this:
    find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name core-util.c -a -not \
        -name adrian-aec.c -a -not -name g711.c \
        -exec sed -i -e '/)$/{N;s/)\n{$/) {/}' {} \;

The excluded files are mirrored files from external sources.
2013-06-24 16:56:24 +03:00
Akihiro Tsukada
53807e4a28 add support for MPEG-2 AAC pass-through
Some S/PDIF receivers have AAC decoder.
Only MPEG2 AAC is added,
as I don't have MPEG-4 AAC decoder and cannot test it.
2013-02-16 21:36:39 +02:00
Tanu Kaskinen
061878b5a4 idxset: Use pa_free_cb_t instead of pa_free2_cb_t
There were no users for the userdata pointer.
2013-02-16 01:15:27 +02:00
Arun Raghavan
a0706e7c84 format: Allow format->sample spec conversion for compressed formats
This allows clients to get a "fake" sample space for compressed formats
that we can support. This should make size/time conversion for things
like calculating buffer attributes simpler.
2012-03-05 20:30:33 +05:30
Arun Raghavan
8baf8e90c2 format: Add API to query a property's type
Since a given property can be single-valued, an array or (in the case of
ints) a range, clients need an API to figure out what type of value a
property holds. This adds such an API. The actual property type
enumeration is kept in the PA_PROP_* namespace and not the
PA_FORMAT_INFO* namespace so that it can later be reused for properties
generically if required.
2012-03-05 20:00:31 +05:30
Arun Raghavan
8f850403c0 format: Trivial reorganisation
Moves all the property setters together
2012-03-05 20:00:31 +05:30
Arun Raghavan
59af940dd5 format: Add more property getters
This adds integer range/array and string array property getters to the
pa_format_info API. Corresponding tests added as well to ensure the code
is valgrind-clean.

The corresponding functions are added to map-file manually for now.
2012-03-05 20:00:31 +05:30
Arun Raghavan
c60f698f1e format: Expose pa_format_info<->pa_sample_spec conversion functions
These utility functions could be handy to clients.
pa_format_info_to_sample_spec_fake() isn't made public, but the return
value is changed to keep in sync with pa_format_info_to_sample_spec().
2012-03-05 20:00:31 +05:30
Arun Raghavan
63429b67c7 format: Don't assert on errors in getters
This makes handling errors in getter functions more graceful, rather
than triggering warnings/asserts. Better to be less trigger-happy about
these things since this is now public-facing API.
2012-03-05 20:00:31 +05:30
Arun Raghavan
6f20d39a1c format: Export pa_format_info int and string property getters
We currently only have setters and clients need to be able to query
these values as well. The return types for these functions needed to be
changed to int since this is public API now.
2012-03-05 20:00:31 +05:30
Arun Raghavan
0ef7e5cb4c format: Remove stupid copy-paste-o
Thanks to Maarten Bosmans for the catch.
2011-08-16 15:21:45 +05:30
Arun Raghavan
8bffbcde1b format: Add string to pa_format_info conversion function
This will help accept string formats from the command like (so we can
set formats using pactl).
2011-08-15 11:51:35 +05:30
Arun Raghavan
348c51bfcd format: Make pa_format_info_snprint() more parseable
Removes the comma as the proplist separator since that makes
pa_proplist_from_string() break and prints only the encoding if there
are no properties (instead of "<encoding>, (no properties)").
2011-08-15 11:51:35 +05:30
Maarten Bosmans
b4e938e194 Move i18n.[ch] to src/pulsecore
The header is used in files troughout the tree and is not included in the public api,
so it belongs in pulsecore, not in pulse.
2011-08-11 13:23:42 +02:00
Arun Raghavan
117c714594 format: Fix channel map handling
Channel map handling in the extended API was broken. Thanks for Milos_SD
for pointing this out on IRC.
2011-05-20 19:21:02 +05:30
Arun Raghavan
1404db3d47 format: Add some convenience API for setting properties
Adds functions to set sample format, rate, channels and channel map on a
format to make life easier for users of the API.
2011-05-15 10:09:35 +05:30
Arun Raghavan
8d076d0990 format: Extend properties to handle lists/ranges
This replaces the simple string used by pa_format_info's proplist with a
JSON string (accessed via new API only). This allows us to express lists
and ranges more cleanly, and embed type information for future
extensibility.

We use json-c for JSON parsing. This is a lightweight depdency (32 KB on
my system) and avoids the hassle of having to reinvent a JSON parser.

Also included is a test which verifies functionality and is
valgrind-clean.
2011-05-15 10:09:35 +05:30
Arun Raghavan
d1f13fa781 format: Add correct sample spec conversion for E-AC3
IEC61937-encapsulated E-AC3 frames contain 6 audio blocks per substream,
which corresponds to 1536 samples contained a 24576-byte frame. To cope
with this, we maintain the s16le stereo sample spec, but quadruple the
sample rate so that the conversion remains accurate.
2011-05-15 10:09:35 +05:30
Arun Raghavan
13a33abf45 format: Export pa_format_info_is_compatible in API
This allows clients to perform checks between formats as well.
2011-05-15 10:09:35 +05:30
Arun Raghavan
9a39a3df10 format: Add a type for DTS 2011-05-02 11:55:39 +05:30
Arun Raghavan
8631f4e2c4 format: Add some convenience functions for printing 2011-05-02 11:55:38 +05:30
Arun Raghavan
a3a0042144 format: Const-ify some parameters 2011-05-02 11:55:38 +05:30
Arun Raghavan
e418e49ecb format: Avoid some code duplication
We frequently need to free an idxset containing pa_format_infos, so
define an internal free function that can be used directly with this
(instead of defining it once-per-file).
2011-05-02 11:54:48 +05:30
Arun Raghavan
13229fb39e sink-input: Don't assert on bad formats
Handles bad format input more gracefully and returns an error instead.
2011-05-02 11:54:48 +05:30
Arun Raghavan
54c391e6db format: Add convenience API to check if a format is PCM or not 2011-05-02 11:54:47 +05:30
Arun Raghavan
3767c9c4e8 format: Add some properties and internal API
The properties will be used by clients to set the sample format,
sampling rate, etc. The functions will be used internally.
2011-05-02 10:17:20 +05:30
Arun Raghavan
c3839c7637 core: Add a pa_format_info structure
This will be used to represent the format of data provided by the client
for both compressed and PCM formats in a new extended API.
2011-05-02 10:17:20 +05:30