comparison beosaudio.cpp @ 153:41d4f3a86c98 libavformat

cleanup; BSoundRecorder moved to Experimental namespace
author mmu_man
date Sun, 15 Jun 2003 17:06:28 +0000
parents c1c8a0777bdb
children 8c55237af288
comparison
equal deleted inserted replaced
152:cc03a75cbde4 153:41d4f3a86c98
31 #include "avformat.h" 31 #include "avformat.h"
32 } 32 }
33 33
34 #ifdef HAVE_BSOUNDRECORDER 34 #ifdef HAVE_BSOUNDRECORDER
35 #include <SoundRecorder.h> 35 #include <SoundRecorder.h>
36 using namespace BPrivate::Media::Experimental;
36 #endif 37 #endif
37 38
38 /* enable performance checks */ 39 /* enable performance checks */
39 //#define PERF_CHECK 40 //#define PERF_CHECK
40 41
41 /* enable Media Kit latency checks */ 42 /* enable Media Kit latency checks */
42 //#define LATENCY_CHECK 43 //#define LATENCY_CHECK
43 44
44 #define AUDIO_BLOCK_SIZE 4096 45 #define AUDIO_BLOCK_SIZE 4096
45 //#define AUDIO_BLOCK_SIZE 2048
46 #define AUDIO_BLOCK_COUNT 8 46 #define AUDIO_BLOCK_COUNT 8
47 47
48 #define AUDIO_BUFFER_SIZE (AUDIO_BLOCK_SIZE*AUDIO_BLOCK_COUNT) 48 #define AUDIO_BUFFER_SIZE (AUDIO_BLOCK_SIZE*AUDIO_BLOCK_COUNT)
49 49
50 typedef struct { 50 typedef struct {
58 /* ring buffer */ 58 /* ring buffer */
59 sem_id input_sem; 59 sem_id input_sem;
60 int input_index; 60 int input_index;
61 sem_id output_sem; 61 sem_id output_sem;
62 int output_index; 62 int output_index;
63 int queued;
64 BSoundPlayer *player; 63 BSoundPlayer *player;
65 #ifdef HAVE_BSOUNDRECORDER 64 #ifdef HAVE_BSOUNDRECORDER
66 BSoundRecorder *recorder; 65 BSoundRecorder *recorder;
67 #endif 66 #endif
68 int has_quit; /* signal callbacks not to wait */ 67 int has_quit; /* signal callbacks not to wait */
194 #ifndef HAVE_BSOUNDRECORDER 193 #ifndef HAVE_BSOUNDRECORDER
195 if (!is_output) 194 if (!is_output)
196 return -EIO; /* not for now */ 195 return -EIO; /* not for now */
197 #endif 196 #endif
198 s->input_sem = create_sem(AUDIO_BUFFER_SIZE, "ffmpeg_ringbuffer_input"); 197 s->input_sem = create_sem(AUDIO_BUFFER_SIZE, "ffmpeg_ringbuffer_input");
199 // s->input_sem = create_sem(AUDIO_BLOCK_SIZE, "ffmpeg_ringbuffer_input");
200 if (s->input_sem < B_OK) 198 if (s->input_sem < B_OK)
201 return -EIO; 199 return -EIO;
202 s->output_sem = create_sem(0, "ffmpeg_ringbuffer_output"); 200 s->output_sem = create_sem(0, "ffmpeg_ringbuffer_output");
203 if (s->output_sem < B_OK) { 201 if (s->output_sem < B_OK) {
204 delete_sem(s->input_sem); 202 delete_sem(s->input_sem);
205 return -EIO; 203 return -EIO;
206 } 204 }
207 s->input_index = 0; 205 s->input_index = 0;
208 s->output_index = 0; 206 s->output_index = 0;
209 s->queued = 0;
210 create_bapp_if_needed(); 207 create_bapp_if_needed();
211 s->frame_size = AUDIO_BLOCK_SIZE; 208 s->frame_size = AUDIO_BLOCK_SIZE;
212 /* bump up the priority (avoid realtime though) */ 209 /* bump up the priority (avoid realtime though) */
213 set_thread_priority(find_thread(NULL), B_DISPLAY_PRIORITY+1); 210 set_thread_priority(find_thread(NULL), B_DISPLAY_PRIORITY+1);
214 #ifdef HAVE_BSOUNDRECORDER 211 #ifdef HAVE_BSOUNDRECORDER