X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_content.cc;h=6681a4f0a897aa6c6c9de3c192c1cad434d69a8c;hb=d2ba89cff99a379ad18ed4d5b405ccec7f10edfe;hp=c791309ad04dae2280ce31b4e6146e4385b3ace8;hpb=eeaca1992aa117fe3a2a4a079d8a20a01d88e933;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index c791309ad..6681a4f0a 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -19,22 +19,22 @@ */ -#include "ffmpeg_content.h" -#include "video_content.h" #include "audio_content.h" -#include "ffmpeg_examiner.h" -#include "ffmpeg_subtitle_stream.h" -#include "ffmpeg_audio_stream.h" #include "compose.hpp" -#include "job.h" -#include "util.h" -#include "filter.h" -#include "film.h" -#include "log.h" #include "config.h" +#include "constants.h" #include "exceptions.h" +#include "ffmpeg_audio_stream.h" +#include "ffmpeg_content.h" +#include "ffmpeg_examiner.h" +#include "ffmpeg_subtitle_stream.h" +#include "film.h" +#include "filter.h" #include "frame_rate_change.h" +#include "job.h" +#include "log.h" #include "text_content.h" +#include "video_content.h" #include #include extern "C" { @@ -273,7 +273,7 @@ FFmpegContent::examine (shared_ptr film, shared_ptr job) if (examiner->has_video ()) { video.reset (new VideoContent (this)); - video->take_from_examiner (examiner); + video->take_from_examiner(film, examiner); } auto first_path = path (0); @@ -320,6 +320,7 @@ FFmpegContent::examine (shared_ptr film, shared_ptr job) text.clear (); text.push_back (make_shared(this, TextType::OPEN_SUBTITLE, TextType::UNKNOWN)); _subtitle_stream = _subtitle_streams.front (); + text.front()->add_font(make_shared("")); } } @@ -331,7 +332,7 @@ FFmpegContent::examine (shared_ptr film, shared_ptr job) /* FFmpeg has detected this file as 29.97 and the examiner thinks it is using "soft" 2:3 pulldown (telecine). * This means we can treat it as a 23.976fps file. */ - set_video_frame_rate (24000.0 / 1001); + set_video_frame_rate(film, 24000.0 / 1001); video->set_length (video->length() * 24.0 / 30); } } @@ -537,10 +538,12 @@ FFmpegContent::add_properties (shared_ptr film, list& video->add_properties (p); if (_bits_per_pixel) { - /* Assuming there's three components, so bits per pixel component is _bits_per_pixel / 3 */ - int const lim_start = pow(2, _bits_per_pixel.get() / 3 - 4); - int const lim_end = 235 * pow(2, _bits_per_pixel.get() / 3 - 8); - int const total = pow(2, _bits_per_pixel.get() / 3); + auto pixel_quanta_product = video->pixel_quanta().x * video->pixel_quanta().y; + auto bits_per_main_pixel = pixel_quanta_product * _bits_per_pixel.get() / (pixel_quanta_product + 2); + + int const lim_start = pow(2, bits_per_main_pixel - 4); + int const lim_end = 235 * pow(2, bits_per_main_pixel - 8); + int const total = pow(2, bits_per_main_pixel); switch (_color_range.get_value_or(AVCOL_RANGE_UNSPECIFIED)) { case AVCOL_RANGE_UNSPECIFIED: @@ -553,14 +556,14 @@ FFmpegContent::add_properties (shared_ptr film, list& /// file is limited, so that not all possible values are valid. p.push_back ( UserProperty ( - UserProperty::VIDEO, _("Colour range"), String::compose(_("Limited (%1-%2)"), lim_start, lim_end) + UserProperty::VIDEO, _("Colour range"), String::compose(_("Limited / video (%1-%2)"), lim_start, lim_end) ) ); break; case AVCOL_RANGE_JPEG: /// TRANSLATORS: this means that the range of pixel values used in this /// file is full, so that all possible pixel values are valid. - p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), String::compose (_("Full (0-%1)"), total))); + p.push_back(UserProperty(UserProperty::VIDEO, _("Colour range"), String::compose(_("Full (0-%1)"), total - 1))); break; default: DCPOMATIC_ASSERT (false);