@soga/mediainfo 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -2,3 +2,5 @@ export * from './mediainfo';
2
2
  export * from './mediainfo.types';
3
3
  export * from './mp4box';
4
4
  export * from './mp4box.types';
5
+ export * from './resolution';
6
+ export * from './resolution.types';
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,o)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),__exportStar=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||__createBinding(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./mediainfo"),exports),__exportStar(require("./mediainfo.types"),exports),__exportStar(require("./mp4box"),exports),__exportStar(require("./mp4box.types"),exports);
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,r,t,o){void 0===o&&(o=t);var i=Object.getOwnPropertyDescriptor(r,t);i&&!("get"in i?!r.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,o,i)}:function(e,r,t,o){void 0===o&&(o=t),e[o]=r[t]}),__exportStar=this&&this.__exportStar||function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||__createBinding(r,e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),__exportStar(require("./mediainfo"),exports),__exportStar(require("./mediainfo.types"),exports),__exportStar(require("./mp4box"),exports),__exportStar(require("./mp4box.types"),exports),__exportStar(require("./resolution"),exports),__exportStar(require("./resolution.types"),exports);
@@ -0,0 +1,6 @@
1
+ import type { StandardItem } from './resolution.types';
2
+ export declare function getVideoStandard(width: number, height: number): {
3
+ standard: StandardItem;
4
+ adapts: StandardItem[];
5
+ };
6
+ export declare const getStandardInfo: (width: number, height: number) => StandardItem;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStandardInfo=void 0,exports.getVideoStandard=getVideoStandard;const resolutionMap=new Map,horizontal_resolutions=[{key:"h_p360",is_horizontal:!0,width:640,height:360,label:"360p",tag:"",edge:"width",codec:"libx264"},{key:"h_p540",is_horizontal:!0,width:960,height:540,label:"540p",tag:"",edge:"width",codec:"libx264"},{key:"h_p720",is_horizontal:!0,width:1280,height:720,label:"720p",tag:"",edge:"width",codec:"libx264"},{key:"h_p1080",is_horizontal:!0,width:1920,height:1080,label:"1080p",tag:"HD",edge:"width",codec:"libx264"},{key:"h_p1440",is_horizontal:!0,width:2560,height:1440,label:"1440p",tag:"HD",edge:"width",codec:"libx265"},{key:"h_k4",is_horizontal:!0,width:3840,height:2160,label:"2160p",tag:"4K",edge:"width",codec:"libx265"},{key:"h_k8",is_horizontal:!0,width:7680,height:4320,label:"4320p",tag:"8K",edge:"width",codec:"libx265"},{key:"h_k16",is_horizontal:!0,width:15360,height:8640,label:"16K",tag:"",edge:"width",codec:"libx265"},{key:"h_k32",is_horizontal:!0,width:30720,height:17280,label:"32K",tag:"32K",edge:"width",codec:"libx265"},{key:"h_k32plus",is_horizontal:!0,width:61440,height:34560,label:"64K",tag:"",edge:"width",codec:"libx265"}],vertical_resolutions=[{key:"v_p360",is_horizontal:!1,height:640,width:360,label:"360p",tag:"",edge:"height",codec:"libx264"},{key:"v_p540",is_horizontal:!1,height:960,width:540,label:"540p",tag:"",edge:"height",codec:"libx264"},{key:"v_p720",is_horizontal:!1,height:1280,width:720,label:"720p",tag:"",edge:"height",codec:"libx264"},{key:"v_p1080",is_horizontal:!1,height:1920,width:1080,label:"1080p",tag:"HD",edge:"height",codec:"libx264"},{key:"v_p1440",is_horizontal:!1,height:2560,width:1440,label:"1440p",tag:"HD",edge:"height",codec:"libx265"},{key:"v_k4",is_horizontal:!1,height:3840,width:2160,label:"2160p",tag:"4K",edge:"height",codec:"libx265"},{key:"v_k8",is_horizontal:!1,height:7680,width:4320,label:"4320p",tag:"8K",edge:"height",codec:"libx265"},{key:"v_k16",is_horizontal:!1,height:15360,width:8640,label:"16K",tag:"",edge:"height",codec:"libx265"},{key:"v_k32",is_horizontal:!1,height:30720,width:17280,label:"32K",tag:"32K",edge:"height",codec:"libx265"},{key:"v_k32plus",is_horizontal:!1,height:61440,width:34560,label:"64K",tag:"",edge:"height",codec:"libx265"}];function getVideoStandard(e,t){if(e<t){const i=[],h=[],{length:o}=vertical_resolutions;for(let l=0;l<o;l++){const o=vertical_resolutions[l],a=t>=.9*vertical_resolutions[l].height,d=e>=.9*vertical_resolutions[l].width;if(a&&i.unshift({...o,edge:"height"}),d&&h.unshift({...o,edge:"width"}),!a&&!d)break}const l=i.shift()??vertical_resolutions[0],a=h.shift()??vertical_resolutions[0],d=l.height>a.height;return{standard:d?l:a,adapts:d?i:h}}{const i=[],h=[],{length:o}=horizontal_resolutions;for(let l=0;l<o;l++){const o=horizontal_resolutions[l],a=e>=.9*horizontal_resolutions[l].width,d=t>=.9*horizontal_resolutions[l].height;if(a&&i.unshift({...o,edge:"width"}),d&&h.unshift({...o,edge:"height"}),!a&&!d)break}const l=i.shift()??horizontal_resolutions[0],a=h.shift()??horizontal_resolutions[0],d=l.width>a.width;return{standard:d?l:a,adapts:d?i:h}}}horizontal_resolutions.forEach((e=>{resolutionMap.set(`horizontal_${e.width}`,e)})),vertical_resolutions.forEach((e=>{resolutionMap.set(`vertical_${e.height}`,e)}));const getStandardInfo=(e,t)=>{const{standard:i}=getVideoStandard(e,t);return i};exports.getStandardInfo=getStandardInfo;
@@ -0,0 +1,11 @@
1
+ export type StandardKey = 'h_p360' | 'h_p540' | 'h_p720' | 'h_p1080' | 'h_p1440' | 'h_k4' | 'h_k8' | 'h_k16' | 'h_k32' | 'h_k32plus' | 'v_p360' | 'v_p540' | 'v_p720' | 'v_p1080' | 'v_p1440' | 'v_k4' | 'v_k8' | 'v_k16' | 'v_k32' | 'v_k32plus';
2
+ export type StandardItem = {
3
+ key: StandardKey;
4
+ is_horizontal: boolean;
5
+ width: number;
6
+ height: number;
7
+ label: string;
8
+ tag: string;
9
+ edge: 'width' | 'height';
10
+ codec: string;
11
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soga/mediainfo",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },