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

Side by Side Diff: media/omx/omx_test.cc

Issue 431040: Revert "Implement method stubs for OpenMAX IL instead of relying on -lOmxCore." (Closed)
Patch Set: Created 11 years, 1 month 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
« no previous file with comments | « media/media.gyp ('k') | media/omx/omx_test.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 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 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 // A test program that drives an OpenMAX video decoder module. This program 5 // A test program that drives an OpenMAX video decoder module. This program
6 // will take video in elementary stream and read into the decoder. 6 // will take video in elementary stream and read into the decoder.
7 // Usage of this program: 7 // Usage of this program:
8 // ./omx_test --file=<file> --component=<component> --codec=<codec> 8 // ./omx_test --file=<file> --component=<component> --codec=<codec>
9 // <file> = Input file name 9 // <file> = Input file name
10 // <component> = Name of the OpenMAX component 10 // <component> = Name of the OpenMAX component
11 // <codec> = Codec to be used, available codecs: h264, vc1, mpeg4, h263. 11 // <codec> = Codec to be used, available codecs: h264, vc1, mpeg4, h263.
12 12
13 #include "base/at_exit.h" 13 #include "base/at_exit.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h"
16 #include "base/message_loop.h" 15 #include "base/message_loop.h"
17 #include "base/scoped_ptr.h" 16 #include "base/scoped_ptr.h"
18 #include "media/omx/input_buffer.h" 17 #include "media/omx/input_buffer.h"
19 #include "media/omx/omx_video_decoder.h" 18 #include "media/omx/omx_video_decoder.h"
20 19
21 // This is the driver object to feed the decoder with data from a file. 20 // This is the driver object to feed the decoder with data from a file.
22 // It also provides callbacks for the decoder to receive events from the 21 // It also provides callbacks for the decoder to receive events from the
23 // decoder. 22 // decoder.
24 class TestApp { 23 class TestApp {
25 public: 24 public:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // This method feeds the decoder with 32KB of input data. 82 // This method feeds the decoder with 32KB of input data.
84 const int kSize = 32768; 83 const int kSize = 32768;
85 uint8* data = new uint8[kSize]; 84 uint8* data = new uint8[kSize];
86 int read = fread(data, 1, kSize, file_); 85 int read = fread(data, 1, kSize, file_);
87 decoder_->Feed(new media::InputBuffer(data, read), 86 decoder_->Feed(new media::InputBuffer(data, read),
88 NewCallback(this, &TestApp::FeedCallback)); 87 NewCallback(this, &TestApp::FeedCallback));
89 } 88 }
90 89
91 void Run() { 90 void Run() {
92 // Open the input file. 91 // Open the input file.
93 file_ = file_util::OpenFile(filename_, "rb"); 92 file_ = fopen(filename_, "rb");
94 if (!file_) { 93 if (!file_) {
95 printf("Error - can't open file %s\n", filename_); 94 printf("Error - can't open file %s\n", filename_);
96 return; 95 return;
97 } 96 }
98 97
99 // Setup the decoder with the message loop of the current thread. Also 98 // Setup the decoder with the message loop of the current thread. Also
100 // setup component name, codec and callbacks. 99 // setup component name, codec and callbacks.
101 decoder_ = new media::OmxVideoDecoder(&message_loop_); 100 decoder_ = new media::OmxVideoDecoder(&message_loop_);
102 decoder_->Setup(component_, codec_); 101 decoder_->Setup(component_, codec_);
103 decoder_->SetErrorCallback(NewCallback(this, &TestApp::ErrorCallback)); 102 decoder_->SetErrorCallback(NewCallback(this, &TestApp::ErrorCallback));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 154 }
156 155
157 // Create a TestApp object and run the decoder. 156 // Create a TestApp object and run the decoder.
158 TestApp test(filename.c_str(), component.c_str(), codec_id); 157 TestApp test(filename.c_str(), component.c_str(), codec_id);
159 158
160 // This call will run the decoder until EOS is reached or an error 159 // This call will run the decoder until EOS is reached or an error
161 // is encountered. 160 // is encountered.
162 test.Run(); 161 test.Run();
163 return 0; 162 return 0;
164 } 163 }
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | media/omx/omx_test.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698