Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implements a Demuxer that can switch among different data sources mid-stream. | 5 // Implements a Demuxer that can switch among different data sources mid-stream. |
| 6 // Uses FFmpegDemuxer under the covers, so see the caveats at the top of | 6 // Uses FFmpegDemuxer under the covers, so see the caveats at the top of |
| 7 // ffmpeg_demuxer.h. | 7 // ffmpeg_demuxer.h. |
| 8 | 8 |
| 9 #include "media/filters/chunk_demuxer.h" | 9 #include "media/filters/chunk_demuxer.h" |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 | 49 |
| 50 // Offset of the segment size field in kWebMHeader. Used to update | 50 // Offset of the segment size field in kWebMHeader. Used to update |
| 51 // the segment size field before handing the buffer to FFmpeg. | 51 // the segment size field before handing the buffer to FFmpeg. |
| 52 static const int kSegmentSizeOffset = sizeof(kWebMHeader) - 8; | 52 static const int kSegmentSizeOffset = sizeof(kWebMHeader) - 8; |
| 53 | 53 |
| 54 static const uint8 kEmptyCluster[] = { | 54 static const uint8 kEmptyCluster[] = { |
| 55 0x1F, 0x43, 0xB6, 0x75, 0x80 // CLUSTER (size = 0) | 55 0x1F, 0x43, 0xB6, 0x75, 0x80 // CLUSTER (size = 0) |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Create an "end of stream" buffer. | 58 // Create an "end of stream" buffer. |
| 59 static Buffer* CreateEOSBuffer() { return new DataBuffer(0, 0); } | 59 static Buffer* CreateEOSBuffer() { |
| 60 return new DataBuffer(scoped_array<uint8>(0), 0); | |
|
acolwell GONE FROM CHROMIUM
2012/01/03 22:46:40
nit: 0 not necessary in constructor.
Ami GONE FROM CHROMIUM
2012/01/03 22:52:02
Actually, scoped_array<uint8>(0) is not necessary.
| |
| 61 } | |
| 60 | 62 |
| 61 class ChunkDemuxerStream : public DemuxerStream { | 63 class ChunkDemuxerStream : public DemuxerStream { |
| 62 public: | 64 public: |
| 63 typedef std::deque<scoped_refptr<Buffer> > BufferQueue; | 65 typedef std::deque<scoped_refptr<Buffer> > BufferQueue; |
| 64 typedef std::deque<ReadCallback> ReadCBQueue; | 66 typedef std::deque<ReadCallback> ReadCBQueue; |
| 65 | 67 |
| 66 ChunkDemuxerStream(Type type, AVStream* stream); | 68 ChunkDemuxerStream(Type type, AVStream* stream); |
| 67 virtual ~ChunkDemuxerStream(); | 69 virtual ~ChunkDemuxerStream(); |
| 68 | 70 |
| 69 void Flush(); | 71 void Flush(); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 base::AutoUnlock auto_unlock(lock_); | 816 base::AutoUnlock auto_unlock(lock_); |
| 815 if (cb.is_null()) { | 817 if (cb.is_null()) { |
| 816 host()->OnDemuxerError(error); | 818 host()->OnDemuxerError(error); |
| 817 return; | 819 return; |
| 818 } | 820 } |
| 819 cb.Run(error); | 821 cb.Run(error); |
| 820 } | 822 } |
| 821 } | 823 } |
| 822 | 824 |
| 823 } // namespace media | 825 } // namespace media |
| OLD | NEW |