Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: media/tools/omx_test/file_sink.cc

Issue 7066071: Removing defunct OpenMAX code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: removed tab Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/tools/omx_test/file_sink.h ('k') | media/tools/omx_test/omx_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #include "media/tools/omx_test/file_sink.h"
6
7 #include "base/file_util.h"
8 #include "base/logging.h"
9 #include "media/tools/omx_test/color_space_util.h"
10
11 namespace media {
12
13 FileSink::FileSink(const FilePath& output_path,
14 bool simulate_copy,
15 bool enable_csc)
16 : output_path_(output_path),
17 simulate_copy_(simulate_copy),
18 enable_csc_(enable_csc),
19 width_(0),
20 height_(0),
21 copy_buf_size_(0),
22 csc_buf_size_(0) {
23 }
24
25 FileSink::~FileSink() {}
26
27 void FileSink::BufferReady(int size, uint8* buffer) {
28 if (size > copy_buf_size_) {
29 copy_buf_.reset(new uint8[size]);
30 copy_buf_size_ = size;
31 }
32 if (size > csc_buf_size_) {
33 csc_buf_.reset(new uint8[size]);
34 csc_buf_size_ = size;
35 }
36
37 // Copy the output of the decoder to user memory.
38 if (simulate_copy_ || output_file_.get()) // Implies a copy.
39 memcpy(copy_buf_.get(), buffer, size);
40
41 uint8* out_buffer = copy_buf_.get();
42 if (enable_csc_) {
43 // Now assume the raw output is NV21.
44 media::NV21toIYUV(copy_buf_.get(), csc_buf_.get(), width_, height_);
45 out_buffer = csc_buf_.get();
46 }
47
48 if (output_file_.get())
49 fwrite(out_buffer, sizeof(uint8), size, output_file_.get());
50 }
51
52 bool FileSink::Initialize() {
53 // Opens the output file for writing.
54 if (!output_path_.empty()) {
55 output_file_.Set(file_util::OpenFile(output_path_, "wb"));
56 if (!output_file_.get()) {
57 LOG(ERROR) << "can't open dump file %s" << output_path_.value();
58 return false;
59 }
60 }
61 return true;
62 }
63
64 void FileSink::UpdateSize(int width, int height) {
65 width_ = width;
66 height_ = height;
67 }
68
69 } // namespace media
OLDNEW
« no previous file with comments | « media/tools/omx_test/file_sink.h ('k') | media/tools/omx_test/omx_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698