Backout changeset 4867b986b2c7 and b4185d03b6d5 (bug 1180589) for bustage on CLOSED TREE

This commit is contained in:
Brian Birtles 2015-09-29 13:50:23 +09:00
parent a3d65ca0f0
commit 03e7ba3c92
11 changed files with 7 additions and 633 deletions

View File

@ -8,7 +8,6 @@
#include "mozilla/dom/TVListeners.h" #include "mozilla/dom/TVListeners.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsITVService.h" #include "nsITVService.h"
#include "nsITVSimulatorService.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "TVServiceFactory.h" #include "TVServiceFactory.h"
@ -28,14 +27,8 @@ TVServiceFactory::AutoCreateTVService()
nsresult rv; nsresult rv;
nsCOMPtr<nsITVService> service = do_CreateInstance(TV_SERVICE_CONTRACTID); nsCOMPtr<nsITVService> service = do_CreateInstance(TV_SERVICE_CONTRACTID);
if (!service) { if (!service) {
if (Preferences::GetBool("dom.testing.tv_enabled_for_hosted_apps", false)) { // Fallback to the fake service.
// Fallback to the fake service. service = do_CreateInstance(FAKE_TV_SERVICE_CONTRACTID, &rv);
service = do_CreateInstance(FAKE_TV_SERVICE_CONTRACTID, &rv);
} else {
// Fallback to the TV Simulator Service
service = do_CreateInstance(TV_SIMULATOR_SERVICE_CONTRACTID, &rv);
}
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr; return nullptr;
} }

View File

