| 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 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 22 matching lines...) Expand all Loading... |
| 33 #include "media/base/demuxer.h" | 33 #include "media/base/demuxer.h" |
| 34 #include "media/base/pipeline.h" | 34 #include "media/base/pipeline.h" |
| 35 #include "media/base/video_decoder_config.h" | 35 #include "media/base/video_decoder_config.h" |
| 36 #include "media/filters/ffmpeg_glue.h" | 36 #include "media/filters/ffmpeg_glue.h" |
| 37 | 37 |
| 38 // FFmpeg forward declarations. | 38 // FFmpeg forward declarations. |
| 39 struct AVFormatContext; | 39 struct AVFormatContext; |
| 40 struct AVPacket; | 40 struct AVPacket; |
| 41 struct AVRational; | 41 struct AVRational; |
| 42 struct AVStream; | 42 struct AVStream; |
| 43 class ScopedPtrAVFreePacket; |
| 43 | 44 |
| 44 namespace media { | 45 namespace media { |
| 45 | 46 |
| 46 class BitstreamConverter; | 47 class BitstreamConverter; |
| 47 class FFmpegDemuxer; | 48 class FFmpegDemuxer; |
| 48 | 49 |
| 49 class FFmpegDemuxerStream : public DemuxerStream { | 50 class FFmpegDemuxerStream : public DemuxerStream { |
| 50 public: | 51 public: |
| 51 // Keeps a copy of |demuxer| and initializes itself using information | 52 // Keeps a copy of |demuxer| and initializes itself using information |
| 52 // inside |stream|. Both parameters must outlive |this|. | 53 // inside |stream|. Both parameters must outlive |this|. |
| 53 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream); | 54 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream); |
| 54 | 55 |
| 55 // Returns true is this stream has pending reads, false otherwise. | 56 // Returns true is this stream has pending reads, false otherwise. |
| 56 // | 57 // |
| 57 // Safe to call on any thread. | 58 // Safe to call on any thread. |
| 58 bool HasPendingReads(); | 59 bool HasPendingReads(); |
| 59 | 60 |
| 60 // Enqueues and takes ownership over the given AVPacket. | 61 // Enqueues the given AVPacket. |
| 61 void EnqueuePacket(AVPacket* packet); | 62 void EnqueuePacket(scoped_ptr_malloc<AVPacket, ScopedPtrAVFreePacket> packet); |
| 62 | 63 |
| 63 // Signals to empty the buffer queue and mark next packet as discontinuous. | 64 // Signals to empty the buffer queue and mark next packet as discontinuous. |
| 64 void FlushBuffers(); | 65 void FlushBuffers(); |
| 65 | 66 |
| 66 // Empties the queues and ignores any additional calls to Read(). | 67 // Empties the queues and ignores any additional calls to Read(). |
| 67 void Stop(); | 68 void Stop(); |
| 68 | 69 |
| 69 // Returns the duration of this stream. | 70 // Returns the duration of this stream. |
| 70 base::TimeDelta duration(); | 71 base::TimeDelta duration(); |
| 71 | 72 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // starting clock value to match the timestamps in the media file. Default | 260 // starting clock value to match the timestamps in the media file. Default |
| 260 // is 0. | 261 // is 0. |
| 261 base::TimeDelta start_time_; | 262 base::TimeDelta start_time_; |
| 262 | 263 |
| 263 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 264 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
| 264 }; | 265 }; |
| 265 | 266 |
| 266 } // namespace media | 267 } // namespace media |
| 267 | 268 |
| 268 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 269 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
| OLD | NEW |