projects
/
oss-streamer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
70c9734
)
Added stdin source (to use with 'arecord -t raw' command for 16-bit audio)
author
Roman Bazalevsky
<rvb@rvb.name>
Fri, 11 Jul 2014 15:52:32 +0000
(19:52 +0400)
committer
Roman Bazalevsky
<rvb@rvb.name>
Fri, 11 Jul 2014 15:52:32 +0000
(19:52 +0400)
oss-streamer
patch
|
blob
|
history
oss-streamer.c
patch
|
blob
|
history
diff --git
a/oss-streamer
b/oss-streamer
index deb0d96216beaa546dda6bb1d7f217688adbdca0..ceabc2e898569ffcf81c4b715e07515fc5578253 100755
(executable)
Binary files a/oss-streamer and b/oss-streamer differ
diff --git
a/oss-streamer.c
b/oss-streamer.c
index c5702d422f114080bae2ab54f62411e606c3a7d4..a64a16646ca10a9f8e8fa50fc0ad041a2656e701 100644
(file)
--- a/
oss-streamer.c
+++ b/
oss-streamer.c
@@
-15,7
+15,6
@@
#include <fcntl.h>
#define SOURCE_VERSION "0.0"
#include <fcntl.h>
#define SOURCE_VERSION "0.0"
-#define BOUNDARY "arflebarfle"
typedef enum { SNAPSHOT, STREAM } answer_t;
typedef enum { SNAPSHOT, STREAM } answer_t;
@@
-23,7
+22,7
@@
typedef enum { SNAPSHOT, STREAM } answer_t;
int stop=0, sd;
int force_delay=0;
#define BUF_SIZE 4096
int stop=0, sd;
int force_delay=0;
#define BUF_SIZE 4096
-
int
source_dev;
+
FILE *
source_dev;
/* signal fresh frames */
pthread_mutex_t db = PTHREAD_MUTEX_INITIALIZER;
/* signal fresh frames */
pthread_mutex_t db = PTHREAD_MUTEX_INITIALIZER;
@@
-97,7
+96,7
@@
void *get_thread( void *arg ) {
while( !stop ) {
/* grab a frame */
while( !stop ) {
/* grab a frame */
- if(
read(source_dev,rbuffer,BUF_SIZE
) < 0 ) {
+ if(
fread(rbuffer,1,BUF_SIZE,source_dev
) < 0 ) {
fprintf(stderr, "Error grabbing\n");
exit(1);
}
fprintf(stderr, "Error grabbing\n");
exit(1);
}
@@
-281,8
+280,12
@@
int main(int argc, char *argv[])
/* allocate audio datastructure */
/* open video device and prepare data structure */
/* allocate audio datastructure */
/* open video device and prepare data structure */
- source_dev = open(dev,O_RDONLY);
- if (source_dev < 0) {
+ if (strcmp(dev,"stdin")==0) {
+ source_dev = stdin;
+ } else {
+ source_dev = fopen(dev,"r");
+ }
+ if (source_dev == NULL) {
fprintf(stderr, "error opening source device\n");
exit(1);
}
fprintf(stderr, "error opening source device\n");
exit(1);
}