@ -1,438 +0,0 @@
/* 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/. */
"use strict";
function debug(aMsg) {
//dump("[TVSimulatorService] " + aMsg + "\n");
}
const Cc = Components.classes;
const Cu = Components.utils;
const Ci = Components.interfaces;
const Cr = Components.returnCode;
const TV_SIMULATOR_DUMMY_DIRECTORY = "dummy";
const TV_SIMULATOR_DUMMY_FILE = "settings.json";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
function TVSimulatorService() {
this._internalTuners = null;
this._scanCompleteTimer = null;
this._scanningWrapTunerData = null;
this._init();
}
TVSimulatorService.prototype = {
classID: Components.ID("{94b065ad-d45a-436a-b394-6dabc3cf110f}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsITVSimulatorService,
Ci.nsITVService,
Ci.nsITimerCallback]),
_init: function TVSimInit() {
if (this._internalTuners) {
return;
}
// Load the setting file from local JSON file.
// Synchrhronous File Reading.
let file = Cc["@mozilla.org/file/local;1"]
.createInstance(Ci.nsILocalFile);
file.initWithPath(this._getFilePath(TV_SIMULATOR_DUMMY_FILE));
let fstream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
let cstream = Cc["@mozilla.org/intl/converter-input-stream;1"]
.createInstance(Ci.nsIConverterInputStream);
let settingStr = "";
try {
fstream.init(file, -1, 0, 0);
cstream.init(fstream,
"UTF-8",
1024,
Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
let str = {};
while (cstream.readString(0xffffffff, str) != 0) {
settingStr += str.value;
}
} catch(e) {
debug("Error occurred : " + e );
return;
} finally {
cstream.close();
}
let settingObj;
try {
/*
*
* Setting JSON file format:
*
* Note: This setting JSON is not allow empty array.
* If set the empty array, _init() will fail.
* e.g.
* - "tuners": []
* - "channels":[]
* Format:
* {
* "tuners": [{
* "id": "The ID of the tuner",
* "supportedType": ["The array of source type to be used."],
* "sources": [{
* "type": "The source type to be used",
* "channels" : [{
* "networkId": "The ID of the channel network",
* "transportStreamId": "The ID of channel transport stream",
* "serviceId": "The ID of channel service",
* "type": "The type of channel",
* "name": "The channel name",
* "number" : The LCN (Logical Channel Number) of the channel,
* "isEmergency" : Whether this channel is emergency status,
* "isFree": Whether this channel is free or not,
* "videoFilePath": "The path of the fake video file",
* "programs":[{
* "eventId": "The ID of this program event",
* "title" : "This program's title",
* "startTime": "The start time of this program",
* "duration": "The duration of this program",
* "description": "The description of this program",
* "rating": "The rating of this program",
* "audioLanugages": ["The array of audio language"],
* "subtitleLanguages":["The array of subtitle language"],
* },]
* },]
* },]
* },]
* }
*/
settingObj = JSON.parse(settingStr);
} catch(e) {
debug("File load error: " + e);
return;
}
// Key is as follow
// {'tunerId':tunerId, 'sourceType':sourceType}
this._internalTuners = new Map();
// TVTunerData
for each (let tunerData in settingObj.tuners) {
let tuner = Cc["@mozilla.org/tv/tvtunerdata;1"]
.createInstance(Ci.nsITVTunerData);
tuner.id = tunerData.id;
tuner.streamType = tuner.TV_STREAM_TYPE_SIMULATOR;
tuner.setSupportedSourceTypes(tunerData.supportedType.length,
tunerData.supportedType);
let wrapTunerData = {
'tuner': tuner,
'channels': new Map(),
'sourceType': undefined,
};
// TVSource
for each (let sourceData in tunerData.sources) {
wrapTunerData.sourceType = sourceData.type;
// TVChannel
for each (let channelData in sourceData.channels) {
let channel = Cc["@mozilla.org/tv/tvchanneldata;1"]
.createInstance(Ci.nsITVChannelData);
channel.networkId = channelData.networkId;
channel.transportStreamId = channelData.transportStreamId;
channel.serviceId = channelData.serviceId;
channel.type = channelData.type;
channel.name = channelData.name;
channel.number = channelData.number;
channel.isEmergency = channelData.isEmergency;
channel.isFree = channelData.isFree;
let wrapChannelData = {
'channel': channel,
'programs': new Array(),
'videoFilePath': channelData.videoFilePath,
};
// TVProgram
for each (let programData in channelData.programs) {
let program = Cc["@mozilla.org/tv/tvprogramdata;1"]
.createInstance(Ci.nsITVProgramData);
program.eventId = programData.eventId;
program.title = programData.title;
program.startTime = programData.startTime;
program.duration = programData.duration;
program.description = programData.description;
program.rating = programData.rating;
program.setAudioLanguages(programData.audioLanguages.length,
programData.audioLanguages);
program.setSubtitleLanguages(programData.subtitleLanguages.length,
programData.subtitleLanguages);
wrapChannelData.programs.push(program);
}
// Sort the program according to the startTime
wrapChannelData.programs.sort(function(a, b) {
return a.startTime - b.startTime;
});
wrapTunerData.channels.set(channel.number, wrapChannelData);
}
// Sort the channel according to the channel number
wrapTunerData.channels = new Map([...wrapTunerData.channels.entries()].sort(function(a, b) {
return a[0] - b[0];
}));
this._internalTuners.set(
this._getTunerMapKey(tuner.id, sourceData.type),
wrapTunerData);
}
}
},
getTuners: function TVSimGetTuners(aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return Cr.NS_ERROR_INVALID_ARG;
}
let tuners = Cc["@mozilla.org/array;1"]
.createInstance(Ci.nsIMutableArray);
for (let [k,wrapTunerData] of this._internalTuners) {
tuners.appendElement(wrapTunerData.tuner, false);
}
return aCallback.notifySuccess(tuners);
},
setSource: function TVSimSetSource(aTunerId, aSourceType, aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return NS_ERROR_INVALID_ARG;
}
let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
if (!wrapTunerData) {
return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
}
return aCallback.notifySuccess(null);
},
startScanningChannels: function TVSimStartScanningChannels(aTunerId, aSourceType, aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return Cr.NS_ERROR_INVALID_ARG;
}
let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
if (!wrapTunerData || !wrapTunerData.channels) {
return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
}
if (this._scanningWrapTunerData) {
return aCallback.notifyError(Cr.NS_ERROR_DOM_INVALID_STATE_ERR);
}
this._scanningWrapTunerData = wrapTunerData;
aCallback.notifySuccess(null);
for (let [key, wrapChannelData] of wrapTunerData.channels) {
this._sourceListener.notifyChannelScanned(
wrapTunerData.tuner.id,
wrapTunerData.sourceType,
wrapChannelData.channel);
}
this._scanCompleteTimer = Cc["@mozilla.org/timer;1"]
.createInstance(Ci.nsITimer);
rv = this._scanCompleteTimer.initWithCallback(this, 10,
Ci.nsITimer.TYPE_ONE_SHOT);
return Cr.NS_OK;
},
notify: function TVSimTimerCallback(aTimer) {
if (!this._scanningWrapTunerData) {
return;
}
this._scanCompleteTimer = null;
this._scanningWrapTunerData = null;
return this._sourceListener.notifyChannelScanComplete(
this._scanningWrapTunerData.tuner.id,
this._scanningWrapTunerData.sourceType);
},
stopScanningChannels: function TVSimStopScanningChannels(aTunerId, aSourceType, aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return Cr.NS_ERROR_INVALID_ARG;
}
if (!this._scanningWrapTunerData) {
return aCallback.notifyError(Cr.NS_ERROR_DOM_INVALID_STATE_ERR);
}
let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
if (!wrapTunerData) {
return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
}
if (this._scanCompleteTimer) {
this._scanCompleteTimer.cancel();
this._scanCompleteTimer = null;
}
if (wrapTunerData.tuner.id === this._scanningWrapTunerData.tuner.id &&
wrapTunerData.sourceType === this._scanningWrapTunerData.sourceType) {
this._scanningWrapTunerData = null;
this._sourceListener.notifyChannelScanStopped(
wrapTunerData.tuner.id,
wrapTunerData.sourceType);
}
return aCallback.notifySuccess(null);
},
clearScannedChannelsCache: function TVSimClearScannedChannelsCache(aTunerId, aSourceType, aCallback) {
// Doesn't support for this method.
return Cr.NS_OK;
},
setChannel: function TVSimSetChannel(aTunerId, aSourceType, aChannelNumber, aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return Cr.NS_ERROR_INVALID_ARG;
}
let channel = Cc["@mozilla.org/array;1"]
.createInstance(Ci.nsIMutableArray);
let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
if (!wrapTunerData || !wrapTunerData.channels) {
return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
}
let wrapChannelData = wrapTunerData.channels.get(aChannelNumber);
if (!wrapChannelData) {
return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
}
channel.appendElement(wrapChannelData.channel, false);
return aCallback.notifySuccess(channel);
},
getChannels: function TVSimGetChannels(aTunerId, aSourceType, aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return Cr.NS_ERROR_INVALID_ARG;
}
let channelArray = Cc["@mozilla.org/array;1"]
.createInstance(Ci.nsIMutableArray);
let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
if (!wrapTunerData || !wrapTunerData.channels) {
return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
}
for (let [key, wrapChannelData] of wrapTunerData.channels) {
channelArray.appendElement(wrapChannelData.channel, false);
}
return aCallback.notifySuccess(channelArray);
},
getPrograms: function TVSimGetPrograms(aTunerId, aSourceType, aChannelNumber, aStartTime, aEndTime, aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return Cr.NS_ERROR_INVALID_ARG;
}
let programArray = Cc["@mozilla.org/array;1"]
.createInstance(Ci.nsIMutableArray);
let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
if (!wrapTunerData || !wrapTunerData.channels) {
return aCallback.notifyError(Ci.nsITVServiceCallback.TV_ERROR_FAILURE);
}
let wrapChannelData = wrapTunerData.channels.get(aChannelNumber);
if (!wrapChannelData || !wrapChannelData.programs) {
return Cr.NS_ERROR_INVALID_ARG;
}
for each (let program in wrapChannelData.programs) {
programArray.appendElement(program, false);
}
return aCallback.notifySuccess(programArray);
},
getOverlayId: function TVSimGetOverlayId(aTunerId, aCallback) {
if (!aCallback) {
debug("aCallback is null\n");
return Cr.NS_ERROR_INVALID_ARG;
}
// TVSimulatorService does not use this parameter.
overlayIds = Cc["@mozilla.org/array;1"]
.createInstance(Ci.nsIMutableArray);
return aCallback.notifySuccess(overlayIds);
},
set sourceListener(aListener) {
this._sourceListener = aListener;
},
get sourceListener() {
return this._sourceListener;
},
getSimulatorVideoBlobURL: function TVSimGetSimulatorVideoBlob(aTunerId,
aSourceType,
aChannelNumber,
aWin) {
let wrapTunerData = this._getWrapTunerData(aTunerId, aSourceType);
if (!wrapTunerData || !wrapTunerData.channels) {
return "";
}
let wrapChannelData = wrapTunerData.channels.get(aChannelNumber);
if (!wrapChannelData) {
return "";
}
let videoFile = new File(this._getFilePath(wrapChannelData.videoFilePath));
let videoBlobURL = aWin.URL.createObjectURL(videoFile);
return videoBlobURL;
},
_getTunerMapKey: function TVSimGetTunerMapKey(aTunerId, aSourceType) {
return JSON.stringify({'tunerId': aTunerId, 'sourceType': aSourceType});
},
_getWrapTunerData: function TVSimGetWrapTunerData(aTunerId, aSourceType) {
if (!this._internalTuners || this._internalTuners.size <= 0) {
return null;
}
return this._internalTuners.get(this._getTunerMapKey(aTunerId, aSourceType));
},
_getFilePath: function TVSimGetFilePathFromDummyDirectory(fileName) {
let dsFile = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
.get("ProfD", Ci.nsIFile);
dsFile.append(TV_SIMULATOR_DUMMY_DIRECTORY);
dsFile.append(fileName);
return dsFile.path;
},
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TVSimulatorService]);

