From af8007aa958271ba16b15e7d11a891570488f6c9 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 2 Dec 2018 00:37:43 +0100 Subject: [PATCH] Combine timebase.h from Nageru and Futatabi. --- futatabi/clip_list.cpp | 2 +- futatabi/disk_space_estimator.cpp | 2 +- futatabi/disk_space_estimator.h | 4 ++-- futatabi/main.cpp | 2 +- futatabi/mainwindow.cpp | 2 +- futatabi/mux.cpp | 2 +- futatabi/mux.h | 2 +- futatabi/player.cpp | 2 +- nageru/alsa_input.cpp | 2 +- nageru/audio_encoder.cpp | 2 +- nageru/audio_mixer.cpp | 2 +- nageru/benchmark_audio_mixer.cpp | 2 +- nageru/decklink_output.cpp | 2 +- nageru/disk_space_estimator.cpp | 2 +- nageru/disk_space_estimator.h | 4 ++-- nageru/ffmpeg_capture.cpp | 2 +- nageru/kaeru.cpp | 2 +- nageru/mixer.cpp | 2 +- nageru/mixer.h | 2 +- nageru/mux.cpp | 2 +- nageru/mux.h | 2 +- nageru/quicksync_encoder.cpp | 2 +- nageru/quicksync_encoder_impl.h | 2 +- nageru/timebase.h | 25 ------------------------- nageru/video_encoder.cpp | 2 +- nageru/x264_encoder.cpp | 2 +- {futatabi => shared}/timebase.h | 0 27 files changed, 27 insertions(+), 52 deletions(-) delete mode 100644 nageru/timebase.h rename {futatabi => shared}/timebase.h (100%) diff --git a/futatabi/clip_list.cpp b/futatabi/clip_list.cpp index 14f083e..9ccbb71 100644 --- a/futatabi/clip_list.cpp +++ b/futatabi/clip_list.cpp @@ -1,7 +1,7 @@ #include "clip_list.h" #include "mainwindow.h" -#include "timebase.h" +#include "shared/timebase.h" #include "ui_mainwindow.h" #include diff --git a/futatabi/disk_space_estimator.cpp b/futatabi/disk_space_estimator.cpp index 69de4d5..073e57e 100644 --- a/futatabi/disk_space_estimator.cpp +++ b/futatabi/disk_space_estimator.cpp @@ -1,6 +1,6 @@ #include "disk_space_estimator.h" -#include "timebase.h" +#include "shared/timebase.h" #include #include diff --git a/futatabi/disk_space_estimator.h b/futatabi/disk_space_estimator.h index f02cb9c..e4b2c51 100644 --- a/futatabi/disk_space_estimator.h +++ b/futatabi/disk_space_estimator.h @@ -9,7 +9,7 @@ // // The bitrate is measured over a simple 30-second sliding window. -#include "timebase.h" +#include "shared/timebase.h" #include #include @@ -25,7 +25,7 @@ public: // Report that a video frame with the given pts and size has just been // written (possibly appended) to the given file. // - // is taken to be in TIMEBASE units (see timebase.h). + // is taken to be in TIMEBASE units (see shared/timebase.h). void report_write(const std::string &filename, size_t bytes, uint64_t pts); private: diff --git a/futatabi/main.cpp b/futatabi/main.cpp index 14bc12a..41bbb82 100644 --- a/futatabi/main.cpp +++ b/futatabi/main.cpp @@ -32,7 +32,7 @@ extern "C" { #include "player.h" #include "shared/post_to_main_thread.h" #include "ref_counted_gl_sync.h" -#include "timebase.h" +#include "shared/timebase.h" #include "ui_mainwindow.h" #include "vaapi_jpeg_decoder.h" diff --git a/futatabi/mainwindow.cpp b/futatabi/mainwindow.cpp index b9dee27..85a86a8 100644 --- a/futatabi/mainwindow.cpp +++ b/futatabi/mainwindow.cpp @@ -6,7 +6,7 @@ #include "frame_on_disk.h" #include "player.h" #include "shared/post_to_main_thread.h" -#include "timebase.h" +#include "shared/timebase.h" #include "ui_mainwindow.h" #include diff --git a/futatabi/mux.cpp b/futatabi/mux.cpp index bcbbef3..34a2bdd 100644 --- a/futatabi/mux.cpp +++ b/futatabi/mux.cpp @@ -22,7 +22,7 @@ extern "C" { } #include "defs.h" -#include "timebase.h" +#include "shared/timebase.h" using namespace std; diff --git a/futatabi/mux.h b/futatabi/mux.h index 53e5539..dca6be5 100644 --- a/futatabi/mux.h +++ b/futatabi/mux.h @@ -18,7 +18,7 @@ extern "C" { #include #include -#include "timebase.h" +#include "shared/timebase.h" struct MuxMetrics { // “written” will usually be equal video + audio + mux overhead, diff --git a/futatabi/player.cpp b/futatabi/player.cpp index 918b61d..19b0482 100644 --- a/futatabi/player.cpp +++ b/futatabi/player.cpp @@ -8,7 +8,7 @@ #include "httpd.h" #include "jpeg_frame_view.h" #include "mux.h" -#include "timebase.h" +#include "shared/timebase.h" #include "video_stream.h" #include diff --git a/nageru/alsa_input.cpp b/nageru/alsa_input.cpp index 08a67f7..90a440f 100644 --- a/nageru/alsa_input.cpp +++ b/nageru/alsa_input.cpp @@ -9,7 +9,7 @@ #include "alsa_pool.h" #include "bmusb/bmusb.h" -#include "timebase.h" +#include "shared/timebase.h" using namespace std; using namespace std::chrono; diff --git a/nageru/audio_encoder.cpp b/nageru/audio_encoder.cpp index e33d218..daeb8a8 100644 --- a/nageru/audio_encoder.cpp +++ b/nageru/audio_encoder.cpp @@ -23,7 +23,7 @@ extern "C" { #include "defs.h" #include "mux.h" -#include "timebase.h" +#include "shared/timebase.h" using namespace std; diff --git a/nageru/audio_mixer.cpp b/nageru/audio_mixer.cpp index 9e7dd59..193ae6f 100644 --- a/nageru/audio_mixer.cpp +++ b/nageru/audio_mixer.cpp @@ -22,7 +22,7 @@ #include "flags.h" #include "metrics.h" #include "state.pb.h" -#include "timebase.h" +#include "shared/timebase.h" using namespace bmusb; using namespace std; diff --git a/nageru/benchmark_audio_mixer.cpp b/nageru/benchmark_audio_mixer.cpp index b47c340..f140a51 100644 --- a/nageru/benchmark_audio_mixer.cpp +++ b/nageru/benchmark_audio_mixer.cpp @@ -17,7 +17,7 @@ #include "defs.h" #include "input_mapping.h" #include "resampling_queue.h" -#include "timebase.h" +#include "shared/timebase.h" #define NUM_BENCHMARK_CARDS 4 #define NUM_WARMUP_FRAMES 100 diff --git a/nageru/decklink_output.cpp b/nageru/decklink_output.cpp index 28f433a..8d7c47f 100644 --- a/nageru/decklink_output.cpp +++ b/nageru/decklink_output.cpp @@ -14,7 +14,7 @@ #include "flags.h" #include "metrics.h" #include "print_latency.h" -#include "timebase.h" +#include "shared/timebase.h" #include "v210_converter.h" using namespace movit; diff --git a/nageru/disk_space_estimator.cpp b/nageru/disk_space_estimator.cpp index 86e5e87..5c4c41b 100644 --- a/nageru/disk_space_estimator.cpp +++ b/nageru/disk_space_estimator.cpp @@ -6,7 +6,7 @@ #include #include "metrics.h" -#include "timebase.h" +#include "shared/timebase.h" DiskSpaceEstimator::DiskSpaceEstimator(DiskSpaceEstimator::callback_t callback) : callback(callback) diff --git a/nageru/disk_space_estimator.h b/nageru/disk_space_estimator.h index 73b392c..ce81321 100644 --- a/nageru/disk_space_estimator.h +++ b/nageru/disk_space_estimator.h @@ -16,7 +16,7 @@ #include #include -#include "timebase.h" +#include "shared/timebase.h" class DiskSpaceEstimator { @@ -30,7 +30,7 @@ public: // responsible for writing to the stream on disk. // // If the filename changed since last time, the estimation is reset. - // is taken to be in TIMEBASE units (see timebase.h). + // is taken to be in TIMEBASE units (see shared/timebase.h). void report_write(const std::string &filename, uint64_t pts); private: diff --git a/nageru/ffmpeg_capture.cpp b/nageru/ffmpeg_capture.cpp index 2ecdf64..7081da8 100644 --- a/nageru/ffmpeg_capture.cpp +++ b/nageru/ffmpeg_capture.cpp @@ -33,7 +33,7 @@ extern "C" { #include "flags.h" #include "image_input.h" #include "ref_counted_frame.h" -#include "timebase.h" +#include "shared/timebase.h" #define FRAME_SIZE (8 << 20) // 8 MB. diff --git a/nageru/kaeru.cpp b/nageru/kaeru.cpp index 10f1e93..0e55586 100644 --- a/nageru/kaeru.cpp +++ b/nageru/kaeru.cpp @@ -8,7 +8,7 @@ #include "mixer.h" #include "mux.h" #include "quittable_sleeper.h" -#include "timebase.h" +#include "shared/timebase.h" #include "x264_encoder.h" #include diff --git a/nageru/mixer.cpp b/nageru/mixer.cpp index deaa8e7..79966b5 100644 --- a/nageru/mixer.cpp +++ b/nageru/mixer.cpp @@ -49,7 +49,7 @@ #include "pbo_frame_allocator.h" #include "ref_counted_gl_sync.h" #include "resampling_queue.h" -#include "timebase.h" +#include "shared/timebase.h" #include "timecode_renderer.h" #include "v210_converter.h" #include "video_encoder.h" diff --git a/nageru/mixer.h b/nageru/mixer.h index 32a1ea4..992bcb9 100644 --- a/nageru/mixer.h +++ b/nageru/mixer.h @@ -35,7 +35,7 @@ #include "ref_counted_frame.h" #include "ref_counted_gl_sync.h" #include "theme.h" -#include "timebase.h" +#include "shared/timebase.h" #include "video_encoder.h" #include "ycbcr_interpretation.h" diff --git a/nageru/mux.cpp b/nageru/mux.cpp index b1b9db6..cb4d0ba 100644 --- a/nageru/mux.cpp +++ b/nageru/mux.cpp @@ -24,7 +24,7 @@ extern "C" { #include "defs.h" #include "flags.h" #include "metrics.h" -#include "timebase.h" +#include "shared/timebase.h" using namespace std; diff --git a/nageru/mux.h b/nageru/mux.h index 9614bff..ed742ff 100644 --- a/nageru/mux.h +++ b/nageru/mux.h @@ -18,7 +18,7 @@ extern "C" { #include #include -#include "timebase.h" +#include "shared/timebase.h" struct MuxMetrics { // “written” will usually be equal video + audio + mux overhead, diff --git a/nageru/quicksync_encoder.cpp b/nageru/quicksync_encoder.cpp index c4f8aef..cc3818d 100644 --- a/nageru/quicksync_encoder.cpp +++ b/nageru/quicksync_encoder.cpp @@ -54,7 +54,7 @@ extern "C" { #include "print_latency.h" #include "quicksync_encoder_impl.h" #include "ref_counted_frame.h" -#include "timebase.h" +#include "shared/timebase.h" #include "x264_encoder.h" using namespace movit; diff --git a/nageru/quicksync_encoder_impl.h b/nageru/quicksync_encoder_impl.h index 7645b99..6e6e759 100644 --- a/nageru/quicksync_encoder_impl.h +++ b/nageru/quicksync_encoder_impl.h @@ -17,7 +17,7 @@ #include "audio_encoder.h" #include "defs.h" -#include "timebase.h" +#include "shared/timebase.h" #include "print_latency.h" #include "ref_counted_gl_sync.h" diff --git a/nageru/timebase.h b/nageru/timebase.h deleted file mode 100644 index dbc4402..0000000 --- a/nageru/timebase.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _TIMEBASE_H -#define _TIMEBASE_H 1 - -// Common timebase that allows us to represent one frame exactly in all the -// relevant frame rates: -// -// Timebase: 1/120000 -// Frame at 50fps: 2400/120000 -// Frame at 60fps: 2000/120000 -// Frame at 59.94fps: 2002/120000 -// Frame at 23.976fps: 5005/120000 -// -// If we also wanted to represent one sample at 48000 Hz, we'd need -// to go to 300000. Also supporting one sample at 44100 Hz would mean -// going to 44100000; probably a bit excessive. -#define TIMEBASE 120000 - -// Some muxes, like MP4 (or at least avformat's implementation of it), -// are not too fond of values above 2^31. At timebase 120000, that's only -// about five hours or so, so we define a coarser timebase that doesn't -// get 59.94 precisely (so there will be a marginal amount of pts jitter), -// but can do at least 50 and 60 precisely, and months of streaming. -#define COARSE_TIMEBASE 300 - -#endif // !defined(_TIMEBASE_H) diff --git a/nageru/video_encoder.cpp b/nageru/video_encoder.cpp index 42247e9..e7dd8a7 100644 --- a/nageru/video_encoder.cpp +++ b/nageru/video_encoder.cpp @@ -18,7 +18,7 @@ extern "C" { #include "httpd.h" #include "mux.h" #include "quicksync_encoder.h" -#include "timebase.h" +#include "shared/timebase.h" #include "x264_encoder.h" class RefCountedFrame; diff --git a/nageru/x264_encoder.cpp b/nageru/x264_encoder.cpp index 8463d1b..e061a58 100644 --- a/nageru/x264_encoder.cpp +++ b/nageru/x264_encoder.cpp @@ -17,7 +17,7 @@ #include "metrics.h" #include "mux.h" #include "print_latency.h" -#include "timebase.h" +#include "shared/timebase.h" #include "x264_dynamic.h" #include "x264_speed_control.h" diff --git a/futatabi/timebase.h b/shared/timebase.h similarity index 100% rename from futatabi/timebase.h rename to shared/timebase.h -- 2.39.2