From 876e2c9728b53b407a7c94931c276d89d526b0b1 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 10 Apr 2023 18:18:28 +0800 Subject: [PATCH] tmp --- scf_def.h | 3 +++ simp_ffmpeg_output.c | 2 +- simp_filter.c | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/scf_def.h b/scf_def.h index c735f34..22d1be5 100644 --- a/scf_def.h +++ b/scf_def.h @@ -11,6 +11,9 @@ #include #include #include +#include +#include +#include #if 1 #include diff --git a/simp_ffmpeg_output.c b/simp_ffmpeg_output.c index b5e4cc1..7f23298 100644 --- a/simp_ffmpeg_output.c +++ b/simp_ffmpeg_output.c @@ -29,7 +29,7 @@ static int _video_init(simp_ffmpeg_t* priv) priv->vcodec_ctx->gop_size = 30; priv->vcodec_ctx->max_b_frames = 2; priv->vcodec_ctx->pix_fmt = AV_PIX_FMT_YUV420P; - priv->vcodec_ctx->sample_aspect_ratio = (AVRational){16, 9}; + priv->vcodec_ctx->sample_aspect_ratio = (AVRational){1, 1}; s->time_base = priv->vcodec_ctx->time_base; if (priv->fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER) diff --git a/simp_filter.c b/simp_filter.c index 978da9a..6501430 100644 --- a/simp_filter.c +++ b/simp_filter.c @@ -341,7 +341,23 @@ static void* __filter_run(void* arg) f->error = ret; goto error; } +#if 1 + static int fd = -1; + if (-1 == fd) + fd = open("1.yuv", O_RDWR | O_CREAT | O_TRUNC, 0666); + if (fd > 0) { + int i; + for (i = 0; i < f->vframe->height; i++) + write(fd, f->vframe->data[0] + i * f->vframe->linesize[0], f->vframe->width); + + for (i = 0; i < f->vframe->height / 2; i++) + write(fd, f->vframe->data[1] + i * f->vframe->linesize[1], f->vframe->width / 2); + + for (i = 0; i < f->vframe->height / 2; i++) + write(fd, f->vframe->data[2] + i * f->vframe->linesize[2], f->vframe->width / 2); + } +#endif for (l = scf_list_head(&f->outputs); l != scf_list_sentinel(&f->outputs); l = scf_list_next(l)) { io = scf_list_data(l, simp_avio_t, list); -- 2.25.1