FileDocCategorySizeDatePackage
Packetizer.javaAPI DocJMF 2.1.1e3412Mon May 12 12:21:02 BST 2003com.ibm.media.codec.audio.gsm

Packetizer

public class Packetizer extends AudioPacketizer
Implements an GSM Packetizer.

Fields Summary
Constructors Summary
public Packetizer()

        packetSize=99;
       	supportedInputFormats = new AudioFormat[] {
	        new AudioFormat(
                    AudioFormat.GSM,
                    8000,
                    Format.NOT_SPECIFIED,
		    1,
                    Format.NOT_SPECIFIED,
                    Format.NOT_SPECIFIED,
                    33*8,
                    Format.NOT_SPECIFIED,
                    Format.byteArray
                )
        } ;
        defaultOutputFormats  = new AudioFormat[] {
	        new AudioFormat(
                    AudioFormat.GSM_RTP,
                    8000,
                    Format.NOT_SPECIFIED,
		    1,
                    Format.NOT_SPECIFIED,
                    Format.NOT_SPECIFIED,
                    33*8,
                    Format.NOT_SPECIFIED,
                    Format.byteArray
                )
        } ;

        PLUGIN_NAME="GSM Packetizer";

    
Methods Summary
public java.lang.Object[]getControls()

        if (controls==null) {
             controls=new Control[1];
             controls[0]=new PacketSizeAdapter(this,packetSize,true);
	}
        return (Object[])controls;
    
protected javax.media.Format[]getMatchingOutputFormats(javax.media.Format in)


        AudioFormat af =(AudioFormat) in;

        supportedOutputFormats = new AudioFormat[] {
                new AudioFormat(
                    AudioFormat.GSM_RTP,
                    8000,
                    Format.NOT_SPECIFIED,
		    1,
                    Format.NOT_SPECIFIED,
                    Format.NOT_SPECIFIED,
                    33*8,
                    Format.NOT_SPECIFIED,
                    Format.byteArray
                )
        };
        return  supportedOutputFormats;
    
public voidopen()

        setPacketSize(packetSize);
        reset();
    
public synchronized voidsetPacketSize(int newPacketSize)

        packetSize=newPacketSize;

        sample_count = (packetSize / 33) * 160;

        if (history==null) {
            history=new byte[packetSize];
            return;
        }

        if (packetSize > history.length ) {
            byte[] newHistory=new byte[packetSize];
            System.arraycopy(history,0,newHistory,0,historyLength);
            history=newHistory;
        }