Commit Graph

177 Commits

Author SHA1 Message Date
Martchus d48722f26c Fix unity builds
* Define `CHRONO_UTILITIES_TIMESPAN_INTEGER_SCALE_OVERLOADS` consistently
  with all necassary changes
* Avoid ambiguity between enum members and certain class/struct names
2024-01-30 23:31:15 +01:00
Martchus 9f41c30443 Silence/fix GCC's maybe-uninitialized warnings
* The warning about `bsEnvCount` is actually correct.
* The warning about `lastAtomToBeWritten` might be correct.
* The warning about `relPos` is definitely unjustified because `relPos` is
  only used when `cueRelativePositionElement` is not `nullptr` and `relPos`
  is initialized in that case.
* The warnings about `pos`, `nextPageOffset` and `startOfLastMetaDataBlock`
  are also wrong for similar reasons.
2023-10-31 20:05:13 +01:00
Martchus 92345027fb Use generic `toInt()` function which relies less on compiler optimizations 2023-05-18 00:52:28 +02:00
Martchus 111d6190cb Avoid some of the warnings from MSVC 2023-05-07 21:45:15 +02:00
Martchus 981db492e4 Avoid unqualified calls to `std::move` 2023-02-20 19:54:42 +01:00
Martchus cb93d6900c Apply clang-format 2023-02-03 13:31:40 +01:00
Martchus dc4e4082e0 Use `std::filesystem::resize_file` instead of POSIX function
* Avoid platform-specific code
* Fix build with MSVC
2023-02-01 14:05:32 +01:00
Martchus 04e6996ce3 Use the output file path when making an MP4 file also if no rewrite required
Otherwise the `--output-files` option of the tag editor will be ignored
when editing an MP4 file and no rewrite is required.

Note that the condition is already this way in `MediaFileInfo::makeMp3File()`
and `MatroskaContainer::internalMakeFile()`.
2023-01-02 20:04:42 +01:00
Martchus 766e7657b5 Preserve explicitly "undefined" language of MP4 tracks 2023-01-02 19:50:30 +01:00
Martchus 8d4c315611 Improve error messages about missing mandatory MP4 atoms 2023-01-02 19:18:07 +01:00
Martchus 3193df8e3f Fix reading duration from MP4's track header atom
* Skip 4 bytes reserved space correctly
* See https://github.com/Martchus/tageditor/issues/98
2023-01-02 19:16:45 +01:00
Martchus 9511d61371 Add comment about meaning of iTunes rating values 2022-06-16 01:15:51 +02:00
Martchus d6e1b4b77d Fix mapping of iTunes "advisory" rating to KnownField::LawRating
That likely fits the "advisory" rating better than KnownField::Rating which
is more a personal rating.
2022-06-16 01:15:51 +02:00
Martchus 4da00f8b75 Add more field mappings 2022-04-09 23:36:39 +02:00
Martchus bf1eee45ba Add field mappings for all fields mentioned in Matroska spec 2022-04-06 00:01:19 +02:00
Martchus 28abe151fd Avoid duplicating MP4 epoch 2022-02-16 00:04:09 +01:00
Martchus 503fb725a2 Improve handling time values of MP4 files
* Cache result of `verifyPresentTrackHeader()` instead of running the code
  unnecassarily multiple times
* Do not tamper with existing/raw values by default to avoid
  inconsistencies through rounding errors and possibly fix
  https://github.com/Martchus/tageditor/issues/80
* Avoid conversions to double (depending on the time scale rounding errors
  might still occur)