View File

@ -1,3 +0,0 @@
component {94b065ad-d45a-436a-b394-6dabc3cf110f} TVSimulatorService.js
contract @mozilla.org/tv/simulatorservice;1 {94b065ad-d45a-436a-b394-6dabc3cf110f}
TVSimulatorService @mozilla.org/tv/simulatorservice;1

View File

@ -133,14 +133,6 @@ TVSource::SetCurrentChannel(nsITVChannelData* aChannelData)
mCurrentChannel = TVChannel::Create(GetOwner(), this, aChannelData); mCurrentChannel = TVChannel::Create(GetOwner(), this, aChannelData);
NS_ENSURE_TRUE(mCurrentChannel, NS_ERROR_DOM_ABORT_ERR); NS_ENSURE_TRUE(mCurrentChannel, NS_ERROR_DOM_ABORT_ERR);
nsRefPtr<TVSource> currentSource = mTuner->GetCurrentSource();
if (currentSource && mType == currentSource->Type()) {
rv = mTuner->ReloadMediaStream();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
return DispatchCurrentChannelChangedEvent(mCurrentChannel); return DispatchCurrentChannelChangedEvent(mCurrentChannel);
} }

View File

@ -13,10 +13,8 @@
#include "mozilla/dom/TVUtils.h" #include "mozilla/dom/TVUtils.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsITVService.h" #include "nsITVService.h"
#include "nsITVSimulatorService.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "TVTuner.h" #include "TVTuner.h"
#include "mozilla/dom/HTMLVideoElement.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -83,9 +81,6 @@ TVTuner::Init(nsITVTunerData* aData)
mTVService = TVServiceFactory::AutoCreateTVService(); mTVService = TVServiceFactory::AutoCreateTVService();
NS_ENSURE_TRUE(mTVService, false); NS_ENSURE_TRUE(mTVService, false);
rv = aData->GetStreamType(&mStreamType);
NS_ENSURE_SUCCESS(rv, false);
return true; return true;
} }
@ -199,111 +194,16 @@ TVTuner::GetStream() const
return stream.forget(); return stream.forget();
} }
nsresult
TVTuner::ReloadMediaStream()
{
return InitMediaStream();
}
nsresult nsresult
TVTuner::InitMediaStream() TVTuner::InitMediaStream()
{ {
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(GetOwner()); nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(GetOwner());
nsRefPtr<DOMMediaStream> stream = nullptr; nsRefPtr<DOMHwMediaStream> stream = DOMHwMediaStream::CreateHwStream(window);
if (mStreamType == nsITVTunerData::TV_STREAM_TYPE_HW) {
stream = DOMHwMediaStream::CreateHwStream(window);
} else if (mStreamType == nsITVTunerData::TV_STREAM_TYPE_SIMULATOR) {
stream = CreateSimulatedMediaStream();
}
mStream = stream.forget(); mStream = stream.forget();
return NS_OK; return NS_OK;
} }
already_AddRefed<DOMMediaStream>
TVTuner::CreateSimulatedMediaStream()
{
ErrorResult error;
nsIDocument* doc = GetOwner()->GetExtantDoc();
if (NS_WARN_IF(!doc)) {
return nullptr;
}
nsRefPtr<Element> element = doc->CreateElement(VIDEO_TAG, error);
if (NS_WARN_IF(error.Failed())) {
return nullptr;
}
nsCOMPtr<nsIContent> content(do_QueryInterface(element));
if (NS_WARN_IF(!content)) {
return nullptr;
}
HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(content.get());
if (NS_WARN_IF(!mediaElement)) {
return nullptr;
}
mediaElement->SetAutoplay(true, error);
if (NS_WARN_IF(error.Failed())) {
return nullptr;
}
mediaElement->SetLoop(true, error);
if (NS_WARN_IF(error.Failed())) {
return nullptr;
}
nsCOMPtr<nsIDOMWindow> domWin(do_QueryInterface(GetOwner()));
if (NS_WARN_IF(!domWin)) {
return nullptr;
}
nsCOMPtr<nsITVSimulatorService> simService(do_QueryInterface(mTVService));
if (NS_WARN_IF(!simService)) {
return nullptr;
}
if (NS_WARN_IF(!mCurrentSource)) {
return nullptr;
}
nsRefPtr<TVChannel> currentChannel = mCurrentSource->GetCurrentChannel();
if (NS_WARN_IF(!currentChannel)) {
return nullptr;
}
nsString currentChannelNumber;
currentChannel->GetNumber(currentChannelNumber);
if (currentChannelNumber.IsEmpty()) {
return nullptr;
}
nsString currentVideoBlobUrl;
nsresult rv = simService->GetSimulatorVideoBlobURL(mId,
ToTVSourceTypeStr(mCurrentSource->Type()),
currentChannelNumber,
domWin,
currentVideoBlobUrl);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
mediaElement->SetSrc(currentVideoBlobUrl, error);
if (NS_WARN_IF(error.Failed())) {
return nullptr;
}
// See Media Capture from DOM Elements spec.
// http://www.w3.org/TR/mediacapture-fromelement/
nsRefPtr<DOMMediaStream> stream = mediaElement->MozCaptureStream(error);
if (NS_WARN_IF(error.Failed())) {
return nullptr;
}
return stream.forget();
}
nsresult nsresult
TVTuner::DispatchCurrentSourceChangedEvent(TVSource* aSource) TVTuner::DispatchCurrentSourceChangedEvent(TVSource* aSource)
{ {

View File

@ -11,8 +11,6 @@
// Include TVTunerBinding.h since enum TVSourceType can't be forward declared. // Include TVTunerBinding.h since enum TVSourceType can't be forward declared.
#include "mozilla/dom/TVTunerBinding.h" #include "mozilla/dom/TVTunerBinding.h"
#define VIDEO_TAG NS_LITERAL_STRING("video")
class nsITVService; class nsITVService;
class nsITVTunerData; class nsITVTunerData;
@ -61,8 +59,6 @@ public:
IMPL_EVENT_HANDLER(currentsourcechanged); IMPL_EVENT_HANDLER(currentsourcechanged);
nsresult ReloadMediaStream();
private: private:
explicit TVTuner(nsPIDOMWindow* aWindow); explicit TVTuner(nsPIDOMWindow* aWindow);
@ -72,13 +68,10 @@ private:
nsresult InitMediaStream(); nsresult InitMediaStream();
already_AddRefed<DOMMediaStream> CreateSimulatedMediaStream();
nsresult DispatchCurrentSourceChangedEvent(TVSource* aSource); nsresult DispatchCurrentSourceChangedEvent(TVSource* aSource);
nsCOMPtr<nsITVService> mTVService; nsCOMPtr<nsITVService> mTVService;
nsRefPtr<DOMMediaStream> mStream; nsRefPtr<DOMMediaStream> mStream;
uint16_t mStreamType;
nsRefPtr<TVSource> mCurrentSource; nsRefPtr<TVSource> mCurrentSource;
nsTArray<nsRefPtr<TVSource>> mSources; nsTArray<nsRefPtr<TVSource>> mSources;
nsString mId; nsString mId;

View File

@ -48,20 +48,6 @@ TVTunerData::SetId(const nsAString& aId)
return NS_OK; return NS_OK;
} }
/* virtual */ NS_IMETHODIMP
TVTunerData::GetStreamType(uint16_t* aStreamType)
{
*aStreamType = mStreamType;
return NS_OK;
}
/* virtual */ NS_IMETHODIMP
TVTunerData::SetStreamType(const uint16_t aStreamType)
{
mStreamType = aStreamType;
return NS_OK;
}
/* virtual */ NS_IMETHODIMP /* virtual */ NS_IMETHODIMP
TVTunerData::GetSupportedSourceTypes(uint32_t* aCount, TVTunerData::GetSupportedSourceTypes(uint32_t* aCount,
char*** aSourceTypes) char*** aSourceTypes)

