-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): add better parameters management.
Also fix a mismatch between iOS and Android video resolutions
- Loading branch information
1 parent
0bbd9b2
commit 0417737
Showing
10 changed files
with
67 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,31 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
/// Enumeration for camera resolution | ||
/// Only 16/9 resolutions are supported. | ||
enum Resolution { | ||
/// 352x240 | ||
/// 426x240 | ||
@JsonValue("240p") | ||
RESOLUTION_240, | ||
RESOLUTION_240(size: Size(426, 240)), | ||
|
||
/// 640x360 | ||
@JsonValue("360p") | ||
RESOLUTION_360, | ||
RESOLUTION_360(size: Size(640, 360)), | ||
|
||
/// 858x480 | ||
/// 854x480 | ||
@JsonValue("480p") | ||
RESOLUTION_480, | ||
RESOLUTION_480(size: Size(854, 480)), | ||
|
||
/// 1280x720 | ||
@JsonValue("720p") | ||
RESOLUTION_720, | ||
RESOLUTION_720(size: Size(1280, 720)), | ||
|
||
/// 1920x1080 | ||
@JsonValue("1080p") | ||
RESOLUTION_1080 | ||
} | ||
RESOLUTION_1080(size: Size(1920, 1080)); | ||
|
||
const Resolution({required this.size}); | ||
|
||
/// Extension of [Resolution] | ||
extension ResolutionExtension on Resolution { | ||
/// Returns the aspect ratio from a [Resolution] | ||
double getAspectRatio() { | ||
var result = 0.0; | ||
switch (this) { | ||
case Resolution.RESOLUTION_240: | ||
result = 352 / 240; | ||
break; | ||
case Resolution.RESOLUTION_360: | ||
result = 640 / 360; | ||
break; | ||
case Resolution.RESOLUTION_480: | ||
result = 858 / 480; | ||
break; | ||
case Resolution.RESOLUTION_720: | ||
result = 1280 / 720; | ||
break; | ||
case Resolution.RESOLUTION_1080: | ||
result = 1920 / 1080; | ||
break; | ||
default: | ||
result = 16 / 9; | ||
break; | ||
} | ||
return result; | ||
} | ||
final Size size; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
/// Enumeration for supported RTMP sample rate | ||
@JsonEnum(valueField: 'value') | ||
enum SampleRate { | ||
/// 11025 Hz | ||
@JsonValue(11025) | ||
kHz_11, | ||
kHz_11(value: 11025), | ||
|
||
/// 22050 Hz | ||
@JsonValue(22050) | ||
kHz_22, | ||
kHz_22(value: 22050), | ||
|
||
/// 44100 Hz | ||
@JsonValue(44100) | ||
kHz_44_1, | ||
kHz_44_1(value: 44100); | ||
|
||
const SampleRate({required this.value}); | ||
|
||
final int value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters