Index: media/filters/ivf_parser.h |
diff --git a/media/filters/ivf_parser.h b/media/filters/ivf_parser.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ee5576c21d28edbbf0396939ff1a276aedba921 |
--- /dev/null |
+++ b/media/filters/ivf_parser.h |
@@ -0,0 +1,57 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_FILTERS_IVF_PARSER_H_ |
+#define MEDIA_FILTERS_IVF_PARSER_H_ |
+ |
+#include <stddef.h> |
+#include <stdint.h> |
+ |
+#include "base/macros.h" |
+#include "media/base/media_export.h" |
+ |
+namespace media { |
+ |
+struct MEDIA_EXPORT IvfFileHeader { |
wuchengli
2015/07/30 06:26:13
Remove IvfFileHeader and IvfFrameHeader in video_e
kcwu
2015/07/30 11:52:52
Done.
I preferred timebase_denum and timebase_num
|
+ uint16_t version; |
+ uint16_t header_size; |
+ uint32_t fourcc; |
+ uint16_t width; |
+ uint16_t height; |
+ uint32_t timebase_denum; |
+ uint32_t timebase_num; |
+ uint32_t num_frames; |
+ uint32_t unused; |
+}; |
wuchengli
2015/07/30 06:26:13
__attribute__((packed)) for video_encode_accelerat
kcwu
2015/07/30 11:52:52
I found #pragma pack is portable (across chrome pl
|
+ |
+struct MEDIA_EXPORT IvfFrameHeader { |
+ uint32_t data_size; |
+ int64_t timestamp; |
+ const uint8_t* data; |
+}; |
+ |
+class MEDIA_EXPORT IvfParser { |
xhwang
2015/07/29 16:43:42
Can you add some comments explaining what IVF stan
kcwu
2015/07/30 11:52:52
Done.
|
+ public: |
+ IvfParser(); |
+ |
+ // Initializes the parser for IVF |stream| with size |size| and parses the |
+ // file header. Returns true on success. |
+ bool Initialize(const uint8_t* stream, |
+ size_t size, |
+ IvfFileHeader* file_header); |
+ |
+ // Parses the next frame. Returns true if the next frame is parsed without |
+ // error. |
+ bool ParseNextFrame(IvfFrameHeader* frame_header); |
+ |
+ private: |
+ bool ParseFileHeader(IvfFileHeader* file_header); |
+ |
+ const uint8_t* ptr_; |
+ const uint8_t* end_; |
xhwang
2015/07/29 16:43:42
DISALLOW_COPY_AND_ASSIGN?
xhwang
2015/07/29 16:43:42
Comment on what ptr_ and end_ are.
kcwu
2015/07/30 11:52:52
Done.
kcwu
2015/07/30 11:52:52
Done.
|
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_FILTERS_IVF_PARSER_H_ |