From: Carl Hetherington Date: Tue, 13 Dec 2022 00:04:07 +0000 (+0100) Subject: Add video_{range,frame_type}.{cc,h} and remove some types.h includes. X-Git-Tag: v2.16.36~15 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=94d5ba335224db075a95a76654f732ef54a4eabd Add video_{range,frame_type}.{cc,h} and remove some types.h includes. --- diff --git a/src/lib/analyse_audio_job.h b/src/lib/analyse_audio_job.h index f8311da47..2b749da6b 100644 --- a/src/lib/analyse_audio_job.h +++ b/src/lib/analyse_audio_job.h @@ -25,10 +25,9 @@ #include "audio_analyser.h" -#include "job.h" #include "audio_point.h" -#include "types.h" #include "dcpomatic_time.h" +#include "job.h" #include #include diff --git a/src/lib/audio_analyser.cc b/src/lib/audio_analyser.cc index 1556f921d..687da9cef 100644 --- a/src/lib/audio_analyser.cc +++ b/src/lib/audio_analyser.cc @@ -30,7 +30,6 @@ #include "film.h" #include "filter.h" #include "playlist.h" -#include "types.h" #include extern "C" { #include diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc index 721ffed07..6f1bb2375 100644 --- a/src/lib/audio_analysis.cc +++ b/src/lib/audio_analysis.cc @@ -20,10 +20,10 @@ #include "audio_analysis.h" +#include "audio_content.h" #include "cross.h" -#include "util.h" #include "playlist.h" -#include "audio_content.h" +#include "util.h" #include #include LIBDCP_DISABLE_WARNINGS diff --git a/src/lib/content.h b/src/lib/content.h index 5b804b331..ce6eaa83b 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -50,6 +50,9 @@ namespace cxml { class Job; class Film; class AtmosContent; +class AudioContent; +class TextContent; +class VideoContent; class ContentProperty { diff --git a/src/lib/create_cli.h b/src/lib/create_cli.h index a5e0c3941..e473be1f2 100644 --- a/src/lib/create_cli.h +++ b/src/lib/create_cli.h @@ -19,7 +19,7 @@ */ -#include "types.h" +#include "video_frame_type.h" #include #include #include diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 0324075a3..34153eafc 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -30,7 +30,6 @@ #include "dcpomatic_time.h" #include "film.h" -#include "types.h" #include "weak_film.h" #include diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 8db0099c1..b628efc31 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -35,7 +35,6 @@ #include "player.h" #include "ratio.h" #include "text_content.h" -#include "types.h" #include "video_content.h" #include "writer.h" #include diff --git a/src/lib/image.h b/src/lib/image.h index 60e65c20a..0237b3d1b 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -29,7 +29,7 @@ #include "crop.h" #include "position.h" #include "position_image.h" -#include "types.h" +#include "video_range.h" extern "C" { #include } diff --git a/src/lib/overlaps.cc b/src/lib/overlaps.cc index 7a541a7c2..770882cd5 100644 --- a/src/lib/overlaps.cc +++ b/src/lib/overlaps.cc @@ -21,7 +21,6 @@ #include "content.h" #include "overlaps.h" -#include "types.h" using std::function; diff --git a/src/lib/piece.h b/src/lib/piece.h index 688242c06..c617de544 100644 --- a/src/lib/piece.h +++ b/src/lib/piece.h @@ -25,7 +25,6 @@ #include "dcpomatic_time.h" #include "frame_rate_change.h" -#include "types.h" class Content; diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h index d5b531f41..8ceef9f51 100644 --- a/src/lib/reel_writer.h +++ b/src/lib/reel_writer.h @@ -27,7 +27,6 @@ #include "player_text.h" #include "referenced_reel_asset.h" #include "render_text.h" -#include "types.h" #include "weak_film.h" #include #include diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index 2338bde97..702f848ac 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -25,7 +25,6 @@ #include "font_config.h" #include "image.h" #include "render_text.h" -#include "types.h" #include "util.h" #include #include diff --git a/src/lib/text_decoder.h b/src/lib/text_decoder.h index 9b3050f71..5362540c2 100644 --- a/src/lib/text_decoder.h +++ b/src/lib/text_decoder.h @@ -25,7 +25,6 @@ #include "decoder.h" #include "rect.h" -#include "types.h" #include "content_text.h" #include "decoder_part.h" #include diff --git a/src/lib/types.cc b/src/lib/types.cc index 69d27a1ce..fd4b8906c 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -87,53 +87,6 @@ text_type_to_name (TextType t) } } -string -video_frame_type_to_string (VideoFrameType t) -{ - switch (t) { - case VideoFrameType::TWO_D: - return "2d"; - case VideoFrameType::THREE_D: - return "3d"; - case VideoFrameType::THREE_D_LEFT_RIGHT: - return "3d-left-right"; - case VideoFrameType::THREE_D_TOP_BOTTOM: - return "3d-top-bottom"; - case VideoFrameType::THREE_D_ALTERNATE: - return "3d-alternate"; - case VideoFrameType::THREE_D_LEFT: - return "3d-left"; - case VideoFrameType::THREE_D_RIGHT: - return "3d-right"; - default: - DCPOMATIC_ASSERT (false); - } - - DCPOMATIC_ASSERT (false); -} - -VideoFrameType -string_to_video_frame_type (string s) -{ - if (s == "2d") { - return VideoFrameType::TWO_D; - } else if (s == "3d") { - return VideoFrameType::THREE_D; - } else if (s == "3d-left-right") { - return VideoFrameType::THREE_D_LEFT_RIGHT; - } else if (s == "3d-top-bottom") { - return VideoFrameType::THREE_D_TOP_BOTTOM; - } else if (s == "3d-alternate") { - return VideoFrameType::THREE_D_ALTERNATE; - } else if (s == "3d-left") { - return VideoFrameType::THREE_D_LEFT; - } else if (s == "3d-right") { - return VideoFrameType::THREE_D_RIGHT; - } - - DCPOMATIC_ASSERT (false); -} - CPLSummary::CPLSummary (boost::filesystem::path p) : dcp_directory (p.leaf().string()) { @@ -167,30 +120,3 @@ CPLSummary::CPLSummary (boost::filesystem::path p) } -string -video_range_to_string (VideoRange r) -{ - switch (r) { - case VideoRange::FULL: - return "full"; - case VideoRange::VIDEO: - return "video"; - default: - DCPOMATIC_ASSERT (false); - } -} - - -VideoRange -string_to_video_range (string s) -{ - if (s == "full") { - return VideoRange::FULL; - } else if (s == "video") { - return VideoRange::VIDEO; - } - - DCPOMATIC_ASSERT (false); - return VideoRange::FULL; -} - diff --git a/src/lib/types.h b/src/lib/types.h index 9bf4c80b1..9801ef557 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -86,23 +86,6 @@ typedef std::vector> FFmpegContentList; typedef int64_t Frame; -enum class VideoFrameType -{ - TWO_D, - /** `True' 3D content, e.g. 3D DCPs */ - THREE_D, - THREE_D_LEFT_RIGHT, - THREE_D_TOP_BOTTOM, - THREE_D_ALTERNATE, - /** This content is all the left frames of some 3D */ - THREE_D_LEFT, - /** This content is all the right frames of some 3D */ - THREE_D_RIGHT -}; - -std::string video_frame_type_to_string (VideoFrameType); -VideoFrameType string_to_video_frame_type (std::string); - enum class Eyes { BOTH, @@ -128,16 +111,6 @@ enum class ReelType }; -enum class VideoRange -{ - FULL, ///< full, or "JPEG" (0-255 for 8-bit) - VIDEO ///< video, or "MPEG" (16-235 for 8-bit) -}; - -extern std::string video_range_to_string (VideoRange r); -extern VideoRange string_to_video_range (std::string s); - - /** Type of captions. * * The generally accepted definitions seem to be: diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 087a92245..3ef8b2775 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -29,6 +29,8 @@ #include "dcpomatic_time.h" #include "pixel_quanta.h" #include "user_property.h" +#include "video_frame_type.h" +#include "video_range.h" #include #include diff --git a/src/lib/video_frame_type.cc b/src/lib/video_frame_type.cc new file mode 100644 index 000000000..5882fb1fb --- /dev/null +++ b/src/lib/video_frame_type.cc @@ -0,0 +1,75 @@ +/* + Copyright (C) 2013-2021 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#include "dcpomatic_assert.h" +#include "video_frame_type.h" + + +using std::string; + + +string +video_frame_type_to_string(VideoFrameType t) +{ + switch (t) { + case VideoFrameType::TWO_D: + return "2d"; + case VideoFrameType::THREE_D: + return "3d"; + case VideoFrameType::THREE_D_LEFT_RIGHT: + return "3d-left-right"; + case VideoFrameType::THREE_D_TOP_BOTTOM: + return "3d-top-bottom"; + case VideoFrameType::THREE_D_ALTERNATE: + return "3d-alternate"; + case VideoFrameType::THREE_D_LEFT: + return "3d-left"; + case VideoFrameType::THREE_D_RIGHT: + return "3d-right"; + default: + DCPOMATIC_ASSERT (false); + } + + DCPOMATIC_ASSERT (false); +} + +VideoFrameType +string_to_video_frame_type(string s) +{ + if (s == "2d") { + return VideoFrameType::TWO_D; + } else if (s == "3d") { + return VideoFrameType::THREE_D; + } else if (s == "3d-left-right") { + return VideoFrameType::THREE_D_LEFT_RIGHT; + } else if (s == "3d-top-bottom") { + return VideoFrameType::THREE_D_TOP_BOTTOM; + } else if (s == "3d-alternate") { + return VideoFrameType::THREE_D_ALTERNATE; + } else if (s == "3d-left") { + return VideoFrameType::THREE_D_LEFT; + } else if (s == "3d-right") { + return VideoFrameType::THREE_D_RIGHT; + } + + DCPOMATIC_ASSERT(false); +} + diff --git a/src/lib/video_frame_type.h b/src/lib/video_frame_type.h new file mode 100644 index 000000000..a5da7ca21 --- /dev/null +++ b/src/lib/video_frame_type.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2013-2021 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#ifndef DCPOMATIC_VIDEO_FRAME_TYPE_H +#define DCPOMATIC_VIDEO_FRAME_TYPE_H + + +#include + + +enum class VideoFrameType +{ + TWO_D, + /** `True' 3D content, e.g. 3D DCPs */ + THREE_D, + THREE_D_LEFT_RIGHT, + THREE_D_TOP_BOTTOM, + THREE_D_ALTERNATE, + /** This content is all the left frames of some 3D */ + THREE_D_LEFT, + /** This content is all the right frames of some 3D */ + THREE_D_RIGHT +}; + + +std::string video_frame_type_to_string(VideoFrameType); +VideoFrameType string_to_video_frame_type(std::string); + + +#endif diff --git a/src/lib/video_range.cc b/src/lib/video_range.cc new file mode 100644 index 000000000..b9cfef6d5 --- /dev/null +++ b/src/lib/video_range.cc @@ -0,0 +1,56 @@ +/* + Copyright (C) 2013-2021 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#include "dcpomatic_assert.h" +#include "video_range.h" + + +using std::string; + + +string +video_range_to_string(VideoRange r) +{ + switch (r) { + case VideoRange::FULL: + return "full"; + case VideoRange::VIDEO: + return "video"; + default: + DCPOMATIC_ASSERT (false); + } +} + + +VideoRange +string_to_video_range(string s) +{ + if (s == "full") { + return VideoRange::FULL; + } else if (s == "video") { + return VideoRange::VIDEO; + } + + DCPOMATIC_ASSERT (false); + return VideoRange::FULL; +} + + diff --git a/src/lib/video_range.h b/src/lib/video_range.h new file mode 100644 index 000000000..0cd361804 --- /dev/null +++ b/src/lib/video_range.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2013-2021 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#ifndef DCPOMATIC_VIDEO_RANGE_H +#define DCPOMATIC_VIDEO_RANGE_H + + +#include + + +enum class VideoRange +{ + FULL, ///< full, or "JPEG" (0-255 for 8-bit) + VIDEO ///< video, or "MPEG" (16-235 for 8-bit) +}; + + +extern std::string video_range_to_string(VideoRange r); +extern VideoRange string_to_video_range(std::string s); + + +#endif + + diff --git a/src/lib/wscript b/src/lib/wscript index f3e16fad8..cdf864cfc 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -200,9 +200,11 @@ sources = """ video_decoder.cc video_filter_graph.cc video_filter_graph_set.cc + video_frame_type.cc video_mxf_content.cc video_mxf_decoder.cc video_mxf_examiner.cc + video_range.cc video_ring_buffers.cc writer.cc zipper.cc diff --git a/src/wx/auto_crop_dialog.cc b/src/wx/auto_crop_dialog.cc index bfc08beb3..7e1f73653 100644 --- a/src/wx/auto_crop_dialog.cc +++ b/src/wx/auto_crop_dialog.cc @@ -23,7 +23,6 @@ #include "dcpomatic_spin_ctrl.h" #include "wx_util.h" #include "lib/config.h" -#include "lib/types.h" AutoCropDialog::AutoCropDialog (wxWindow* parent, Crop crop) diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h index 4ce68aea5..a493ea80d 100644 --- a/src/wx/content_panel.h +++ b/src/wx/content_panel.h @@ -22,7 +22,6 @@ #include "content_menu.h" #include "lib/enum_indexed_vector.h" #include "lib/film.h" -#include "lib/types.h" #include LIBDCP_DISABLE_WARNINGS #include diff --git a/src/wx/controls.h b/src/wx/controls.h index df33005ff..f04f3aab6 100644 --- a/src/wx/controls.h +++ b/src/wx/controls.h @@ -25,7 +25,6 @@ #include "lib/dcpomatic_time.h" #include "lib/film.h" -#include "lib/types.h" #include LIBDCP_DISABLE_WARNINGS #include diff --git a/src/wx/kdm_cpl_panel.h b/src/wx/kdm_cpl_panel.h index 720a1efe8..9ce90217e 100644 --- a/src/wx/kdm_cpl_panel.h +++ b/src/wx/kdm_cpl_panel.h @@ -18,6 +18,7 @@ */ + #include "lib/types.h" #include LIBDCP_DISABLE_WARNINGS @@ -25,6 +26,7 @@ LIBDCP_DISABLE_WARNINGS LIBDCP_ENABLE_WARNINGS #include + class KDMCPLPanel : public wxPanel { public: diff --git a/src/wx/timeline_content_view.h b/src/wx/timeline_content_view.h index aa9832e5d..7794120cd 100644 --- a/src/wx/timeline_content_view.h +++ b/src/wx/timeline_content_view.h @@ -25,7 +25,6 @@ #include "timeline_view.h" #include "lib/change_signaller.h" -#include "lib/types.h" #include LIBDCP_DISABLE_WARNINGS #include diff --git a/src/wx/video_panel.h b/src/wx/video_panel.h index 752e37765..81e65d820 100644 --- a/src/wx/video_panel.h +++ b/src/wx/video_panel.h @@ -28,6 +28,7 @@ #include "content_widget.h" #include "timecode.h" #include "lib/film.h" +#include "lib/video_frame_type.h" class CheckBox; diff --git a/test/guess_crop_test.cc b/test/guess_crop_test.cc index ed273254c..ccced0b3e 100644 --- a/test/guess_crop_test.cc +++ b/test/guess_crop_test.cc @@ -22,7 +22,6 @@ #include "lib/content.h" #include "lib/content_factory.h" #include "lib/guess_crop.h" -#include "lib/types.h" #include "lib/video_content.h" #include "test.h" #include diff --git a/test/test.h b/test/test.h index 8bcef0604..8399abf9a 100644 --- a/test/test.h +++ b/test/test.h @@ -19,12 +19,14 @@ */ -#include "lib/types.h" +#include "lib/video_frame_type.h" +#include #include #include #include +class Content; class Film; class Image; class Log;