OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this | |
2 // source code is governed by a BSD-style license that can be found in the | |
3 // LICENSE file. | |
4 | |
5 #ifndef MEDIA_TOOLS_OMX_TEST_FILE_SINK_H_ | |
6 #define MEDIA_TOOLS_OMX_TEST_FILE_SINK_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/file_path.h" | |
13 #include "base/memory/scoped_handle.h" | |
14 #include "base/memory/scoped_ptr.h" | |
15 | |
16 namespace media { | |
17 | |
18 // This class writes output of a frame decoded by OmxCodec and save it to | |
19 // a file. | |
20 class FileSink { | |
21 public: | |
22 FileSink(const FilePath& output_path, | |
23 bool simulate_copy, | |
24 bool enable_csc); | |
25 | |
26 virtual ~FileSink(); | |
27 | |
28 virtual void BufferReady(int size, uint8* buffer); | |
29 | |
30 // Initialize this object. Returns true if successful. | |
31 bool Initialize(); | |
32 | |
33 // Update the output frame size. | |
34 void UpdateSize(int wdith, int height); | |
35 | |
36 // Write the frame buffer reference by |buffer|. | |
37 void Write(uint8* buffer, int size); | |
38 | |
39 private: | |
40 FilePath output_path_; | |
41 bool simulate_copy_; | |
42 bool enable_csc_; | |
43 ScopedStdioHandle output_file_; | |
44 | |
45 // Image properties. | |
46 int width_; | |
47 int height_; | |
48 | |
49 // Buffers for copying and color space conversion. | |
50 scoped_array<uint8> copy_buf_; | |
51 int copy_buf_size_; | |
52 scoped_array<uint8> csc_buf_; | |
53 int csc_buf_size_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(FileSink); | |
56 }; | |
57 | |
58 } // namespace media | |
59 | |
60 #endif // MEDIA_TOOLS_OMX_TEST_FILE_SINK_H_ | |
OLD | NEW |