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

Packetizer

public class Packetizer extends AudioPacketizer
Implements an G723 Packetizer.

Fields Summary
Constructors Summary
public Packetizer()

        packetSize=48;
       	supportedInputFormats = new AudioFormat[] {
	        new AudioFormat(
                    AudioFormat.G723,
                    8000,
                    Format.NOT_SPECIFIED,
		    1,
                    Format.NOT_SPECIFIED,
                    Format.NOT_SPECIFIED,
                    24*8,
                    Format.NOT_SPECIFIED,
                    Format.byteArray
                )
        } ;
        defaultOutputFormats  = new AudioFormat[] {
	        new AudioFormat(
                    AudioFormat.G723_RTP,
                    8000,
                    Format.NOT_SPECIFIED,
		    1,
                    Format.NOT_SPECIFIED,
                    Format.NOT_SPECIFIED,
                    24*8,
                    Format.NOT_SPECIFIED,
                    Format.byteArray
                )
        } ;

        PLUGIN_NAME="G723 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.G723_RTP,
                    8000,
                    Format.NOT_SPECIFIED,
		    1,
                    Format.NOT_SPECIFIED,
                    Format.NOT_SPECIFIED,
                    24*8,
                    Format.NOT_SPECIFIED,
                    Format.byteArray
                )
        };
        return  supportedOutputFormats;
    
public voidopen()

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

        packetSize=newPacketSize;

        sample_count = (packetSize / 24 )*240;

        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;
        }