2013-09-04 07:08:11 +04: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 BUFFER_DECODER_H_
|
|
|
|
#define BUFFER_DECODER_H_
|
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/ReentrantMonitor.h"
|
2015-07-16 21:52:43 +03:00
|
|
|
#include "mozilla/TaskQueue.h"
|
|
|
|
|
|
|
|
#include "AbstractMediaDecoder.h"
|
2013-09-04 07:08:11 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides a decoder object which decodes a media file that lives in
|
|
|
|
* a memory buffer.
|
|
|
|
*/
|
2015-04-28 09:42:00 +03:00
|
|
|
class BufferDecoder final : public AbstractMediaDecoder
|
2013-09-04 07:08:11 +04:00
|
|
|
{
|
|
|
|
public:
|
2013-09-27 09:22:37 +04:00
|
|
|
// This class holds a weak pointer to MediaResource. It's the responsibility
|
2013-09-04 07:08:11 +04:00
|
|
|
// of the caller to manage the memory of the MediaResource object.
|
|
|
|
explicit BufferDecoder(MediaResource* aResource);
|
|
|
|
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
|
|
|
|
|
|
// This has to be called before decoding begins
|
2015-07-16 21:13:49 +03:00
|
|
|
void BeginDecoding(TaskQueue* aTaskQueueIdentity);
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual ReentrantMonitor& GetReentrantMonitor() final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-18 00:23:12 +03:00
|
|
|
virtual bool OnStateMachineTaskQueue() const final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-18 01:33:24 +03:00
|
|
|
virtual bool OnDecodeTaskQueue() const final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual MediaResource* GetResource() const final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-03 07:46:48 +03:00
|
|
|
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aDropped) final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetMediaSeekable(bool aMediaSeekable) final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual VideoFrameContainer* GetVideoFrameContainer() final override;
|
|
|
|
virtual layers::ImageContainer* GetImageContainer() final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsTransportSeekable() final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsMediaSeekable() final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-05 04:33:40 +03:00
|
|
|
virtual void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
|
|
|
|
nsAutoPtr<MetadataTags> aTags,
|
2015-03-21 19:28:04 +03:00
|
|
|
MediaDecoderEventVisibility aEventVisibility) final override;
|
2015-03-05 04:33:40 +03:00
|
|
|
virtual void FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo,
|
2015-03-21 19:28:04 +03:00
|
|
|
MediaDecoderEventVisibility aEventVisibility) final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void OnReadMetadataCompleted() final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual MediaDecoderOwner* GetOwner() final override;
|
2013-09-04 07:08:11 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void NotifyWaitingForResourcesStatusChanged() final override;
|
2014-03-11 07:44:09 +04:00
|
|
|
|
2015-06-19 23:45:09 +03:00
|
|
|
virtual void NotifyDataArrived(uint32_t, int64_t, bool) final override {};
|
2014-08-20 12:07:00 +04:00
|
|
|
|
2014-08-22 06:14:36 +04:00
|
|
|
private:
|
2014-06-24 20:36:43 +04:00
|
|
|
virtual ~BufferDecoder();
|
|
|
|
|
2013-09-04 07:08:11 +04:00
|
|
|
// This monitor object is not really used to synchronize access to anything.
|
|
|
|
// It's just there in order for us to be able to override
|
|
|
|
// GetReentrantMonitor correctly.
|
|
|
|
ReentrantMonitor mReentrantMonitor;
|
2015-07-16 21:13:49 +03:00
|
|
|
nsRefPtr<TaskQueue> mTaskQueueIdentity;
|
2013-09-04 07:08:11 +04:00
|
|
|
nsRefPtr<MediaResource> mResource;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* BUFFER_DECODER_H_ */
|