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

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

Issue 2491043003: MediaResource refactoring to support multiple streams (Closed)
Patch Set: rebase Created 3 years, 10 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
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 //
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Type type() const override; 109 Type type() const override;
110 Liveness liveness() const override; 110 Liveness liveness() const override;
111 void Read(const ReadCB& read_cb) override; 111 void Read(const ReadCB& read_cb) override;
112 void EnableBitstreamConverter() override; 112 void EnableBitstreamConverter() override;
113 bool SupportsConfigChanges() override; 113 bool SupportsConfigChanges() override;
114 AudioDecoderConfig audio_decoder_config() override; 114 AudioDecoderConfig audio_decoder_config() override;
115 VideoDecoderConfig video_decoder_config() override; 115 VideoDecoderConfig video_decoder_config() override;
116 VideoRotation video_rotation() override; 116 VideoRotation video_rotation() override;
117 bool enabled() const override; 117 bool enabled() const override;
118 void set_enabled(bool enabled, base::TimeDelta timestamp) override; 118 void set_enabled(bool enabled, base::TimeDelta timestamp) override;
119 void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) override; 119 void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb);
xhwang 2017/02/01 18:26:04 ditto about enabled() and add an empty line
servolk 2017/02/01 22:29:17 Done (in later CL where SetStreamStatusChangeCB is
120 120
121 void SetLiveness(Liveness liveness); 121 void SetLiveness(Liveness liveness);
122 122
123 // Returns the range of buffered data in this stream. 123 // Returns the range of buffered data in this stream.
124 Ranges<base::TimeDelta> GetBufferedRanges() const; 124 Ranges<base::TimeDelta> GetBufferedRanges() const;
125 125
126 // Returns true if this stream has capacity for additional data. 126 // Returns true if this stream has capacity for additional data.
127 bool HasAvailableCapacity(); 127 bool HasAvailableCapacity();
128 128
129 // Returns the total buffer size FFMpegDemuxerStream is holding onto. 129 // Returns the total buffer size FFMpegDemuxerStream is holding onto.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 std::string GetDisplayName() const override; 211 std::string GetDisplayName() const override;
212 void Initialize(DemuxerHost* host, 212 void Initialize(DemuxerHost* host,
213 const PipelineStatusCB& status_cb, 213 const PipelineStatusCB& status_cb,
214 bool enable_text_tracks) override; 214 bool enable_text_tracks) override;
215 void AbortPendingReads() override; 215 void AbortPendingReads() override;
216 void Stop() override; 216 void Stop() override;
217 void StartWaitingForSeek(base::TimeDelta seek_time) override; 217 void StartWaitingForSeek(base::TimeDelta seek_time) override;
218 void CancelPendingSeek(base::TimeDelta seek_time) override; 218 void CancelPendingSeek(base::TimeDelta seek_time) override;
219 void Seek(base::TimeDelta time, const PipelineStatusCB& cb) override; 219 void Seek(base::TimeDelta time, const PipelineStatusCB& cb) override;
220 base::Time GetTimelineOffset() const override; 220 base::Time GetTimelineOffset() const override;
221 DemuxerStream* GetStream(DemuxerStream::Type type) override; 221 std::vector<DemuxerStream*> GetStreams() override;
222 void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) override;
222 base::TimeDelta GetStartTime() const override; 223 base::TimeDelta GetStartTime() const override;
223 int64_t GetMemoryUsage() const override; 224 int64_t GetMemoryUsage() const override;
224 225
225 // Calls |encrypted_media_init_data_cb_| with the initialization data 226 // Calls |encrypted_media_init_data_cb_| with the initialization data
226 // encountered in the file. 227 // encountered in the file.
227 void OnEncryptedMediaInitData(EmeInitDataType init_data_type, 228 void OnEncryptedMediaInitData(EmeInitDataType init_data_type,
228 const std::string& encryption_key_id); 229 const std::string& encryption_key_id);
229 230
230 // Allow FFmpegDemuxerStream to notify us when there is updated information 231 // Allow FFmpegDemuxerStream to notify us when there is updated information
231 // about capacity and what buffered data is available. 232 // about capacity and what buffered data is available.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 270
270 // Returns true if the maximum allowed memory usage has been reached. 271 // Returns true if the maximum allowed memory usage has been reached.
271 bool IsMaxMemoryUsageReached() const; 272 bool IsMaxMemoryUsageReached() const;
272 273
273 // Signal all FFmpegDemuxerStreams that the stream has ended. 274 // Signal all FFmpegDemuxerStreams that the stream has ended.
274 void StreamHasEnded(); 275 void StreamHasEnded();
275 276
276 // Called by |url_protocol_| whenever |data_source_| returns a read error. 277 // Called by |url_protocol_| whenever |data_source_| returns a read error.
277 void OnDataSourceError(); 278 void OnDataSourceError();
278 279
279 // Returns the stream from |streams_| that matches |type| as an 280 // Returns the first stream from |streams_| that matches |type| as an
280 // FFmpegDemuxerStream. 281 // FFmpegDemuxerStream and is enabled.
xhwang 2017/02/01 18:26:04 Add a TODO to support multiple streams? Or a comme
servolk 2017/02/01 22:29:17 This is an internal function that is only used for
281 FFmpegDemuxerStream* GetFFmpegStream(DemuxerStream::Type type) const; 282 FFmpegDemuxerStream* GetFirstEnabledFFmpegStream(
283 DemuxerStream::Type type) const;
282 284
283 // Called after the streams have been collected from the media, to allow 285 // Called after the streams have been collected from the media, to allow
284 // the text renderer to bind each text stream to the cue rendering engine. 286 // the text renderer to bind each text stream to the cue rendering engine.
285 void AddTextStreams(); 287 void AddTextStreams();
286 288
287 void SetLiveness(DemuxerStream::Liveness liveness); 289 void SetLiveness(DemuxerStream::Liveness liveness);
288 290
289 DemuxerHost* host_; 291 DemuxerHost* host_;
290 292
291 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 293 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 base::WeakPtr<FFmpegDemuxer> weak_this_; 368 base::WeakPtr<FFmpegDemuxer> weak_this_;
367 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_; 369 base::WeakPtrFactory<FFmpegDemuxer> cancel_pending_seek_factory_;
368 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 370 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
369 371
370 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 372 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
371 }; 373 };
372 374
373 } // namespace media 375 } // namespace media
374 376
375 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 377 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698