mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
FLV reader: use rationals instead of doubles for calculating default duration
This commit is contained in:
parent
49549d871b
commit
bdfa8171c4
@ -146,8 +146,6 @@ flv_track_c::flv_track_c(char type)
|
||||
, m_v_height{}
|
||||
, m_v_dwidth{}
|
||||
, m_v_dheight{}
|
||||
, m_v_frame_rate{}
|
||||
, m_v_aspect_ratio{}
|
||||
, m_v_cts_offset{}
|
||||
, m_v_frame_type{}
|
||||
, m_a_channels{}
|
||||
@ -365,7 +363,7 @@ flv_reader_c::create_packetizer(int64_t id) {
|
||||
void
|
||||
flv_reader_c::create_v_avc_packetizer(flv_track_cptr &track) {
|
||||
m_ti.m_private_data = track->m_private_data;
|
||||
track->m_ptzr = add_packetizer(new avc_video_packetizer_c(this, m_ti, track->m_v_frame_rate ? static_cast<int64_t>(1'000'000'000.0 / track->m_v_frame_rate) : 0, track->m_v_width, track->m_v_height));
|
||||
track->m_ptzr = add_packetizer(new avc_video_packetizer_c(this, m_ti, track->m_v_frame_rate ? mtx::to_int_rounded(1'000'000'000 / track->m_v_frame_rate) : 0, track->m_v_width, track->m_v_height));
|
||||
show_packetizer_info(m_video_track_idx, ptzr(track->m_ptzr));
|
||||
}
|
||||
|
||||
@ -384,7 +382,7 @@ flv_reader_c::create_v_generic_packetizer(flv_track_cptr &track) {
|
||||
|
||||
m_ti.m_private_data = memory_c::clone(&bih, sizeof(bih));
|
||||
|
||||
track->m_ptzr = add_packetizer(new video_for_windows_packetizer_c(this, m_ti, static_cast<int64_t>(1'000'000'000.0 / track->m_v_frame_rate), track->m_v_width, track->m_v_height));
|
||||
track->m_ptzr = add_packetizer(new video_for_windows_packetizer_c(this, m_ti, track->m_v_frame_rate ? mtx::to_int_rounded(1'000'000'000 / track->m_v_frame_rate) : 0, track->m_v_width, track->m_v_height));
|
||||
show_packetizer_info(m_video_track_idx, ptzr(track->m_ptzr));
|
||||
}
|
||||
|
||||
@ -425,7 +423,7 @@ flv_reader_c::new_stream_v_avc(flv_track_cptr &track,
|
||||
if (!track->m_v_height)
|
||||
track->m_v_height = sps_info.height;
|
||||
if (!track->m_v_frame_rate && sps_info.timing_info.num_units_in_tick && sps_info.timing_info.time_scale)
|
||||
track->m_v_frame_rate = sps_info.timing_info.time_scale / sps_info.timing_info.num_units_in_tick;
|
||||
track->m_v_frame_rate = mtx::rational(sps_info.timing_info.time_scale, sps_info.timing_info.num_units_in_tick);
|
||||
}
|
||||
|
||||
if (!track->m_v_frame_rate)
|
||||
@ -682,7 +680,7 @@ flv_reader_c::process_script_tag() {
|
||||
|
||||
std::optional<double> number;
|
||||
|
||||
if ((number = parser.get_meta_data_value<double>("framerate"))) {
|
||||
if (number = parser.get_meta_data_value<double>("framerate"); number && *number) {
|
||||
m_tracks[m_video_track_idx]->m_v_frame_rate = *number;
|
||||
mxdebug_if(m_debug, fmt::format("Video frame rate from meta data: {0}\n", *number));
|
||||
}
|
||||
@ -798,7 +796,7 @@ flv_reader_c::read(generic_packetizer_c *,
|
||||
|
||||
int64_t duration = -1;
|
||||
if (track->m_v_frame_rate && track->m_fourcc.equiv("AVC1"))
|
||||
duration = 1000000000ll / track->m_v_frame_rate;
|
||||
duration = mtx::to_int(mtx::rational(1'000'000'000, track->m_v_frame_rate));
|
||||
|
||||
auto packet = new packet_t(track->m_payload, track->m_timestamp, duration, 'I' == track->m_v_frame_type ? VFT_IFRAME : VFT_PFRAMEAUTOMATIC, VFT_NOBFRAME);
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
|
||||
// video related parameters
|
||||
unsigned int m_v_version, m_v_width, m_v_height, m_v_dwidth, m_v_dheight;
|
||||
double m_v_frame_rate, m_v_aspect_ratio;
|
||||
mtx_mp_rational_t m_v_frame_rate;
|
||||
int64_t m_v_cts_offset;
|
||||
char m_v_frame_type;
|
||||
|
||||
|
@ -223,7 +223,7 @@ T_375keep_pcm_timecodes:c6e84046a867df190e718079b1d689c6:passed:20121208-154352:
|
||||
T_376append_empty_tracks:72315f7e03d1ef866a32ac169de44df3-9f3982a1b250d1e405460c1340780a60-8042a39585365c77bcd977491c89581f:passed:20121208-190510:2.061997946
|
||||
T_377mp3_skip_id3_properly:3e01ed3a28f48687dfd842988b6c462d:passed:20121216-212310:0.064033007
|
||||
T_378deprecated_iso_639_2_codes:hrv+rum+srp-407eae4b9aa1e7aa594182cc8b342f54:passed:20121217-171624:0.096870722
|
||||
T_379flv:9482ef123a40a1abe94a4648066b5130-a1ba511254e3bbd43c7efbffd228b483-93fc9bb91bb8b6c59cc8c90eab3f821d-a1ba511254e3bbd43c7efbffd228b483-617096308cd537e71f04ffcbb3836c3c-3d462c22c022638e95e6a48dbb2adbb7-6323c95ac4fd439c714e35463891bc5f-3d462c22c022638e95e6a48dbb2adbb7-03fbabe0a407c28ccd5baa4f6904d0ba-dec78f2da03c9b8ed4af86155ba5eb13-a52de858999798a983b6e01ccffc7c3b-dec78f2da03c9b8ed4af86155ba5eb13:passed:20121223-134722:2.756877638
|
||||
T_379flv:2c4d50b656042444606e413a03d54d23-0d8b1026d2d20111c5eebdb0e585eea3-93fc9bb91bb8b6c59cc8c90eab3f821d-0d8b1026d2d20111c5eebdb0e585eea3-617096308cd537e71f04ffcbb3836c3c-3d462c22c022638e95e6a48dbb2adbb7-6323c95ac4fd439c714e35463891bc5f-3d462c22c022638e95e6a48dbb2adbb7-686f908bb55abf7268ad404d37133cd4-0f90c1bbfb14a423193218ce00f22df3-a52de858999798a983b6e01ccffc7c3b-0f90c1bbfb14a423193218ce00f22df3:passed:20121223-134722:2.756877638
|
||||
T_380split_frames:36364ee0aed96f357972e2b04a5acaf6+4b0a4aa893ebdc54b99830c076ba9992+ok-36364ee0aed96f357972e2b04a5acaf6+4b0a4aa893ebdc54b99830c076ba9992+ok-36364ee0aed96f357972e2b04a5acaf6+4b0a4aa893ebdc54b99830c076ba9992+ok:passed:20121223-232902:0.83181061
|
||||
T_381X_alac:3e8a3dd5bf2d14cb73a765538228ef5c-ed3dd47220947f8130974268f0af281d:passed:20121225-133740:0.107668003
|
||||
T_382split_chapters:3772c133e35dfad586315f1c9a4d2703+ee2f2249d3c67b34b904a4ddd327d5ff+ok-5ea2d092c0a7b3154759c24de766591c+92b1284001b5f21b487aab382278da0f+ok-4d60856f527a90fb709f39d0c6f0d85e+96103a2cb6858b8a4a7c48bbe47f006a+779644f30d907b2307772636b960aa7a+1c1bc0a4e44d691032a963f0a741eb65+c34ae64096c03e957f864104c889bd6a+d7a0ba879c179bc4fc77710c90959a8a+c1dfd482ce4d74408579033aed4fb245+30e361d1cd302148fd3088f34cc8e335+b09d86d689229737287e7fdf166a0e9a+4c823f6d4d67373f14ee5e3b648848ae+e5d6da0e17e75963e4c51fc626cb44b3+7090ad88b821befb27e45e582c0a30b4+db67e2065e54b127c3616ce4471fc615+df641b600662e03730ea792b65628b34+e5c0adf71b0755bdb2aa55b3dc2e0427+bb60817236134a4abf09cec3f8fcb8ec+bce4657d37bb6cb554e19d32a02ddda4+ok-d0e9c122e580aaffa75d7fe629b5dcd3+b2ccd232f7000c11ae85ac409df7ea90+98666499245f61287800c84a93f070fc+a1004a45a5f89f399e9cd952b0bd5f28+500d283848c2c1e3eff53fda26ea286a+4d9bd60239a2f5ad063e8f9cda4eb5d0+fcd93392271f446611bc3c435ed7381f+b81128cf8406c23ca7de366ed2e3de32+fe02573ef8e0553e7d2181bfd224d10f+e1a5280be38ed3fa592e233802aa8761+7fd863b04a8b8c6a61c61e0065caebc0+bf44952a40ebff62488f6ae1a7c1f211+e383320fedba3b28d2f5c3fa5e7643c8+60fec339d40d46e5d0a0a60cdd53a21c+d50e64cf9eefc4fe1d21d5227933dded+425aacfb6faf2b3fd5af641a8d713c7b+bb048eecdf4433658302db22106d99ef+ok:passed:20121227-202501:1.646075125
|
||||
@ -476,7 +476,7 @@ T_628srt_no_decimal_places:bf265f5702fd6953f6a21443ba64df4d:passed:20180102-1916
|
||||
T_629mpeg_ts_broken_pes_packets:30017e266103fbab809ddf4f5a577d28:passed:20180113-212211:0.190835185
|
||||
T_630propedit_add_statistics_tags_with_compression:c60c16fec3187e1a33b7efe22d8df910-18+70+590:passed:20180118-205706:0.153635835
|
||||
T_631ogg_opus_packet_without_data:552d80c9be0504d8af2b96ff7638c623:passed:20180210-164242:0.196680388
|
||||
T_632flv_aac_codec_initialization_more_than_5_bytes:ec69c72facaa61d63eb9bacbd7da25c1:passed:20180222-152609:0.333656616
|
||||
T_632flv_aac_codec_initialization_more_than_5_bytes:0ef81206366640d34953fc5b3719deeb:passed:20180222-152609:0.333656616
|
||||
T_633payload_signalled_but_no_payload_bytes:129087cee296b1e3f009c97b02d42913:passed:20180304-220823:0.229460962
|
||||
T_634dialog_normalization_gain_removal:80d3def5582bd9d5e267ecec2cd4d9de-95f18c26bc99733342a127263ba3256a-95f18c26bc99733342a127263ba3256a-95f18c26bc99733342a127263ba3256a-7cea6b05b0a6fcaf4268d6e585d8f285-eefde537623146f769c5d36db5eb27d9-eefde537623146f769c5d36db5eb27d9-eefde537623146f769c5d36db5eb27d9-a94c639a749439a819a16541fa14228f-5a7b408457bfd3afaa269bebd8840388-5a7b408457bfd3afaa269bebd8840388-5a7b408457bfd3afaa269bebd8840388-e461965eb64bb79a2c2eace027423356-64d6db9ee9a86d5497432d9c75afbc8b-64d6db9ee9a86d5497432d9c75afbc8b-64d6db9ee9a86d5497432d9c75afbc8b-0d578ac0060e12cba437d146204ce02a-cddde4f29e15b88b4317f03adb5862db-87b103c68661af67908885db6dc985e6-87b103c68661af67908885db6dc985e6:passed:20180308-204112:3.321428335
|
||||
T_635propedit_update_doc_type_version:01677a1c8edc61e9e7d65e91975bda54-4+1-4+1:passed:20180310-135142:0.509975434
|
||||
|
Loading…
Reference in New Issue
Block a user