mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-07 17:09:07 +00:00
Merge the PlatformDecoderModule and AVCCDecoderModule
Also separate and rework the H.264 wrapper
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "AVCCDecoderModule.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "WMFDecoderModule.h"
|
||||
@@ -28,6 +27,9 @@
|
||||
#include "SharedThreadPool.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
|
||||
#include "mp4_demuxer/DecoderData.h"
|
||||
#include "H264Converter.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
extern already_AddRefed<PlatformDecoderModule> CreateBlankDecoderModule();
|
||||
@@ -113,13 +115,12 @@ PlatformDecoderModule::CreatePDM()
|
||||
if (sFFmpegDecoderEnabled) {
|
||||
nsRefPtr<PlatformDecoderModule> m = FFmpegRuntimeLinker::CreateDecoderModule();
|
||||
if (m) {
|
||||
nsRefPtr<PlatformDecoderModule> m2(new AVCCDecoderModule(m));
|
||||
return m2.forget();
|
||||
return m.forget();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_APPLEMEDIA
|
||||
nsRefPtr<PlatformDecoderModule> m(new AVCCDecoderModule(new AppleDecoderModule()));
|
||||
nsRefPtr<PlatformDecoderModule> m(new AppleDecoderModule());
|
||||
return m.forget();
|
||||
#endif
|
||||
#ifdef MOZ_GONK_MEDIACODEC
|
||||
@@ -135,28 +136,55 @@ PlatformDecoderModule::CreatePDM()
|
||||
}
|
||||
#endif
|
||||
if (sGMPDecoderEnabled) {
|
||||
nsRefPtr<PlatformDecoderModule> m(new AVCCDecoderModule(new GMPDecoderModule()));
|
||||
nsRefPtr<PlatformDecoderModule> m(new GMPDecoderModule());
|
||||
return m.forget();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
PlatformDecoderModule::SupportsAudioMimeType(const nsACString& aMimeType)
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
PlatformDecoderModule::CreateDecoder(const mp4_demuxer::TrackConfig& aConfig,
|
||||
FlushableMediaTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer)
|
||||
{
|
||||
return aMimeType.EqualsLiteral("audio/mp4a-latm");
|
||||
nsRefPtr<MediaDataDecoder> m;
|
||||
|
||||
if (aConfig.IsAudioConfig()) {
|
||||
m = CreateAudioDecoder(static_cast<const mp4_demuxer::AudioDecoderConfig&>(aConfig),
|
||||
aTaskQueue,
|
||||
aCallback);
|
||||
return m.forget();
|
||||
}
|
||||
|
||||
if (!aConfig.IsVideoConfig()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (H264Converter::IsH264(aConfig)) {
|
||||
m = new H264Converter(this,
|
||||
static_cast<const mp4_demuxer::VideoDecoderConfig&>(aConfig),
|
||||
aLayersBackend,
|
||||
aImageContainer,
|
||||
aTaskQueue,
|
||||
aCallback);
|
||||
} else {
|
||||
m = CreateVideoDecoder(static_cast<const mp4_demuxer::VideoDecoderConfig&>(aConfig),
|
||||
aLayersBackend,
|
||||
aImageContainer,
|
||||
aTaskQueue,
|
||||
aCallback);
|
||||
}
|
||||
return m.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
PlatformDecoderModule::SupportsVideoMimeType(const nsACString& aMimeType)
|
||||
PlatformDecoderModule::SupportsMimeType(const nsACString& aMimeType)
|
||||
{
|
||||
return aMimeType.EqualsLiteral("video/mp4") || aMimeType.EqualsLiteral("video/avc");
|
||||
}
|
||||
|
||||
bool
|
||||
PlatformDecoderModule::DecoderNeedsAVCC(const mp4_demuxer::VideoDecoderConfig& aConfig)
|
||||
{
|
||||
return false;
|
||||
return aMimeType.EqualsLiteral("audio/mp4a-latm") ||
|
||||
aMimeType.EqualsLiteral("video/mp4") ||
|
||||
aMimeType.EqualsLiteral("video/avc");
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
Reference in New Issue
Block a user