public class WZMediaConfig extends Object implements Comparable<WZMediaConfig>, Serializable
WZMediaConfig
class provides configuration properties for the capture and encoding of video and audioModifier and Type | Field and Description |
---|---|
static int |
ALWAYS_LANDSCAPE
An identifier for specifying that video should always be sent in landscape orientation.
|
static int |
ALWAYS_PORTRAIT
An identifier for specifying that video should always be sent in portrait orientation.
|
static int |
AUDIO_CHANNELS_MONO
An identifier for specifying single channel mono audio
|
static int |
AUDIO_CHANNELS_STEREO
An identifier for specifying dual channel stereo audio
|
static int |
CROP_TO_FRAME
Deprecated.
|
static int |
DEFAULT_AUDIO_BITRATE
The default value for the audio framerate (64000 bps)
|
static int |
DEFAULT_AUDIO_SAMPLE_RATE
The default value for the audio sample rate (44100 hZ)
|
static int |
DEFAULT_SCALE_MODE
The default value for the video display scale mode (2)
|
static int |
DEFAULT_VIDEO_BITRATE
The default value for the video stream bitrate (1500 bps)
|
static float |
DEFAULT_VIDEO_BITRATE_SCALING_FACTOR |
static int |
DEFAULT_VIDEO_FRAME_BUFFER_MULTIPLIER |
static int |
DEFAULT_VIDEO_FRAME_HEIGHT
The default value for the video frame height (480 px)
|
static int |
DEFAULT_VIDEO_FRAME_RATE
The default value for the video framerate (30 fps)
|
static WZSize |
DEFAULT_VIDEO_FRAME_SIZE
The default value for the video stream size, in pixels
|
static int |
DEFAULT_VIDEO_FRAME_SKIP_COUNT |
static int |
DEFAULT_VIDEO_FRAME_WIDTH
The default value for the video frame width (640 px)
|
static int |
DEFAULT_VIDEO_KEYFRAME_INTERVAL
The default value for the video keyframe interval (30 frames)
|
static int |
FILL_FRAME
Deprecated.
|
static int |
FILL_VIEW
An identifier that specifies video and image previews should be resized and cropped, if necessary,
to preserve the aspect ratio and fill the entire view.
|
static WZMediaConfig |
FRAME_SIZE_1280x720
An identifier for a preset configuration representing 720p HD video
|
static WZMediaConfig |
FRAME_SIZE_1440x1080
An identifier for a preset configuration representing 720p HD video
|
static WZMediaConfig |
FRAME_SIZE_176x144
An identifier for a preset configuration appropriate for Quarter CIF (QCIF)
|
static WZMediaConfig |
FRAME_SIZE_1920x1080
An identifier for a preset configuration representing 1080p HD video
|
static WZMediaConfig |
FRAME_SIZE_320x240
An identifier for a preset configuration appropriate for Quarter Video Graphics Array (QVGA)
|
static WZMediaConfig |
FRAME_SIZE_352x288
An identifier for a preset configuration appropriate for Common Intermediate Format (CIF)
|
static WZMediaConfig |
FRAME_SIZE_3840x2160
An identifier for a preset configuration representing 4k Ultra HD video
|
static WZMediaConfig |
FRAME_SIZE_640x480
An identifier for a preset configuration appropriate for Video Graphics Array (VGA)
|
static WZMediaConfig |
FRAME_SIZE_960x540
An identifier for a preset configuration appropriate for use on a high bandwidth connection
|
static int |
ORIENTATION_LANDSCAPE
An identifier for specifying landscape orientation
|
static int |
ORIENTATION_LANDSCAPE_INVERTED
An identifier for specifying inverted (upside down) landscape orientation
|
static int |
ORIENTATION_PORTRAIT
An identifier for specifying portrait orientation
|
static int |
ORIENTATION_PORTRAIT_INVERTED
An identifier for specifying inverted (upside down) portrait orientation
|
static WZMediaConfig[] |
PRESET_CONFIGS
An array containing each of the preset configuration identifiers, presorted from lowest video frame size to highest
|
static int |
RESIZE_TO_ASPECT
An identifier that specifies video and image previews should be resized and letterboxed, if necessary,
to preserve the aspect ratio.
|
static int |
SAME_AS_SOURCE
An identifier for specifying that video should be sent in the same orientation as the video input device or source when streaming bwan.
|
static int[] |
SUPPORTED_AUDIO_SAMPLE_RATES
The audio sample rates supported
|
Constructor and Description |
---|
WZMediaConfig()
The default constructor
|
WZMediaConfig(WZMediaConfig other)
Construct a new instance using the property values from the specified instance
|
Modifier and Type | Method and Description |
---|---|
static String |
bitrateLabel(int bps)
Generates a human-readable representation of a bitrate value (e.g.
|
int |
compareTo(WZMediaConfig other)
Compare this instance with the specified instance based on video frame size
|
boolean |
equals(Object other)
Compare this instance with the specified instance for equality based on video frame size
|
static WZMediaConfig[] |
fromFrameSizes(WZSize[] frameSizes)
Generates an array of media configurations from an array of video frame sizes
|
int |
getAudioBitRate()
Returns the audio stream bitrate
|
int |
getAudioChannels()
Returns the no.
|
int |
getAudioSampleRate()
Returns the audio sample rate
|
int |
getFrameBufferSizeMultiplier() |
int |
getFrameRateLowBandwidthSkipCount() |
String |
getLabel(boolean withFrameSize,
boolean withPreset,
boolean withBitrate)
Deprecated.
|
String |
getLabel(boolean withFrameSize,
boolean withPreset,
boolean withAspect,
boolean withBitrate)
Return a configurable, human-readable representation of this configuration instance (e.g.
|
float |
getLowBandwidthScalingFactor() |
String |
getPresetLabel()
Returns the predefined label describing a preset configuration (e.g.
|
String |
getPresetLabelByFrameSize()
Returns the predefined label for a preset configuration (e.g.
|
int |
getVideoBitRate()
Returns the video stream bitrate
|
int |
getVideoFrameHeight()
Returns the video frame height
|
int |
getVideoFramerate()
Returns the video framerate
|
WZSize |
getVideoFrameSize()
Returns the video frame size value
|
int |
getVideoFrameWidth()
Returns the video frame width
|
int |
getVideoKeyFrameInterval()
Returns the video keyframe interval
|
WZProfileLevel |
getVideoProfileLevel()
Get the H.264 profile level
|
int |
getVideoRotation()
Returns the rotation, in degrees, of the video source with 0 being the natural landscape orientation and 90 being the natural portrait orientation
180 and 270 are the inverted landscape and portrait orientations respectively
|
boolean |
isABREnabled()
Indicates if Adjustable Bitrate (ABR) is enabled or not
|
boolean |
isAudioEnabled()
Indicates if audio streaming is enabled
|
static boolean |
isLandscape(int orientation)
Indicates if the orientation identifier specified matches one of the landscape identifiers
|
static boolean |
isLandscapeRotation(int rotation)
Indicates if the rotation angle specifies a landscape orientation or not
|
static boolean |
isPortrait(int orientation)
Indicates if the orientation identifier specified matches one of the portrait identifiers
|
static boolean |
isPortraitRotation(int rotation)
Indicates if the rotation angle specifies a portrait orientation or not
|
static boolean |
isValidScaleMode(int scaleMode)
Returns true if the value provided is a valid value for the scale mode property
|
boolean |
isVideoEnabled()
Indicates if video streaming is enabled
|
static int |
keyFrameIntervalFramesToSeconds(int frames,
int frameRate)
Converts between # of frames to fps given the frame rate
|
static String |
orientationLabel(int orientation)
Returns a string representation of the specified orientation
|
static int |
orientationToRotation(int orientation)
Converts an orientation specifier to a surface rotation angle
|
static int |
orientationToSurfaceRotation(int orientation)
Deprecated.
Use
orientationToRotation(int) instead |
void |
resetToDefaults() |
static int |
rotationToOrientation(int rotation)
Converts a surface rotation angle to one of the orientation identifiers.
|
void |
set(WZMediaConfig other)
Update the property values of this instance with the property values from the specified instance
|
void |
setABREnabled(boolean abrEnabled)
Enable or disable Adjustable Bitrate (ABR)
|
void |
setAudioBitRate(int audioBitRate)
Set the audio stream bitrate
|
void |
setAudioChannels(int audioChannels)
Set the no.
|
void |
setAudioEnabled(boolean audioEnabled)
Enable or disable audio streaming
|
int |
setAudioSampleRate(int audioSampleRate)
Set the the audio sample rate.
|
void |
setFrameBufferSizeMultiplier(int frameBufferSizeMultiplier)
The FrameBufferSizeMultiplier property is the value by which to multiply
the video frame rate to derive the number of
video frames to buffer before the encoder starts to throttle bitrate
and/or frame rate.
|
void |
setFrameRateLowBandwidthSkipCount(int frameRateLowBandwidthSkipCount)
The FrameRateLowBandwidthSkipCount property is the number of frames to skip
when the encoder cannot keep up with the broadcaster.
|
void |
setLowBandwidthScalingFactor(float lowBandwidthScalingFactor)
The LowBandwidthScalingFactor property is the factor by
which to scale the desired bitrate in low bandwidth conditions.
|
void |
setVideoBitRate(int videoBitRate)
Set the video stream bitrate
|
void |
setVideoEnabled(boolean videoEnabled)
Enable or disable video streaming
|
void |
setVideoFrameHeight(int height)
Set the video frame height
Frame sizes should always be specified using landscape-based dimensions (i.e.
|
void |
setVideoFramerate(int videoFrameRate)
Set the video framerate
|
void |
setVideoFrameSize(int width,
int height)
Set the video frame size using the specified values.
|
void |
setVideoFrameSize(WZSize videoSize)
Set the video frame size using the values from the specified instance
Frame sizes should always be specified using landscape-based dimensions (i.e.
|
void |
setVideoFrameWidth(int width)
Set the video frame width
Frame sizes should always be specified using landscape-based dimensions (i.e.
|
void |
setVideoKeyFrameInterval(int videoKeyFrameInterval)
Set the video keyframe interval
|
void |
setVideoProfileLevel(int profile,
int level)
Set the H.264 profile
|
void |
setVideoProfileLevel(WZProfileLevel profileLevel)
Set the H.264 profile
|
void |
setVideoRotation(int videoRotation)
Specify the rotation, in degrees, of the video source with 0 being the natural landscape orientation and 90 being the natural portrait orientation
180 and 270 are the inverted landscape and portrait orientations respectively
|
static int |
surfaceRotationToOrientation(int rotation)
Deprecated.
Use
rotationToOrientation(int) instead |
WZDataMap |
toDataMap()
Returns a
WZDataMap containing the configuration properties |
WZDataMap |
toDataMap(WZDataMap dataMap)
Returns a
WZDataMap containing the configuration properties |
static WZSize[] |
toFrameSizes(WZMediaConfig[] mediaConfigs)
Generates an array of the video frame sizes contained in an array of media configuration instances
|
String |
toString() |
public static final int DEFAULT_VIDEO_FRAME_WIDTH
public static final int DEFAULT_VIDEO_FRAME_HEIGHT
public static final WZSize DEFAULT_VIDEO_FRAME_SIZE
public static final int DEFAULT_VIDEO_BITRATE
public static final int DEFAULT_VIDEO_FRAME_RATE
public static final int DEFAULT_VIDEO_KEYFRAME_INTERVAL
public static final int DEFAULT_AUDIO_SAMPLE_RATE
public static final int DEFAULT_AUDIO_BITRATE
public static final int[] SUPPORTED_AUDIO_SAMPLE_RATES
public static final int RESIZE_TO_ASPECT
public static final int CROP_TO_FRAME
RESIZE_TO_ASPECT
public static final int FILL_VIEW
public static final int FILL_FRAME
FILL_VIEW
public static final int DEFAULT_SCALE_MODE
public static final int ORIENTATION_LANDSCAPE
public static final int ORIENTATION_PORTRAIT
public static final int ORIENTATION_LANDSCAPE_INVERTED
public static final int ORIENTATION_PORTRAIT_INVERTED
public static final int ALWAYS_LANDSCAPE
public static final int ALWAYS_PORTRAIT
public static final int SAME_AS_SOURCE
public static final int AUDIO_CHANNELS_STEREO
public static final int AUDIO_CHANNELS_MONO
public static final WZMediaConfig FRAME_SIZE_176x144
video resolution: 320x240, video bitrate: 280 kbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_320x240
video resolution: 320x240, video bitrate: 280 kbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_352x288
video resolution: 320x240, video bitrate: 1 mbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_640x480
video resolution: 640x480, video bitrate: 1.5 mbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_960x540
video resolution: 960x540, video bitrate: 1.5 mbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_1280x720
video resolution: 1280x720, video bitrate: 3.75 mbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_1440x1080
video resolution: 1440x1080, video bitrate: 5 mbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_1920x1080
video resolution: 1920x1080, video bitrate: 5 mbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig FRAME_SIZE_3840x2160
video resolution: 3840x2160, video bitrate: 8 mbps, framerate: 30 fps, keyframe interval: 30 frames audio sample rate: 44.1kHz, audio bitrate: 64 kbps
public static final WZMediaConfig[] PRESET_CONFIGS
public static final float DEFAULT_VIDEO_BITRATE_SCALING_FACTOR
public static final int DEFAULT_VIDEO_FRAME_BUFFER_MULTIPLIER
public static final int DEFAULT_VIDEO_FRAME_SKIP_COUNT
public WZMediaConfig()
public WZMediaConfig(WZMediaConfig other)
other
- The instance to replicatepublic static boolean isValidScaleMode(int scaleMode)
scaleMode
- a scale mode property valuepublic static boolean isLandscape(int orientation)
orientation
- ORIENTATION_LANDSCAPE
, ORIENTATION_PORTRAIT
, ORIENTATION_LANDSCAPE_INVERTED
, or ORIENTATION_PORTRAIT_INVERTED
true
if the specified identifier is one of the landscape identifiers, false
otherwisepublic static boolean isLandscapeRotation(int rotation)
rotation
- rotation angle, in degreestrue
if the specified rotation angle specifies a landscape orientation, false otherwisepublic static String orientationLabel(int orientation)
orientation
- ORIENTATION_LANDSCAPE
, ORIENTATION_PORTRAIT
, ORIENTATION_LANDSCAPE_INVERTED
, or ORIENTATION_PORTRAIT_INVERTED
"portrait"
or "landscape"
public static boolean isPortrait(int orientation)
orientation
- ORIENTATION_LANDSCAPE
, ORIENTATION_PORTRAIT
, ORIENTATION_LANDSCAPE_INVERTED
, or ORIENTATION_PORTRAIT_INVERTED
true
if the specified identifier is one of the portrait identifiers, false
otherwisepublic static boolean isPortraitRotation(int rotation)
rotation
- rotation angle, in degreestrue
if the specified rotation angle specifies a portrait orientation, false otherwisepublic static int rotationToOrientation(int rotation)
ORIENTATION_LANDSCAPE
represents 0° followed, in a clockwise manner at 90° increments, by ORIENTATION_PORTRAIT
(90°),
ORIENTATION_LANDSCAPE_INVERTED
(180°), and ORIENTATION_PORTRAIT_INVERTED
(270°)
rotation
- A surface rotation angle, in degreesORIENTATION_LANDSCAPE
, ORIENTATION_PORTRAIT
, ORIENTATION_LANDSCAPE_INVERTED
, or ORIENTATION_PORTRAIT_INVERTED
public static int surfaceRotationToOrientation(int rotation)
rotationToOrientation(int)
insteadpublic static int orientationToRotation(int orientation)
orientation
- ORIENTATION_LANDSCAPE
(0°), ORIENTATION_PORTRAIT
(90°), ORIENTATION_LANDSCAPE_INVERTED
(180°), or ORIENTATION_PORTRAIT_INVERTED
(270°)public static int orientationToSurfaceRotation(int orientation)
orientationToRotation(int)
insteadpublic static int keyFrameIntervalFramesToSeconds(int frames, int frameRate)
frames
- the no. of frame between keyframesframeRate
- the frame ratepublic static String bitrateLabel(int bps)
bps
- A bitrate valuepublic static WZSize[] toFrameSizes(WZMediaConfig[] mediaConfigs)
mediaConfigs
- An array of media configuration instancespublic static WZMediaConfig[] fromFrameSizes(WZSize[] frameSizes)
frameSizes
- An array of video frame sizespublic void setLowBandwidthScalingFactor(float lowBandwidthScalingFactor)
lowBandwidthScalingFactor
- The default is 0.75public float getLowBandwidthScalingFactor()
public void setFrameRateLowBandwidthSkipCount(int frameRateLowBandwidthSkipCount)
frameRateLowBandwidthSkipCount
- The default is 4 meaning skip 1 of every 4 framespublic int getFrameRateLowBandwidthSkipCount()
public void setFrameBufferSizeMultiplier(int frameBufferSizeMultiplier)
frameBufferSizeMultiplier
- The default value is 4public int getFrameBufferSizeMultiplier()
public void setABREnabled(boolean abrEnabled)
abrEnabled
- true to have the bitrate of the video stream automatically
adjusted based on bandwidth constraints, false otherwisepublic boolean isABREnabled()
public void resetToDefaults()
public int compareTo(WZMediaConfig other)
compareTo
in interface Comparable<WZMediaConfig>
other
- The instance to be used for comparisonpublic boolean equals(Object other)
public void set(WZMediaConfig other)
other
- The instance with the property values to replicatepublic WZSize getVideoFrameSize()
public void setVideoFrameSize(WZSize videoSize)
videoSize
- An instance with the property values to usepublic void setVideoFrameSize(int width, int height)
width
- The width of the video frame (pixels)height
- The height of the video frame (pixels)public int getVideoFrameWidth()
public void setVideoFrameWidth(int width)
width
- The video frame width (pixels)public int getVideoFrameHeight()
public void setVideoFrameHeight(int height)
height
- the video height (pixels)public int getVideoRotation()
public void setVideoRotation(int videoRotation)
videoRotation
- the rotation, in degrees, of the device's orientationpublic int getVideoBitRate()
public void setVideoBitRate(int videoBitRate)
videoBitRate
- The video stream bitrate (kbps)public int getVideoFramerate()
public void setVideoFramerate(int videoFrameRate)
videoFrameRate
- The video framerate (fps)public int getVideoKeyFrameInterval()
public void setVideoKeyFrameInterval(int videoKeyFrameInterval)
videoKeyFrameInterval
- The keyframe interval (# of frames between keyframes)public WZProfileLevel getVideoProfileLevel()
public void setVideoProfileLevel(int profile, int level)
profile
- The profile identifierlevel
- The level identifierWZProfileLevel
public void setVideoProfileLevel(WZProfileLevel profileLevel)
profileLevel
- The profile levelpublic int getAudioChannels()
AUDIO_CHANNELS_STEREO
or AUDIO_CHANNELS_MONO
public void setAudioChannels(int audioChannels)
audioChannels
- The no. of audio channels. AUDIO_CHANNELS_STEREO
or AUDIO_CHANNELS_MONO
public int getAudioSampleRate()
public int setAudioSampleRate(int audioSampleRate)
SUPPORTED_AUDIO_SAMPLE_RATES
.
If a value not in this list is specified, the next highest value from the list of supported sample rates will be used instead.audioSampleRate
- The sample rate (Hz)public int getAudioBitRate()
public void setAudioBitRate(int audioBitRate)
audioBitRate
- The audio stream bitrate (kbps)public boolean isVideoEnabled()
true
> if video streaming is enabled, false
> otherwisepublic void setVideoEnabled(boolean videoEnabled)
videoEnabled
- true
> if video streaming is enabled, false
> otherwisepublic boolean isAudioEnabled()
true
> if audio streaming is enabled, false
> otherwisepublic void setAudioEnabled(boolean audioEnabled)
audioEnabled
- true
> if audio streaming is enabled, false
> otherwisepublic String getPresetLabel()
null
if this instance is not one of the preset configurations that has a predefined labelpublic String getPresetLabelByFrameSize()
null
if this instance does not match one of the presets with a predefined label by video frame sizepublic String getLabel(boolean withFrameSize, boolean withPreset, boolean withBitrate)
public String getLabel(boolean withFrameSize, boolean withPreset, boolean withAspect, boolean withBitrate)
withFrameSize
- indicates if the frame size should be included or notwithPreset
- indicates if the preset label for the frame size should be included or notwithAspect
- indicates if the aspect ratio should be displayed with the frame size or notwithBitrate
- indicates if the video bitrate should be included or notpublic WZDataMap toDataMap(WZDataMap dataMap)
WZDataMap
containing the configuration propertiesdataMap
- a previouslly allocated data map in which to add the configuration properties© 2016 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal