Prechádzať zdrojové kódy

LibVideo: Change all Span<u8 const> to ReadonlyBytes

Zaggy1024 2 rokov pred
rodič
commit
40b0bb0914

+ 1 - 1
Userland/Libraries/LibVideo/MatroskaDemuxer.cpp

@@ -18,7 +18,7 @@ DecoderErrorOr<NonnullOwnPtr<MatroskaDemuxer>> MatroskaDemuxer::from_file(String
     return make<MatroskaDemuxer>(document);
 }
 
-DecoderErrorOr<NonnullOwnPtr<MatroskaDemuxer>> MatroskaDemuxer::from_data(Span<u8 const> data)
+DecoderErrorOr<NonnullOwnPtr<MatroskaDemuxer>> MatroskaDemuxer::from_data(ReadonlyBytes data)
 {
     // FIXME: MatroskaReader should return errors.
     auto nullable_document = MatroskaReader::parse_matroska_from_data(data.data(), data.size());

+ 1 - 1
Userland/Libraries/LibVideo/MatroskaDemuxer.h

@@ -18,7 +18,7 @@ public:
     // FIXME: We should instead accept some abstract data streaming type so that the demuxer
     //        can work with non-contiguous data.
     static DecoderErrorOr<NonnullOwnPtr<MatroskaDemuxer>> from_file(StringView filename);
-    static DecoderErrorOr<NonnullOwnPtr<MatroskaDemuxer>> from_data(Span<u8 const> data);
+    static DecoderErrorOr<NonnullOwnPtr<MatroskaDemuxer>> from_data(ReadonlyBytes data);
 
     MatroskaDemuxer(NonnullOwnPtr<MatroskaDocument>& document)
         : m_document(move(document))

+ 2 - 2
Userland/Libraries/LibVideo/VP9/Decoder.cpp

@@ -19,7 +19,7 @@ Decoder::Decoder()
 {
 }
 
-DecoderErrorOr<void> Decoder::receive_sample(Span<u8 const> chunk_data)
+DecoderErrorOr<void> Decoder::receive_sample(ReadonlyBytes chunk_data)
 {
     auto superframe_sizes = m_parser->parse_superframe_sizes(chunk_data);
 
@@ -52,7 +52,7 @@ inline size_t index_from_row_and_column(u32 row, u32 column, u32 stride)
     return row * stride + column;
 }
 
-DecoderErrorOr<void> Decoder::decode_frame(Span<u8 const> frame_data)
+DecoderErrorOr<void> Decoder::decode_frame(ReadonlyBytes frame_data)
 {
     // 1. The syntax elements for the coded frame are extracted as specified in sections 6 and 7. The syntax
     // tables include function calls indicating when the block decode processes should be triggered.

+ 2 - 2
Userland/Libraries/LibVideo/VP9/Decoder.h

@@ -28,7 +28,7 @@ public:
     Decoder();
     ~Decoder() override { }
     /* (8.1) General */
-    DecoderErrorOr<void> receive_sample(Span<u8 const>) override;
+    DecoderErrorOr<void> receive_sample(ReadonlyBytes) override;
     void dump_frame_info();
 
     DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() override;
@@ -36,7 +36,7 @@ public:
 private:
     typedef i32 Intermediate;
 
-    DecoderErrorOr<void> decode_frame(Span<u8 const>);
+    DecoderErrorOr<void> decode_frame(ReadonlyBytes);
     DecoderErrorOr<void> create_video_frame();
 
     DecoderErrorOr<void> allocate_buffers();

+ 2 - 2
Userland/Libraries/LibVideo/VP9/Parser.cpp

@@ -28,7 +28,7 @@ Parser::~Parser()
 {
 }
 
-Vector<size_t> Parser::parse_superframe_sizes(Span<const u8> frame_data)
+Vector<size_t> Parser::parse_superframe_sizes(ReadonlyBytes frame_data)
 {
     if (frame_data.size() < 1)
         return {};
@@ -76,7 +76,7 @@ Vector<size_t> Parser::parse_superframe_sizes(Span<const u8> frame_data)
 }
 
 /* (6.1) */
-DecoderErrorOr<void> Parser::parse_frame(Span<const u8> frame_data)
+DecoderErrorOr<void> Parser::parse_frame(ReadonlyBytes frame_data)
 {
     m_bit_stream = make<BitStream>(frame_data.data(), frame_data.size());
     m_syntax_element_counter = make<SyntaxElementCounter>();

+ 2 - 2
Userland/Libraries/LibVideo/VP9/Parser.h

@@ -33,13 +33,13 @@ class Parser {
 public:
     explicit Parser(Decoder&);
     ~Parser();
-    DecoderErrorOr<void> parse_frame(Span<const u8>);
+    DecoderErrorOr<void> parse_frame(ReadonlyBytes);
     void dump_info();
 
 private:
     /* Annex B: Superframes are a method of storing multiple coded frames into a single chunk
      * See also section 5.26. */
-    Vector<size_t> parse_superframe_sizes(Span<const u8>);
+    Vector<size_t> parse_superframe_sizes(ReadonlyBytes);
 
     DecoderErrorOr<FrameType> read_frame_type();
     DecoderErrorOr<ColorRange> read_color_range();

+ 1 - 1
Userland/Libraries/LibVideo/VideoDecoder.h

@@ -18,7 +18,7 @@ class VideoDecoder {
 public:
     virtual ~VideoDecoder() {};
 
-    virtual DecoderErrorOr<void> receive_sample(Span<u8 const> sample) = 0;
+    virtual DecoderErrorOr<void> receive_sample(ReadonlyBytes sample) = 0;
     DecoderErrorOr<void> receive_sample(ByteBuffer const& sample) { return receive_sample(sample.span()); }
     virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0;
 };