CFLAGS += -I./
CFLAGS += `pkg-config --cflags gtk+-3.0`
-LDFLAGS += -lavformat -lavcodec -lavfilter -lavutil
+LDFLAGS += -lavdevice -lavformat -lavcodec -lavfilter -lavutil
LDFLAGS += -lGL
LDFLAGS += `pkg-config --libs gtk+-3.0`
return -1;
}
- simp_filter_t* f = NULL;
- simp_avio_t* in = NULL;
- simp_avio_t* out = NULL;
+ avdevice_register_all();
+
+ simp_filter_t* f = NULL;
+ simp_avio_t* in = NULL;
+ simp_avio_t* out = NULL;
+ simp_avio_t* alsa = NULL;
if (simp_avio_open(&in, "ffmpeg_input", argv[1], NULL) < 0) {
scf_loge("\n");
return -1;
}
+ if (simp_avio_open(&alsa, "ffmpeg_alsa", NULL, "hw:0") < 0) {
+ scf_loge("\n");
+ return -1;
+ }
+
if (simp_filter_open(&f) < 0) {
scf_loge("\n");
return -1;
simp_filter_add_input (f, in);
simp_filter_add_output(f, out);
+ simp_filter_add_output(f, alsa);
- f->speed.num = 200;
+ f->speed.num = 1;
f->speed.den = 1;
if (simp_filter_run(f) < 0) {
return -1;
}
+ if (simp_avio_run(alsa) < 0) {
+ scf_loge("\n");
+ return -1;
+ }
+
if (simp_avio_run(out) < 0) {
scf_loge("\n");
return -1;
extern simp_avio_ops_t simp_avio_ffmpeg_input;
extern simp_avio_ops_t simp_avio_ffmpeg_output;
+extern simp_avio_ops_t simp_avio_ffmpeg_alsa;
static simp_avio_ops_t* avio_array[] =
{
&simp_avio_ffmpeg_input,
&simp_avio_ffmpeg_output,
+ &simp_avio_ffmpeg_alsa,
NULL,
};
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
+#include "libavdevice/avdevice.h"
#include "libavutil/avutil.h"
#include "libavutil/opt.h"
#include "libavfilter/avfilter.h"
AVStream* s = NULL;
AVCodec* c;
+ scf_loge("out: %p\n", out);
+
avformat_alloc_output_context2(&priv->ctx_out, out, NULL, path);
- if (!priv->ctx_out)
+ if (!priv->ctx_out) {
+ scf_loge("\n");
return -ENOMEM;
+ }
c = avcodec_find_encoder(priv->codec_in->codec_id);
if (!c)
priv->idx_out = -1;
if (in) {
+ scf_loge("in: %s\n", in);
ret = _audio_input_init(priv, in);
if (ret < 0)
goto error;
}
if (out) {
+ scf_loge("out: %s\n", out);
ret = _audio_output_init(priv, out);
if (ret < 0)
goto error;