sbGStreamerTranscodeDeviceConfigurator Class Reference

#include <sbGStreamerTranscodeDeviceConfigurator.h>

Inheritance diagram for sbGStreamerTranscodeDeviceConfigurator:
[legend]
Collaboration diagram for sbGStreamerTranscodeDeviceConfigurator:
[legend]

Classes

struct  Dimensions
 
struct  EncoderProfileData
 

Public Member Functions

NS_IMETHOD GetInputUri (nsIURI **aUri)
 
NS_IMETHOD SetInputUri (nsIURI *aUri)
 
NS_IMETHOD GetInputFormat (sbIMediaFormat **aInputFormat)
 
NS_IMETHOD SetInputFormat (sbIMediaFormat *aInputFormat)
 
NS_IMETHOD GetLastError (sbITranscodeError **aLastError)
 
NS_IMETHOD GetMuxer (nsAString &aMuxer)
 
NS_IMETHOD GetUseMuxer (PRBool *aUseMuxer)
 
NS_IMETHOD GetFileExtension (nsACString &aFileExtension)
 
NS_IMETHOD GetVideoEncoder (nsAString &aVideoEncoder)
 
NS_IMETHOD GetUseVideoEncoder (PRBool *aUseVideoEncoder)
 
NS_IMETHOD GetVideoFormat (sbIMediaFormatVideo **aVideoFormat)
 
NS_IMETHOD GetAudioEncoder (nsAString &aAudioEncoder)
 
NS_IMETHOD GetUseAudioEncoder (PRBool *aUseAudioEncoder)
 
NS_IMETHOD GetAudioFormat (sbIMediaFormatAudio **aAudioFormat)
 
NS_IMETHOD GetVideoEncoderProperties (nsIPropertyBag **aVideoEncoderProperties)
 
NS_IMETHOD GetAudioEncoderProperties (nsIPropertyBag **aAudioEncoderProperties)
 
NS_IMETHOD DetermineOutputType ()
 
NS_IMETHOD Configurate ()
 
NS_IMETHOD GetAvailableProfiles (nsIArray **aProfiles)
 
 sbGStreamerTranscodeDeviceConfigurator ()
 
- Public Member Functions inherited from sbTranscodingConfigurator
NS_DECL_ISUPPORTS
NS_DECL_SBITRANSCODINGCONFIGURATOR 
sbTranscodingConfigurator ()
 
- Public Member Functions inherited from sbITranscodingConfigurator
void determineOutputType ()
 Determine the trancode destination format to use, based on the target device and desired output quality settings. The device must be set before calling this function. This will only determine the file format settings, not the details such as dimensions or bitrates. The muxer and encoder attributes below may be read after calling this method, but not the format details or properties. More...
 
void configurate ()
 Determine the transcode settings to use based on the input given. Both the device and the input format must be set before calling this function. Once this is called, the functions below may be called (they will throw an error if called before this function is called). More...
 

Protected Member Functions

virtual ~sbGStreamerTranscodeDeviceConfigurator ()
 
nsresult EnsureProfileAvailable (sbITranscodeEncoderProfile *aProfile)
 
nsresult SelectQuality ()
 
nsresult SelectProfile ()
 
nsresult SetAudioProperties ()
 
nsresult DetermineOutputDimensions ()
 
nsresult DetermineOutputVideoBitrate ()
 
nsresult SetVideoProperties ()
 
nsresult CopyPropertiesIntoBag (nsIArray *aSrcProps, nsIWritablePropertyBag *aDstBag, PRBool aIsVideo)
 
- Protected Member Functions inherited from sbTranscodingConfigurator
virtual ~sbTranscodingConfigurator ()
 

Static Protected Member Functions

static Dimensions GetMaximumFit (const Dimensions &aInput, const Dimensions &aMaximum)
 

Protected Attributes

nsDataHashtable
< nsISupportsHashKey,
EncoderProfileData
mElementNames
 
double mQuality
 
nsCOMPtr< sbIDevicemDevice
 
nsCOMPtr< nsIArray > mAvailableProfiles
 
nsCOMPtr
< sbITranscodeEncoderProfile
mSelectedProfile
 
nsCOMPtr< sbIVideoFormatTypemSelectedFormat
 
