stream.h

Go to the documentation of this file.
00001 #ifndef foostreamhfoo
00002 #define foostreamhfoo
00003 
00004 /* $Id: stream.h 2067 2007-11-21 01:30:40Z lennart $ */
00005 
00006 /***
00007   This file is part of PulseAudio.
00008 
00009   Copyright 2004-2006 Lennart Poettering
00010   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
00011 
00012   PulseAudio is free software; you can redistribute it and/or modify
00013   it under the terms of the GNU Lesser General Public License as published
00014   by the Free Software Foundation; either version 2 of the License,
00015   or (at your option) any later version.
00016 
00017   PulseAudio is distributed in the hope that it will be useful, but
00018   WITHOUT ANY WARRANTY; without even the implied warranty of
00019   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00020   General Public License for more details.
00021 
00022   You should have received a copy of the GNU Lesser General Public License
00023   along with PulseAudio; if not, write to the Free Software
00024   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025   USA.
00026 ***/
00027 
00028 #include <sys/types.h>
00029 
00030 #include <pulse/sample.h>
00031 #include <pulse/channelmap.h>
00032 #include <pulse/volume.h>
00033 #include <pulse/def.h>
00034 #include <pulse/cdecl.h>
00035 #include <pulse/operation.h>
00036 
00265 PA_C_DECL_BEGIN
00266 
00268 typedef struct pa_stream pa_stream;
00269 
00271 typedef void (*pa_stream_success_cb_t) (pa_stream*s, int success, void *userdata);
00272 
00274 typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t bytes, void *userdata);
00275 
00277 typedef void (*pa_stream_notify_cb_t)(pa_stream *p, void *userdata);
00278 
00280 pa_stream* pa_stream_new(
00281         pa_context *c                     ,
00282         const char *name                  ,
00283         const pa_sample_spec *ss          ,
00284         const pa_channel_map *map         );
00285 
00287 void pa_stream_unref(pa_stream *s);
00288 
00290 pa_stream *pa_stream_ref(pa_stream *s);
00291 
00293 pa_stream_state_t pa_stream_get_state(pa_stream *p);
00294 
00296 pa_context* pa_stream_get_context(pa_stream *p);
00297 
00302 uint32_t pa_stream_get_index(pa_stream *s);
00303 
00312 uint32_t pa_stream_get_device_index(pa_stream *s);
00313 
00322 const char *pa_stream_get_device_name(pa_stream *s);
00323 
00328 int pa_stream_is_suspended(pa_stream *s);
00329 
00331 int pa_stream_connect_playback(
00332         pa_stream *s                  ,
00333         const char *dev                ,
00334         const pa_buffer_attr *attr    ,
00335         pa_stream_flags_t flags       ,
00336         pa_cvolume *volume            ,
00337         pa_stream *sync_stream        );
00338 
00340 int pa_stream_connect_record(
00341         pa_stream *s                   ,
00342         const char *dev               ,
00343         const pa_buffer_attr *attr    ,
00344         pa_stream_flags_t flags       );
00345 
00347 int pa_stream_disconnect(pa_stream *s);
00348 
00356 int pa_stream_write(
00357         pa_stream *p             ,
00358         const void *data         ,
00359         size_t bytes             ,
00360         pa_free_cb_t free_cb     ,
00361         int64_t offset,          
00362         pa_seek_mode_t seek      );
00363 
00369 int pa_stream_peek(
00370         pa_stream *p                 ,
00371         const void **data            ,
00372         size_t *bytes                );
00373 
00376 int pa_stream_drop(pa_stream *p);
00377 
00379 size_t pa_stream_writable_size(pa_stream *p);
00380 
00382 size_t pa_stream_readable_size(pa_stream *p);
00383 
00385 pa_operation* pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00386 
00391 pa_operation* pa_stream_update_timing_info(pa_stream *p, pa_stream_success_cb_t cb, void *userdata);
00392 
00394 void pa_stream_set_state_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata);
00395 
00398 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00399 
00402 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
00403 
00405 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00406 
00408 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00409 
00413 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00414 
00420 void pa_stream_set_moved_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00421 
00430 void pa_stream_set_suspended_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
00431 
00433 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
00434 
00438 pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00439 
00442 pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00443 
00447 pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *userdata);
00448 
00450 pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_success_cb_t cb, void *userdata);
00451 
00467 int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec);
00468 
00473 int pa_stream_get_latency(pa_stream *s, pa_usec_t *r_usec, int *negative);
00474 
00485 const pa_timing_info* pa_stream_get_timing_info(pa_stream *s);
00486 
00488 const pa_sample_spec* pa_stream_get_sample_spec(pa_stream *s);
00489 
00491 const pa_channel_map* pa_stream_get_channel_map(pa_stream *s);
00492 
00496 const pa_buffer_attr* pa_stream_get_buffer_attr(pa_stream *s);
00497 
00504 pa_operation *pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr, pa_stream_success_cb_t cb, void *userdata);
00505 
00506 /* Change the stream sampling rate during playback. You need to pass
00507  * PA_STREAM_VARIABLE_RATE in the flags parameter of
00508  * pa_stream_connect() if you plan to use this function. Only valid
00509  * after the stream has been connected successfully and if the server
00510  * is at least PulseAudio 0.9.8. \since 0.9.8 */
00511 pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_stream_success_cb_t cb, void *userdata);
00512 
00513 PA_C_DECL_END
00514 
00515 #endif

Generated on Tue Apr 24 02:06:15 2012 for PulseAudio by  doxygen 1.4.7