From: Wim T. <wt...@us...> - 2001-12-02 16:40:06
|
Update of /cvsroot/gstreamer/gstreamer/plugins/rtp In directory usw-pr-cvs1:/tmp/cvs-serv13714 Modified Files: gstrtprecv.c gstrtpsend.c gstrtpsend.h rtp.c rtp.h Log Message: Applied the latest patch from zeenix. Index: gstrtprecv.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/plugins/rtp/gstrtprecv.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gstrtprecv.c 2001/11/13 22:14:09 1.2 +++ gstrtprecv.c 2001/12/02 16:40:02 1.3 @@ -63,8 +63,8 @@ "mpeg_video", "video/mpeg", "mpegversion", GST_PROPS_INT_RANGE (1, 2), - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "sliced", GST_PROPS_BOOLEAN (TRUE) ), + "systemstream", GST_PROPS_BOOLEAN (FALSE) ), + //"sliced", GST_PROPS_BOOLEAN (TRUE) ), GST_CAPS_NEW ( "audio_raw", @@ -193,14 +193,15 @@ break ; case PAYLOAD_MPV: + case PAYLOAD_BMPEG: caps = GST_CAPS_NEW ( "mpeg_video", "video/mpeg", "mpegversion", GST_PROPS_INT( message->layer ? message->layer : 2 ), - "systemstream", GST_PROPS_BOOLEAN( message->mpeg_bool1 ), + "systemstream", GST_PROPS_BOOLEAN( message->mpeg_bool1 ), "sliced", GST_PROPS_BOOLEAN( message->mpeg_bool2 ) ) ; - break ; + break ; case PAYLOAD_L16_MONO : caps = GST_CAPS_NEW ( @@ -235,6 +236,7 @@ /* Network to Host Byte ordering */ message->payload_type = g_ntohl( message->payload_type ) ; + message->mtu = g_ntohl( message->mtu ) ; message->frequency = g_ntohl( message->frequency ) ; message->packets_sent = g_ntohl( message->packets_sent ) ; @@ -255,17 +257,19 @@ if( caps ) { gst_pad_set_caps( pad, caps ) ; } - else g_print( "Unknown payload_t recieved\n" ) ; + else g_print( "Unknown payload_t %d recieved\n", message->payload_type ) ; + + rtprecv->mtu = message->mtu ; - rtprecv->payload_type = message->payload_type ; - rtprecv->frequency = message->frequency ; - rtprecv->layer = message->layer ; - rtprecv->mpeg_bool1 = message->mpeg_bool1 ; - rtprecv->mpeg_bool2 = message->mpeg_bool2 ; + rtprecv->payload_type = message->payload_type ; + rtprecv->frequency = message->frequency ; + rtprecv->layer = message->layer ; + rtprecv->mpeg_bool1 = message->mpeg_bool1 ; + rtprecv->mpeg_bool2 = message->mpeg_bool2 ; - if( rtprecv->payload_type == PAYLOAD_GSM || + if( rtprecv->payload_type == PAYLOAD_GSM || rtprecv->payload_type == PAYLOAD_L16_MONO ) - rtprecv->frequency = gst_caps_get_int( gst_pad_get_caps( pad ), "rate" ) ; + rtprecv->frequency = gst_caps_get_int( gst_pad_get_caps( pad ), "rate" ) ; } } @@ -322,6 +326,7 @@ GstCaps *caps ; message.frequency = 0 ; + message.mtu = rtprecv->mtu ; message.layer = 0 ; message.mpeg_bool1 = FALSE ; message.mpeg_bool2 = TRUE ; Index: gstrtpsend.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/plugins/rtp/gstrtpsend.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gstrtpsend.c 2001/11/13 22:14:09 1.2 +++ gstrtpsend.c 2001/12/02 16:40:02 1.3 @@ -40,6 +40,7 @@ enum { ARG_0, + ARG_IP_LIST, ARG_IP, ARG_PORT, ARG_PAYLOAD_TYPE, @@ -66,9 +67,11 @@ GST_CAPS_NEW ( "mpeg_video", "video/mpeg", - "mpegversion", GST_PROPS_INT_RANGE (1, 2), - "systemstream", GST_PROPS_BOOLEAN (FALSE), - "sliced", GST_PROPS_BOOLEAN (TRUE) ), + NULL + //"mpegversion", GST_PROPS_INT_RANGE (1, 2), + //"systemstream", GST_PROPS_BOOLEAN (FALSE), + //"sliced", GST_PROPS_BOOLEAN (TRUE) ), + ), GST_CAPS_NEW ( "audio_raw", @@ -132,6 +135,9 @@ parent_class = g_type_class_ref(GST_TYPE_ELEMENT); + g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_IP_LIST, + g_param_spec_pointer("ip_list","ip_list","ip_list", + G_PARAM_READWRITE)); // CHECKME g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_IP, g_param_spec_string("ip","ip","ip", NULL, G_PARAM_READWRITE)); // CHECKME @@ -167,9 +173,10 @@ rtpsend->mpeg_bool1 = FALSE ; rtpsend->mpeg_bool2 = TRUE ; - rtpsend->ip = g_strdup ("127.0.0.1"); + rtpsend->ip = NULL; // for append func. to work + rtpsend->ip = g_slist_append( rtpsend->ip, "127.0.0.1" ); rtpsend->port = 8000 ; - rtpsend->mtu = 160; + rtpsend->mtu = 160 ; rtpsend->conn.rtp_sock = 0 ; @@ -189,19 +196,27 @@ if( strcmp( mime, "audio/x-gsm" ) == 0 ) { rtpsend->payload_type = PAYLOAD_GSM ; rtpsend->frequency = gst_caps_get_int( caps, "rate" ) ; + rtpsend->mtu = 160 ; } else if( strcmp( mime, "audio/mp3" ) == 0 ) { rtpsend->payload_type = PAYLOAD_MPA ; + rtpsend->mtu = 512 ; rtpsend->frequency = gst_caps_get_int( caps, "bitrate" ) ; rtpsend->layer = gst_caps_get_int( caps, "layer" ) ; rtpsend->mpeg_bool2 = gst_caps_get_boolean( caps, "framed" ) ; } else if( strcmp( mime, "video/mpeg" ) == 0 ) { - rtpsend->payload_type = PAYLOAD_MPV ; + gboolean bool ; + + if( ( bool = gst_caps_get_boolean( caps, "systemstream" ) ) ) + rtpsend->payload_type = PAYLOAD_BMPEG ; + else rtpsend->payload_type = PAYLOAD_MPV ; + + rtpsend->mtu = 1024 ; rtpsend->layer = gst_caps_get_int( caps, "mpegversion" ) ; - rtpsend->mpeg_bool1 = gst_caps_get_boolean( caps, "systemstream" ) ; + rtpsend->mpeg_bool1 = bool ; rtpsend->mpeg_bool2 = gst_caps_get_boolean( caps, "sliced" ) ; } @@ -211,6 +226,7 @@ if( gst_caps_get_boolean( caps, "channels" ) == 1 ) if( gst_caps_get_boolean( caps, "signed" ) == TRUE ) { rtpsend->payload_type = PAYLOAD_L16_MONO ; + rtpsend->mtu = 1024 ; rtpsend->frequency = gst_caps_get_int( caps, "rate" ) ; } } @@ -228,6 +244,7 @@ message.socket_closed = FALSE ; message.payload_type = g_htonl( rtpsend->payload_type ); + message.mtu = g_htonl( rtpsend->mtu ); message.frequency = g_htonl( rtpsend->frequency ); message.layer = rtpsend->layer ; message.mpeg_bool1 = rtpsend->mpeg_bool1 ; @@ -295,18 +312,45 @@ gst_rtpsend_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GstRtpSend *rtpsend; - gchar* payload_type_str ; + gchar *payload_type_str ; + gchar **ip; /* it's not null if we got it, but it might not be ours */ g_return_if_fail(GST_IS_RTPSEND(object)); rtpsend = GST_RTPSEND(object); switch (prop_id) { + case ARG_IP_LIST: + if( rtpsend->conn.rtp_sock != 0 ) { + g_print( "adding/removing, while not in NULL state, would'nt work\n" ) ; + return ; + } + + if (rtpsend->ip != NULL) { + rtpsend->ip = g_slist_remove( rtpsend->ip, "127.0.0.1" ) ; + } + + rtpsend->ip = g_slist_concat( rtpsend->ip, + g_value_get_pointer( value ) ) ; + break; case ARG_IP: - if (rtpsend->ip) - g_free (rtpsend->ip); - rtpsend->ip = g_strdup (g_value_get_string (value)); - break; + if( rtpsend->conn.rtp_sock != 0 ) { + g_print( "adding/removing, while not in NULL state, would'nt work\n" ) ; + return ; + } + + if (rtpsend->ip != NULL) { + rtpsend->ip = g_slist_remove( rtpsend->ip, "127.0.0.1" ) ; + } + + for( ip = g_strsplit( g_value_get_string( value ), ",", 0 ); + *ip; ip++ ) { + rtpsend->ip = g_slist_append( rtpsend->ip, *ip ); + } + + //g_strfreev( ip ); + /*rtpsend->ip = g_slist_append( rtpsend->ip, + g_strdup( g_value_get_string( value ) ) );*/ case ARG_PORT: rtpsend->port = g_value_get_int (value); break; @@ -314,17 +358,57 @@ payload_type_str = g_strdup (g_value_get_string (value)); if( strcmp( payload_type_str, "gsm" ) == 0 ) - rtpsend->payload_type = PAYLOAD_GSM ; + rtpsend->payload_type = PAYLOAD_GSM ; - if( strcmp( payload_type_str, "mp3" ) == 0 ) - rtpsend->payload_type = PAYLOAD_MPA ; + if( strcmp( payload_type_str, "mp1" ) == 0 ) { + rtpsend->payload_type = PAYLOAD_MPA ; + rtpsend->layer = 1 ; + rtpsend->mtu = 512 ; + } + + if( strcmp( payload_type_str, "mp2" ) == 0 ) { + rtpsend->payload_type = PAYLOAD_MPA ; + rtpsend->layer = 2 ; + rtpsend->mtu = 512 ; + } + + if( strcmp( payload_type_str, "mp3" ) == 0 ) { + rtpsend->payload_type = PAYLOAD_MPA ; + rtpsend->layer = 3 ; + rtpsend->mtu = 512 ; + } + + if( strcmp( payload_type_str, "mpeg1" ) == 0 ) { + rtpsend->payload_type = PAYLOAD_MPV ; + rtpsend->layer = 1 ; + rtpsend->mpeg_bool1 = FALSE ; + rtpsend->mtu = 1024 ; + } + + if( strcmp( payload_type_str, "mpeg2" ) == 0 ) { + rtpsend->payload_type = PAYLOAD_MPV ; + rtpsend->layer = 2 ; + rtpsend->mpeg_bool1 = FALSE ; + rtpsend->mtu = 1024 ; + } + + if( strcmp( payload_type_str, "mpeg1_sys" ) == 0 ) { + rtpsend->payload_type = PAYLOAD_BMPEG ; + rtpsend->layer = 1 ; + rtpsend->mpeg_bool1 = TRUE ; + rtpsend->mtu = 1024 ; + } - if( strcmp( payload_type_str, "mpeg" ) == 0 ) - rtpsend->payload_type = PAYLOAD_MPV ; + if( strcmp( payload_type_str, "mpeg2_sys" ) == 0 ) { + rtpsend->payload_type = PAYLOAD_BMPEG ; + rtpsend->layer = 2 ; + rtpsend->mpeg_bool1 = TRUE ; + rtpsend->mtu = 1024 ; + } if( strcmp( payload_type_str, "raw_audio" ) == 0 ) - rtpsend->payload_type = PAYLOAD_L16_MONO ; - + rtpsend->payload_type = PAYLOAD_L16_MONO ; + break; case ARG_MTU: rtpsend->mtu = g_value_get_int (value); @@ -337,25 +421,62 @@ gst_rtpsend_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GstRtpSend *rtpsend; - + GSList *iterator; + gchar *ip1 = NULL, *ip2 = NULL; + /* it's not null if we got it, but it might not be ours */ g_return_if_fail(GST_IS_RTPSEND(object)); rtpsend = GST_RTPSEND(object); switch (prop_id) { + case ARG_IP_LIST: + g_value_set_pointer( value, rtpsend->ip ); + break; case ARG_IP: - g_value_set_string (value, rtpsend->ip); + for( iterator = rtpsend->ip ; iterator ; + iterator = g_slist_next( iterator ) ) { + if( ip1 == NULL ) { + ip1 = (gchar *)iterator->data; + } + else { + /* This code is'nt as silly as it seems: */ + g_free( ip2 ); + ip2 = ip1; + ip1 = g_strjoin( ",", ip1, (gchar *)iterator->data, NULL ); + } + } + g_value_set_string( value, ip1 ); break; case ARG_PORT: g_value_set_int (value, rtpsend->port); break; case ARG_PAYLOAD_TYPE: if( rtpsend->payload_type == PAYLOAD_GSM ) - g_value_set_string (value, "gsm" ); + g_value_set_string (value, "gsm" ); - if( rtpsend->payload_type == PAYLOAD_MPA ) - g_value_set_string (value, "mp3" ); + if( rtpsend->payload_type == PAYLOAD_MPA ) { + if( rtpsend->layer == 1 ) + g_value_set_string (value, "mp1" ); + if( rtpsend->layer == 2 ) + g_value_set_string (value, "mp2" ); + if( rtpsend->layer == 3 ) + g_value_set_string (value, "mp3" ); + } + if( rtpsend->payload_type == PAYLOAD_MPV ) { + if( rtpsend->layer == 1 ) + g_value_set_string (value, "mpeg1" ); + if( rtpsend->layer == 2 ) + g_value_set_string (value, "mpeg2" ); + } + + if( rtpsend->payload_type == PAYLOAD_BMPEG ) { + if( rtpsend->layer == 1 ) + g_value_set_string (value, "mpeg1_sys" ); + if( rtpsend->layer == 2 ) + g_value_set_string (value, "mpeg2_sys" ); + } + if( rtpsend->payload_type == PAYLOAD_L16_MONO ) g_value_set_string (value, "raw_audio" ); @@ -380,10 +501,10 @@ GST_DEBUG (0,"state pending %d\n", GST_STATE_PENDING (element)); - /* if going down into NULL state, close the file if it's open */ switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: + rtp_client_connection (&rtpsend->conn); if (rtp_connection_call(&rtpsend->conn,rtpsend->ip,rtpsend->port )) { @@ -391,6 +512,7 @@ message.socket_closed = FALSE ; message.payload_type = g_htonl( rtpsend->payload_type ); + message.mtu = g_htonl( rtpsend->mtu ); message.frequency = g_htonl( rtpsend->frequency ); message.layer = rtpsend->layer ; message.mpeg_bool1 = rtpsend->mpeg_bool1 ; @@ -409,7 +531,7 @@ /*shout_disconnect (&icecastsend->conn);*/ message.socket_closed = TRUE ; rtcp_send( &rtpsend->conn, message ) ; - close( rtpsend->conn.rtp_sock ) ; + rtp_close_all( &rtpsend->conn ); break; default: Index: gstrtpsend.h =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/plugins/rtp/gstrtpsend.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gstrtpsend.h 2001/11/13 22:14:09 1.2 +++ gstrtpsend.h 2001/12/02 16:40:02 1.3 @@ -47,7 +47,7 @@ gboolean mpeg_bool1 ; /* MPA & MPV*/ gboolean mpeg_bool2 ; /* MPV */ - gchar *ip; + GSList *ip; guint port; guint mtu; @@ -73,7 +73,8 @@ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTPSEND)) gboolean gst_rtpsend_plugin_init (GModule *module, GstPlugin *plugin); - +void gst_rtpsend_add_address (GstRtpSend *send, gchar* address); +void gst_rtpsend_remove_address (GstRtpSend *send, gchar* address); #ifdef __cplusplus } Index: rtp.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/plugins/rtp/rtp.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- rtp.c 2001/11/13 22:14:09 1.2 +++ rtp.c 2001/12/02 16:40:02 1.3 @@ -36,7 +36,7 @@ } if (!host) { - herror("error looking up host"); + g_warning( "error looking up host: %s", host_name ); return 0; } @@ -51,6 +51,8 @@ gpointer buf, int nbytes, rtp_payload_t pt, guint32 nsamp) { + GSList *addresses; + struct sockaddr_in *addr; static int i = 0 ; Rtp_Packet packet; @@ -66,29 +68,50 @@ rtp_packet_set_seq(packet, g_htons( sen->seq ) ); rtp_packet_set_timestamp(packet, g_htonl( sen->timestamp ) ); - /* including test for a test, plz remove( i varriable too ) if i forget to */ - if( i == 3 ) - ++sen->seq ; - - if( i == 5 ) - ++sen->seq ; - - i++ ; // Test code end. - ++sen->seq; sen->timestamp += nsamp; g_memmove(rtp_packet_get_payload(packet), buf, nbytes); - sen->addr.sin_port = g_htons(sen->port); - rtp_packet_send(packet, sen->rtp_sock, (struct sockaddr *)&sen->addr, - sizeof( sen->addr ) ); + + for( addresses = sen->addresses; + addresses; addresses = g_slist_next( addresses ) ) { + addr = (struct sockaddr_in*)addresses->data; + //g_print( "sending packet with seq. #%d", sen->seq ); + addr->sin_port = g_htons(sen->port); + rtp_packet_send(packet, sen->rtp_sock, (struct sockaddr *)addr, + sizeof( struct sockaddr_in ) ); + } + ++sen->packets_sent; sen->octets_sent += rtp_packet_get_packet_len(packet); + //g_print( "sent rtp packet\n" ); rtp_packet_free(packet); } Rtp_Packet +rtp_really_receive( rtp_receiver_info* recv_info, guint32 mtu ) +{ + Rtp_Packet packet; + guint32 packet_size ; + struct sockaddr_in from_addr ; + socklen_t from_len = sizeof( from_addr ); + + packet = rtp_packet_read( recv_info->rtp_sock, + (struct sockaddr *)&from_addr, + &from_len ); + packet_size = rtp_packet_get_payload_len( packet ) ; + + if( packet_size > mtu ) + g_warning( "Recieved RTP Packet's size is larger than MTU\n" ) ; + + ++recv_info->packets_sent; + recv_info->octets_sent += packet_size; + + return packet; +} + +Rtp_Packet rtp_receive( rtp_receiver_info* recv_info, guint32 mtu ) { /* I am including a packet sequencing code of mine, if you dont like @@ -105,15 +128,12 @@ Rtp_Packet packet; guint16 seq; guint8 i; - guint32 packet_size ; - struct sockaddr_in from_addr ; - socklen_t from_len = sizeof( from_addr ); + //guint32 packet_size ; + //struct sockaddr_in from_addr ; + //socklen_t from_len = sizeof( from_addr ); if( !missed ) { - packet = rtp_packet_read( recv_info->rtp_sock, - (struct sockaddr *)&from_addr, - &from_len ); - packet_size = rtp_packet_get_payload_len( packet ) ; + packet = rtp_really_receive( recv_info, mtu ) ; seq = g_ntohs( rtp_packet_get_seq( packet ) ) ; //g_print( "no miss %d\n", seq ) ; @@ -125,7 +145,7 @@ } else if( recv_info->seq+1 != seq ) { - //g_print( "seq %d %d\n", recv_info->seq, seq ) ; + g_print( "seq %d %d\n", recv_info->seq, seq ) ; missed = TRUE ; missing = (recv_info->seq+1 ) % BUFF_SIZE ; last = (recv_info->seq ) % BUFF_SIZE ; @@ -161,10 +181,7 @@ } } else { - packet = rtp_packet_read( recv_info->rtp_sock, - (struct sockaddr *)&from_addr, - &from_len ); - packet_size = rtp_packet_get_payload_len( packet ) ; + packet = rtp_really_receive( recv_info, mtu ) ; seq = g_ntohs( rtp_packet_get_seq( packet ) ); if( seq % BUFF_SIZE == last ) @@ -176,7 +193,9 @@ } } - /*packet = rtp_packet_read( recv_info->rtp_sock, &from_addr ) ; + /* packet = rtp_packet_read( recv_info->rtp_sock, + (struct sockaddr *)&from_addr, + &from_len ); packet_size = rtp_packet_get_payload_len( packet ) ; if( packet_size > mtu ) @@ -195,6 +214,8 @@ rtcp_send( rtp_sender_info* sen, Rtcp_APP_message message ) { Rtcp_Compound compound; + GSList *addresses; + struct sockaddr_in *addr; compound = rtcp_compound_new_allocate(RTP_MTU); rtcp_compound_add_sr(compound, sen->ssrc, sen->timestamp, @@ -203,14 +224,21 @@ rtcp_compound_add_app(compound, sen->ssrc, App_Name, &message, sizeof message ) ; - sen->addr.sin_port = g_htons(sen->port+1); - g_print("Sending rtcp message...\n" ); - rtcp_compound_send(compound, sen->rtp_sock, - (struct sockaddr *)&(sen->addr), - sizeof( struct sockaddr_in ) ); - - sen->addr.sin_port = g_htons(sen->port); + + for( addresses = sen->addresses ; + addresses ; addresses = g_slist_next( addresses ) ) { + addr = (struct sockaddr_in*)addresses->data; + addr->sin_port = g_htons(sen->port+1); + g_print("Sending rtcp message...\n" ); + + rtcp_compound_send(compound, sen->rtp_sock, + (struct sockaddr *)addr, + sizeof( struct sockaddr_in ) ); + addr->sin_port = g_htons(sen->port); + } + + g_print( "sent rtcp compound\n" ); rtcp_compound_free(compound); } @@ -265,15 +293,26 @@ void rtp_client_connection( rtp_sender_info* sen) { + GSList *addresses; + g_print( "initializing socket\n" ) ; if ((sen->rtp_sock = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { g_print("open_sockets : Send_Sock"); } + + for( addresses = sen->addresses ; + addresses ; addresses = g_slist_next( addresses ) ) { + g_free( addresses->data ); + } + + g_slist_free( sen->addresses ); + + sen->addresses = NULL; } void rtp_server_connection( rtp_receiver_info* recv) { - + /* RTP Socket */ if ((recv->rtp_sock = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { g_print("open_sockets : RTP Sock"); @@ -300,22 +339,42 @@ int rtp_connection_call( rtp_sender_info* sen, - gchar *hostname, + GSList *hostnames, guint port ) { + GSList *names = hostnames; + gchar *host; struct in_addr call_host; /* host info of computer to call */ + struct sockaddr_in *addr; + int i = 0, ret = 0 ; + + + for( names = hostnames; + names; names= g_slist_next( names ) ) { + host = (gchar *)names->data ; + + if( ( i = find_host(host, &call_host ) ) ) { + g_print( "found host %s\n", host ) ; - if (find_host(hostname, &call_host)) { - sen->addr.sin_family = AF_INET; - sen->addr.sin_port = g_htons( port ); - - g_memmove(&sen->addr.sin_addr.s_addr, - &call_host, sizeof (struct in_addr)); - + addr = g_malloc( sizeof( struct sockaddr_in ) ); + + addr->sin_family = AF_INET; + addr->sin_port = g_htons( port ); + g_memmove(&addr->sin_addr.s_addr, + &call_host, sizeof (struct in_addr)); + + sen->addresses = g_slist_append( sen->addresses, addr ); + } + + ret = ret | i; + } + + if( ret ) + { sen->seq = random32(1); sen->ssrc = random32(2); sen->timestamp = random32(3); - sen->hostname = g_strdup(hostname); + //sen->hostname = g_strdup(hostname); sen->port = port; sen->packets_sent = 0; return 1; @@ -341,3 +400,20 @@ return 1; } + +void rtp_close_all( rtp_sender_info *sen) +{ + GSList *addresses; + + close( sen->rtp_sock ) ; + sen->rtp_sock = 0 ; + + for( addresses = sen->addresses; addresses; + addresses = g_slist_next( addresses ) ) { + g_free( addresses->data ); + } + + g_slist_free( sen->addresses ); + sen->addresses = NULL; +} + Index: rtp.h =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/plugins/rtp/rtp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- rtp.h 2001/11/13 22:14:09 1.2 +++ rtp.h 2001/12/02 16:40:02 1.3 @@ -54,6 +54,8 @@ /* Video: */ PAYLOAD_MPV = 32, /* Video MPEG-1 & 2 */ +/* BOTH */ + PAYLOAD_BMPEG = 34 /* Not Standard */ } rtp_payload_t; typedef struct rtp_info rtp_sender_info ; @@ -62,7 +64,8 @@ struct rtp_info { int rtp_sock; - int rtcp_sock; // We only need this in rtp_receiver + int rtcp_sock; // We only need this in rtp_receiver + GSList *addresses; // For enabling rtp_sender for multicast struct sockaddr_in addr; guint32 ssrc; guint16 seq; @@ -77,8 +80,9 @@ { /* Rtp */ gboolean socket_closed ; - guint32 packets_sent ; - + guint32 packets_sent ; + guint mtu ; + rtp_payload_t payload_type ; /* media type */ guint frequency ; /* OSS, GSM & MPA*/ @@ -113,11 +117,13 @@ int rtp_connection_call( rtp_sender_info* sen, - gchar *hostname, + GSList *hostnames, guint port ); int rtp_server_init( rtp_receiver_info* recv, guint port ); +void +rtp_close_all( rtp_sender_info *sen); #endif |