PRInt32 mVideoBitrate
 
sbFraction mVideoFrameRate
 
Dimensions mOutputDimensions
 
sbFraction mOutputPAR
 
- Protected Attributes inherited from sbTranscodingConfigurator
CONFIGURATE_STATE mConfigurateState
 
nsCOMPtr< nsIURI > mInputUri
 
nsCOMPtr< sbITranscodeErrormLastError
 
nsCOMPtr< sbIMediaFormatmInputFormat
 
PRBool mUseMuxer
 
nsString mMuxer
 
PRBool mUseVideoEncoder
 
nsString mVideoEncoder
 
PRBool mUseAudioEncoder
 
nsString mAudioEncoder
 
nsCString mFileExtension
 
nsCOMPtr< sbIMediaFormatVideomVideoFormat
 
nsCOMPtr< sbIMediaFormatAudiomAudioFormat
 
nsCOMPtr< nsIWritablePropertyBag2 > mVideoEncoderProperties
 
nsCOMPtr< nsIWritablePropertyBag2 > mAudioEncoderProperties
 

Additional Inherited Members

- Public Attributes inherited from sbITranscodingConfigurator
readonly attribute nsIArray availableProfiles
 
attribute nsIURI inputUri
 
attribute sbIMediaFormat inputFormat
 The input format to use when configuring the transcode profile. More...
 
readonly attribute
sbITranscodeError 
lastError
 
readonly attribute AString muxer
 The muxer to use. The name is specific to the transcoder (for example, this may be a gstreamer element name for a gstreamer-based transcoder). More...
 
readonly attribute boolean useMuxer
 Whether a muxer is in use. e.g. for a bare FLAC audio file it won't be. More...
 
readonly attribute ACString fileExtension
 The file extension to use for transcoded files. This may depend on the muxer or the used codecs. It may also depend on nothing at all; it's all up to the configurator. More...
 
readonly attribute AString videoEncoder
 The video encoder to use. The name is specific to the transcoder (for example, this may be a gstreamer element name for a gstreamer-based transcoder). More...
 
readonly attribute boolean useVideoEncoder
 Whether a video encoder is in use. If this is true, the videoEncoder attribute must be non-empty. More...
 
readonly attribute AString audioEncoder
 The audio encoder to use. The name is specific to the transcoder (for example, this may be a gstreamer element name for a gstreamer-based transcoder). This may be a void string if raw audio is desired. More...
 
readonly attribute boolean useAudioEncoder
 Whether a audio encoder is in use. If this is true, the audioEncoder attribute may be empty; indicating that raw audio is desired. More...
 
readonly attribute
sbIMediaFormatVideo 
videoFormat
 The basic video format for data that is not specific to a particular codec. More...
 
readonly attribute
sbIMediaFormatAudio 
audioFormat
 The basic audio format for data that is not specific to a particular codec. More...
 
readonly attribute nsIPropertyBag videoEncoderProperties
 With the input given, return the properties to set on the encoder to encode this format. This is used to e.g. select a bitrate for the video encoder. More...
 
readonly attribute nsIPropertyBag audioEncoderProperties
 With the input given, return the properties to set on the encoder to encode this format. This is used to e.g. select a bitrate for the audio encoder. More...
 
- Public Attributes inherited from sbIDeviceTranscodingConfigurator
attribute sbIDevice device
 Set the device that we get the capabilities from, using the capabilities of the device this function will set inputFormat for the configurate function to use so we can limit the transcoding to only what this device supports. More...
 
- Public Attributes inherited from sbPIGstTranscodingConfigurator
attribute double quality
 
- Protected Types inherited from sbTranscodingConfigurator
enum  CONFIGURATE_STATE { CONFIGURATE_NOT_STARTED, CONFIGURATE_OUTPUT_SET, CONFIGURATE_FINISHED }
 

Detailed Description

Definition at line 56 of file sbGStreamerTranscodeDeviceConfigurator.h.

Constructor & Destructor Documentation

sbGStreamerTranscodeDeviceConfigurator::sbGStreamerTranscodeDeviceConfigurator ( )

Definition at line 175 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

sbGStreamerTranscodeDeviceConfigurator::~sbGStreamerTranscodeDeviceConfigurator ( )
protectedvirtual

