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

Side by Side Diff: media/filters/ffmpeg_demuxer.h

Issue 1894073002: Revert of Allow muting/unmuting audio through media track API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink-sb-tracks6
Patch Set: Rebased Created 4 years, 8 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
« no previous file with comments | « media/filters/chunk_demuxer_unittest.cc ('k') | media/filters/ffmpeg_demuxer.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 // 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 //
11 // FFmpegDemuxer sets the duration of pipeline during initialization by using 11 // FFmpegDemuxer sets the duration of pipeline during initialization by using
12 // the duration of the longest audio/video stream. 12 // the duration of the longest audio/video stream.
13 // 13 //
14 // NOTE: since FFmpegDemuxer reads packets sequentially without seeking, media 14 // NOTE: since FFmpegDemuxer reads packets sequentially without seeking, media
15 // files with very large drift between audio/video streams may result in 15 // files with very large drift between audio/video streams may result in
16 // excessive memory consumption. 16 // excessive memory consumption.
17 // 17 //
18 // When stopped, FFmpegDemuxer and FFmpegDemuxerStream release all callbacks 18 // When stopped, FFmpegDemuxer and FFmpegDemuxerStream release all callbacks
19 // and buffered packets. Reads from a stopped FFmpegDemuxerStream will not be 19 // and buffered packets. Reads from a stopped FFmpegDemuxerStream will not be
20 // replied to. 20 // replied to.
21 21
22 #ifndef MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 22 #ifndef MEDIA_FILTERS_FFMPEG_DEMUXER_H_
23 #define MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 23 #define MEDIA_FILTERS_FFMPEG_DEMUXER_H_
24 24
25 #include <stddef.h> 25 #include <stddef.h>
26 #include <stdint.h> 26 #include <stdint.h>
27 27
28 #include <map>
29 #include <string> 28 #include <string>
30 #include <utility> 29 #include <utility>
31 #include <vector> 30 #include <vector>
32 31
33 #include "base/callback.h" 32 #include "base/callback.h"
34 #include "base/macros.h" 33 #include "base/macros.h"
35 #include "base/memory/scoped_ptr.h" 34 #include "base/memory/scoped_ptr.h"
36 #include "base/memory/scoped_vector.h" 35 #include "base/memory/scoped_vector.h"
37 #include "base/threading/thread.h" 36 #include "base/threading/thread.h"
38 #include "media/base/audio_decoder_config.h" 37 #include "media/base/audio_decoder_config.h"
39 #include "media/base/decoder_buffer.h" 38 #include "media/base/decoder_buffer.h"
40 #include "media/base/decoder_buffer_queue.h" 39 #include "media/base/decoder_buffer_queue.h"
41 #include "media/base/demuxer.h" 40 #include "media/base/demuxer.h"
42 #include "media/base/media_tracks.h"
43 #include "media/base/pipeline_status.h" 41 #include "media/base/pipeline_status.h"
44 #include "media/base/text_track_config.h" 42 #include "media/base/text_track_config.h"
45 #include "media/base/video_decoder_config.h" 43 #include "media/base/video_decoder_config.h"
46 #include "media/ffmpeg/ffmpeg_deleters.h" 44 #include "media/ffmpeg/ffmpeg_deleters.h"
47 #include "media/filters/blocking_url_protocol.h" 45 #include "media/filters/blocking_url_protocol.h"
48 46
49 // FFmpeg forward declarations. 47 // FFmpeg forward declarations.
50 struct AVPacket; 48 struct AVPacket;
51 struct AVRational; 49 struct AVRational;
52 struct AVStream; 50 struct AVStream;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Allow FFmpegDemuxerStream to notify us when there is updated information 216 // Allow FFmpegDemuxerStream to notify us when there is updated information
219 // about capacity and what buffered data is available. 217 // about capacity and what buffered data is available.
220 void NotifyCapacityAvailable(); 218 void NotifyCapacityAvailable();
221 void NotifyBufferingChanged(); 219 void NotifyBufferingChanged();
222 220
223 // The lowest demuxed timestamp. If negative, DemuxerStreams must use this to 221 // The lowest demuxed timestamp. If negative, DemuxerStreams must use this to
224 // adjust packet timestamps such that external clients see a zero-based 222 // adjust packet timestamps such that external clients see a zero-based
225 // timeline. 223 // timeline.
226 base::TimeDelta start_time() const { return start_time_; } 224 base::TimeDelta start_time() const { return start_time_; }
227 225
228 // Notifies the demuxer that track ids has been assigned to a media tracks.
229 void OnTrackIdsAssigned(const MediaTracks& tracks,
230 const std::vector<unsigned>& track_ids) override;
231
232 // Finds a DemuxerStream corresponding to the given blink |track_id|. Note
233 // that the input track id is blink track id and not bytestream track id.
234 const DemuxerStream* GetDemuxerStreamByTrackId(
235 unsigned track_id) const override;
236
237 private: 226 private:
238 // To allow tests access to privates. 227 // To allow tests access to privates.
239 friend class FFmpegDemuxerTest; 228 friend class FFmpegDemuxerTest;
240 229
241 // FFmpeg callbacks during initialization. 230 // FFmpeg callbacks during initialization.
242 void OnOpenContextDone(const PipelineStatusCB& status_cb, bool result); 231 void OnOpenContextDone(const PipelineStatusCB& status_cb, bool result);
243 void OnFindStreamInfoDone(const PipelineStatusCB& status_cb, int result); 232 void OnFindStreamInfoDone(const PipelineStatusCB& status_cb, int result);
244 233
245 // FFmpeg callbacks during seeking. 234 // FFmpeg callbacks during seeking.
246 void OnSeekFrameDone(const PipelineStatusCB& cb, int result); 235 void OnSeekFrameDone(const PipelineStatusCB& cb, int result);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 bool duration_known_; 327 bool duration_known_;
339 328
340 // FFmpegURLProtocol implementation and corresponding glue bits. 329 // FFmpegURLProtocol implementation and corresponding glue bits.
341 scoped_ptr<BlockingUrlProtocol> url_protocol_; 330 scoped_ptr<BlockingUrlProtocol> url_protocol_;
342 scoped_ptr<FFmpegGlue> glue_; 331 scoped_ptr<FFmpegGlue> glue_;
343 332
344 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 333 const EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
345 334
346 const MediaTracksUpdatedCB media_tracks_updated_cb_; 335 const MediaTracksUpdatedCB media_tracks_updated_cb_;
347 336
348 MediaTracks::TrackIdToDemuxStreamMap track_id_to_demux_stream_;
349
350 // NOTE: Weak pointers must be invalidated before all other member variables. 337 // NOTE: Weak pointers must be invalidated before all other member variables.
351 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 338 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
352 339
353 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 340 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
354 }; 341 };
355 342
356 } // namespace media 343 } // namespace media
357 344
358 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 345 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer_unittest.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698