PulseAudio  3.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 
00552 int pa_stream_peek(
00553         pa_stream *p                 ,
00554         const void **data            ,
00555         size_t *nbytes               );
00556 
00559 int pa_stream_drop(pa_stream *p);
00560 
00562 size_t pa_stream_writable_size(pa_stream *p);
00563 
00565 size_t pa_stream_readable_size(pa_stream *p);
00566 
00571 pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00572 
00577 pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
00578 
00580 void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
00581 
00584 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00585 
00587 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00588 
00590 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00591 
00596 int64_t pa_stream_get_underflow_index(pa_stream *p);
00597 
00599 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00600 
00606 void pa_stream_set_started_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00607 
00611 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00612 
00618 void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00619 
00628 void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00629 
00632 void pa_stream_set_event_callback(pa_stream *p, pa_stream_event_cb_t cb, void *userdata);
00633 
00639 void pa_stream_set_buffer_attr_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00640 
00651 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
00652 
00657 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00658 
00661 pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00662 
00666 pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00667 
00669 pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
00670 
00702 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
00703 
00716 int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
00717 
00732 const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
00733 
00735 const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
00736 
00738 const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
00739 
00741 const pa_format_info* pa_stream_get_format_info(pa_stream *s);
00742 
00751 const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
00752 
00761 pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
00762 
00768 pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
00769 
00776 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);
00777 
00780 pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[], pa_stream_success_cb_t cb, void *userdata);
00781 
00786 int pa_stream_set_monitor_stream(pa_stream *s, uint32_t sink_input_idx);
00787 
00791 uint32_t pa_stream_get_monitor_stream(pa_stream *s);
00792 
00793 PA_C_DECL_END
00794 
00795 #endif