PulseAudio  2.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, write to the Free Software
00022   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023   USA.
00024 ***/
00025 
00026 #include <sys/types.h>
00027 
00028 #include <pulse/sample.h>
00029 #include <pulse/format.h>
00030 #include <pulse/channelmap.h>
00031 #include <pulse/volume.h>
00032 #include <pulse/def.h>
00033 #include <pulse/cdecl.h>
00034 #include <pulse/operation.h>
00035 #include <pulse/context.h>
00036 #include <pulse/proplist.h>
00037 
00319 PA_C_DECL_BEGIN
00320 
00322 typedef struct pa_stream pa_stream;
00323 
00325 typedef void (*pa_stream_success_cb_t) (pa_stream*s, int success, void *userdata);
00326 
00328 typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t nbytes, void *userdata);
00329 
00331 typedef void (*pa_stream_notify_cb_t)(pa_stream *p, void *userdata);
00332 
00339 typedef void (*pa_stream_event_cb_t)(pa_stream *p, const char *name, pa_proplist *pl, void *userdata);
00340 
00344 pa_stream* pa_stream_new(
00345         pa_context *c                     ,
00346         const char *name                  ,
00347         const pa_sample_spec *ss          ,
00348         const pa_channel_map *map         );
00349 
00353 pa_stream* pa_stream_new_with_proplist(
00354         pa_context *c                     ,
00355         const char *name                  ,
00356         const pa_sample_spec *ss          ,
00357         const pa_channel_map *map         ,
00358         pa_proplist *p                    );
00359 
00364 pa_stream *pa_stream_new_extended(
00365         pa_context *c                     ,
00366         const char *name                  ,
00367         pa_format_info * const * formats  ,
00368         unsigned int n_formats            ,
00369         pa_proplist *p                    );
00370 
00372 void pa_stream_unref(pa_stream *s);
00373 
00375 pa_stream *pa_stream_ref(pa_stream *s);
00376 
00378 pa_stream_state_t pa_stream_get_state(pa_stream *p);
00379 
00381 pa_context* pa_stream_get_context(pa_stream *p);
00382 
00387 uint32_t pa_stream_get_index(pa_stream *s);
00388 
00398 uint32_t pa_stream_get_device_index(pa_stream *s);
00399 
00409 const char *pa_stream_get_device_name(pa_stream *s);
00410 
00415 int pa_stream_is_suspended(pa_stream *s);
00416 
00419 int pa_stream_is_corked(pa_stream *s);
00420 
00439 int pa_stream_connect_playback(
00440         pa_stream *s                  ,
00441         const char *dev                ,
00442         const pa_buffer_attr *attr    ,
00443         pa_stream_flags_t flags       ,
00444         const pa_cvolume *volume      ,
00445         pa_stream *sync_stream        );
00446 
00448 int pa_stream_connect_record(
00449         pa_stream *s                   ,
00450         const char *dev               ,
00451         const pa_buffer_attr *attr    ,
00452         pa_stream_flags_t flags       );
00453 
00455 int pa_stream_disconnect(pa_stream *s);
00456 
00489 int pa_stream_begin_write(
00490         pa_stream *p,
00491         void **data,
00492         size_t *nbytes);
00493 
00503 int pa_stream_cancel_write(
00504         pa_stream *p);
00505 
00528 int pa_stream_write(
00529         pa_stream *p             ,
00530         const void *data         ,
00531         size_t nbytes            ,
00532         pa_free_cb_t free_cb     ,
00533         int64_t offset,          
00534         pa_seek_mode_t seek      );
00535 
00542 int pa_stream_peek(
00543         pa_stream *p                 ,
00544         const void **data            ,
00545         size_t *nbytes               );
00546 
00549 int pa_stream_drop(pa_stream *p);
00550 
00552 size_t pa_stream_writable_size(pa_stream *p);
00553 
00555 size_t pa_stream_readable_size(pa_stream *p);
00556 
00561 pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00562 
00567 pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
00568 
00570 void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
00571 
00574 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00575 
00577 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00578 
00580 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00581 
00586 int64_t pa_stream_get_underflow_index(pa_stream *p);
00587 
00589 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00590 
00596 void pa_stream_set_started_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00597 
00601 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00602 
00608 void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00609 
00618 void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00619 
00622 void pa_stream_set_event_callback(pa_stream *p, pa_stream_event_cb_t cb, void *userdata);
00623 
00629 void pa_stream_set_buffer_attr_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00630 
00641 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
00642 
00647 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00648 
00651 pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00652 
00656 pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00657 
00659 pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
00660 
00692 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
00693 
00706 int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
00707 
00722 const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
00723 
00725 const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
00726 
00728 const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
00729 
00731 const pa_format_info* pa_stream_get_format_info(pa_stream *s);
00732 
00741 const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
00742 
00751 pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
00752 
00758 pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
00759 
00766 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);
00767 
00770 pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[], pa_stream_success_cb_t cb, void *userdata);
00771 
00776 int pa_stream_set_monitor_stream(pa_stream *s, uint32_t sink_input_idx);
00777 
00781 uint32_t pa_stream_get_monitor_stream(pa_stream *s);
00782 
00783 PA_C_DECL_END
00784 
00785 #endif