2022-02-15 23:22:48 +01:00
Martchus d19a09db5b Make `startDate` static as it isn't used in any other units 2022-02-15 21:35:49 +01:00
Martchus eafe2fa997 Avoid constructor for TrackHeaderInfo 2022-02-15 21:23:29 +01:00
Martchus d390e8c9cf Deduplicate code for computing timing values of MP4 track 2022-02-15 21:22:07 +01:00
Martchus 532a805254 Avoid adding empty values when setting values and field does not exist 2021-12-31 01:15:13 +01:00
Martchus 18d054a600 Fix warnings about unused variables 2021-12-05 17:49:54 +01:00
Martchus e277070e9c Use `std::filesystem` in backup helper code
* Fix applying changes to symlinks so that the target is modified in any
  case (and not just if a rewrite isn't necessary)
* Avoid using `std::rename` and `std::remove` because they might not work
  under Windows when the path contains non-ASCII characters
* Simplify code, remove `isRelative()`
2021-09-11 23:54:49 +02:00
Martchus f39e8b4d8c Avoid useless cases when assigning tag size (which is now std::uint64_t) 2021-08-08 00:05:11 +02:00
Jonas Kvinge ea23d71e8a Fix spelling and typos 2021-07-02 11:12:39 +02:00
Martchus f5cb2c5cba Preserve media type of MP4 tracks if media type is unknown 2021-04-09 22:15:44 +02:00
Martchus 0a041f6ad2 Fix warnings 2021-03-20 21:26:25 +01:00
Martchus 65597fd71e Add API to allow aborting overall/expensive parsing functions
* Not really implemented within the various code paths of the parsers at
  this point; this commit mainly adds the API.
* Adjust example in README
2021-02-04 23:21:50 +01:00
Martchus f21ac07da0 Get rid of deprecated fields 2021-02-01 17:11:08 +01:00
Martchus 78439e2e3f Fix returning nullptr where now a std::string_view is required 2021-02-01 17:10:01 +01:00
Martchus 64d98f5530 Use std::string_view where it makes sense 2021-01-30 21:53:06 +01:00
Martchus 49154905b1 Improve code in Mp4Tag::setValues() 2021-01-30 19:22:06 +01:00
Martchus 42eac2074d Return additional values stored within MP4 fields via values() 2021-01-30 19:18:29 +01:00
Martchus 65d52b2d57 Improve customization point for clearing tag field
* Allow customizing clearing only the value
* Use same naming scheme as in other places
* Avoid having to add an empty reset() function in subclasses
2021-01-30 19:10:16 +01:00
Martchus 5b6c65aa27 Improve diag messages when parsing MP4 tag fields 2021-01-30 15:13:42 +01:00
Martchus 8efe6e5a63 Avoid converting MP4 data when text of correct encoding is assigned anyways 2021-01-30 15:00:10 +01:00
Martchus 84183aaf02 Improve handling of MP4 tags
* Preserve multiple data atoms
* Assume JPEG as raw data type when making cover field (instead of UTF-8)
* Split certain functions
* Simplify code
2021-01-30 13:59:48 +01:00
Martchus 761e3ee44b Mark all "final" tag, track and container classes as such 2020-12-18 21:13:52 +01:00
Martchus 6b469f1c26 Add Locale class to deal with differently specified languages/countries
Different media/tag formats specify languages and countries
differently. This change introduces a Locale class to keep track
of the format being used. So far there are no automatic conversions
implemented so it is entirely up to the user to pass valid values using
a format which matches the one required by the media/tag format.

This change also adds support for Matroska's IETF elements so at least the
raw value can be read, written and is preserved.
2020-12-16 17:48:08 +01:00
Martchus 4cc2dbd9e6 Use flags instead of tons of boolean fields in AbstractTrack 2020-12-16 17:48:08 +01:00
Martchus 5f39e377dc Use std::size_t consistently 2020-11-25 17:54:30 +01:00
Martchus 16f4d2165c Do not incorrectly abbreviate MPEG-4 ASP as H.263
Unlike MPEG-4 AVC and H.264, MPEG-4 ASP and H.263 are not identical.
2020-10-01 19:09:01 +02:00
Martchus d26e594777 Deprecate 'Year' in favor of 'RecordDate' and 'ReleaseDate', fix handling in ID3v2
1. Convert TYER and related fields of old ID3v2 versions to the new TDRC
  field and only expose that via the generic accessors.
2. When writing an old ID3v2 tag, convert TDRC back to the old fields.
3. One can still manually unset the via 1. auto-populated TDRC to disable 2.
   and write the old fields directly. So the automatic handling does not
   reduce the flexibility of the library.
4. Deprecate 'Year'; it is replaced by the already existing 'RecordDate'
   which is now supposed to be used everywhere where 'Year' was used before
5. Introduce 'ReleaseDate' to support this field which is supported in
   ID3v2.4.0 and Matroska via the generic accessors.
6. Use ISO format when converting tag values of the type DateTime to/from
   string. This is closer to what's used in ID3v2 tags internally. (The
   library still allows the old format as fallback when parsing for
   compatibility.)
2020-04-24 23:15:13 +02:00
Martchus 0e66b34d48 Add human readable representation of certain IDs as comments 2020-04-22 22:08:02 +02:00
Martchus 248a6555f3 Add links to upstream documentation of field IDs for the different formats 2020-04-22 18:43:41 +02:00
Martchus b2c02e9acc Fix childs -> children 2019-12-30 22:54:11 +01:00
Martchus 49798ae3a8 Improve wording in Mp4Container 2019-12-15 19:44:44 +01:00
Martchus 7043c3d2a9 Don't suppress IO errors when writing files
* Close or flush streams explicitely so writing is not
  deferred
    * to catch errors in the right place
    * to avoid suppressing errors completely when writing
      would be deferred to the destructor invocation
* Improve comments
2019-12-15 19:43:16 +01:00
Martchus a59a01cfe9 Prevent warning when adding album artist to MP4
Prevents "making MP4 tag field aART: It was not possible to
find an appropriate raw data type id. UTF-8 will be assumed."
2019-10-09 18:03:34 +02:00
Martchus 9299c58c22 Detect VP9 in MP4 2019-09-25 22:05:25 +02:00