History

increase buffer for mcfs video stream to 64k

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit cc9ca351 parent ee5b9873 files · +34 −3Browse files

Unified · Split

3 files
  1. stream.c +2 −0
  2. stream.h +2 −0
  3. stream_mc.c +30 −3
stream.c+2−0
@@ -50,6 +50,8 @@ Sclose(Stream *s) · 49 unmodified lines
50 return;50 return;
51 s->ops.close(s);51 s->ops.close(s);
52 s->type = -1;52 s->type = -1;
53 if(s->freeaux != nil)
54 s->freeaux(s->aux);
53}55}
54 56
55int57int
stream.h+2−0
@@ -67,6 +67,8 @@ struct Stream { · 66 unmodified lines
67 void *b;67 void *b;
68 u8int *buf;68 u8int *buf;
69 int bufsz;69 int bufsz;
70 void *aux;
71 void (*freeaux)(void *);
70};72};
71 73
72Stream *Sopen(char *filename, int *num);74Stream *Sopen(char *filename, int *num);
stream_mc.c+30−3
@@ -6,6 +6,15 @@ · 5 unmodified lines
6 6
7enum {7enum {
8 Maxstreams = 2,8 Maxstreams = 2,
9 Bufsz = 64*1024,
10};
11
12typedef struct MCaux MCaux;
13
14struct MCaux {
15 int fd;
16 Biobuf bio;
17 u8int buf[Bufsz];
9};18};
10 19
11static int20static int
@@ -47,6 +56,16 @@ audfmt(char *fmt) · 35 unmodified lines
47 return -1;56 return -1;
48}57}
49 58
59static void
60freeaux(void *aux)
61{
62 MCaux *a;
63
64 a = aux;
65 close(a->fd);
66 free(a);
67}
68
50static Stream *69static Stream *
51mcopen(char *filename, int *num, int *failed)70mcopen(char *filename, int *num, int *failed)
52{71{
@@ -54,6 +73,7 @@ mcopen(char *filename, int *num, int *failed) · 1 unmodified line
54 char *line;73 char *line;
55 int p, pid, n, ns;74 int p, pid, n, ns;
56 Biobuf b;75 Biobuf b;
76 MCaux *a;
57 char *argv[] = {77 char *argv[] = {
58 "mcfs",78 "mcfs",
59 filename,79 filename,
@@ -82,9 +102,16 @@ mcopen(char *filename, int *num, int *failed) · 22 unmodified lines
82 if(nvideo < 1 && strcmp(v[1], "video") == 0){102 if(nvideo < 1 && strcmp(v[1], "video") == 0){
83 s->video.w = atoi(v[3]);103 s->video.w = atoi(v[3]);
84 s->video.h = atoi(v[4]);104 s->video.h = atoi(v[4]);
85 if(mcfs(argv, &sp) > 0 && ivfopenb(Bfdopen(sp, OREAD), s, failed) == 0){105 if(mcfs(argv, &sp) > 0){
86 nvideo++;106 if((a = malloc(sizeof(*a))) == nil)
87 ns++;107 sysfatal("memory");
108 a->fd = sp;
109 s->aux = a;
110 s->freeaux = freeaux;
111 if(Binits(&a->bio, sp, OREAD, a->buf, Bufsz) == 0 && ivfopenb(&a->bio, s, failed) == 0){
112 nvideo++;
113 ns++;
114 }
88 }115 }
89 }else if(naudio < 1 && strcmp(v[1], "audio") == 0 && (s->fmt = audfmt(v[2])) >= 0){116 }else if(naudio < 1 && strcmp(v[1], "audio") == 0 && (s->fmt = audfmt(v[2])) >= 0){
90 s->audio.nchan = atoi(v[3]);117 s->audio.nchan = atoi(v[3]);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t