View File

@ -26,7 +26,6 @@ private:
nsString mId; nsString mId;
char** mSupportedSourceTypes; char** mSupportedSourceTypes;
uint32_t mCount; uint32_t mCount;
uint16_t mStreamType;
}; };
class TVChannelData final : public nsITVChannelData class TVChannelData final : public nsITVChannelData

View File

@ -34,12 +34,6 @@ UNIFIED_SOURCES += [
XPIDL_SOURCES += [ XPIDL_SOURCES += [
'nsITVService.idl', 'nsITVService.idl',
'nsITVSimulatorService.idl',
]
EXTRA_COMPONENTS += [
'TVSimulatorService.js',
'TVSimulatorService.manifest',
] ]
XPIDL_MODULE = 'dom_tv' XPIDL_MODULE = 'dom_tv'

View File

@ -20,19 +20,9 @@ interface nsIArray;
* and then uses the setter functions to adjust the properties of the object * and then uses the setter functions to adjust the properties of the object
* before passing it. * before passing it.
*/ */
[scriptable, builtinclass, uuid(c6d39e86-022b-4db5-b0df-602abfbeac69)] [scriptable, builtinclass, uuid(608d3f7e-f9f1-4b3c-82c2-3eb60b1d3de8)]
interface nsITVTunerData : nsISupports interface nsITVTunerData : nsISupports
{ {
/**
* Switch TVTuner.stream type.
* TV_STREAM_TYPE_SIMULATOR : Simulate the MediaStream. This MediaStream load from Profile Directory.
* TV_STREAM_TYPE_HW : Get from real device
*/
const unsigned short TV_STREAM_TYPE_SIMULATOR = 0;
const unsigned short TV_STREAM_TYPE_HW = 1;
attribute unsigned short streamType;
attribute DOMString id; attribute DOMString id;
/** /**
@ -148,7 +138,7 @@ interface nsITVProgramData : nsISupports
[array, size_is(count)] in string languages); [array, size_is(count)] in string languages);
}; };
[scriptable, builtinclass, uuid(47746633-1b77-4df4-9424-d315bde3d455)] [builtinclass, uuid(c3fd7a8c-21e4-11e4-97e8-74d02b97e723)]
interface nsITVSourceListener : nsISupports interface nsITVSourceListener : nsISupports
{ {
/** /**
@ -208,7 +198,7 @@ interface nsITVSourceListener : nsISupports
in unsigned long count); in unsigned long count);
}; };
[scriptable, builtinclass, uuid(01582a11-4707-455d-8d2a-2c8de8227dad)] [builtinclass, uuid(a19e6e7e-2293-11e4-b335-74d02b97e723)]
interface nsITVServiceCallback : nsISupports interface nsITVServiceCallback : nsISupports
{ {
const unsigned short TV_ERROR_OK = 0; const unsigned short TV_ERROR_OK = 0;
@ -268,7 +258,7 @@ interface nsITVServiceCallback : nsISupports
* new TVServiceNotifyRunnable(callback, dataList, optional errorCode); * new TVServiceNotifyRunnable(callback, dataList, optional errorCode);
* return NS_DispatchToCurrentThread(runnable); * return NS_DispatchToCurrentThread(runnable);
*/ */
[scriptable, uuid(e52f93f1-6071-468b-a198-d8e6bc5ca348)] [uuid(1b17e3cc-1c84-11e4-a4d4-74d02b97e723)]
interface nsITVService : nsISupports interface nsITVService : nsISupports
{ {
attribute nsITVSourceListener sourceListener; attribute nsITVSourceListener sourceListener;
@ -390,4 +380,3 @@ interface nsITVService : nsISupports
void getOverlayId(in DOMString tunerId, void getOverlayId(in DOMString tunerId,
in nsITVServiceCallback callback); in nsITVServiceCallback callback);
}; };

View File

@ -1,31 +0,0 @@
/* 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/. */
#include "nsISupports.idl"
#include "nsITVService.idl"
#include "nsIDOMWindow.idl"
%{C++
#define TV_SIMULATOR_SERVICE_CONTRACTID\
"@mozilla.org/tv/simulatorservice;1"
%}
[scriptable, uuid(8ecae67d-a959-4f8a-a786-14dc12bd8d3c)]
interface nsITVSimulatorService : nsITVService
{
/*
* Get the URL of simulated video blob.
*
* @param tunerId The ID of the tuner.
* @param sourceType The source type to be used.
* @param channelNumber The LCN (Logical Channel Number) of the channel.
* @param window The window object of content.
* @return blobUrl The URL of created blob from local video file.
*/
void getSimulatorVideoBlobURL(in DOMString tunerId,
in DOMString sourceType,
in DOMString channelNumber,
in nsIDOMWindow window,
[retval] out DOMString blobUrl);
};