Definition at line 189 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Member Function Documentation

NS_IMETHODIMP sbGStreamerTranscodeDeviceConfigurator::Configurate ( )

Definition at line 1581 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

nsresult sbGStreamerTranscodeDeviceConfigurator::CopyPropertiesIntoBag ( nsIArray *  aSrcProps,
nsIWritablePropertyBag *  aDstBag,
PRBool  aIsVideo 
)
protected

Copy properties, either audio or video.

Parameters
aSrcPropsthe properties to copy from
aDstBagthe property bag to output
aIsVideotrue if this is for video, false for audio

Definition at line 1302 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbGStreamerTranscodeDeviceConfigurator::DetermineOutputDimensions ( )
protected

Determine the desired output size and framerate

the profile has been selected via SelectProfile() mOutputDimensions is the desired output size mOutputFramerate is the desired output framerate

Determine the output size

the profile has been selected via SelectProfile() mOutputDimensions is the desired output size

Definition at line 789 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP sbGStreamerTranscodeDeviceConfigurator::DetermineOutputType ( )

Definition at line 1556 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbGStreamerTranscodeDeviceConfigurator::DetermineOutputVideoBitrate ( )
protected

Select the bitrate to encode the video at

mOutputDimensions has been set mSelectedProfile has been selected mSelectedFormat has been selected mVideoBitrate will be set (if it hasn't already been, or if the existing setting is too high for the device)

Scale the video to something useful for the selected video bit rate mOutputDimensions has been set mSelectedProfile has been selected mSelectedFormat has been selected mVideoBitrate will be set

Definition at line 1200 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbGStreamerTranscodeDeviceConfigurator::EnsureProfileAvailable ( sbITranscodeEncoderProfile aProfile)
protected

Make sure the given transcode profile does not use any gstreamer elements that we do not have access to.

Parameters
aProfilethe profile to test
Exceptions
NS_ERROR_NOT_AVAILABLEif the profile uses elements that are not found

Check that we have an audio encoder available

Check that we have an video encoder available

Definition at line 281 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetAudioEncoder ( nsAString &  aAudioEncoder)
inline

Definition at line 81 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetAudioEncoderProperties ( nsIPropertyBag **  aAudioEncoderProperties)
inline

Definition at line 85 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetAudioFormat ( sbIMediaFormatAudio **  aAudioFormat)
inline

Definition at line 83 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHODIMP sbGStreamerTranscodeDeviceConfigurator::GetAvailableProfiles ( nsIArray **  aProfiles)

Definition at line 1428 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetFileExtension ( nsACString &  aFileExtension)
inline

Definition at line 77 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetInputFormat ( sbIMediaFormat **  aInputFormat)
inline

Definition at line 72 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetInputUri ( nsIURI **  aUri)
inline

Definition at line 70 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetLastError ( sbITranscodeError **  aLastError)
inline

Definition at line 74 of file sbGStreamerTranscodeDeviceConfigurator.h.

sbGStreamerTranscodeDeviceConfigurator::Dimensions sbGStreamerTranscodeDeviceConfigurator::GetMaximumFit ( const Dimensions aInput,
const Dimensions aMaximum 
)
staticprotected

Given an input image dimensions (which provides the aspect ratio) and maximum image dimensions, return a rectangle that is the largest possible to fit in the second but with the aspect ratio of the first. This for now will ignore all PARs.

Definition at line 1171 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the caller graph for this function:

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetMuxer ( nsAString &  aMuxer)
inline

Definition at line 75 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetUseAudioEncoder ( PRBool *  aUseAudioEncoder)
inline

Definition at line 82 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetUseMuxer ( PRBool *  aUseMuxer)
inline

Definition at line 76 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetUseVideoEncoder ( PRBool *  aUseVideoEncoder)
inline

Definition at line 79 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetVideoEncoder ( nsAString &  aVideoEncoder)
inline

Definition at line 78 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetVideoEncoderProperties ( nsIPropertyBag **  aVideoEncoderProperties)
inline

Definition at line 84 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::GetVideoFormat ( sbIMediaFormatVideo **  aVideoFormat)
inline

Definition at line 80 of file sbGStreamerTranscodeDeviceConfigurator.h.

nsresult sbGStreamerTranscodeDeviceConfigurator::SelectProfile ( )
protected

Select the encoding profile to use

the device has been set the quality has been set mSelectedProfile is the encoder profile to use mSelectedFormat is ths device format matching the profile mMuxer, mVideoEncoder, mAudioEncoder are the required element names

Select the encoding profile to use

the device has been set the quality has been set mSelectedProfile is the encoder profile to use mSelectedFormat is ths device format matching the profile

Because there's no useful way to enumerate the device capabilities, we must instead step through the encoder profiles and inspect each to see if it's acceptable on a particular device.

Definition at line 443 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbGStreamerTranscodeDeviceConfigurator::SelectQuality ( )
protected

Selects the quality if it has not been set

the quality is set

Definition at line 392 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the caller graph for this function:

nsresult sbGStreamerTranscodeDeviceConfigurator::SetAudioProperties ( )
protected

Set audio-related properties

a profile has been selected mAudioEncoderProperties contains the audio properties desired

Definition at line 691 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::SetInputFormat ( sbIMediaFormat aInputFormat)
inline

Definition at line 73 of file sbGStreamerTranscodeDeviceConfigurator.h.

NS_IMETHOD sbGStreamerTranscodeDeviceConfigurator::SetInputUri ( nsIURI *  aUri)
inline

Definition at line 71 of file sbGStreamerTranscodeDeviceConfigurator.h.

nsresult sbGStreamerTranscodeDeviceConfigurator::SetVideoProperties ( )
protected

Actually set the various video related properties mOutputDimensions has been set mVideoBitrate has been set mVideoFormat and mVideoEncoderProperties are set

Definition at line 1244 of file sbGStreamerTranscodeDeviceConfigurator.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

nsCOMPtr<nsIArray> sbGStreamerTranscodeDeviceConfigurator::mAvailableProfiles
protected

A cache of the encoder profiles available (should only be used via GetAvailableProfiles)

Definition at line 221 of file sbGStreamerTranscodeDeviceConfigurator.h.

nsCOMPtr<sbIDevice> sbGStreamerTranscodeDeviceConfigurator::mDevice
protected

The device to transcode to

Definition at line 216 of file sbGStreamerTranscodeDeviceConfigurator.h.

nsDataHashtable<nsISupportsHashKey, EncoderProfileData> sbGStreamerTranscodeDeviceConfigurator::mElementNames
protected

Definition at line 207 of file sbGStreamerTranscodeDeviceConfigurator.h.

Dimensions sbGStreamerTranscodeDeviceConfigurator::mOutputDimensions
protected

The selected output dimensions

Definition at line 245 of file sbGStreamerTranscodeDeviceConfigurator.h.

sbFraction sbGStreamerTranscodeDeviceConfigurator::mOutputPAR
protected

The selected output pixel aspect ratio

Definition at line 250 of file sbGStreamerTranscodeDeviceConfigurator.h.

double sbGStreamerTranscodeDeviceConfigurator::mQuality
protected

The quality setting to use

Definition at line 212 of file sbGStreamerTranscodeDeviceConfigurator.h.

nsCOMPtr<sbIVideoFormatType> sbGStreamerTranscodeDeviceConfigurator::mSelectedFormat
protected

The device video format that corresponds with mSelectedProfile; set by SelectProfile()

Definition at line 230 of file sbGStreamerTranscodeDeviceConfigurator.h.

nsCOMPtr<sbITranscodeEncoderProfile> sbGStreamerTranscodeDeviceConfigurator::mSelectedProfile
protected

The encoder profile selected; set by SelectProfile()

Definition at line 225 of file sbGStreamerTranscodeDeviceConfigurator.h.

PRInt32 sbGStreamerTranscodeDeviceConfigurator::mVideoBitrate
protected

The video bit rate we want to use

Definition at line 235 of file sbGStreamerTranscodeDeviceConfigurator.h.

sbFraction sbGStreamerTranscodeDeviceConfigurator::mVideoFrameRate
protected

The video frame rate we want to use

Definition at line 240 of file sbGStreamerTranscodeDeviceConfigurator.h.


The documentation for this class was generated from the following files: