PulseAudio  1.1
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 
00397 uint32_t pa_stream_get_device_index(pa_stream *s);
00398 
00407 const char *pa_stream_get_device_name(pa_stream *s);
00408 
00413 int pa_stream_is_suspended(pa_stream *s);
00414 
00417 int pa_stream_is_corked(pa_stream *s);
00418 
00435 int pa_stream_connect_playback(
00436         pa_stream *s                  ,
00437         const char *dev                ,
00438         const pa_buffer_attr *attr    ,
00439         pa_stream_flags_t flags       ,
00440         const pa_cvolume *volume      ,
00441         pa_stream *sync_stream        );
00442 
00444 int pa_stream_connect_record(
00445         pa_stream *s                   ,
00446         const char *dev               ,
00447         const pa_buffer_attr *attr    ,
00448         pa_stream_flags_t flags       );
00449 
00451 int pa_stream_disconnect(pa_stream *s);
00452 
00481 int pa_stream_begin_write(
00482         pa_stream *p,
00483         void **data,
00484         size_t *nbytes);
00485 
00495 int pa_stream_cancel_write(
00496         pa_stream *p);
00497 
00518 int pa_stream_write(
00519         pa_stream *p             ,
00520         const void *data         ,
00521         size_t nbytes            ,
00522         pa_free_cb_t free_cb     ,
00523         int64_t offset,          
00524         pa_seek_mode_t seek      );
00525 
00532 int pa_stream_peek(
00533         pa_stream *p                 ,
00534         const void **data            ,
00535         size_t *nbytes               );
00536 
00539 int pa_stream_drop(pa_stream *p);
00540 
00542 size_t pa_stream_writable_size(pa_stream *p);
00543 
00545 size_t pa_stream_readable_size(pa_stream *p);
00546 
00551 pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00552 
00557 pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
00558 
00560 void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
00561 
00564 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00565 
00568 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00569 
00571 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00572 
00577 int64_t pa_stream_get_underflow_index(pa_stream *p);
00578 
00580 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00581 
00587 void pa_stream_set_started_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00588 
00592 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00593 
00599 void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00600 
00609 void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00610 
00613 void pa_stream_set_event_callback(pa_stream *p, pa_stream_event_cb_t cb, void *userdata);
00614 
00620 void pa_stream_set_buffer_attr_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00621 
00632 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
00633 
00638 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00639 
00642 pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00643 
00647 pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00648 
00650 pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
00651 
00683 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
00684 
00695 int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
00696 
00711 const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
00712 
00714 const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
00715 
00717 const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
00718 
00720 const pa_format_info* pa_stream_get_format_info(pa_stream *s);
00721 
00730 const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
00731 
00740 pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
00741 
00747 pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
00748 
00755 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);
00756 
00759 pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[], pa_stream_success_cb_t cb, void *userdata);
00760 
00765 int pa_stream_set_monitor_stream(pa_stream *s, uint32_t sink_input_idx);
00766 
00770 uint32_t pa_stream_get_monitor_stream(pa_stream *s);
00771 
00772 PA_C_DECL_END
00773 
00774 #endif