src/jlibrtp/RTPAppIntf.java
changeset 13 e684f11070d5
equal deleted inserted replaced
12:c9ff263c29ad 13:e684f11070d5
       
     1 /**
       
     2  * Java RTP Library (jlibrtp)
       
     3  * Copyright (C) 2006 Arne Kepp
       
     4  * 
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2.1 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  * 
       
    15  * You should have received a copy of the GNU Lesser General Public
       
    16  * License along with this library; if not, write to the Free Software
       
    17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
       
    18  */
       
    19 
       
    20 package jlibrtp;
       
    21 
       
    22 
       
    23 /**
       
    24  * This is the callback interface for RTP packets.
       
    25  * 
       
    26  * It is mandatory, but you can inore the data if you like.
       
    27  * 
       
    28  * @author Arne Kepp
       
    29  */
       
    30 public interface RTPAppIntf {
       
    31 	
       
    32 	/**
       
    33 	 * The callback method through which the application will receive
       
    34 	 * data from jlibrtp. These calls are synchronous, so you will not
       
    35 	 * receive any new packets until this call returns.
       
    36 	 * 
       
    37 	 * @param frame the frame containing the data
       
    38 	 * @param participant the participant from which the data came
       
    39 	 */
       
    40 	public void receiveData(DataFrame frame, Participant participant);
       
    41 	
       
    42 	
       
    43 	/**
       
    44 	 * The callback method through which the application will receive
       
    45 	 * notifications about user updates, additions and byes.
       
    46 	 *  Types:
       
    47 	 *  	1 - Bye
       
    48 	 *  	2 - New through RTP, check .getRtpSendSock()
       
    49 	 *  	3 - New through RTCP, check .getRtcpSendSock()
       
    50 	 * 		4 - SDES packet received, check the getCname() etc methods
       
    51 	 *      5 - Matched SSRC to ip-address provided by application
       
    52 	 * 
       
    53 	 * @param type the type of event
       
    54 	 * @param participant the participants in question
       
    55 	 */
       
    56 	public void userEvent(int type, Participant[] participant);
       
    57 	
       
    58 	/**
       
    59 	 * The callback method through which the application can specify
       
    60 	 * the number of packets that make up a frame for a given payload type.
       
    61 	 * 
       
    62 	 * A negative value denotes frames of variable length, so jlibrtp
       
    63 	 * will return whatever it has at the time.
       
    64 	 * 
       
    65 	 * In most applications, this function can simply return 1.
       
    66 	 * 
       
    67 	 * This should be implemented as something fast, such as an
       
    68 	 * integer array with the indeces being the payload type.
       
    69 	 * 
       
    70 	 * @param payloadType the payload type specified in the RTP packet
       
    71 	 * @return the number of packets that make up a frame
       
    72 	 */
       
    73 	public int frameSize(int payloadType);
       
    74 }