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

Side by Side Diff: media/base/pipeline.h

Issue 10800041: Update media duration if data is appended after the previous duration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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 | Annotate | Revision Log
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 #ifndef MEDIA_BASE_PIPELINE_H_ 5 #ifndef MEDIA_BASE_PIPELINE_H_
6 #define MEDIA_BASE_PIPELINE_H_ 6 #define MEDIA_BASE_PIPELINE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // 119 //
120 // These callbacks are only executed after Start() has been called and until 120 // These callbacks are only executed after Start() has been called and until
121 // Stop() has completed. 121 // Stop() has completed.
122 // 122 //
123 // It is an error to call this method after the pipeline has already started. 123 // It is an error to call this method after the pipeline has already started.
124 // 124 //
125 // TODO(scherkus): remove IsInitialized() and force clients to use callbacks. 125 // TODO(scherkus): remove IsInitialized() and force clients to use callbacks.
126 void Start(scoped_ptr<FilterCollection> filter_collection, 126 void Start(scoped_ptr<FilterCollection> filter_collection,
127 const PipelineStatusCB& ended_cb, 127 const PipelineStatusCB& ended_cb,
128 const PipelineStatusCB& error_cb, 128 const PipelineStatusCB& error_cb,
129 const PipelineStatusCB& start_cb); 129 const PipelineStatusCB& start_cb,
130 const base::Closure& new_duration_cb);
130 131
131 // Asynchronously stops the pipeline and resets it to an uninitialized state. 132 // Asynchronously stops the pipeline and resets it to an uninitialized state.
132 // 133 //
133 // If provided, |stop_cb| will be executed when the pipeline has been 134 // If provided, |stop_cb| will be executed when the pipeline has been
134 // completely torn down and reset to an uninitialized state. It is acceptable 135 // completely torn down and reset to an uninitialized state. It is acceptable
135 // to call Start() again once the callback has finished executing. 136 // to call Start() again once the callback has finished executing.
136 // 137 //
137 // Stop() must be called before destroying the pipeline. Clients can 138 // Stop() must be called before destroying the pipeline. Clients can
138 // determine whether Stop() must be called by checking IsRunning(). 139 // determine whether Stop() must be called by checking IsRunning().
139 // 140 //
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // Returns true if the given state is one that transitions to a new state 283 // Returns true if the given state is one that transitions to a new state
283 // after iterating through each filter. 284 // after iterating through each filter.
284 static bool TransientState(State state); 285 static bool TransientState(State state);
285 286
286 // Given the current state, returns the next state. 287 // Given the current state, returns the next state.
287 State FindNextState(State current); 288 State FindNextState(State current);
288 289
289 // DataSourceHost (by way of DemuxerHost) implementation. 290 // DataSourceHost (by way of DemuxerHost) implementation.
290 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE; 291 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE;
291 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE; 292 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE;
292 virtual void AddBufferedTimeRange(base::TimeDelta start,
293 base::TimeDelta end) OVERRIDE;
294 293
295 // DemuxerHost implementaion. 294 // DemuxerHost implementaion.
296 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; 295 virtual void SetDuration(base::TimeDelta duration) OVERRIDE;
297 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; 296 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE;
297 virtual void AddBufferedTimeRange(base::TimeDelta start,
298 base::TimeDelta end) OVERRIDE;
298 299
299 // Initiates teardown sequence in response to a runtime error. 300 // Initiates teardown sequence in response to a runtime error.
300 // 301 //
301 // Safe to call from any thread. 302 // Safe to call from any thread.
302 void SetError(PipelineStatus error); 303 void SetError(PipelineStatus error);
303 304
304 // Callback executed when the natural size of the video has changed. 305 // Callback executed when the natural size of the video has changed.
305 void OnNaturalVideoSizeChanged(const gfx::Size& size); 306 void OnNaturalVideoSizeChanged(const gfx::Size& size);
306 307
307 // Callback executed when either of the renderers have ended. 308 // Callback executed when either of the renderers have ended.
(...skipping 22 matching lines...) Expand all
330 331
331 // Callback executed by video renderer to update clock time. 332 // Callback executed by video renderer to update clock time.
332 void OnVideoTimeUpdate(base::TimeDelta max_time); 333 void OnVideoTimeUpdate(base::TimeDelta max_time);
333 334
334 // The following "task" methods correspond to the public methods, but these 335 // The following "task" methods correspond to the public methods, but these
335 // methods are run as the result of posting a task to the PipelineInternal's 336 // methods are run as the result of posting a task to the PipelineInternal's
336 // message loop. 337 // message loop.
337 void StartTask(scoped_ptr<FilterCollection> filter_collection, 338 void StartTask(scoped_ptr<FilterCollection> filter_collection,
338 const PipelineStatusCB& ended_cb, 339 const PipelineStatusCB& ended_cb,
339 const PipelineStatusCB& error_cb, 340 const PipelineStatusCB& error_cb,
340 const PipelineStatusCB& start_cb); 341 const PipelineStatusCB& start_cb,
342 const base::Closure& new_duration_cb);
341 343
342 // InitializeTask() performs initialization in multiple passes. It is executed 344 // InitializeTask() performs initialization in multiple passes. It is executed
343 // as a result of calling Start() or InitializationComplete() that advances 345 // as a result of calling Start() or InitializationComplete() that advances
344 // initialization to the next state. It works as a hub of state transition for 346 // initialization to the next state. It works as a hub of state transition for
345 // initialization. One stage communicates its status to the next through 347 // initialization. One stage communicates its status to the next through
346 // |last_stage_status|. 348 // |last_stage_status|.
347 void InitializeTask(PipelineStatus last_stage_status); 349 void InitializeTask(PipelineStatus last_stage_status);
348 350
349 // Stops and destroys all filters, placing the pipeline in the kStopped state. 351 // Stops and destroys all filters, placing the pipeline in the kStopped state.
350 void StopTask(const base::Closure& stop_cb); 352 void StopTask(const base::Closure& stop_cb);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 bool audio_disabled_; 530 bool audio_disabled_;
529 531
530 // Filter collection as passed in by Start(). 532 // Filter collection as passed in by Start().
531 scoped_ptr<FilterCollection> filter_collection_; 533 scoped_ptr<FilterCollection> filter_collection_;
532 534
533 // Callbacks for various pipeline operations. 535 // Callbacks for various pipeline operations.
534 PipelineStatusCB seek_cb_; 536 PipelineStatusCB seek_cb_;
535 base::Closure stop_cb_; 537 base::Closure stop_cb_;
536 PipelineStatusCB ended_cb_; 538 PipelineStatusCB ended_cb_;
537 PipelineStatusCB error_cb_; 539 PipelineStatusCB error_cb_;
540 base::Closure new_duration_cb_;
538 541
539 // Decoder reference used for signalling imminent shutdown. 542 // Decoder reference used for signalling imminent shutdown.
540 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the 543 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the
541 // renderer thread loop hostage for until PipelineImpl::Stop() calls its 544 // renderer thread loop hostage for until PipelineImpl::Stop() calls its
542 // callback. 545 // callback.
543 // This reference should only be used for this hack and no other purposes. 546 // This reference should only be used for this hack and no other purposes.
544 // http://crbug.com/110228 tracks removing this hack. 547 // http://crbug.com/110228 tracks removing this hack.
545 scoped_refptr<VideoDecoder> video_decoder_; 548 scoped_refptr<VideoDecoder> video_decoder_;
546 549
547 // Renderer references used for setting the volume and determining 550 // Renderer references used for setting the volume and determining
(...skipping 14 matching lines...) Expand all
562 // Time of pipeline creation; is non-zero only until the pipeline first 565 // Time of pipeline creation; is non-zero only until the pipeline first
563 // reaches "kStarted", at which point it is used & zeroed out. 566 // reaches "kStarted", at which point it is used & zeroed out.
564 base::Time creation_time_; 567 base::Time creation_time_;
565 568
566 DISALLOW_COPY_AND_ASSIGN(Pipeline); 569 DISALLOW_COPY_AND_ASSIGN(Pipeline);
567 }; 570 };
568 571
569 } // namespace media 572 } // namespace media
570 573
571 #endif // MEDIA_BASE_PIPELINE_H_ 574 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698