summaryrefslogtreecommitdiff
path: root/src/codec
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-11-12 12:12:31 -0500
committerAndrew Opalach <andrew@akon.city> 2024-11-12 12:12:31 -0500
commit29fa4f8d667d543595e652e7402d395d507ba464 (patch)
treeeaa2adf9f687c499b31eeddef42493c4bfda9b1c /src/codec
parentb4bcfa1da5c1be9f7999d4d4df4e8d1b73c3061a (diff)
downloadcamu-29fa4f8d667d543595e652e7402d395d507ba464.tar.gz
camu-29fa4f8d667d543595e652e7402d395d507ba464.tar.bz2
camu-29fa4f8d667d543595e652e7402d395d507ba464.zip
Add user volume, simple client add cli
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/codec')
-rw-r--r--src/codec/ffmpeg/decoder.c3
-rw-r--r--src/codec/ffmpeg/encoder.c9
-rw-r--r--src/codec/ffmpeg/encoder.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/codec/ffmpeg/decoder.c b/src/codec/ffmpeg/decoder.c
index 03940a0..d3ab3b2 100644
--- a/src/codec/ffmpeg/decoder.c
+++ b/src/codec/ffmpeg/decoder.c
@@ -43,8 +43,7 @@ static bool ff_decoder_init(struct camu_decoder *dec, struct camu_renderer *rend
av->codec_context->thread_type = FF_THREAD_SLICE;
al_log_debug("ff_decoder", "Using %i threads for decoder.", cpus);
-//#ifndef CAMU_SINK_NO_VIDEO
-#if 0
+#if !defined CAMU_SINK_NO_VIDEO && defined CAMU_RENDERER_VULKAN
if (codecpar->codec_type == AVMEDIA_TYPE_VIDEO && renderer && renderer->get_buffer2) {
av->codec_context->get_buffer2 = renderer->get_buffer2;
av->codec_context->opaque = renderer->opaque;
diff --git a/src/codec/ffmpeg/encoder.c b/src/codec/ffmpeg/encoder.c
index 83a8b55..11aaaff 100644
--- a/src/codec/ffmpeg/encoder.c
+++ b/src/codec/ffmpeg/encoder.c
@@ -11,7 +11,6 @@
#include "encoder.h"
-#define BITRATE 256000
#define FRAME_DURATION 20
#define SAMPLES_PER_FRAME (48000 / 1000.0 * FRAME_DURATION)
#define CHANNELS 2
@@ -21,7 +20,7 @@ static void free_frame_data(struct camu_ff_encoder *enc)
if (enc->frame && enc->frame->nb_samples > 0) av_freep(&enc->frame->data[0]);
}
-bool camu_ff_encoder_init(struct camu_ff_encoder *enc, char *encoder_name, char *ext)
+bool camu_ff_encoder_init(struct camu_ff_encoder *enc, char *encoder_name, char *ext, u32 bitrate)
{
al_memset(enc, 0, sizeof(struct camu_ff_encoder));
@@ -42,7 +41,7 @@ bool camu_ff_encoder_init(struct camu_ff_encoder *enc, char *encoder_name, char
enc->codec_context->sample_rate = 48000;
av_channel_layout_default(&enc->codec_context->ch_layout, CHANNELS);
enc->codec_context->sample_fmt = AV_SAMPLE_FMT_FLT;
- enc->codec_context->bit_rate = BITRATE;
+ enc->codec_context->bit_rate = bitrate;
enc->codec_context->frame_size = SAMPLES_PER_FRAME;
enc->codec_context->time_base = (AVRational){ 1, enc->codec_context->sample_rate };
enc->codec_context->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
@@ -53,7 +52,9 @@ bool camu_ff_encoder_init(struct camu_ff_encoder *enc, char *encoder_name, char
}
AVDictionary *opts = NULL;
- av_dict_set(&opts, "b", "256k", 0);
+ char kbps[16];
+ al_snprintf(kbps, sizeof(kbps), "%uk", bitrate / 1000);
+ av_dict_set(&opts, "b", kbps, 0);
av_dict_set(&opts, "vbr", "off", 0);
av_dict_set(&opts, "compression_level", "10", 0);
av_dict_set(&opts, "frame_duration", "20", 0);
diff --git a/src/codec/ffmpeg/encoder.h b/src/codec/ffmpeg/encoder.h
index c0d953c..238403f 100644
--- a/src/codec/ffmpeg/encoder.h
+++ b/src/codec/ffmpeg/encoder.h
@@ -18,7 +18,7 @@ struct camu_ff_encoder {
void *userdata;
};
-bool camu_ff_encoder_init(struct camu_ff_encoder *enc, char *encoder_name, char *ext);
+bool camu_ff_encoder_init(struct camu_ff_encoder *enc, char *encoder_name, char *ext, u32 bitrate);
void camu_ff_encoder_push(struct camu_ff_encoder *enc, u8 **data, s32 sample_count);
void camu_ff_encoder_reset(struct camu_ff_encoder *enc);
void camu_ff_encoder_close(struct camu_ff_encoder *enc);