From 70b91ad4b65ea36bf7ac686cfc2caccdd7572f0f Mon Sep 17 00:00:00 2001 From: rexy712 Date: Sat, 16 Mar 2019 11:38:29 -0700 Subject: [PATCH] changed std::numeric_limits::min() to AV_NOPTS_VALUE. more portable --- TODO | 1 + include/libav/fmt/context.hpp | 3 ++- src/test.cpp | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 56075df..ee137bf 100644 --- a/TODO +++ b/TODO @@ -5,3 +5,4 @@ sync with matrix. add events to a queue that consumer can wait on or nonblocking youtube video download raii swscontext thorough error checking +register libav in the libav namespace somewhere diff --git a/include/libav/fmt/context.hpp b/include/libav/fmt/context.hpp index ff9fce8..e94fd4c 100644 --- a/include/libav/fmt/context.hpp +++ b/include/libav/fmt/context.hpp @@ -16,8 +16,9 @@ namespace libav::fmt{ public: input_context(void) = default; input_context(const char* filename){ - if(avformat_open_input(&m_context, filename, 0, 0) < 0) + if(avformat_open_input(&m_context, filename, 0, 0) < 0){ return; + } if(avformat_find_stream_info(m_context, 0) < 0){ reset(); } diff --git a/src/test.cpp b/src/test.cpp index 1ccc7f8..3666bb7 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -48,8 +48,6 @@ #include "reddit.hpp" #include "matrix.hpp" -#include //numeric_limits - extern "C"{ # include //sws_scale # include //av_image_alloc @@ -132,7 +130,7 @@ bool mux_audio_video(const raii::string_base& audio_file, const raii::string_bas //took me 2 days to realize I had to initialize these to the smallest possible int64 value instead of just 0 int64_t last_video_dts, last_audio_dts; - last_video_dts = last_audio_dts = std::numeric_limits::min(); + last_video_dts = last_audio_dts = AV_NOPTS_VALUE; while(true){ libav::packet packet; @@ -252,6 +250,7 @@ void write_to_file(const char* file, const raii::string_base& data){ } int main(){ + REGISTER_LIBAV(); //Read data file DEBUG_PRINT("reading data file \"data\"\n"); raii::rjp_ptr root = read_data_file("data");