aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/capture.c27
-rw-r--r--common/channel.c6
-rw-r--r--common/commands.c32
-rw-r--r--common/commands.h1
-rw-r--r--common/frequencies.c2
-rw-r--r--common/parseconfig.c4
6 files changed, 49 insertions, 23 deletions
diff --git a/common/capture.c b/common/capture.c
index 97e272f..4396a24 100644
--- a/common/capture.c
+++ b/common/capture.c
@@ -8,6 +8,7 @@
#include <signal.h>
#include <string.h>
#include <pthread.h>
+#include <inttypes.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -255,9 +256,9 @@ struct movie_handle {
const struct ng_writer *writer;
void *handle;
pthread_t tflush;
- long long start;
- long long rts;
- long long stopby;
+ uint64_t start;
+ uint64_t rts;
+ uint64_t stopby;
int slots;
/* video */
@@ -267,7 +268,7 @@ struct movie_handle {
int seq;
struct FIFO vfifo;
pthread_t tvideo;
- long long vts;
+ uint64_t vts;
/* video converter thread */
struct FIFO cfifo;
@@ -284,10 +285,10 @@ struct movie_handle {
struct FIFO afifo;
pthread_t taudio;
pthread_t raudio;
- long long ats;
+ uint64_t ats;
- long long rdrift;
- long long vdrift;
+ uint64_t rdrift;
+ uint64_t vdrift;
};
static void*
@@ -517,7 +518,7 @@ int
movie_writer_stop(struct movie_handle *h)
{
char line[128];
- long long stopby;
+ uint64_t stopby;
int frames,i;
void *dummy;
@@ -526,12 +527,12 @@ movie_writer_stop(struct movie_handle *h)
if (h->vfmt.fmtid != VIDEO_NONE && h->afmt.fmtid != AUDIO_NONE) {
for (frames = 0; frames < 16; frames++) {
- stopby = (long long)(h->frames + frames) * 1000000000000 / h->fps;
+ stopby = (uint64_t)(h->frames + frames) * (uint64_t)1000000000000 / h->fps;
if (stopby > h->ats)
break;
}
frames++;
- h->stopby = (long long)(h->frames + frames) * 1000000000000 / h->fps;
+ h->stopby = (uint64_t)(h->frames + frames) * (uint64_t)1000000000000 / h->fps;
while (frames) {
movie_grab_put_video(h,NULL);
frames--;
@@ -593,11 +594,11 @@ movie_print_timestamps(struct movie_handle *h)
(h->rdrift > 0) ? '+' : '-',
(int)((abs(h->rdrift) / 1000000000)),
(int)((abs(h->rdrift) % 1000000000) / 10000000),
- (int)(h->rdrift * h->fps / 1000000000000),
+ (int)(h->rdrift * h->fps / (uint64_t)1000000000000),
(h->vdrift > 0) ? '+' : '-',
(int)((abs(h->vdrift) / 1000000000)),
(int)((abs(h->vdrift) % 1000000000) / 10000000),
- (int)(h->vdrift * h->fps / 1000000000000));
+ (int)(h->vdrift * h->fps / (uint64_t)1000000000000));
rec_status(line);
}
@@ -622,7 +623,7 @@ movie_grab_put_video(struct movie_handle *h, struct ng_video_buf **ret)
#endif
/* rate control */
- expected = (buf->info.ts - h->vdrift) * h->fps / 1000000000000;
+ expected = (buf->info.ts - h->vdrift) * h->fps / (uint64_t)1000000000000;
if (expected < h->frames-1) {
if (debug > 1)
fprintf(stderr,"rate: ignoring frame [%d %d]\n",
diff --git a/common/channel.c b/common/channel.c
index b10802f..1b8596e 100644
--- a/common/channel.c
+++ b/common/channel.c
@@ -2,9 +2,7 @@
channel for Bt848 frame grabber driver
Copyright (C) 1996,97 Marcus Metzler (mocm@thp.uni-koeln.de)
-
- many changes by Gerd Knorr <kraxel@goldbach.in-berlin.de>
- [ hmm, think by now nearly nothing left from the original code ... ]
+ (c) 1998-2003 Gerd Knorr <kraxel@bytesex.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -693,7 +691,7 @@ save_config()
if (channels[i]->key != NULL)
fprintf(fp,"key = %s\n",channels[i]->key);
if (0 != strcmp(channels[i]->group,defaults.group))
- fprintf(fp,"group = %s\n",defaults.group);
+ fprintf(fp,"group = %s\n",channels[i]->group);
if (channels[i]->midi != 0)
fprintf(fp,"midi = %d\n",channels[i]->midi);
if (channels[i]->capture != cur_capture)
diff --git a/common/commands.c b/common/commands.c
index 9b33bc9..bf633a9 100644
--- a/common/commands.c
+++ b/common/commands.c
@@ -198,6 +198,26 @@ void add_attrs(struct ng_attribute *new)
#endif
}
+void init_overlay(void)
+{
+ do_va_cmd(2,"setfreqtab",(-1 != chantab)
+ ? chanlist_names[chantab].str : "europe-west");
+
+ cur_capture = -1;
+ switch (defaults.capture) {
+ case CAPTURE_ON:
+ case CAPTURE_OVERLAY:
+ do_va_cmd(2,"capture","overlay");
+ break;
+ case CAPTURE_GRABDISPLAY:
+ do_va_cmd(2,"capture","grabdisplay");
+ break;
+ default:
+ do_va_cmd(2,"capture","off");
+ break;
+ }
+}
+
/* ----------------------------------------------------------------------- */
int
@@ -282,7 +302,7 @@ split_cmdline(char *line, int *count)
static void
set_capture(int capture, int tmp_switch)
{
- static int last_on = 0;
+ static int last_on = CAPTURE_OVERLAY;
if (set_capture_hook) {
if (capture == CAPTURE_ON)
@@ -439,7 +459,7 @@ static int update_int(struct ng_attribute *attr, int old, char *new)
/* ----------------------------------------------------------------------- */
void
-attr_init()
+attr_init(void)
{
struct ng_attribute *attr;
int val;
@@ -468,7 +488,7 @@ attr_init()
}
void
-audio_init()
+audio_init(void)
{
struct ng_attribute *attr;
@@ -481,7 +501,7 @@ audio_init()
}
void
-audio_on()
+audio_on(void)
{
struct ng_attribute *attr,*list;
@@ -492,7 +512,7 @@ audio_on()
}
void
-audio_off()
+audio_off(void)
{
struct ng_attribute *attr,*list;
@@ -503,7 +523,7 @@ audio_off()
}
void
-set_defaults()
+set_defaults(void)
{
struct ng_attribute *attr;
diff --git a/common/commands.h b/common/commands.h
index 8e51e9d..7c655d8 100644
--- a/common/commands.h
+++ b/common/commands.h
@@ -71,6 +71,7 @@ void audio_off(void);
void set_defaults(void);
void add_attrs(struct ng_attribute *new);
+void init_overlay(void);
int do_va_cmd(int argc, ...);
int do_command(int argc, char **argv);
diff --git a/common/frequencies.c b/common/frequencies.c
index 1c95832..cc03cf3 100644
--- a/common/frequencies.c
+++ b/common/frequencies.c
@@ -62,6 +62,7 @@ void freq_init(void)
fprintf(stderr,"%s:%d: syntax error\n",
DATADIR "/Index.map",nr);
}
+ fclose(fp);
chanlist_names = malloc((i+1) * sizeof(struct STRTAB));
for (j = 0; j < i; j++) {
@@ -125,6 +126,7 @@ static int freq_readlist(struct CHANLIST **list, int n, char *name)
/* Huh ? */
fprintf(stderr,"%s:%d: syntax error\n", filename, nr);
}
+ fclose(fp);
return n;
}
diff --git a/common/parseconfig.c b/common/parseconfig.c
index d4588d7..5e2b798 100644
--- a/common/parseconfig.c
+++ b/common/parseconfig.c
@@ -133,6 +133,9 @@ cfg_parse_file(char *filename)
if (NULL == e) {
fprintf(stderr,"%s:%d: error: no section\n",filename,nr);
} else {
+ char *c = value + strlen(value)-1;
+ while (c > value && (*c == ' ' || *c == '\t'))
+ *(c--) = 0;
cfg_set_entry(e,tag,value);
}
} else {
@@ -140,6 +143,7 @@ cfg_parse_file(char *filename)
fprintf(stderr,"%s:%d: syntax error\n",filename,nr);
}
}
+ fclose(fp);
return 0;
}

Privacy Policy