From 284f14d04672e238d03b7645a715dc2470c532a2 Mon Sep 17 00:00:00 2001 From: Kevin Meyer Date: Tue, 2 Jan 2024 15:45:53 +0100 Subject: [PATCH] LibVideo: Replace DeprecatedFlyString with FlyString --- .../LibVideo/Containers/Matroska/Document.h | 14 +++++++------- .../Containers/Matroska/MatroskaDemuxer.cpp | 2 +- .../LibVideo/Containers/Matroska/MatroskaDemuxer.h | 2 +- .../LibVideo/Containers/Matroska/Reader.cpp | 4 ++-- Userland/Utilities/matroska.cpp | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Userland/Libraries/LibVideo/Containers/Matroska/Document.h b/Userland/Libraries/LibVideo/Containers/Matroska/Document.h index 861f230ba00..5c1dc652834 100644 --- a/Userland/Libraries/LibVideo/Containers/Matroska/Document.h +++ b/Userland/Libraries/LibVideo/Containers/Matroska/Document.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -115,10 +115,10 @@ public: void set_track_uid(u64 track_uid) { m_track_uid = track_uid; } TrackType track_type() const { return m_track_type; } void set_track_type(TrackType track_type) { m_track_type = track_type; } - DeprecatedFlyString language() const { return m_language; } - void set_language(DeprecatedFlyString const& language) { m_language = language; } - DeprecatedFlyString codec_id() const { return m_codec_id; } - void set_codec_id(DeprecatedFlyString const& codec_id) { m_codec_id = codec_id; } + FlyString language() const { return m_language; } + void set_language(FlyString const& language) { m_language = language; } + FlyString codec_id() const { return m_codec_id; } + void set_codec_id(FlyString const& codec_id) { m_codec_id = codec_id; } double timestamp_scale() const { return m_timestamp_scale; } void set_timestamp_scale(double timestamp_scale) { m_timestamp_scale = timestamp_scale; } u64 codec_delay() const { return m_codec_delay; } @@ -144,8 +144,8 @@ private: u64 m_track_number { 0 }; u64 m_track_uid { 0 }; TrackType m_track_type { Invalid }; - DeprecatedFlyString m_language = "eng"; - DeprecatedFlyString m_codec_id; + FlyString m_language = "eng"_fly_string; + FlyString m_codec_id; double m_timestamp_scale { 1 }; u64 m_codec_delay { 0 }; u64 m_timestamp_offset { 0 }; diff --git a/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.cpp b/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.cpp index f8befa7eed3..c646457b500 100644 --- a/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.cpp +++ b/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.cpp @@ -71,7 +71,7 @@ DecoderErrorOr MatroskaDemuxer::get_track_status( return &m_track_statuses.get(track).release_value(); } -CodecID MatroskaDemuxer::get_codec_id_for_string(DeprecatedFlyString const& codec_id) +CodecID MatroskaDemuxer::get_codec_id_for_string(FlyString const& codec_id) { dbgln_if(MATROSKA_DEBUG, "Codec ID: {}", codec_id); if (codec_id == "V_VP8") diff --git a/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.h b/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.h index 2a2c0eb9359..4caa6351600 100644 --- a/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.h +++ b/Userland/Libraries/LibVideo/Containers/Matroska/MatroskaDemuxer.h @@ -46,7 +46,7 @@ private: }; DecoderErrorOr get_track_status(Track track); - CodecID get_codec_id_for_string(DeprecatedFlyString const& codec_id); + CodecID get_codec_id_for_string(FlyString const& codec_id); Reader m_reader; diff --git a/Userland/Libraries/LibVideo/Containers/Matroska/Reader.cpp b/Userland/Libraries/LibVideo/Containers/Matroska/Reader.cpp index d5ac59420dd..4a7de8357fb 100644 --- a/Userland/Libraries/LibVideo/Containers/Matroska/Reader.cpp +++ b/Userland/Libraries/LibVideo/Containers/Matroska/Reader.cpp @@ -468,11 +468,11 @@ static DecoderErrorOr parse_track_entry(Streamer& streamer) dbgln_if(MATROSKA_TRACE_DEBUG, "Read TrackType attribute: {}", to_underlying(track_entry.track_type())); break; case TRACK_LANGUAGE_ID: - track_entry.set_language(TRY_READ(streamer.read_string())); + track_entry.set_language(DECODER_TRY_ALLOC(FlyString::from_utf8(TRY_READ(streamer.read_string()).view()))); dbgln_if(MATROSKA_TRACE_DEBUG, "Read Track's Language attribute: {}", track_entry.language()); break; case TRACK_CODEC_ID: - track_entry.set_codec_id(TRY_READ(streamer.read_string())); + track_entry.set_codec_id(DECODER_TRY_ALLOC(FlyString::from_utf8(TRY_READ(streamer.read_string()).view()))); dbgln_if(MATROSKA_TRACE_DEBUG, "Read Track's CodecID attribute: {}", track_entry.codec_id()); break; case TRACK_TIMESTAMP_SCALE_ID: diff --git a/Userland/Utilities/matroska.cpp b/Userland/Utilities/matroska.cpp index 611cfb9af07..9be03e5c295 100644 --- a/Userland/Utilities/matroska.cpp +++ b/Userland/Utilities/matroska.cpp @@ -52,8 +52,8 @@ ErrorOr serenity_main(Main::Arguments arguments) outln("\tTrack #{} with TrackID {}", track_entry.track_number(), track_entry.track_uid()); outln("\tTrack has TrackType {}", static_cast(track_entry.track_type())); - outln("\tTrack has Language \"{}\"", track_entry.language().characters()); - outln("\tTrack has CodecID \"{}\"", track_entry.codec_id().characters()); + outln("\tTrack has Language \"{}\"", track_entry.language()); + outln("\tTrack has CodecID \"{}\"", track_entry.codec_id()); outln("\tTrack has TrackTimestampScale {}", track_entry.timestamp_scale()); outln("\tTrack has CodecDelay {}", track_entry.codec_delay());