diff options
Diffstat (limited to 'src/pulse')
-rw-r--r-- | src/pulse/channelmap.c | 4 | ||||
-rw-r--r-- | src/pulse/context.c | 22 | ||||
-rw-r--r-- | src/pulse/gccmacro.h | 11 | ||||
-rw-r--r-- | src/pulse/introspect.c | 12 | ||||
-rw-r--r-- | src/pulse/introspect.h | 4 | ||||
-rw-r--r-- | src/pulse/proplist.h | 171 | ||||
-rw-r--r-- | src/pulse/scache.c | 4 | ||||
-rw-r--r-- | src/pulse/util.c | 6 |
8 files changed, 152 insertions, 82 deletions
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c index 983b8977..82e36c00 100644 --- a/src/pulse/channelmap.c +++ b/src/pulse/channelmap.c @@ -217,10 +217,10 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p case 6: m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT; - m->map[1] = PA_CHANNEL_POSITION_SIDE_LEFT; + m->map[1] = PA_CHANNEL_POSITION_REAR_LEFT; m->map[2] = PA_CHANNEL_POSITION_FRONT_CENTER; m->map[3] = PA_CHANNEL_POSITION_FRONT_RIGHT; - m->map[4] = PA_CHANNEL_POSITION_SIDE_RIGHT; + m->map[4] = PA_CHANNEL_POSITION_REAR_RIGHT; m->map[5] = PA_CHANNEL_POSITION_LFE; return m; diff --git a/src/pulse/context.c b/src/pulse/context.c index 81050914..9309c6b7 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -129,9 +129,6 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * pa_init_i18n(); - if (!name && !pa_proplist_contains(p, PA_PROP_APPLICATION_NAME)) - return NULL; - c = pa_xnew(pa_context, 1); PA_REFCNT_INIT(c); @@ -338,8 +335,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o pa_assert(p); pa_assert(chunk); - pa_assert(chunk->memblock); - pa_assert(chunk->length); + pa_assert(chunk->length > 0); pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); @@ -347,11 +343,11 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o if ((s = pa_dynarray_get(c->record_streams, channel))) { - pa_assert(seek == PA_SEEK_RELATIVE); - pa_assert(offset == 0); - - pa_memblockq_seek(s->record_memblockq, offset, seek); - pa_memblockq_push_align(s->record_memblockq, chunk); + if (chunk->memblock) { + pa_memblockq_seek(s->record_memblockq, offset, seek); + pa_memblockq_push_align(s->record_memblockq, chunk); + } else + pa_memblockq_seek(s->record_memblockq, offset+chunk->length, seek); if (s->read_callback) { size_t l; @@ -558,6 +554,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) { pa_context_unref(c); } +#if ENABLE_LEGACY_RUNTIME_DIR static char *get_old_legacy_runtime_dir(void) { char *p, u[128]; struct stat st; @@ -601,10 +598,12 @@ static char *get_very_old_legacy_runtime_dir(void) { return p; } - +#endif static pa_strlist *prepend_per_user(pa_strlist *l) { char *ufn; + +#if ENABLE_LEGACY_RUNTIME_DIR static char *legacy_dir; /* The very old per-user instance path (< 0.9.11). This is supported only to ease upgrades */ @@ -622,6 +621,7 @@ static pa_strlist *prepend_per_user(pa_strlist *l) { pa_xfree(p); pa_xfree(legacy_dir); } +#endif /* The per-user instance */ if ((ufn = pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET))) { diff --git a/src/pulse/gccmacro.h b/src/pulse/gccmacro.h index 0b1a1a66..58188ee2 100644 --- a/src/pulse/gccmacro.h +++ b/src/pulse/gccmacro.h @@ -88,7 +88,7 @@ #endif #ifndef PA_GCC_PACKED -#ifdef __GNUCC__ +#ifdef __GNUC__ #define PA_GCC_PACKED __attribute__ ((packed)) #else /** Structure shall be packed in memory **/ @@ -109,7 +109,7 @@ #endif #ifndef PA_GCC_MALLOC -#ifdef __GNUCC__ +#ifdef __GNUC__ #define PA_GCC_MALLOC __attribute__ ((malloc)) #else /** Macro for usage of GCC's malloc attribute */ @@ -117,4 +117,11 @@ #endif #endif +#ifndef PA_GCC_WEAKREF +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 1)) || (__GNUC__ > 4)) +/** Macro for usgae of GCC's weakref attribute */ +#define PA_GCC_WEAKREF(x) __attribute__((weakref(#x))); +#endif +#endif + #endif diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c index 1d50939c..04bcd4f5 100644 --- a/src/pulse/introspect.c +++ b/src/pulse/introspect.c @@ -162,6 +162,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u i.n_volume_steps = PA_VOLUME_NORM+1; mute = FALSE; state = PA_SINK_INVALID_STATE; + i.card = PA_INVALID_INDEX; if (pa_tagstruct_getu32(t, &i.index) < 0 || pa_tagstruct_gets(t, &i.name) < 0 || @@ -182,7 +183,8 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u (o->context->version >= 15 && (pa_tagstruct_get_volume(t, &i.base_volume) < 0 || pa_tagstruct_getu32(t, &state) < 0 || - pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) { + pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 || + pa_tagstruct_getu32(t, &i.card) < 0))) { pa_context_fail(o->context, PA_ERR_PROTOCOL); pa_proplist_free(i.proplist); @@ -293,6 +295,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, i.n_volume_steps = PA_VOLUME_NORM+1; mute = FALSE; state = PA_SOURCE_INVALID_STATE; + i.card = PA_INVALID_INDEX; if (pa_tagstruct_getu32(t, &i.index) < 0 || pa_tagstruct_gets(t, &i.name) < 0 || @@ -313,7 +316,8 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, (o->context->version >= 15 && (pa_tagstruct_get_volume(t, &i.base_volume) < 0 || pa_tagstruct_getu32(t, &state) < 0 || - pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) { + pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 || + pa_tagstruct_getu32(t, &i.card) < 0))) { pa_context_fail(o->context, PA_ERR_PROTOCOL); pa_proplist_free(i.proplist); @@ -517,7 +521,9 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u for (j = 0; j < i.n_profiles; j++) { if (pa_tagstruct_gets(t, &i.profiles[j].name) < 0 || - pa_tagstruct_gets(t, &i.profiles[j].description) < 0) { + pa_tagstruct_gets(t, &i.profiles[j].description) < 0 || + pa_tagstruct_getu32(t, &i.profiles[j].n_sinks) < 0 || + pa_tagstruct_getu32(t, &i.profiles[j].n_sources)< 0) { pa_context_fail(o->context, PA_ERR_PROTOCOL); pa_xfree(i.profiles); diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h index badc787e..b873a84a 100644 --- a/src/pulse/introspect.h +++ b/src/pulse/introspect.h @@ -215,6 +215,7 @@ typedef struct pa_sink_info { pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the output device. \since 0.9.15 */ pa_sink_state_t state; /**< State \since 0.9.15 */ uint32_t n_volume_steps; /**< Number of volume steps for sinks which do not support arbitrary volumes. \since 0.9.15 */ + uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */ } pa_sink_info; /** Callback prototype for pa_context_get_sink_info_by_name() and friends */ @@ -273,6 +274,7 @@ typedef struct pa_source_info { pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the input device. \since 0.9.15 */ pa_source_state_t state; /**< State \since 0.9.15 */ uint32_t n_volume_steps; /**< Number of volume steps for sources which do not support arbitrary volumes. \since 0.9.15 */ + uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */ } pa_source_info; /** Callback prototype for pa_context_get_source_info_by_name() and friends */ @@ -396,6 +398,8 @@ pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_suc typedef struct pa_card_profile_info { const char *name; /**< Name of this profile */ const char *description; /**< Description of this profile */ + uint32_t n_sinks; /**< Number of sinks this profile would create */ + uint32_t n_sources; /**< Number of sources this profile would create */ } pa_card_profile_info; /** Stores information about cards. Please note that this structure diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h index 57a23d9f..c0c34593 100644 --- a/src/pulse/proplist.h +++ b/src/pulse/proplist.h @@ -30,110 +30,163 @@ PA_C_DECL_BEGIN -/* Defined properties: - * - * media.name "Guns'N'Roses: Civil War" - * media.title "Civil War" - * media.artist "Guns'N'Roses" - * media.language "de_DE" - * media.filename - * media.icon Binary blob containing PNG icon data - * media.icon_name Name from XDG icon naming spec - * media.role video, music, game, event, phone, animation, production, filter, abstract, stream - * event.id Name from XDG sound naming spec - * event.description "Button blabla clicked" for a11y - * event.mouse.x - * event.mouse.y - * event.mouse.hpos Float formatted as string in range 0..1 - * event.mouse.vpos Float formatted as string in range 0..1 - * event.mouse.button Button number following X11 ordering - * window.name - * window.id "org.gnome.rhytmbox.MainWindow" - * window.icon Binary blob containing PNG icon data - * window.icon_name Name from XDG icon naming spec - * window.x11.display - * window.x11.screen - * window.x11.monitor - * window.x11.xid - * application.name "Rhythmbox Media Player" - * application.id "org.gnome.rhythmbox" - * application.version - * application.icon Binary blob containing PNG icon data - * application.icon_name Name from XDG icon naming spec - * application.language - * application.process.id - * application.process.binary - * application.process.user - * application.process.host - * application.process.machine_id D-Bus machine ID - * device.string - * device.api oss, alsa, sunaudio - * device.description - * device.bus_path - * device.serial - * device.vendor_product_id - * device.class sound, modem, monitor, filter, abstract - * device.form_factor laptop-speakers, external-speakers, telephone, tv-capture, webcam-capture, microphone-capture, headset, headphones, hands-free, car, hifi, computer, portable - * device.connector isa, pci, usb, firewire, bluetooth - * device.access_mode mmap, mmap_rewrite, serial - * device.master_device - * device.buffering.buffer_size - * device.buffering.fragment_size - * device.profile.name analog-stereo, analog-surround-40, iec958-stereo, ... - * device.profile.description "Analog Stereo", ... - */ +/** For streams: localized media name, formatted as UTF-8. e.g. "Guns'N'Roses: Civil War".*/ #define PA_PROP_MEDIA_NAME "media.name" + +/** For streams: localized media title if applicable, formatted as UTF-8. e.g. "Civil War" */ #define PA_PROP_MEDIA_TITLE "media.title" + +/** For streams: localized media artist if applicable, formatted as UTF-8. e.g. "Guns'N'Roses" */ #define PA_PROP_MEDIA_ARTIST "media.artist" + +/** For streams: media language if applicable, in standard POSIX format. e.g. "de_DE" */ #define PA_PROP_MEDIA_LANGUAGE "media.language" + +/** For streams: source filename if applicable, in URI format or local path. e.g. "/home/lennart/music/foobar.ogg" */ #define PA_PROP_MEDIA_FILENAME "media.filename" + +/** For streams: icon for the media. A binary blob containing PNG image data */ #define PA_PROP_MEDIA_ICON "media.icon" + +/** For streams: an XDG icon name for the media. e.g. "audio-x-mp3" */ #define PA_PROP_MEDIA_ICON_NAME "media.icon_name" + +/** For streams: logic role of this media. One of the strings "video", "music", "game", "event", "phone", "animation", "production" */ #define PA_PROP_MEDIA_ROLE "media.role" + +/** For event sound streams: XDG event sound name. e.g. "message-new-email" (Event sound streams are those with media.role set to "event") */ #define PA_PROP_EVENT_ID "event.id" + +/** For event sound streams: localized human readable one-line description of the event, formatted as UTF-8. e.g. "Email from lennart@example.com received." */ #define PA_PROP_EVENT_DESCRIPTION "event.description" + +/** For event sound streams: absolute horizontal mouse position on the screen if the event sound was triggered by a mouse click, integer formatted as text string. e.g. "865" */ #define PA_PROP_EVENT_MOUSE_X "event.mouse.x" + +/** For event sound streams: absolute vertical mouse position on the screen if the event sound was triggered by a mouse click, integer formatted as text string. e.g. "432" */ #define PA_PROP_EVENT_MOUSE_Y "event.mouse.y" + +/** For event sound streams: relative horizontal mouse position on the screen if the event sound was triggered by a mouse click, float formatted as text string, ranging from 0.0 (left side of the screen) to 1.0 (right side of the screen). e.g. "0.65" */ #define PA_PROP_EVENT_MOUSE_HPOS "event.mouse.hpos" + +/** For event sound streams: relative vertical mouse position on the screen if the event sound was triggered by a mouse click, float formatted as text string, ranging from 0.0 (top of the screen) to 1.0 (bottom of the screen). e.g. "0.43" */ #define PA_PROP_EVENT_MOUSE_VPOS "event.mouse.vpos" + +/** For event sound streams: mouse button that triggered the event if applicable, integer formatted as string with 0=left, 1=middle, 2=right. e.g. "0" */ #define PA_PROP_EVENT_MOUSE_BUTTON "event.mouse.button" + +/** For streams that belong to a window on the screen: localized window title. e.g. "Totem Music Player" */ #define PA_PROP_WINDOW_NAME "window.name" + +/** For streams that belong to a window on the screen: a textual id for identifying a window logically. e.g. "org.gnome.Totem.MainWindow" */ #define PA_PROP_WINDOW_ID "window.id" + +/** For streams that belong to a window on the screen: window icon. A binary blob containing PNG image data */ #define PA_PROP_WINDOW_ICON "window.icon" + +/** For streams that belong to a window on the screen: an XDG icon name for the window. e.g. "totem" */ #define PA_PROP_WINDOW_ICON_NAME "window.icon_name" + +/** For streams that belong to an X11 window on the screen: the X11 display string. e.g. ":0.0" */ #define PA_PROP_WINDOW_X11_DISPLAY "window.x11.display" + +/** For streams that belong to an X11 window on the screen: the X11 screen the window is on, an integer formatted as string. e.g. "0" */ #define PA_PROP_WINDOW_X11_SCREEN "window.x11.screen" + +/** For streams that belong to an X11 window on the screen: the X11 monitor the window is on, an integer formatted as string. e.g. "0" */ #define PA_PROP_WINDOW_X11_MONITOR "window.x11.monitor" + +/** For streams that belong to an X11 window on the screen: the window XID, an integer formatted as string. e.g. "25632" */ #define PA_PROP_WINDOW_X11_XID "window.x11.xid" + +/** For clients/streams: localized human readable application name. e.g. "Totem Music Player" */ #define PA_PROP_APPLICATION_NAME "application.name" + +/** For clients/streams: a textual id for identifying an application logically. e.g. "org.gnome.Totem" */ #define PA_PROP_APPLICATION_ID "application.id" + +/** For clients/streams: a version string e.g. "0.6.88" */ #define PA_PROP_APPLICATION_VERSION "application.version" + +/** For clients/streams: application icon. A binary blob containing PNG image data */ #define PA_PROP_APPLICATION_ICON "application.icon" + +/** For clients/streams: an XDG icon name for the application. e.g. "totem" */ #define PA_PROP_APPLICATION_ICON_NAME "application.icon_name" + +/** For clients/streams: application language if applicable, in standard POSIX format. e.g. "de_DE" */ #define PA_PROP_APPLICATION_LANGUAGE "application.language" + +/** For clients/streams on UNIX: application process PID, an integer formatted as string. e.g. "4711" */ #define PA_PROP_APPLICATION_PROCESS_ID "application.process.id" + +/** For clients/streams: application process name. e.g. "totem" */ #define PA_PROP_APPLICATION_PROCESS_BINARY "application.process.binary" + +/** For clients/streams: application user name. e.g. "lennart" */ #define PA_PROP_APPLICATION_PROCESS_USER "application.process.user" + +/** For clients/streams: host name the application runs on. e.g. "omega" */ #define PA_PROP_APPLICATION_PROCESS_HOST "application.process.host" + +/** For clients/streams: the D-Bus host id the application runs on. e.g. "543679e7b01393ed3e3e650047d78f6e" */ #define PA_PROP_APPLICATION_PROCESS_MACHINE_ID "application.process.machine_id" + +/** For devices: device string in the underlying audio layer's format. e.g. "surround51:0" */ #define PA_PROP_DEVICE_STRING "device.string" + +/** For devices: API this device is access with. e.g. "alsa" */ #define PA_PROP_DEVICE_API "device.api" + +/** For devices: localized human readable device one-line description, e.g. "Foobar Industries USB Headset 2000+ Ultra" */ #define PA_PROP_DEVICE_DESCRIPTION "device.description" + +/** For devices: bus path to the device in the OS' format. e.g. "/sys/bus/pci/devices/0000:00:1f.2" */ #define PA_PROP_DEVICE_BUS_PATH "device.bus_path" + +/** For devices: serial number if applicable. e.g. "4711-0815-1234" */ #define PA_PROP_DEVICE_SERIAL "device.serial" + +/** For devices: vendor/product ID if applicable. e.g. 1274:1371 */ #define PA_PROP_DEVICE_VENDOR_PRODUCT_ID "device.vendor_product_id" + +/** For devices: device class. One of "sound", "modem", "monitor", "filter" */ #define PA_PROP_DEVICE_CLASS "device.class" + +/** For devices: form factor if applicable. One of "laptop-speakers", "external-speakers", "telephone", "tv-capture", "webcam-capture", "microphone-capture", "headset", "headphones", "hands-free", "car", "hifi", "computer", "portable" */ #define PA_PROP_DEVICE_FORM_FACTOR "device.form_factor" + +/** For devices: connector of the device if applicable. One of "isa", "pci", "usb", "firewire", "bluetooth" */ #define PA_PROP_DEVICE_CONNECTOR "device.connector" + +/** For devices: access mode of the device if applicable. One of "mmap", "mmap_rewrite", "serial" */ #define PA_PROP_DEVICE_ACCESS_MODE "device.access_mode" + +/** For filter devices: master device id if applicable. */ #define PA_PROP_DEVICE_MASTER_DEVICE "device.master_device" + +/** For devices: buffer size in bytes, integer formatted as string.. */ #define PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE "device.buffering.buffer_size" + +/** For devices: fragment size in bytes, integer formatted as string. */ #define PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE "device.buffering.fragment_size" + +/** For devices: profile identifier for the profile this devices is in. e.g. "analog-stereo", "analog-surround-40", "iec958-stereo", ...*/ #define PA_PROP_DEVICE_PROFILE_NAME "device.profile.name" + +/** For devices: human readable one-line description of the profile this device is in. e.g. "Analog Stereo", ... */ #define PA_PROP_DEVICE_PROFILE_DESCRIPTION "device.profile.description" + +/** For modules: the author's name, formatted as UTF-8 string. e.g. "Lennart Poettering" */ #define PA_PROP_MODULE_AUTHOR "module.author" + +/** For modules: a human readable one-line description of the module's purpose formatted as UTF-8. e.g. "Frobnicate sounds with a flux compensator" */ #define PA_PROP_MODULE_DESCRIPTION "module.description" + +/** For modules: a human readable usage description of the module's arguments formatted as UTF-8. */ #define PA_PROP_MODULE_USAGE "module.usage" + +/** For modules: a version string for the module. e.g. "0.9.15" */ #define PA_PROP_MODULE_VERSION "module.version" /** A property list object. Basically a dictionary with ASCII strings @@ -179,17 +232,17 @@ 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_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 + 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. */ + * property list. */, PA_UPDATE_REPLACE - /*< Merge new property list into the existing one, replacing all + /**< 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; diff --git a/src/pulse/scache.c b/src/pulse/scache.c index c96c42ad..a7e3cd81 100644 --- a/src/pulse/scache.c +++ b/src/pulse/scache.c @@ -66,10 +66,8 @@ int pa_stream_connect_upload(pa_stream *s, size_t length) { pa_tagstruct_put_channel_map(t, &s->channel_map); pa_tagstruct_putu32(t, (uint32_t) length); - if (s->context->version >= 13) { - pa_init_proplist(s->proplist); + if (s->context->version >= 13) pa_tagstruct_put_proplist(t, s->proplist); - } pa_pstream_send_tagstruct(s->context->pstream, t); pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL); diff --git a/src/pulse/util.c b/src/pulse/util.c index b20ea46a..54a188d5 100644 --- a/src/pulse/util.c +++ b/src/pulse/util.c @@ -54,6 +54,8 @@ #endif #include <pulse/xmalloc.h> +#include <pulse/timeval.h> + #include <pulsecore/winsock.h> #include <pulsecore/core-error.h> #include <pulsecore/log.h> @@ -260,8 +262,8 @@ int pa_msleep(unsigned long t) { #elif defined(HAVE_NANOSLEEP) struct timespec ts; - ts.tv_sec = (time_t) (t/1000UL); - ts.tv_nsec = (long) ((t % 1000UL) * 1000000UL); + ts.tv_sec = (time_t) (t / PA_MSEC_PER_SEC); + ts.tv_nsec = (long) ((t % PA_MSEC_PER_SEC) * PA_NSEC_PER_MSEC); return nanosleep(&ts, NULL); #else |