2013-06-20 20:14:42 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_SourceBufferList_h_
|
|
|
|
#define mozilla_dom_SourceBufferList_h_
|
|
|
|
|
|
|
|
#include "SourceBuffer.h"
|
2013-09-26 22:22:37 -07:00
|
|
|
#include "js/RootingAPI.h"
|
|
|
|
#include "mozilla/Assertions.h"
|
2013-06-20 20:14:42 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-31 23:13:50 -07:00
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
2013-09-26 22:22:37 -07:00
|
|
|
#include "nsCycleCollectionNoteChild.h"
|
2013-06-20 20:14:42 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2013-09-26 22:22:37 -07:00
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
|
|
|
struct JSContext;
|
|
|
|
class JSObject;
|
2013-06-20 20:14:42 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
2013-09-26 22:22:37 -07:00
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
template <typename T> class AsyncEventRunner;
|
|
|
|
|
2013-06-20 20:14:42 -07:00
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class MediaSource;
|
|
|
|
|
2014-03-31 23:13:50 -07:00
|
|
|
class SourceBufferList MOZ_FINAL : public DOMEventTargetHelper
|
2013-06-20 20:14:42 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** WebIDL Methods. */
|
|
|
|
SourceBuffer* IndexedGetter(uint32_t aIndex, bool& aFound);
|
|
|
|
|
|
|
|
uint32_t Length();
|
|
|
|
/** End WebIDL methods. */
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2014-03-31 23:13:50 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SourceBufferList,
|
|
|
|
DOMEventTargetHelper)
|
2013-06-20 20:14:42 -07:00
|
|
|
|
|
|
|
explicit SourceBufferList(MediaSource* aMediaSource);
|
|
|
|
|
|
|
|
MediaSource* GetParentObject() const;
|
|
|
|
|
2014-04-08 15:27:18 -07:00
|
|
|
JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2013-06-20 20:14:42 -07:00
|
|
|
|
|
|
|
// Append a SourceBuffer and fire "addsourcebuffer" at the list.
|
|
|
|
void Append(SourceBuffer* aSourceBuffer);
|
|
|
|
|
|
|
|
// Remove a SourceBuffer and fire "removesourcebuffer" at the list.
|
|
|
|
void Remove(SourceBuffer* aSourceBuffer);
|
|
|
|
|
|
|
|
// Returns true if aSourceBuffer is present in the list.
|
|
|
|
bool Contains(SourceBuffer* aSourceBuffer);
|
|
|
|
|
|
|
|
// Remove all SourceBuffers and fire a single "removesourcebuffer" at the list.
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
// True if list has zero entries.
|
|
|
|
bool IsEmpty();
|
|
|
|
|
|
|
|
// Returns true if updating is true on any SourceBuffers in the list.
|
|
|
|
bool AnyUpdating();
|
|
|
|
|
2014-11-18 20:16:41 -08:00
|
|
|
// Runs the range removal steps from the MSE specification on each SourceBuffer.
|
|
|
|
void RangeRemoval(double aStart, double aEnd);
|
2013-06-20 20:14:42 -07:00
|
|
|
|
2013-09-26 22:22:37 -07:00
|
|
|
// Mark all SourceBuffers input buffers as ended.
|
|
|
|
void Ended();
|
|
|
|
|
2014-02-27 16:54:48 -08:00
|
|
|
// Evicts data for the given time range from each SourceBuffer in the list.
|
|
|
|
void Evict(double aStart, double aEnd);
|
|
|
|
|
2014-08-10 18:21:18 -07:00
|
|
|
// Returns the highest end time of any of the Sourcebuffers.
|
|
|
|
double GetHighestBufferedEndTime();
|
|
|
|
|
2014-09-11 15:47:06 -07:00
|
|
|
#if defined(DEBUG)
|
|
|
|
void Dump(const char* aPath);
|
|
|
|
#endif
|
|
|
|
|
2013-06-20 20:14:42 -07:00
|
|
|
private:
|
2014-07-08 14:23:16 -07:00
|
|
|
~SourceBufferList();
|
|
|
|
|
2013-09-26 22:22:37 -07:00
|
|
|
friend class AsyncEventRunner<SourceBufferList>;
|
2013-06-20 20:14:42 -07:00
|
|
|
void DispatchSimpleEvent(const char* aName);
|
|
|
|
void QueueAsyncSimpleEvent(const char* aName);
|
|
|
|
|
|
|
|
nsRefPtr<MediaSource> mMediaSource;
|
|
|
|
nsTArray<nsRefPtr<SourceBuffer> > mSourceBuffers;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
2013-09-26 22:22:37 -07:00
|
|
|
|
2013-06-20 20:14:42 -07:00
|
|
|
} // namespace mozilla
|
|
|
|
#endif /* mozilla_dom_SourceBufferList_h_ */
|