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

Side by Side Diff: media/mf/file_reader_util.h

Issue 3044019: This tool demonstrates the use of the Media Foundation H.264 decoder as a sta... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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/mf/README.chromium ('k') | media/mf/file_reader_util.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 // Borrowed from media/tools/omx_test/file_reader_util.h.
6 // Added some functionalities related to timestamps on packets and Media
7 // Foundation.
8
9 #ifndef MEDIA_MF_FILE_READER_UTIL_H_
10 #define MEDIA_MF_FILE_READER_UTIL_H_
11
12 #include <string>
13
14 #include "base/basictypes.h"
15 #include "base/scoped_handle.h"
16 #include "base/scoped_ptr.h"
17
18 struct AVCodecContext;
19 struct AVFormatContext;
20
21 namespace media {
22
23 class BitstreamConverter;
24
25 // A class to help reading and parsing input file for use in omx_test.
26 class FileReader {
27 public:
28 virtual ~FileReader() {}
29
30 // Initialize FileReader object, returns true if successful.
31 virtual bool Initialize() = 0;
32
33 // Read the file into |output|, and output the number of bytes read to
34 // |size|.
35 virtual void Read(uint8** output, int* size) = 0;
36 };
37
38 class FFmpegFileReader : public FileReader {
39 public:
40 explicit FFmpegFileReader(const std::string& filename);
41 virtual ~FFmpegFileReader();
42 virtual bool Initialize();
43 virtual void Read(uint8** output, int* size);
44
45 // Reads a video packet, converts it into Annex B stream, and allocates a
46 // buffer to |*output| and copies the contents into it. Timstamp and
47 // duration are given in 100-ns units.
48 void Read(uint8** output, int* size, int64* timestamp, int64* duration);
49 bool GetFrameRate(int* num, int* denom) const;
50 bool GetWidth(int* width) const;
51 bool GetHeight(int* height) const;
52 bool GetAspectRatio(int* num, int* denom) const;
53 int64 ConvertFFmpegTimeBaseTo100Ns(int64 time_base_unit) const;
54 bool end_of_stream() const { return end_of_stream_; }
55
56 private:
57 std::string filename_;
58 AVFormatContext* format_context_;
59 AVCodecContext* codec_context_;
60 int target_stream_;
61 scoped_ptr<media::BitstreamConverter> converter_;
62 bool end_of_stream_;
63
64 DISALLOW_COPY_AND_ASSIGN(FFmpegFileReader);
65 };
66
67 } // namespace media
68
69 #endif // MEDIA_MF_FILE_READER_UTIL_H_
OLDNEW
« no previous file with comments | « media/mf/README.chromium ('k') | media/mf/file_reader_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698