Skip to content

Commit e837376

Browse files
committed
x11 capture
1 parent 8686151 commit e837376

21 files changed

+1939
-162
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LFLAGS = $(shell pkg-config --libs cairo) \
1616
$(shell pkg-config --libs fftw3) \
1717
$(shell pkg-config --libs glib-2.0 libcanberra) \
1818
-lccv -lm -lpng -ljpeg -lswscale -lavutil -lswresample \
19-
-lavformat -lavcodec -lpthread -ljack
19+
-lavformat -lavcodec -lpthread -ljack -lX11
2020
LIBS =
2121
#CFLAGS = -O3 -ffast-math -Wall
2222
CFLAGS =-g -Wall
@@ -25,16 +25,16 @@ CFLAGS += $(shell pkg-config --cflags pangocairo) \
2525
$(shell pkg-config --cflags fftw3) \
2626
$(shell pkg-config --cflags glib-2.0 libcanberra)
2727

28-
SRCS = drawable.cc v4l2_wayland.cc muxing.cc sound_shape.cc midi.cc kmeter.cc \
28+
SRCS = vwdrawable.cc v4l2_wayland.cc sound_shape.cc midi.cc kmeter.cc \
2929
video_file_source.cc dingle_dots.cc v4l2.cc sprite.cc snapshot_shape.cc \
30-
easer.cc easable.cc video_file_out.cc
30+
easer.cc easable.cc video_file_out.cc x11.cc
3131
CSRCS= easing.c
3232

3333
OBJS := $(SRCS:.cc=.o) $(CSRCS:.c=.o)
3434

35-
HDRS = drawable.h muxing.h sound_shape.h midi.h v4l2_wayland.h kmeter.h \
35+
HDRS = vwdrawable.h sound_shape.h midi.h v4l2_wayland.h kmeter.h \
3636
video_file_source.h dingle_dots.h v4l2.h sprite.h snapshot_shape.h \
37-
easer.h easing.h easable.h video_file_out.h
37+
easer.h easing.h easable.h video_file_out.h x11.h
3838

3939
.SUFFIXES:
4040

dingle_dots.cc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int DingleDots::init(int width, int height) {
5555
color_init(&c2, 0.0, 0.2, 0.1, 1.0);
5656
this->meters[0].init(this, sr, bufsize, 0.1f, 20.0f, width/2 - 2*w, height/2, w, c1);
5757
this->meters[1].init(this, sr, bufsize, 0.1f, 20.0f, width/2 + 2*w, height/2, w, c2);
58-
58+
this->x11.create(this);
5959
snapshot_shape.init("SNAPSHOT", this->drawing_rect.width / 2., this->drawing_rect.width / 16.,
6060
this->drawing_rect.width / 32., random_color(), this);
6161

@@ -90,7 +90,16 @@ double hanning_window(int i, int N) {
9090
}
9191

9292
int process(jack_nframes_t nframes, void *arg) {
93+
static int first_call = 1;
9394
DingleDots *dd = (DingleDots *)arg;
95+
if (first_call) {
96+
first_call = 0;
97+
int rc = pthread_setname_np(pthread_self(), "vw_audio");
98+
if (rc != 0) {
99+
errno = rc;
100+
perror("pthread_setname_np");
101+
}
102+
}
94103
if (!dd->can_process) return 0;
95104
midi_process_output(nframes, dd);
96105
for (int chn = 0; chn < dd->nports; chn++) {
@@ -337,7 +346,7 @@ int DingleDots::add_note(char *scale_name,
337346
return -1;
338347
}
339348

340-
void DingleDots::get_sound_shapes(std::vector<Drawable *> &sound_shapes)
349+
void DingleDots::get_sound_shapes(std::vector<vwDrawable *> &sound_shapes)
341350
{
342351
for (int i = 0; i < MAX_NUM_SOUND_SHAPES; ++i) {
343352
SoundShape *ss = &this->sound_shapes[i];
@@ -350,8 +359,11 @@ void DingleDots::get_sound_shapes(std::vector<Drawable *> &sound_shapes)
350359
//sound_shapes.push_back(&this->snapshot_shape);
351360
}
352361

353-
void DingleDots::get_sources(std::vector<Drawable *> &list)
362+
void DingleDots::get_sources(std::vector<vwDrawable *> &list)
354363
{
364+
if (this->x11.active) {
365+
list.push_back(&this->x11);
366+
}
355367
for (int i = 0; i < MAX_NUM_V4L2; i++) {
356368
if (this->v4l2[i].active) {
357369
list.push_back(&this->v4l2[i]);

dingle_dots.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ typedef struct midi_key_t midi_key_t;
2626
#include "sprite.h"
2727
#include "easable.h"
2828
#include "video_file_out.h"
29+
#include "x11.h"
2930

3031
#define STR_LEN 80
3132
#define MAX_NUM_V4L2 4
@@ -70,6 +71,7 @@ class DingleDots : public Easable {
7071
int current_sprite_index;
7172
V4l2 v4l2[MAX_NUM_V4L2];
7273
Sprite sprites[MAX_NUM_SPRITES];
74+
X11 x11;
7375
SnapshotShape snapshot_shape;
7476
SoundShape sound_shapes[MAX_NUM_SOUND_SHAPES];
7577
Meter meters[2];
@@ -85,6 +87,7 @@ class DingleDots : public Easable {
8587
double ascale_factor_x;
8688
double ascale_factor_y;
8789
GdkRectangle selection_rect;
90+
8891
uint64_t next_z;
8992
GdkPoint mouse_pos;
9093
uint8_t mdown;
@@ -118,8 +121,8 @@ class DingleDots : public Easable {
118121
color random_color();
119122
uint8_t get_animating() const;
120123
void set_animating(const uint8_t &value);
121-
void get_sound_shapes(std::vector<Drawable *> &sound_shapes);
122-
void get_sources(std::vector<Drawable *> &list);
124+
void get_sound_shapes(std::vector<vwDrawable *> &sound_shapes);
125+
void get_sources(std::vector<vwDrawable *> &list);
123126
double get_selection_box_alpha() const;
124127
void set_selection_box_alpha(double value);
125128
void render_selection_box(cairo_t *cr);

easer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "easer.h"
44
#include "v4l2_wayland.h"
55
#include "dingle_dots.h"
6-
#include "drawable.h"
6+
#include "vwdrawable.h"
77

88
Easer::Easer() {}
99

easer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef enum {
4343
} Easer_Type;
4444

4545
class DingleDots;
46-
class Drawable;
46+
class vwDrawable;
4747
class Easable;
4848
typedef AHFloat (*EasingFuncPtr)(AHFloat);
4949
class Easer {

0 commit comments

Comments
 (0)