From 32c3807fe1b619f0029a6dd19b81d31d19aa54af Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 9 Apr 2022 04:23:41 +0200 Subject: [PATCH] Show correct original fps in mediainfo --- src/main.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7552ed6..e6532df 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -290,7 +290,7 @@ static bool recreate_window_pixmap(Display *dpy, Window window_id, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, pixmap.texture_width, pixmap.texture_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); int err2 = glGetError(); - fprintf(stderr, "error: %d\n", err2); + //fprintf(stderr, "error: %d\n", err2); // glXBindTexImageEXT(dpy, pixmap.glx_pixmap, GLX_FRONT_EXT, NULL); // glGenerateTextureMipmapEXT(glxpixmap, GL_TEXTURE_2D); @@ -390,8 +390,8 @@ static AVCodecContext* create_audio_codec_context(AVFormatContext *av_format_con codec_context->time_base.num = 1; codec_context->time_base.den = AV_TIME_BASE; - codec_context->framerate.num = 1; - codec_context->framerate.den = fps; + codec_context->framerate.num = fps; + codec_context->framerate.den = 1; // Some formats want stream headers to be seperate if (av_format_context->oformat->flags & AVFMT_GLOBALHEADER) @@ -430,8 +430,8 @@ static AVCodecContext *create_video_codec_context(AVFormatContext *av_format_con // identical to 1 codec_context->time_base.num = 1; codec_context->time_base.den = AV_TIME_BASE; - codec_context->framerate.num = 1; - codec_context->framerate.den = fps; + codec_context->framerate.num = fps; + codec_context->framerate.den = 1; codec_context->sample_aspect_ratio.num = 0; codec_context->sample_aspect_ratio.den = 0; codec_context->gop_size = fps * 2; @@ -682,7 +682,7 @@ static AVStream* create_stream(AVFormatContext *av_format_context, AVCodecContex } stream->id = av_format_context->nb_streams - 1; stream->time_base = codec_context->time_base; - stream->avg_frame_rate = av_inv_q(codec_context->framerate); + stream->avg_frame_rate = codec_context->framerate; return stream; } @@ -1391,7 +1391,7 @@ int main(int argc, char **argv) { double frame_timer_elapsed = time_now - frame_timer_start; double elapsed = time_now - start_time; if (elapsed >= 1.0) { - fprintf(stderr, "fps: %d\n", fps_counter); + fprintf(stderr, "update fps: %d\n", fps_counter); start_time = time_now; current_fps = fps_counter; fps_counter = 0;