PulseAudio  9.0
stream.h
Go to the documentation of this file.
00001 #ifndef foostreamhfoo
00002 #define foostreamhfoo
00003 
00004 /***
00005   This file is part of PulseAudio.
00006 
00007   Copyright 2004-2006 Lennart Poettering
00008   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
00009 
00010   PulseAudio is free software; you can redistribute it and/or modify
00011   it under the terms of the GNU Lesser General Public License as published
00012   by the Free Software Foundation; either version 2.1 of the License,
00013   or (at your option) any later version.
00014 
00015   PulseAudio is distributed in the hope that it will be useful, but
00016   WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018   General Public License for more details.
00019 
00020   You should have received a copy of the GNU Lesser General Public License
00021   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
00022 ***/
00023 
00024 #include <sys/types.h>
00025 
00026 #include <pulse/sample.h>
00027 #include <pulse/format.h>
00028 #include <pulse/channelmap.h>
00029 #include <pulse/volume.h>
00030 #include <pulse/def.h>
00031 #include <pulse/cdecl.h>
00032 #include <pulse/operation.h>
00033 #include <pulse/context.h>
00034 #include <pulse/proplist.h>
00035 
00332 PA_C_DECL_BEGIN
00333 
00335 typedef struct pa_stream pa_stream;
00336 
00338 typedef void (*pa_stream_success_cb_t) (pa_stream*s, int success, void *userdata);
00339 
00341 typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t nbytes, void *userdata);
00342 
00344 typedef void (*pa_stream_notify_cb_t)(pa_stream *p, void *userdata);
00345 
00352 typedef void (*pa_stream_event_cb_t)(pa_stream *p, const char *name, pa_proplist *pl, void *userdata);
00353 
00357 pa_stream* pa_stream_new(
00358         pa_context *c                     ,
00359         const char *name                  ,
00360         const pa_sample_spec *ss          ,
00361         const pa_channel_map *map         );
00362 
00366 pa_stream* pa_stream_new_with_proplist(
00367         pa_context *c                     ,
00368         const char *name                  ,
00369         const pa_sample_spec *ss          ,
00370         const pa_channel_map *map         ,
00371         pa_proplist *p                    );
00372 
00377 pa_stream *pa_stream_new_extended(
00378         pa_context *c                     ,
00379         const char *name                  ,
00380         pa_format_info * const * formats  ,
00381         unsigned int n_formats            ,
00382         pa_proplist *p                    );
00383 
00385 void pa_stream_unref(pa_stream *s);
00386 
00388 pa_stream *pa_stream_ref(pa_stream *s);
00389 
00391 pa_stream_state_t pa_stream_get_state(pa_stream *p);
00392 
00394 pa_context* pa_stream_get_context(pa_stream *p);
00395 
00400 uint32_t pa_stream_get_index(pa_stream *s);
00401 
00411 uint32_t pa_stream_get_device_index(pa_stream *s);
00412 
00422 const char *pa_stream_get_device_name(pa_stream *s);
00423 
00428 int pa_stream_is_suspended(pa_stream *s);
00429 
00432 int pa_stream_is_corked(pa_stream *s);
00433 
00458 int pa_stream_connect_playback(
00459         pa_stream *s                  ,
00460         const char *dev                ,
00461         const pa_buffer_attr *attr    ,
00462         pa_stream_flags_t flags       ,
00463         const pa_cvolume *volume      ,
00464         pa_stream *sync_stream        );
00465 
00467 int pa_stream_connect_record(
00468         pa_stream *s                   ,
00469         const char *dev               ,
00470         const pa_buffer_attr *attr    ,
00471         pa_stream_flags_t flags       );
00472 
00474 int pa_stream_disconnect(pa_stream *s);
00475 
00508 int pa_stream_begin_write(
00509         pa_stream *p,
00510         void **data,
00511         size_t *nbytes);
00512 
00522 int pa_stream_cancel_write(
00523         pa_stream *p);
00524 
00547 int pa_stream_write(
00548         pa_stream *p             ,
00549         const void *data         ,
00550         size_t nbytes            ,
00551         pa_free_cb_t free_cb     ,
00552         int64_t offset           ,
00553         pa_seek_mode_t seek      );
00554 
00557 int pa_stream_write_ext_free(
00558         pa_stream *p             ,
00559         const void *data         ,
00560         size_t nbytes            ,
00561         pa_free_cb_t free_cb     ,
00562         void *free_cb_data       ,
00563         int64_t offset           ,
00564         pa_seek_mode_t seek      );
00565 
00582 int pa_stream_peek(
00583         pa_stream *p                 ,
00584         const void **data            ,
00585         size_t *nbytes               );
00586 
00589 int pa_stream_drop(pa_stream *p);
00590 
00599 size_t pa_stream_writable_size(pa_stream *p);
00600 
00602 size_t pa_stream_readable_size(pa_stream *p);
00603 
00608 pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00609 
00614 pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
00615 
00617 void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
00618 
00621 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00622 
00624 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00625 
00627 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00628 
00633 int64_t pa_stream_get_underflow_index(pa_stream *p);
00634 
00636 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00637 
00643 void pa_stream_set_started_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00644 
00648 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00649 
00655 void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00656 
00665 void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00666 
00669 void pa_stream_set_event_callback(pa_stream *p, pa_stream_event_cb_t cb, void *userdata);
00670 
00676 void pa_stream_set_buffer_attr_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00677 
00688 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
00689 
00693 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00694 
00697 pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00698 
00702 pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00703 
00705 pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
00706 
00738 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
00739 
00752 int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
00753 
00768 const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
00769 
00771 const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
00772 
00774 const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
00775 
00777 const pa_format_info* pa_stream_get_format_info(pa_stream *s);
00778 
00787 const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
00788 
00797 pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
00798 
00804 pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
00805 
00812 pa_operation *pa_stream_proplist_update(pa_stream *s, pa_update_mode_t mode, pa_proplist *p, pa_stream_success_cb_t cb, void *userdata);
00813 
00816 pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[], pa_stream_success_cb_t cb, void *userdata);
00817 
00822 int pa_stream_set_monitor_stream(pa_stream *s, uint32_t sink_input_idx);
00823 
00827 uint32_t pa_stream_get_monitor_stream(pa_stream *s);
00828 
00829 PA_C_DECL_END
00830 
00831 #endif