| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 the Demuxer interface using FFmpeg's libavformat. At this time | 5 // Implements the Demuxer interface using FFmpeg's libavformat. At this time |
| 6 // will support demuxing any audio/video format thrown at it. The streams | 6 // will support demuxing any audio/video format thrown at it. The streams |
| 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer | 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer |
| 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs | 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs |
| 9 // can be used to create and initialize the corresponding FFmpeg decoder. | 9 // can be used to create and initialize the corresponding FFmpeg decoder. |
| 10 // | 10 // |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "media/base/media_format.h" | 32 #include "media/base/media_format.h" |
| 33 #include "media/filters/ffmpeg_glue.h" | 33 #include "media/filters/ffmpeg_glue.h" |
| 34 #include "media/filters/ffmpeg_interfaces.h" | 34 #include "media/filters/ffmpeg_interfaces.h" |
| 35 #include "testing/gtest/include/gtest/gtest_prod.h" | 35 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 36 | 36 |
| 37 // FFmpeg forward declarations. | 37 // FFmpeg forward declarations. |
| 38 struct AVCodecContext; | 38 struct AVCodecContext; |
| 39 struct AVBitStreamFilterContext; | 39 struct AVBitStreamFilterContext; |
| 40 struct AVFormatContext; | 40 struct AVFormatContext; |
| 41 struct AVPacket; | 41 struct AVPacket; |
| 42 struct AVRational; |
| 42 struct AVStream; | 43 struct AVStream; |
| 43 | 44 |
| 44 namespace media { | 45 namespace media { |
| 45 | 46 |
| 46 class FFmpegDemuxer; | 47 class FFmpegDemuxer; |
| 47 | 48 |
| 48 // Forward declaration for scoped_ptr_malloc. | 49 // Forward declaration for scoped_ptr_malloc. |
| 49 class ScopedPtrAVFree; | 50 class ScopedPtrAVFree; |
| 50 | 51 |
| 51 class FFmpegDemuxerStream : public DemuxerStream, public AVStreamProvider { | 52 class FFmpegDemuxerStream : public DemuxerStream, public AVStreamProvider { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 virtual ~FFmpegDemuxerStream(); | 87 virtual ~FFmpegDemuxerStream(); |
| 87 | 88 |
| 88 // Carries out enqueuing a pending read on the demuxer thread. | 89 // Carries out enqueuing a pending read on the demuxer thread. |
| 89 void ReadTask(Callback1<Buffer*>::Type* read_callback); | 90 void ReadTask(Callback1<Buffer*>::Type* read_callback); |
| 90 | 91 |
| 91 // Attempts to fulfill a single pending read by dequeueing a buffer and read | 92 // Attempts to fulfill a single pending read by dequeueing a buffer and read |
| 92 // callback pair and executing the callback. | 93 // callback pair and executing the callback. |
| 93 void FulfillPendingRead(); | 94 void FulfillPendingRead(); |
| 94 | 95 |
| 95 // Converts an FFmpeg stream timestamp into a base::TimeDelta. | 96 // Converts an FFmpeg stream timestamp into a base::TimeDelta. |
| 96 base::TimeDelta ConvertTimestamp(int64 timestamp); | 97 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, |
| 98 int64 timestamp); |
| 97 | 99 |
| 98 FFmpegDemuxer* demuxer_; | 100 FFmpegDemuxer* demuxer_; |
| 99 AVStream* stream_; | 101 AVStream* stream_; |
| 100 MediaFormat media_format_; | 102 MediaFormat media_format_; |
| 101 base::TimeDelta duration_; | 103 base::TimeDelta duration_; |
| 102 bool discontinuous_; | 104 bool discontinuous_; |
| 103 bool stopped_; | 105 bool stopped_; |
| 104 | 106 |
| 105 typedef std::deque<scoped_refptr<Buffer> > BufferQueue; | 107 typedef std::deque<scoped_refptr<Buffer> > BufferQueue; |
| 106 BufferQueue buffer_queue_; | 108 BufferQueue buffer_queue_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // If true, then it's our first seek and we won't call av_read_frame(). It's | 228 // If true, then it's our first seek and we won't call av_read_frame(). It's |
| 227 // a hack to get around some issue with FFmpeg. | 229 // a hack to get around some issue with FFmpeg. |
| 228 bool first_seek_hack_; | 230 bool first_seek_hack_; |
| 229 | 231 |
| 230 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 232 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 231 }; | 233 }; |
| 232 | 234 |
| 233 } // namespace media | 235 } // namespace media |
| 234 | 236 |
| 235 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 237 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |