summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-09-04 03:19:21 +0200
committerLennart Poettering <lennart@poettering.net>2007-09-04 03:19:21 +0200
commit308b40e79e6d0720f5dac4f7fe251f6f291fe7dc (patch)
treefe741064bd57f509aecc7593bab1677c2fb316e8
parentcbc2fafc391ecdc141d016e8f7176847e43ba212 (diff)
A couple of minor cleanups: fix Adobe's code to use proper new-style functions;
disconnect streams/contexts explicitly before unref()fing them; guarantee frame alignment.
-rw-r--r--flashsupport.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/flashsupport.c b/flashsupport.c
index 141079d..3477d29 100644
--- a/flashsupport.c
+++ b/flashsupport.c
@@ -124,7 +124,7 @@ extern "C" {
#endif // defined(ALSA) || defined(OSS)
#ifdef V4L1
- static void *FPX_VideoInput_Open();
+ static void *FPX_VideoInput_Open(void);
static int FPX_VideoInput_Close(void *ptr);
static int FPX_VideoInput_GetFrame(void *ptr, char *data, int width, int height, int pitch_n_bytes);
#endif // V4L1
@@ -255,7 +255,7 @@ void *FPX_Init(void *ptr)
return (void *)&fpx_functions;
}
-static void FPX_Shutdown()
+static void FPX_Shutdown(void)
{
#ifdef OPENSSL
@@ -861,12 +861,14 @@ static void write_data(struct output_data *p) {
length = pa_stream_writable_size(p->stream);
- while (length > 0) {
+ while (length > 4) {
size_t l = length;
if (l > BUFSIZE)
l = BUFSIZE;
+ l &= ~ ((size_t) 3);
+
FPI_SoundOutput_FillBuffer(p, (char*) p->buf, l);
if (pa_stream_write(p->stream, p->buf, l, NULL, 0, PA_SEEK_RELATIVE) < 0)
@@ -916,7 +918,7 @@ static void *FPX_SoundOutput_Open(void) {
.channels = 2
};
- struct output_data *p = NULL;
+ struct output_data *p;
/* Awesome, we don't inform the user about any error messages, I
* guess that's Adobe style programming. Rock!" */
@@ -993,11 +995,15 @@ static int FPX_SoundOutput_Close(void *ptr) {
if (p->mainloop)
pa_threaded_mainloop_stop(p->mainloop);
- if (p->stream)
+ if (p->stream) {
+ pa_stream_disconnect(p->stream);
pa_stream_unref(p->stream);
+ }
- if (p->context)
+ if (p->context) {
+ pa_context_disconnect(p->context);
pa_context_unref(p->context);
+ }
if (p->mainloop)
pa_threaded_mainloop_free(p->mainloop);
@@ -1010,7 +1016,7 @@ static int FPX_SoundOutput_Close(void *ptr) {
static int FPX_SoundOutput_Latency(void *ptr) {
struct output_data *p = ptr;
- pa_usec_t t;
+ pa_usec_t t = 0;
int negative;
int r;
@@ -1069,7 +1075,7 @@ static void *v4l_thread(void *ptr)
}
}
-static void *FPX_VideoInput_Open()
+static void *FPX_VideoInput_Open(void)
{
struct VideoOutput_Instance *instance = 0;