Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature send video info #3

Open
wants to merge 7 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules/
build/
dist/
teste*
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@viacast/central-api",
"version": "0.6.11",
"version": "0.6.13-dev",
"description": "Central API",
"repository": "https://github.com/gabrieljablonski/central-api.git",
"author": "gabrieljablonski <[email protected]>",
Expand Down
4 changes: 3 additions & 1 deletion src/CentralApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
CentralStream,
CentralDeviceAuditReport,
CentralDeviceStatistics,
VideoInfo,
} from './typings';
import SocketClient, { SocketEventOff } from './socket/SocketClient';
import HttpClient from './http/HttpClient';
Expand Down Expand Up @@ -308,8 +309,9 @@ export default class CentralApi {

async serviceUpdateStatus(
status: CentralServiceStatus,
modeDet: VideoInfo,
): Promise<CentralSocketResponse<null>> {
return this.socket.serviceUpdateStatus(status);
return this.socket.serviceUpdateStatus(status, modeDet);
}

async serviceToggleRunning(
Expand Down
3 changes: 3 additions & 0 deletions src/socket/SocketClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CentralServiceStatus,
ToggleRunningAction,
CentralDeviceStatistics,
VideoInfo,
} from '../typings';
import { promisify } from '../utils';

Expand Down Expand Up @@ -241,9 +242,11 @@ export default class SocketClient {

async serviceUpdateStatus(
status: CentralServiceStatus,
modeDet: VideoInfo,
): Promise<CentralSocketResponse<null>> {
return this.asyncEmit<null>(DeviceSocketEvent.SERVICE_UPDATE_STATUS, {
status,
modeDet,
});
}

Expand Down
111 changes: 111 additions & 0 deletions src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,114 @@ export interface ServiceConfigField {
export interface ServiceConfig {
config: { field: ServiceConfigField[] };
}

export enum VideoInfoShortNameType {
NTSC = 'ntsc',
NTSC2398 = 'nt23',
PAL = 'pal ',
NTSCp = 'ntsp',
PALp = 'palp',

/* HD 1080 Modes */
HD1080p2398 = '23ps',
HD1080p24 = '24ps',
HD1080p25 = 'Hp25',
HD1080p2997 = 'Hp29',
HD1080p30 = 'Hp30',
HD1080i50 = 'Hi50',
HD1080i5994 = 'Hi59',
HD1080i6000 = 'Hi60',
HD1080p50 = 'Hp50',
HD1080p5994 = 'Hp59',
HD1080p6000 = 'Hp60',

/* HD 720 Modes */
HD720p50 = 'hp50',
HD720p5994 = 'hp59',
HD720p60 = 'hp60',

/* 2k Modes */
QHD2398 = '2k23',
QHD24 = '2k24',
QHD25 = '2k25',

/* DCI Modes */
QHDDCI2398 = '2d23',
QHDDCI24 = '2d24',
QHDDCI25 = '2d25',

/* 4k Modes */
UHD2160p2398 = '4k23',
UHD2160p24 = '4k24',
UHD2160p25 = '4k25',
UHD2160p2997 = '4k29',
UHD2160p30 = '4k30',
UHD2160p50 = '4k50',
UHD2160p5994 = '4k59',
UHD2160p60 = '4k60',

/* DCI Modes */
UHDDCI2398 = '4d23',
UHDDCI24 = '4d24',
UHDDCI25 = '4d25',

UNKNOW = 'unknow',
}

export enum VideoInfoNameType {
NTSC = 'NTSC',
NTSC2398 = 'NTSC',
PAL = 'PAL',
NTSCp = 'NTSC',
PALp = 'PALp',

/* HD 1080 Modes */
HD1080p2398 = '1080p23.98',
HD1080p24 = '1080p24',
HD1080p25 = '1080p25',
HD1080p2997 = '1080p2997',
HD1080p30 = '1080p30',
HD1080i50 = '1080i50',
HD1080i5994 = '1080i59.94',
HD1080i6000 = '1080i60',
HD1080p50 = '1080p50',
HD1080p5994 = '1080p59.94',
HD1080p6000 = '1080p60',

/* HD 720 Modes */
HD720p50 = '720p50',
HD720p5994 = '720p59.94',
HD720p60 = '720p60',

/* 2k Modes */
QHD2398 = '1080p23.98_2k',
QHD24 = '1080p24_2k',
QHD25 = '1080p25_2k',

/* DCI Modes */
QHDDCI2398 = '1080p23.98_DCI_2K',
QHDDCI24 = '1080p24_DCI_2K',
QHDDCI25 = '1080p25_DCI_2K',

/* 4k Modes */
UHD2160p2398 = '2160p23.98',
UHD2160p24 = '2160p24',
UHD2160p25 = '2160p25',
UHD2160p2997 = '2160p29.97',
UHD2160p30 = '2160p30',
UHD2160p50 = '2160p50',
UHD2160p5994 = '2160p59.94',
UHD2160p60 = '2160p60',

/* DCI Modes */
UHDDCI2398 = '2160p23.98',
UHDDCI24 = '2160p24',
UHDDCI25 = '2160p25',

UNKNOW = 'Unknow',
}

export interface VideoInfo {
name?: VideoInfoNameType;
shortName?: VideoInfoShortNameType;
}