diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-27 01:44:20 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-27 01:44:20 +0100 |
| commit | 1d2a51bdc8315fa7283be329669860e435a1513f (patch) | |
| tree | 7f1ccaf99bd89f61377f36405f12178586d65f8f /src/lib | |
| parent | 886c256f532e0f43bcd7f6f9924147c151293cab (diff) | |
Use enum class for VideoRange.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/dcp_examiner.h | 2 | ||||
| -rw-r--r-- | src/lib/dcp_video.cc | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_encoder.cc | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 4 | ||||
| -rw-r--r-- | src/lib/ffmpeg_file_encoder.cc | 2 | ||||
| -rw-r--r-- | src/lib/ffmpeg_image_proxy.cc | 2 | ||||
| -rw-r--r-- | src/lib/image.cc | 4 | ||||
| -rw-r--r-- | src/lib/image_examiner.h | 2 | ||||
| -rw-r--r-- | src/lib/player.cc | 2 | ||||
| -rw-r--r-- | src/lib/types.cc | 10 | ||||
| -rw-r--r-- | src/lib/types.h | 6 | ||||
| -rw-r--r-- | src/lib/util.cc | 2 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 10 | ||||
| -rw-r--r-- | src/lib/video_mxf_examiner.h | 2 |
14 files changed, 26 insertions, 26 deletions
diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index f577e2b35..b61dd94a5 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -59,7 +59,7 @@ public: } VideoRange range () const { - return VIDEO_RANGE_FULL; + return VideoRange::FULL; } std::string name () const { diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index ddad3d8e0..67baa1215 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -99,7 +99,7 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler { shared_ptr<dcp::OpenJPEGImage> xyz; - shared_ptr<Image> image = frame->image (bind (&PlayerVideo::keep_xyz_or_rgb, _1), VIDEO_RANGE_FULL, true, false); + shared_ptr<Image> image = frame->image (bind (&PlayerVideo::keep_xyz_or_rgb, _1), VideoRange::FULL, true, false); if (frame->colour_conversion()) { xyz = dcp::rgb_to_xyz ( image->data()[0], diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 9504b51b8..059742025 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -107,7 +107,7 @@ FFmpegEncoder::FFmpegEncoder ( } _butler.reset ( - new Butler(_film, _player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), VIDEO_RANGE_VIDEO, true, false) + new Butler(_film, _player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), VideoRange::VIDEO, true, false) ); } diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 23c2f1a72..384c21e9c 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -431,9 +431,9 @@ FFmpegExaminer::range () const switch (color_range()) { case AVCOL_RANGE_MPEG: case AVCOL_RANGE_UNSPECIFIED: - return VIDEO_RANGE_VIDEO; + return VideoRange::VIDEO; case AVCOL_RANGE_JPEG: default: - return VIDEO_RANGE_FULL; + return VideoRange::FULL; } } diff --git a/src/lib/ffmpeg_file_encoder.cc b/src/lib/ffmpeg_file_encoder.cc index 0eea003a9..0aa976c3f 100644 --- a/src/lib/ffmpeg_file_encoder.cc +++ b/src/lib/ffmpeg_file_encoder.cc @@ -401,7 +401,7 @@ FFmpegFileEncoder::video (shared_ptr<PlayerVideo> video, DCPTime time) /* All our output formats are video range at the moment */ shared_ptr<Image> image = video->image ( bind (&PlayerVideo::force, _1, _pixel_format), - VIDEO_RANGE_VIDEO, + VideoRange::VIDEO, true, false ); diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc index 5b2280cfd..d082a8ef7 100644 --- a/src/lib/ffmpeg_image_proxy.cc +++ b/src/lib/ffmpeg_image_proxy.cc @@ -195,7 +195,7 @@ FFmpegImageProxy::image (optional<dcp::Size>) const AVPixelFormat const pix_fmt = static_cast<AVPixelFormat>(frame->format); _image.reset (new Image(frame)); - if (_video_range == VIDEO_RANGE_VIDEO && av_pix_fmt_desc_get(pix_fmt)->flags & AV_PIX_FMT_FLAG_RGB) { + if (_video_range == VideoRange::VIDEO && av_pix_fmt_desc_get(pix_fmt)->flags & AV_PIX_FMT_FLAG_RGB) { /* Asking for the video range to be converted by libswscale (in Image) will not work for * RGB sources since that method only processes video range in YUV and greyscale. So we have * to do it ourselves here. diff --git a/src/lib/image.cc b/src/lib/image.cc index 3a23d1abb..efe5b3390 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -239,8 +239,8 @@ Image::crop_scale_window ( */ sws_setColorspaceDetails ( scale_context, - sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), video_range == VIDEO_RANGE_VIDEO ? 0 : 1, - sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), out_video_range == VIDEO_RANGE_VIDEO ? 0 : 1, + sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), video_range == VideoRange::VIDEO ? 0 : 1, + sws_getCoefficients (lut[static_cast<int>(yuv_to_rgb)]), out_video_range == VideoRange::VIDEO ? 0 : 1, 0, 1 << 16, 1 << 16 ); diff --git a/src/lib/image_examiner.h b/src/lib/image_examiner.h index 839e390ed..cad8683a1 100644 --- a/src/lib/image_examiner.h +++ b/src/lib/image_examiner.h @@ -37,7 +37,7 @@ public: } bool yuv () const; VideoRange range () const { - return VIDEO_RANGE_FULL; + return VideoRange::FULL; } private: diff --git a/src/lib/player.cc b/src/lib/player.cc index 5b449ccc1..cbfea55b6 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -382,7 +382,7 @@ Player::black_player_video_frame (Eyes eyes) const eyes, PART_WHOLE, PresetColourConversion::all().front().conversion, - VIDEO_RANGE_FULL, + VideoRange::FULL, std::weak_ptr<Content>(), boost::optional<Frame>(), false diff --git a/src/lib/types.cc b/src/lib/types.cc index 177b5e581..840ee3aa8 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -234,9 +234,9 @@ string video_range_to_string (VideoRange r) { switch (r) { - case VIDEO_RANGE_FULL: + case VideoRange::FULL: return "full"; - case VIDEO_RANGE_VIDEO: + case VideoRange::VIDEO: return "video"; default: DCPOMATIC_ASSERT (false); @@ -248,12 +248,12 @@ VideoRange string_to_video_range (string s) { if (s == "full") { - return VIDEO_RANGE_FULL; + return VideoRange::FULL; } else if (s == "video") { - return VIDEO_RANGE_VIDEO; + return VideoRange::VIDEO; } DCPOMATIC_ASSERT (false); - return VIDEO_RANGE_FULL; + return VideoRange::FULL; } diff --git a/src/lib/types.h b/src/lib/types.h index f8f23a300..4569cfd9a 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -139,10 +139,10 @@ enum ChangeType }; -enum VideoRange +enum class VideoRange { - VIDEO_RANGE_FULL, ///< full, or "JPEG" (0-255 for 8-bit) - VIDEO_RANGE_VIDEO ///< video, or "MPEG" (16-235 for 8-bit) + 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); diff --git a/src/lib/util.cc b/src/lib/util.cc index 36143e232..67b6599ea 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -954,7 +954,7 @@ void emit_subtitle_image (ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder) { /* XXX: this is rather inefficient; decoding the image just to get its size */ - FFmpegImageProxy proxy (sub.png_image(), VIDEO_RANGE_FULL); + FFmpegImageProxy proxy (sub.png_image(), VideoRange::FULL); auto image = proxy.image().image; /* set up rect with height and width */ dcpomatic::Rect<double> rect(0, 0, image->size().width / double(size.width), image->size().height / double(size.height)); diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 14e482467..f5e513912 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -75,7 +75,7 @@ VideoContent::VideoContent (Content* parent) , _yuv (true) , _fade_in (0) , _fade_out (0) - , _range (VIDEO_RANGE_FULL) + , _range (VideoRange::FULL) { } @@ -178,9 +178,9 @@ VideoContent::VideoContent (Content* parent, cxml::ConstNodePtr node, int versio _fade_in = _fade_out = 0; } - _range = VIDEO_RANGE_FULL; + _range = VideoRange::FULL; if (node->optional_string_child("Range").get_value_or("full") == "video") { - _range = VIDEO_RANGE_VIDEO; + _range = VideoRange::VIDEO; } } @@ -270,7 +270,7 @@ VideoContent::as_xml (xmlpp::Node* node) const node->add_child("YUV")->add_child_text (_yuv ? "1" : "0"); node->add_child("FadeIn")->add_child_text (raw_convert<string> (_fade_in)); node->add_child("FadeOut")->add_child_text (raw_convert<string> (_fade_out)); - node->add_child("Range")->add_child_text(_range == VIDEO_RANGE_FULL ? "full" : "video"); + node->add_child("Range")->add_child_text(_range == VideoRange::FULL ? "full" : "video"); } void @@ -321,7 +321,7 @@ VideoContent::identifier () const _custom_size ? _custom_size->height : 0, _fade_in, _fade_out, - _range == VIDEO_RANGE_FULL ? 0 : 1 + _range == VideoRange::FULL ? 0 : 1 ); string s (buffer); diff --git a/src/lib/video_mxf_examiner.h b/src/lib/video_mxf_examiner.h index c66774876..37badafba 100644 --- a/src/lib/video_mxf_examiner.h +++ b/src/lib/video_mxf_examiner.h @@ -40,7 +40,7 @@ public: boost::optional<double> sample_aspect_ratio () const; bool yuv () const; VideoRange range () const { - return VIDEO_RANGE_FULL; + return VideoRange::FULL; } private: |
