summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-02-10 20:46:36 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2018-02-10 20:46:36 +0100
commit998b7e43af9c535a167e3063aea4b0b232639662 (patch)
tree04a2011938cd0100911052753283c6506d9fc015 /modules
parent246e2b01accd5f6936bacd5c6092339b228d0150 (diff)
config: add configurable video pixel format
config: videnc_format yuv420p # yuv420p, yuv444p, ... The default pixel format is still YUV420P
Diffstat (limited to 'modules')
-rw-r--r--modules/vidloop/vidloop.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/modules/vidloop/vidloop.c b/modules/vidloop/vidloop.c
index d99fa49..6deddf2 100644
--- a/modules/vidloop/vidloop.c
+++ b/modules/vidloop/vidloop.c
@@ -32,12 +32,6 @@
*/
-/** Internal pixel-format */
-#ifndef VIDLOOP_INTERNAL_FMT
-#define VIDLOOP_INTERNAL_FMT (VID_FMT_YUV420P)
-#endif
-
-
/** Video Statistics */
struct vstat {
uint64_t tsamp;
@@ -181,17 +175,17 @@ static void vidsrc_frame_handler(struct vidframe *frame, void *arg)
++vl->stat.frames;
- if (frame->fmt != VIDLOOP_INTERNAL_FMT) {
+ if (frame->fmt != vl->cfg.enc_fmt) {
if (!vl->need_conv) {
info("vidloop: NOTE: pixel-format conversion"
" needed: %s --> %s\n",
vidfmt_name(frame->fmt),
- vidfmt_name(VIDLOOP_INTERNAL_FMT));
+ vidfmt_name(vl->cfg.enc_fmt));
vl->need_conv = true;
}
- if (vidframe_alloc(&f2, VIDLOOP_INTERNAL_FMT, &frame->size))
+ if (vidframe_alloc(&f2, vl->cfg.enc_fmt, &frame->size))
return;
vidconv(f2, frame, 0);
@@ -209,7 +203,10 @@ static void vidsrc_frame_handler(struct vidframe *frame, void *arg)
}
if (vl->vc_enc && vl->enc) {
- (void)vl->vc_enc->ench(vl->enc, false, frame);
+ err = vl->vc_enc->ench(vl->enc, false, frame);
+ if (err) {
+ warning("vidloop: encoder error (%m)\n", err);
+ }
}
else {
vl->stat.bytes += vidframe_size(frame->fmt, &frame->size);
@@ -287,10 +284,11 @@ static void print_status(struct video_loop *vl)
{
(void)re_fprintf(stdout,
"\rstatus:"
- " [%s] [%s] intra=%zu "
+ " [%s] [%s] fmt=%s intra=%zu "
" EFPS=%.1f %u kbit/s \r",
vl->vc_enc ? vl->vc_enc->name : "",
vl->vc_dec ? vl->vc_dec->name : "",
+ vidfmt_name(vl->cfg.enc_fmt),
vl->stat.n_intra,
vl->stat.efps, vl->stat.bitrate);
fflush(stdout);