Search in sources :

Example 1 with H263Stream

use of net.majorkernelpanic.streaming.video.H263Stream in project libstreaming by fyhertz.

the class SessionBuilder method build.

/**
	 * Creates a new {@link Session}.
	 * @return The new Session
	 * @throws IOException 
	 */
public Session build() {
    Session session;
    session = new Session();
    session.setOrigin(mOrigin);
    session.setDestination(mDestination);
    session.setTimeToLive(mTimeToLive);
    session.setCallback(mCallback);
    switch(mAudioEncoder) {
        case AUDIO_AAC:
            AACStream stream = new AACStream();
            session.addAudioTrack(stream);
            if (mContext != null)
                stream.setPreferences(PreferenceManager.getDefaultSharedPreferences(mContext));
            break;
        case AUDIO_AMRNB:
            session.addAudioTrack(new AMRNBStream());
            break;
    }
    switch(mVideoEncoder) {
        case VIDEO_H263:
            session.addVideoTrack(new H263Stream(mCamera));
            break;
        case VIDEO_H264:
            H264Stream stream = new H264Stream(mCamera);
            if (mContext != null)
                stream.setPreferences(PreferenceManager.getDefaultSharedPreferences(mContext));
            session.addVideoTrack(stream);
            break;
    }
    if (session.getVideoTrack() != null) {
        VideoStream video = session.getVideoTrack();
        video.setFlashState(mFlash);
        video.setVideoQuality(mVideoQuality);
        video.setSurfaceView(mSurfaceView);
        video.setPreviewOrientation(mOrientation);
        video.setDestinationPorts(5006);
    }
    if (session.getAudioTrack() != null) {
        AudioStream audio = session.getAudioTrack();
        audio.setAudioQuality(mAudioQuality);
        audio.setDestinationPorts(5004);
    }
    return session;
}
Also used : AudioStream(net.majorkernelpanic.streaming.audio.AudioStream) VideoStream(net.majorkernelpanic.streaming.video.VideoStream) AACStream(net.majorkernelpanic.streaming.audio.AACStream) H263Stream(net.majorkernelpanic.streaming.video.H263Stream) H264Stream(net.majorkernelpanic.streaming.video.H264Stream) AMRNBStream(net.majorkernelpanic.streaming.audio.AMRNBStream)

Aggregations

AACStream (net.majorkernelpanic.streaming.audio.AACStream)1 AMRNBStream (net.majorkernelpanic.streaming.audio.AMRNBStream)1 AudioStream (net.majorkernelpanic.streaming.audio.AudioStream)1 H263Stream (net.majorkernelpanic.streaming.video.H263Stream)1 H264Stream (net.majorkernelpanic.streaming.video.H264Stream)1 VideoStream (net.majorkernelpanic.streaming.video.VideoStream)1