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

Side by Side Diff: media/base/decoder_buffer.h

Issue 16274005: Separate DemuxerStream and VideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: VideoFrameStream ready for review. Created 7 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 | « no previous file | media/base/decoder_buffer.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_ 5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_
6 #define MEDIA_BASE_DECODER_BUFFER_H_ 6 #define MEDIA_BASE_DECODER_BUFFER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "media/base/media_export.h" 15 #include "media/base/media_export.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 class DecryptConfig; 19 class DecryptConfig;
20 class VideoDecoderConfig;
20 21
21 // A specialized buffer for interfacing with audio / video decoders. 22 // A specialized buffer for interfacing with audio / video decoders.
22 // 23 //
23 // Specifically ensures that data is aligned and padded as necessary by the 24 // Specifically ensures that data is aligned and padded as necessary by the
24 // underlying decoding framework. On desktop platforms this means memory is 25 // underlying decoding framework. On desktop platforms this means memory is
25 // allocated using FFmpeg with particular alignment and padding requirements. 26 // allocated using FFmpeg with particular alignment and padding requirements.
26 // 27 //
27 // Also includes decoder specific functionality for decryption. 28 // Also includes decoder specific functionality for decryption.
28 // 29 //
29 // NOTE: It is illegal to call any method when IsEndOfStream() is true. 30 // NOTE: It is illegal to call any method when IsEndOfStream() is true.
(...skipping 17 matching lines...) Expand all
47 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. 48 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0.
48 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); 49 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size);
49 50
50 // Create a DecoderBuffer whose |data_| is copied from |data| and |side_data_| 51 // Create a DecoderBuffer whose |data_| is copied from |data| and |side_data_|
51 // is copied from |side_data|. Buffers will be padded and aligned as necessary 52 // is copied from |side_data|. Buffers will be padded and aligned as necessary
52 // Data pointers must not be NULL and sizes must be >= 0. 53 // Data pointers must not be NULL and sizes must be >= 0.
53 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size, 54 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size,
54 const uint8* side_data, 55 const uint8* side_data,
55 int side_data_size); 56 int side_data_size);
56 57
58 // Verify if a fake video DecoderBuffer is valid.
59 static bool VerifyFakeVideoBufferForTest(
scherkus (not reviewing) 2013/06/12 01:06:10 do we have to put these methods on DecoderBuffer?
xhwang 2013/07/03 08:01:34 Done.
60 const scoped_refptr<DecoderBuffer>& buffer,
61 const VideoDecoderConfig& config);
62
57 // Create a DecoderBuffer indicating we've reached end of stream. 63 // Create a DecoderBuffer indicating we've reached end of stream.
58 // 64 //
59 // Calling any method other than IsEndOfStream() on the resulting buffer 65 // Calling any method other than IsEndOfStream() on the resulting buffer
60 // is disallowed. 66 // is disallowed.
61 static scoped_refptr<DecoderBuffer> CreateEOSBuffer(); 67 static scoped_refptr<DecoderBuffer> CreateEOSBuffer();
62 68
69 static const char kFakeVideoBufferHeader[];
70
71 // Create a fake video DecoderBuffer for testing purpose. The buffer contains
72 // part of video decoder config info embedded so that the testing code can do
73 // some sanity check.
74 static scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest(
75 const VideoDecoderConfig& config,
76 base::TimeDelta timestamp,
77 base::TimeDelta duration);
78
63 base::TimeDelta GetTimestamp() const; 79 base::TimeDelta GetTimestamp() const;
64 void SetTimestamp(const base::TimeDelta& timestamp); 80 void SetTimestamp(const base::TimeDelta& timestamp);
65 81
66 base::TimeDelta GetDuration() const; 82 base::TimeDelta GetDuration() const;
67 void SetDuration(const base::TimeDelta& duration); 83 void SetDuration(const base::TimeDelta& duration);
68 84
69 const uint8* GetData() const; 85 const uint8* GetData() const;
70 uint8* GetWritableData() const; 86 uint8* GetWritableData() const;
71 87
72 int GetDataSize() const; 88 int GetDataSize() const;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 121
106 // Constructor helper method for memory allocations. 122 // Constructor helper method for memory allocations.
107 void Initialize(); 123 void Initialize();
108 124
109 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); 125 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer);
110 }; 126 };
111 127
112 } // namespace media 128 } // namespace media
113 129
114 #endif // MEDIA_BASE_DECODER_BUFFER_H_ 130 #endif // MEDIA_BASE_DECODER_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/decoder_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698