changed std::numeric_limits<int64_t>::min() to AV_NOPTS_VALUE. more portable

This commit is contained in:
rexy712 2019-03-16 11:38:29 -07:00
parent 8217964440
commit 70b91ad4b6
3 changed files with 5 additions and 4 deletions

1
TODO
View File

@ -5,3 +5,4 @@ sync with matrix. add events to a queue that consumer can wait on or nonblocking
youtube video download youtube video download
raii swscontext raii swscontext
thorough error checking thorough error checking
register libav in the libav namespace somewhere

View File

@ -16,8 +16,9 @@ namespace libav::fmt{
public: public:
input_context(void) = default; input_context(void) = default;
input_context(const char* filename){ 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; return;
}
if(avformat_find_stream_info(m_context, 0) < 0){ if(avformat_find_stream_info(m_context, 0) < 0){
reset(); reset();
} }

View File

@ -48,8 +48,6 @@
#include "reddit.hpp" #include "reddit.hpp"
#include "matrix.hpp" #include "matrix.hpp"
#include <limits> //numeric_limits
extern "C"{ extern "C"{
# include <libswscale/swscale.h> //sws_scale # include <libswscale/swscale.h> //sws_scale
# include <libavutil/imgutils.h> //av_image_alloc # include <libavutil/imgutils.h> //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 //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; int64_t last_video_dts, last_audio_dts;
last_video_dts = last_audio_dts = std::numeric_limits<int64_t>::min(); last_video_dts = last_audio_dts = AV_NOPTS_VALUE;
while(true){ while(true){
libav::packet packet; libav::packet packet;
@ -252,6 +250,7 @@ void write_to_file(const char* file, const raii::string_base& data){
} }
int main(){ int main(){
REGISTER_LIBAV();
//Read data file //Read data file
DEBUG_PRINT("reading data file \"data\"\n"); DEBUG_PRINT("reading data file \"data\"\n");
raii::rjp_ptr root = read_data_file("data"); raii::rjp_ptr root = read_data_file("data");