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

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

Issue 436021: Implement method stubs for OpenMAX IL instead of relying on -lOmxCore. (Closed)
Patch Set: Windows fix Created 11 years 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"
15 #include "base/message_loop.h" 16 #include "base/message_loop.h"
16 #include "base/scoped_ptr.h" 17 #include "base/scoped_ptr.h"
17 #include "media/omx/input_buffer.h" 18 #include "media/omx/input_buffer.h"
18 #include "media/omx/omx_video_decoder.h" 19 #include "media/omx/omx_video_decoder.h"
19 20
20 // This is the driver object to feed the decoder with data from a file. 21 // This is the driver object to feed the decoder with data from a file.
21 // It also provides callbacks for the decoder to receive events from the 22 // It also provides callbacks for the decoder to receive events from the
22 // decoder. 23 // decoder.
23 class TestApp { 24 class TestApp {
24 public: 25 public:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // This method feeds the decoder with 32KB of input data. 83 // This method feeds the decoder with 32KB of input data.
83 const int kSize = 32768; 84 const int kSize = 32768;
84 uint8* data = new uint8[kSize]; 85 uint8* data = new uint8[kSize];
85 int read = fread(data, 1, kSize, file_); 86 int read = fread(data, 1, kSize, file_);
86 decoder_->Feed(new media::InputBuffer(data, read), 87 decoder_->Feed(new media::InputBuffer(data, read),
87 NewCallback(this, &TestApp::FeedCallback)); 88 NewCallback(this, &TestApp::FeedCallback));
88 } 89 }
89 90
90 void Run() { 91 void Run() {
91 // Open the input file. 92 // Open the input file.
92 file_ = fopen(filename_, "rb"); 93 file_ = file_util::OpenFile(filename_, "rb");
93 if (!file_) { 94 if (!file_) {
94 printf("Error - can't open file %s\n", filename_); 95 printf("Error - can't open file %s\n", filename_);
95 return; 96 return;
96 } 97 }
97 98
98 // Setup the decoder with the message loop of the current thread. Also 99 // Setup the decoder with the message loop of the current thread. Also
99 // setup component name, codec and callbacks. 100 // setup component name, codec and callbacks.
100 decoder_ = new media::OmxVideoDecoder(&message_loop_); 101 decoder_ = new media::OmxVideoDecoder(&message_loop_);
101 decoder_->Setup(component_, codec_); 102 decoder_->Setup(component_, codec_);
102 decoder_->SetErrorCallback(NewCallback(this, &TestApp::ErrorCallback)); 103 decoder_->SetErrorCallback(NewCallback(this, &TestApp::ErrorCallback));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 155 }
155 156
156 // Create a TestApp object and run the decoder. 157 // Create a TestApp object and run the decoder.
157 TestApp test(filename.c_str(), component.c_str(), codec_id); 158 TestApp test(filename.c_str(), component.c_str(), codec_id);
158 159
159 // This call will run the decoder until EOS is reached or an error 160 // This call will run the decoder until EOS is reached or an error
160 // is encountered. 161 // is encountered.
161 test.Run(); 162 test.Run();
162 return 0; 163 return 0;
163 } 164 }
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