You are on page 1of 85

MEDIA RATE ALLOCATION

A PROJECT REPORT

Submitted by

P.BALASUBRAMANIAN (32205205004) R.VIGNESWARAN (32205205302)


in the partial fulfillment for the award of the degree of

BACHELOR OF TECHNOLOGY
In

INFORMATION TECHNOLOGY DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY: Mamallapuram

ANNA UNIVERSITY: CHENNAI 600025


APRIL 2009

ANNA UNIVERSITY: CHENNAI 600 025

BONAFIDE CERTIFICATE

Certified that this project report MEDIA RATE ALLOCATION is the bonafide work of P.BALASUBRAMANIAN (32205205004), R.VIGNESWARAN (32205205302) who carried out the project work under my supervision.
SIGNATURE Ms.D.Jansi Rani HEAD OF THE DEPARTMENT Department of Information Technology Dhanalakshmi Srinivasan College of Engineering and Technology, Mamallapuram. SIGNATURE Ms.T.Yogeswari SUPERVISOR Department of Information Technology Dhanalakshmi Srinivasan College of Engineering and Technology, Mamallapuram.

Submitted for the project viva voce examination held on ____________ INTERNAL EXAMINER EXAMINER EXTERNAL

ACKNOWLEDGEMENT

We are glad to take this opportunity to cordially acknowledge a number of people who provide me with great support in these six months. First, we would like to thank Mr.A.Srinivasan, our Chairman who allowed me to do the project in the college campus. We are also thankful to Dr.R.Ponraj M.Tech Ph.D., our Principal, for his constant support in selecting the project. We wish to express my sincere gratitude to our respected Vice Principal, Mr.Pon.Arivanandham M.E, PhD., for his continued encouragement and support. We are grateful to Lecturer Ms.D.Jansi Rani M.Tech., our Head of the Department, who expressed her interest in my work and supplied me with some of her recent works. We would like to thank Lecturer Ms.T.Yogeswari B.E., for following my project with interest and for giving me constant support. Furthermore, we would like to thank all my Lectures, Lab Technicians and My Friends for their timely help in solving my project queries.

ABSTRACT

Aim of our project is to transfer the video files in an intranet application that multiple clients can receive through single channel with effective usage of bandwidth by using Real time Transport Protocol and Java Media Framework. In our project we can send the video files in to any number of clients from one machine without any default messages. Then here we can send the video files in same machine, at this time same machine act as both sender and receiver. For our project only we need one transmitter side machine, and some receiver side machines. These machines are should be connected in an intranet connection. Then we need movie files for transmission and digital camera if using. So with the help of these items we can execute our project.

This application used to transfer the video file in compressed formative (Video Broadcasting) a deployment solution for Java-technology-based applications. It is the plumbing between the computer and the network that allows the user to launch and manage applications right off the Network. It provides easy access to applications, and guarantees that users are always running the video. Which then automatically downloads, caches, and runs the given Video application. The entire process is typically completed without requiring any user interaction.

CHAPTER I

INTRODUCTION

CHAPTER I 1.1 DEFINITION


Here we are going to transmit video files between transmitter and receiver in an intranet. In the transmitter side machine, Initially user wants the ip address and port number of the target machine that is receiver side machine.The transmitter can capable of storing the movie file in the local machine in to remote machine. Then in the transmitter side machine we are using two protocols, They are Video For window(VFW) and Real Time Transport Protocol(RTP). By using the VFW we sends entire movie files into RTP.So,now all the movie files are placed in the RTP. From the RTP we are going to transmit the movie files in to the receiver side machines.RTP sends entire movie files as packet by packet.Each packet consists of side machine by packet by packet. In the receiver side machine also ,Initially the user wants the ip address and port number of thre transmitter side machine.So now the communication is established between the transmitter side machine and receiver side machine.Here in the receiver side machine also we are using the Video For Window and Realtime Transport Protocol.Then the receiver eight bytes of data. Now transmitter side RTP ready for transmit entire movie files into the receiver

side RTP receives entire movie files as packet by packet.So now we are having entire movie files in the receiver side RTP without any corruption. Then all the movie files are given to the VFW.Then this VFW gives entire movie files into the Java Media Framework(JMF).Java Media Framework enables audio and video files into the users .So by using this JMF the user can see the entire movie files.Here in this project we can transmit the movie files in the same machine.Here one machine act as both transmitter and receiver. 1.2 SYSTEM REQUIREMENTS: 1.2.1 HARDWARE SPECIFICATION Processor Speed RAM Monitor Keyboard Mouse Printer : : : : : : : Intel Pentium IV Processor 3.0 GHz HT 2 GB RAM 15 SAMSUNG Color Monitor Keyboard with 108 Keys Logitech Optical SAMSUNG 6100 Laser

1.2.2 SOFTWARE SPECIFICATION Operating System Front End Packages Tool Back End FEASIBILITY STUDY
7

: : : : :

Windows XP Java ,JDK 1.5 Swing,.Net,JMF Net Beans 5.5.JMF My SQL

1.3

This project make use of a new and evolving protocol named RTP. RTP, the real-time transport protocol. RTP provides end-to-end network transport functions suitable for applications transmitting real-time data, such as audio, video or simulation data, over multicast or unicast network services.The packet size of RTP is 8 bytes. The data transport is augmented by a control protocol (RTCP) to allow monitoring of the data delivery in a manner scalable to large multicast networks, and to provide minimal control and identification functionality. RTP and RTCP are designed to be independent of the underlying transport and network layers. The protocol supports the use of RTP-level translators and mixers. If both audio and video media are used in a conference, they are transmitted as separate RTP sessions RTCP packets are transmitted for each medium using two different UDP port pairs and/or multicast addresses. There is no direct coupling at the RTP level between the audio and video sessions, except that a user participating in both sessions should use the same distinguished (canonical) name in the RTCP packets or both so that the sessions can be associated. One motivation for this separation is to allow some participants in the conference to receive only one medium if they choose.RTP consists of RTP payload: The data transported by RTP in a packet, for example audio samples or compressed video data.

Here we are done our project by using Java Media Framework and Real time Transport Protocol.The Java Media Framework API (JMF) enables audio, video and other time-based media to be added to applications and applets built on Java technology. This optional package, which can capture, playback, stream, and transcode multiple media formats. This project make use of a new and evolving protocol named RTP. RTP, the real-time transport protocol. RTP provides end-to-end network transport functions suitable for applications transmitting real-time data, such as audio, video or simulation data, over multicast or unicast network services.The packet size of RTP is 8 bytes. An one motivation for this separation is to allow some participants in the conference to receive only one medium if they choose. RTP consists of RTP payload: The data transported by RTP in a packet, for example audio samples or compressed video data. RTP packet: A data packet consisting of the fixed RTP header, a possibly empty list of contributing sources (see below), and the payload data. Some underlying protocols may require an encapsulation of the RTP packet to be defined. Typically one packet of the underlying protocol contains a single RTP packet, but several RTP packets may be contained if permitted by the encapsulation method.

RTCP packet: A control packet consisting of a fixed header part similar to that of RTP data packets, followed by structured elements that vary depending upon the RTCP packet type. Typically, multiple RTCP packets are sent together as a compound RTCP packet in a single packet of the underlying protocol; this is enabled by the length field in the fixed header of each RTCP packet.

Port: The "abstraction that transport protocols use to distinguish among multiple destinations within a given host computer. TCP/IP protocols identify ports using small positive integers." The transport selectors (TSEL) used by the OSI transport layer are equivalent to ports. RTP depends upon the lower-layer protocol to provide some mechanism such as ports to multiplex the RTP and RTCP packets of a session.

RTP supports two types of transmissions, a unicast method which allows for one client to connect and receive the transmission or there is a multicast method which allows multiple clients to connect to the server. Obviously the multicast allows for more flexibility with the allowance of more than a single user to get a stream, one of the advantages of the multicast method was that the destination IP address did not need to be known, you needed to supply the multicast address and then the associated port that the RTP session is supposed to run on. RTP is a protocol which essentially rides on top of a transport protocol such as UDP or TCP.

10

An RTP application creates RTP data packets which are then wrapped with TCP or UDP headers to create the desired packet or datagram. TCP or UDP is an ancient question in networking discussions. The benefits of TCP are of course the error checking and congestion control that it ensures. The problem is that in a real-time setting, those checks and balances can be quite costly and be the source of delay and jitter. While UDP makes absolutely no guarantee of time or control or sequencing or even an assurance that the datagram will arrive, it was chosen for it's simplicity and that it is a 'faster' protocol when compared to TCP. RTP packet: A data packet consisting of the fixed RTP header, a possibly empty list of contributing sources (see below), and the payload data. Some underlying protocols may require an encapsulation of the RTP packet to be defined. Typically one packet of the underlying protocol contains a single RTP packet, but several RTP packets may be contained if permitted by the encapsulation method. RTCP packet: A control packet consisting of a fixed header part similar to that of RTP data packets, followed by structured elements that vary depending upon the RTCP packet type. Typically, multiple RTCP packets are sent together as a compound RTCP packet in a single packet of the underlying protocol; this is enabled by the length field in the fixed header of each RTCP packet.Port:

11

The "abstraction that transport protocols use to distinguish among multiple destinations within a given host computer. TCP/IP protocols identify ports using small positive integers." The transport selectors (TSEL) used by the OSI transport layer are equivalent to ports. The RTP depends upon the lower-layer protocol to provide some mechanism such as ports to multiplex the RTP and RTCP packets of a session.RTP supports two types of transmissions, a unicast method which allows for one client to connect and receive the transmission or there is a multicast method which allows multiple clients to connect to the server. An Obviously the multicast allows for more flexibility with the allowance of more than a single user to get a stream, one of the advantages of the multicast method was that the destination IP address did not need to be known, you needed to supply the multicast address and then the associated port that the RTP session is supposed to run on.RTP is a protocol which essentially rides on top of a transport protocol such as UDP or TCP. 1.4 EXISTING SYSTEM Java Web Start (JWS) is an existing deployment solution for Javatechnology-based applications built-in with J2SDK. Java Web Start provides a platform-independent, Secure and robust deployment technology. It enables developer to deploy full-featured applications to end-users by making the application available on a standard web server with any web browser, end users can launch the application and be confident they always have the most recent version.

12

Java Web Start is an application-deployment technology that gives you the power to launch full-featured applications with a single click from your Web browser. Java Web Start includes the security features of the Java 2 platform, so the integrity of your data and files is never compromised. In addition, Java Web Start technology enables you to use the latest Java 2 technology with any browser. With Java Web Start, you launch applications simply by clicking on a Web page link. If the application is not present on your computer, Java Web Start automatically downloads all necessary files. It then caches the files on your computer so the application is always ready to be re-launched anytime you want either from an icon on your desktop or from the browser link. And no matter which method you use to launch the application, the most current version of the application is always presented to you. Java Web Start provides a platform-independent, secure, and robust deployment technology. It enables developers to deploy full-featured applications to end-users by making the applications available on a standard web server. With any web browser, end-users can launch the applications and be confident they always have the most-recent version. It's an easy, robust, and secure way to deploy applications directly from the web. Developers can make applications readily available via the web. In addition, Java Web Start provides Java runtime environment (JRE) management capabilities, it's easy to set up, it's browser-independent, and it's an efficient way to deploy web application solutions.

13

Users can easily access applications much as they would a web page-without a separate installation step. From the desktop, users can access and use Java applications, using a richer and more responsive user interface than is available on a web page. And, once a Java Web Start based application is installed, users simply click to run the application whenever needed. Users do not need to manually update applications because each time they launch an application, it is transparently updated from the web--so they always use the most recent version available. Java Web Start run on: Sun Microsystems provides versions for Windows 98/NT/2000/XP/2003, Solaris Operating Environment (SPARC and Intel editions) and Linux/i486. Apple provides a version for their OS X relese. Server requirements for Java Web Start: Java Web Start uses HTTP for communication between the client and the server. You can use a standard web server to host an application. If you require additional services, such as version-based downloading, incremental updates, or pack200 compression for your applications, the web server will need to support servlets or Java Server Pages. A sample servlet implementing these features is provided in the samples directory of the JDK.

14

1.5

PROPOSED SYSTEM Video Broadcasting provides the same benefits to full-featured

applications as described above for JAVA-based applications. VB is an application deployment solution for the N/W. Using a full-featured application instead of an JAVA-based client which can have many benefits: A highly interactive user interface, comparable to traditional applications, such as word processors and spreadsheets. Lower bandwidth requirements. An application does not necessarily have to connect back to the Web server on each click, and it can cache already-downloaded information. Thus, it can provide better interactivity on slow connections. Support for off-line use.

This system is very affordable to use in a very pleasing environment. Because of this feature, any user can easily adopt in this environment. Security: The application is handled in a secured manner suppose if any illegal local disk access will be performed, then it will ask user whether to permit or deny as a dialog.

15

CHAPTER II

SYSTEM ANALYSIS

16

SYSTEM CONFIGURATION

2.1

WORKING ENVIRONMENT

The development was done on the Windows 95 and Windows NT platforms. Developing in Java means that the code is cross-compiler and platform independent, because the Java language encapsulates the details of the host operating system, and presents a uniform standard interface to the developer. Code written in Java should be compiled by any tool, which compiles Java, on any platform. Plus, the Java Byte Code (thats the binary results of the compilation) should run on any machine supporting the Java Virtual Machine. Thats a plus when developing Internet related applications. Java Media Framework (JMF), It is used for enabling the audio and video. 2.2 SOFTWARE DESCRIPTION

2.2.1 OVERVIEW OF JAVA Java (with a capital J) is a high-level, third generation programming language, like C, Fortran, Smalltalk, Perl, and many others. You can use Java to write computer applications that crunch numbers, process words, play games, store data or do any of the thousands of other things computer software can do.

17

Compared to other programming languages, Java is most similar to C. However although Java shares much of C's syntax, it is not C. Knowing how to program in C or, better yet, C++, will certainly help you to learn Java more quickly, but you don't need to know C to learn Java. Unlike C++ Java is not a superset of C. A Java compiler won't compile C code, and most large C programs need to be changed substantially before they can become Java programs. What's most special about Java in relation to other programming languages is that it lets you write special programs called applets that can be downloaded from the Internet and played safely within a web browser. Traditional computer programs have far too much access to your system to be downloaded and executed willy-nilly. Although you generally trust the maintainers of various ftp archives and bulletin boards to do basic virus checking and not to post destructive software, a lot still slips through the cracks. Even more dangerous software would be promulgated if any web page you visited could run programs on your system. You have no way of checking these programs for bugs or for out-and-out malicious behavior before downloading and running them. Java solves this problem by severely restricting what an applet can do. A Java applet cannot write to your hard disk without your permission. It cannot write to arbitrary addresses in memory and thereby introduce a virus into your computer. It should not crash your system.

18

Java is an object-oriented programming language with a built-in application programming interface (API) that can handle graphics and user interfaces and that can be used to create applications or applets. Because of its rich set of API's, similar to Macintosh and Windows, and its platform independence, Java can also be thought of as a platform in itself. Java also has standard libraries for doing mathematics. Much of the syntax of Java is the same as C and C++. One major difference is that Java does not have pointers. However, the biggest difference is that you must write object oriented code in Java. Procedural pieces of code can only be embedded in objects. In the following we assume that the reader has some familiarity with a programming language. In particular, some familiarity with the syntax of C/C++ is useful. In Java we distinguish between applications, which are programs that perform the same functions as those written in other programming languages, and applets, which are programs that can be embedded in a Web page and accessed over the Internet. Our initial focus will be on writing applications. When a program is compiled, a byte code is produced that can be read and executed by any platform that can run Java. Java technology readily harnesses the power of the network because it is both a programming language and a selection of specialized platforms. As such, it standardizes the development and deployment of the kind of secure, portable, reliable, and scalable applications required by the networked economy. Because the Internet and World Wide Web play a major role in new business development, consistent and widely supported standard are critical to growth and success.
19

2.2.2 OVERVIEW OF SWING IN JAVA Swing is a widget toolkit for Java. It is part of Sun Microsystems' Java Foundation Classes (JFC) an API for providing a graphical user interface (GUI) for Java programs.Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit. Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform. Swing is a platform-independent, Model-View-Controller GUI framework for Java. It follows a single-threaded programming model, and possesses the following traits: Platform independence : Swing is platform independent both in terms of its expression (Java) and its implementation (non-native universal rendering of widgets). Extensibility : Swing is a highly partitioned architecture, which allows for the "plugging" of various custom implementations of specified framework interfaces: Users can provide their own custom implementation(s) of these components to override the default implementations. In general, Swing users can extend the framework by extending existing (framework) classes and/or providing alternative implementations of core components.

20

Component-oriented : Swing is a component-based framework. The distinction between objects and components is a fairly subtle point: concisely, a component is a well-behaved object with a known/specified characteristic pattern of behaviour. Swing objects asynchronously fire events, have "bound" properties, and respond to a well-known set of commands (specific to the component.) Specifically, Swing components are Java Beans components, compliant with the Java Beans Component Architecture specifications. Customizable : Given the programmatic rendering model of the Swing framework, fine control over the details of rendering of a component is possible in Swing. As a general pattern, the visual representation of a Swing component is a composition of a standard set of elements, such as a "border", "inset", decorations, etc. Typically, users will programmatically customize a standard Swing component (such as a JTable) by assigning specific Borders, Colors, Backgrounds, opacities, etc., as the properties of that component. The core component will then use these property (settings) to determine the appropriate renderers to use in painting its various aspects. However, it is also completely possible to create unique GUI controls with highly customized visual representation.

21

Configurable : Swing's heavy reliance on runtime mechanisms and indirect composition patterns allows it to respond at runtime to fundamental changes in its settings. For example, a Swing-based application can change its look and feel at runtime. Further, users can provide their own look and feel implementation, which allows for uniform changes in the look and feel of existing Swing applications without any programmatic change to the application code. 2.2.3 OVERVIEW OF JAVA MEADIA FRAMEWORK (JMF) The Java Media Framework (JMF) is a recent API for Java dealing with real-time multimedia presentation and effects processing. JMF handles time-based media, media which changes with respect to time. Examples of this are video from a television source, audio from a raw-audio format file and animations. The beta JMF 2.0 specification will be used for this report, as they currently reflect the features that will appear in the final version. Stages : The JMF architecture is organized into three stages: During the input stage, data is read from a source and passed in

22

The processing stage consists of a number of codecs and effects designed to modify the data stream to one suitable for output. These codecs may perform functions such as compressing or decompressing the audio to a different format, adding a watermark of some kind, cleaning up noise or applying an effect to the stream (such as echo to the audio). Once the processing stage has applied its transformations to the stream, it passes the information to the output stage. The output stage may take the stream and pass it to a file on disk, output it to the local video display or transmit it over the network. For example, a JMF system may read input from a TV capture card from the local system capturing input from a VCR in the input stage. It may then pass it to the processing stage to add a watermark in the corner of each frame and finally broadcast it over the local Intranet in the output stage.

23

============ Building JMF ============ Solaris: Requires: - A JavaSound build, JDK 1.3+ or use the SCSL source. - JDK 1.2.2 or above - Sparc compilers 4.x and above - gnumake Script template: doc/buildinfo/buildjmf.sh-template Linux: Requires: - A JavaSound build, JDK 1.3+ or use the SCSL source. - JDK 1.2.2 or above - GNU C/C++ compilers - GNU make Script template: doc/buildinfo/buildjmf.sh-template Windows: Requires: - A JavaSound build, JDK 1.3+ or use the SCSL source. - JDK 1.2.2 or above - Visual Studio 6.0 or above. Script template: doc/buildinfo/buildjmf.bat-template Modify the script templates to adapt to your environment. =========== Running JMF =========== Solaris: - set your CLASSPATH to: $JMFHOME/build/solaris/image/lib/jmf.jar: $JMFHOME/build/solaris/image/lib/sound.jar - add to your LD_LIBRARY_PATH: $JMFHOME/build/solaris/image/lib

24

Linux: - set your CLASSPATH to: $JMFHOME/build/linux/image/lib/jmf.jar: $JMFHOME/build/linux/image/lib/sound.jar - add to your LD_LIBRARY_PATH: $JMFHOME/build/linux/image/lib Windows: - set your CLASSPATH to: %JMFHOME%\build\win32\image\lib\jmf.jar;%JMFHOME %\build\win32\image\lib\sound.jar - add to your path: %JMFHOME%\build\win32\image\lib JMStudio is a demo app showcasing the capabilities of JMF. doc/buildinfo/runjmf.sh-template doc/buildinfo/runjmf.bat-template are sample scripts to run JMStudio. JMFRegistry is an app to view the plugins installed on your JMF installation.

25

2.3

RTCP: Real Time Transport Control Protocol (or RTP Control Protocol) The Real Time Transport Control Protocol (RTP control protocol or

RTCP) is based on the periodic transmission of control packets to all participants in the session, using the same distribution mechanism as the data packets. The underlying protocol must provide multiplexing of the data and control packets, for example using separate port numbers with UDP. RTCP performs four functions: 1. RTCP provides feedback on the quality of the data distribution. This is an integral part of the RTP's role as a transport protocol and is related to the flow and congestion control functions of other transport protocols. 2. RTCP carries a persistent transport-level identifier for an RTP source called the canonical name or CNAME. Since the SSRC identifier may change if a conflict is discovered or a program is restarted, receivers require the CNAME to keep track of each participant. Receivers may also require the CNAME to associate multiple data streams from a given participant in a set of related RTP sessions, for example to synchronize audio and video.

26

3. The first two functions require that all participants send RTCP packets, therefore the rate must be controlled in order for RTP to scale up to a large number of participants. By having each participant send its control packets to all the others, each can independently observe the number of participants. This number is used to calculate the rate at which the packets are sent. 4. An OPTIONAL function is to convey minimal session control information, for example participant identification to be displayed in the user interface. This is most likely to be useful in "loosely controlled" sessions where participants enter and leave without membership control or parameter negotiation. Functions SHOULD be used in all environments, but particularly in the IP multicast environment. RTP application designers SHOULD avoid mechanisms that can only work in unicast mode and will not scale to larger numbers.

27

2.4

Component Architecture: JMF is built around a component architecture. The compenents are

organized into a number of main categories:


Media handlers Data sources Codecs/Effects Renderers Mux/Demuxes

Media Handlers : MediaHandlers are registered for each type of file that JMF must be able to handle. To support new file formats, a new MediaHandler can be created. Data Sources : A DataSource handler manages source streams from various inputs. These can be for network protocols, such as http or ftp, or for simple input from disk. Codecs/Effects : Codecs and Effects are components that take an input stream, apply a transformation to it and output it. Codecs may have different input and output formats, while Effects are simple transformations of a single input format to an output stream of the same format.

28

Renderers : A renderer is similar to a Codec, but the final output is somewhere other than another stream. A VideoRenderer outputs the final data to the screen, but another kind of renderer could output to different hardware, such as a TV out card. Mux/Demuxes : Multiplexers and Demultiplexers are used to combine multiple streams into a single stream or vice-versa, respectively. They are useful for creating and reading a package of audio and video for saving to disk as a single file, or transmitting over a network. Presenting Data : The Java Media Framework provides a number of pre-built classes that handle the reading, processing and display of data. Using the Player, media can easily be incorporated into any graphical application (AWT or Swing). The Processor allows you to control the encoding or decoding process at a finer level than the Player, such as adding a custom codec or effect between the input and output stages. The JMF API specifies a simple, unified architecture to synchronize and control audio, video, and other time-based data within Java applications and applets. JMF software, documentation, sample programs, and the source code can be downloaded from Sun's Web site at java.sun.com/products/javamedia/jmf.

29

In this section, we'll briefly discuss the basic concepts of JMF, including a few useful classes required to build a Web conferencing application: 1. The DataSource class is an abstraction that represents audio, video, or a combination of both. A data source can be a file or a stream and is constructed from the Manager and MediaLocator as follows: DataSource ds =

javax.media.Manager.createDataSource(mediaLocator); Here, MediaLocator is a class that JMF uses to represent audio or video media location and is created as follows: MediaLocator mediaLocator = new MediaLocator("vfw://0"); 2. The Player class is used to play media files or stream media. A player is constructed from MediaLocator or the media URL as follows: Player player = Manager.createPlayer(mediaLocator); Once the player is realized (ready to play state), you can call player.start() to play the media. A realized player can be created from the DataSource: Player player = Manager.createRealizedPlayer(ds); 3. A processor is a type of player. Besides playing the media, it can also output media through a DataSource to another player or processor.

30

A processor is used to manipulate the data and convert the data from one format to another. It's created from the DataSource, MediaLocator, or a URL: Processor processor = Manager.createProcessor(new

URL("http://localhost/test.mov)); 4. A manager is one of the most important classes of JMF. It handles the construction of players, processors, and DataSources, as we have seen earlier. 2.5 ARCHITECTURE DESCRIPTION: The architecture of our approach is shown in Figure 1. It implements a Web conferencing application over HTTP. The architecture has one centralized server and one or many distributed clients. The server has a Web server and a servlet container. Clients run two applets, one for capturing media and the other for playing the media. The high level steps are: 1. The applet continuously captures video and audio streams from the Webcam. These streams are saved locally in a specified format as a file every few seconds. This file is uploaded to the server over HTTP using a file upload servlet. Uploading uses a separate thread. A significant loss of frames will result if the file upload is in the same thread as file capture. Note that a more efficient method would be to write these streams directly on the server using a socket.

31

This is currently not possible because the DataSource class provided with JMF does not contain a method to get the InputStream. A custom InputStream-based DataSource can be developed. 2. A server gets a new file clip from the sender and stores it in a sender-specific directory. A counter, such as filename+i, is attached to the filename. 3. The JMF Player applet continuously downloads new files from the Web server. It uses JMF's perfecting capability to play these clips in a continuous manner. When the current clip is being played, a new instance of Player is created for the next clip and the next clip is downloaded from the server. This makes the playing of clips continuous, as the next clip to be played has already been prefetched. Note that the entire clip is downloaded by the player applet before playing it. At the start of playing and during the process of fetching a new clip, the player applet checks new file availability for n seconds before timing out. 2.6 MOV FORMAT MOV video file is a file format used by the QuickTime-wrapped files. QuickTime Content (.mov, .qt), developed by Apple Computer, is a file format for storing and playing back movie with sound. This flexible format isn't limited to Macintosh operating systems. It's also commonly used in Windows systems, and other types of computing platforms.

32

MOV video file functions as a multimedia container file that contains one or more tracks, each of which stores a particular type of data: audio, video, effects, or text (e.g. for subtitles). Each track either contains a digitally-encoded media stream (using a specific codec) or a data reference to the media stream located in another file. Tracks are maintained in a hierarchal data structure consisting of objects called atoms. An atom can be a parent to other atoms or it can contain media or edit data, but it cannot do both. The ability to contain abstract data references for the media data, and the separation of the media data from the media offsets and the track edit lists means that QuickTime is particularly suited for editing, as it is capable of importing and editing in place (without data copying). Other later-developed media container formats such as Microsoft's Advanced Systems Format or the open source Ogg and Matroska containers lack this abstraction, and require all media data to be rewritten after editing. Other file formats that QuickTime supports natively (to varying degrees) include WAV, MP3, and MPEG-1. With additional QuickTime Extensions, it can also support Ogg, ASF, FLV, MKV, DivX Media Format, and others.

33

2.7

VIDEO CONVERTER: Video Converter is the best video conversion software with all

decoders and encoders built in, no more codec needed. It supports almost all video formats as input files such as QuickTime(MOV,QT), 3GP/3GPP, 3G2/3GP2, MJPEG, AVI, DivX, XviD, MPG, MPEG(MPEG-1/2), DAT, FLV, MKV, M4V, VOB, WMV, MP4, ASF, TS, MPEG4 AVC, DVR-MS, H.263, H.264 at an unmatchable speed and high quality, Vista supported. RER Video Converter can convert any video format to MOV video file, and convert MOV videos to any other video format. MOV CONVERTER MOV Converter helps you a lot by converting almost all popular video formats to MOV video file and convert MOV video file to popular video/audio formats to meet your needs - convert MOV videos to one of the compression formats - AVI, convert .MOV video file to 3GP extension file to play video files on your cellphone, convert MOV video file to FLV format to upload videos to the notable video websites supporting FLV video - YouTube, Myspace, Google Video and Yahoo! Video, and convert MOV video file to MP3, MP4, 3GP, 3G2, MPEG, MPG, VOB, AVI, ASF, WMV, FLV, H.264, MJPEG as you like.

34

Functionality Unlike Java applets, Web Start applications do not run inside the browser, and the sandbox in which they run need not have as many restrictions, although this can be configured. Web Start has an advantage over appl$ets in that it overcomes many compatibility problems with browsers' Java plugins and different JVM versions. On the other hand, Web Start programs cannot communicate with the browser as easily as applets. To assist migration, users can also invoke a Java Applet as a Java Web Start application. Implementation Java Web Start provides a series of classes in the javax.jnlp package which provide various services to the application. Sun designed most of these services with the aim of allowing carefully controlled access to resources (such as files and the system clipboard) while restricting the application to authorized operations. Sun introduced version 1.0 of Web Start in March 2001.[1] Since J2SE 1.4 Web Start comes as a default part of Java Runtime Environment (JRE) called javaws, and computer administrators no longer have to install it separately.

35

2.8

SYSTEM DESIGN

INPUT DESIGN: Live Videos Files are through the LAN Via is accepted only if the validations are true Like Port and IP Address. Process can be done through acknowledgement with Sender Processing Code Seen Your Window.

OUTPUT DESIGN: Output designs are retrieved from the Video Files are through the LAN Connection using well define RTP and JMF formulas. These outputs can predict by the users and the user can customize the video file viewing. The Video Files are Easily run in with out Media Player.

CLASS STRUCTURE: The classes can be segregated by nature of behavior and their process. The following are the classes involved in process life cycle.

2.9

SYSTEM DESCRIPTION

Main Modules: Transmitter Receiver RTCP Monitor AV Transmitters

36

2.9.1 Transmitter:

In the transmitter side machine,Initially user wants the ip address and port number of the the target machine that is receiver side machine. The transmitter can capable of storing the movie file in the local machine in to remote machine. Then in the transmitter side machine we are using two protocols,They are Video For Window(VFW) and Real Time Transport Protocol(RTP). By using the VFW we sends entire movie files into RTP.So,now all the movie files are placed in the RTP. From the RTP we are going to transmit the movie files in to the receiver side machines.RTP sends entire movie files as packet by packet.Each packet consists of eight bytes of data. Now transmitter side RTP ready for transmit entire movie files into the receiver side machine by packet by packet.

37

38

2.9.2 Receiver: In the receiver side machine also ,Initially the user wants the ip address and port number of thre transmitter side machine.So now the communication is established between the transmitter side machine and receiver side machine. Here in the receiver side machine also we are using the Video For Window and Realtime Transport Protocol. Then the receiver side RTP receives entire movie files as packet by packet.So now we are having entire movie files in the receiver side RTP without any corruption. Then all the movie files are given to the VFW.Then this VFW gives entire movie files into the Java Media Framework(JMF). Java Media Framework enables audio and video files into the users .So by using this JMF the user can see the entire movie files. Here in this project we can transmit the movie files in the same machine.Here one machine act as both transmitter and receiver.Here the ip address and port numbers are same. transmitter side and receiver side. And also one Realtime Transport Protocol,one video for window and one java media framework is used both

39

RECIEVERE VIDEO FLOW DIAGRAM: RTP = REAL TIME PROTOCOL VFW = VIDEO FOR WINDOW

RTP

VFW

RECIEVER PORT

RECIEVER

VIDEO FILE

40

2.9.3 RTCP Monitor: RTCP monitor scans the data transferrd from port.When ever any media streams have been transferred across the receiver application and transmittrer application.It just track the data transferred from the sender application. RTCP monitor is adapted in both sender side as well as the receiver side.In both side it will report the information passed across the channel. 2.9.4 AV Transmitter The AV transmitter can capable of storing the movie file in the local machine in to remote machine.Then in the transmitter side machine we are using two protocols,They are Video For Window(VFW) and Real Time Transport Protocol(RTP).By using the VFW we sends entire movie files into RTP.So,now all the movie files are placed in the RTP.From the RTP we are going to transmit the movie files in to the receiver side machines. 2.10 RATE ALLOCATION ALGORITHM: This section presents a simple algorithm that computes the optimal rate allocation for the optimization problem. The previous theorems and conditions for termination represent the keys for a fast search through the flow tree. Assume that the server knows, or can predict the parameters of the intermediate network links, and the sequence-dependent distortion. In case where two network paths have the same end-to-end loss probability, they are considered as a single path with aggregated bandwidth.

41

42

2.11 TESTING 2.11.1 SYSTEM TESTING The System Testing is used to find the integration of each module in the system. It is also tested to find discrepancies between the system and its original objectives, current specification and system documentation. System Testing is a series of different tests whose primary purpose is to fully exercise the computer-based system. Testing is used to find the compatibility between the various program units available in the system. The System test will focus on the behavior of the application and system as a whole. Scenarios will be executed Within the application Through file transfers Reports generation Other outputs or data checks To verify that the system successfully accomplishes the Test cases and scripts/scenarios should be mapped to business

functions included in the scope of the project requirements outlined in the User Requirements document. This will ensure that all requirements have been addressed and tested. Integration Testing: Integration testing is a systematic testing for constructing the program structure, while at the same time conducting test to uncover errors associated within the interface. Bottom-up integration is used for this phase. It begins construction and testing with atomic modules.

43

This strategy is implemented with the following steps. Low-level modules are combined to form clusters that perform The cluster is tested. Drivers are removed and clusters are combined moving upward a specific software sub function.

in the program structure. Validation Testing: This provides the final assurance that the software meets all functional, behavioral and performance requirements. The software is completely assembled as a package. Validation succeeds when the software functions in which the user expects.

2.11.2 ACCEPTANCE TESTING There are four categories of tests that a programmer will typically perform on a program unit Functional Tests Performance Tests Stress Tests Structure Tests

Functional testing, the code is tested with nominal input values for which the expected results are known. I have tested it by giving characters to a quantity number value. It shows me an error that it can contain only numerals. In this way, I have tested with a number of inputs to my project fields.
44

Performance testing is applied to determine the evaluation speed on various parts; memory utilization, throughput, and response time and device utilization of various program units are tested. This is achieved by using the efficient query analysis in the data base retrieval. Stress testing, which is designed to intentionally, to break the unit, is done. This testing is performed to find the limitations of the system developed by us. This is achieved, as I tested the individual units first. As they have shown no error, I integrate all of them. Structure testing that is concerned with exercising the internal logic of a program and traveling particular execution paths. I have structured my project by having various functional calls that are invoked by different modules and in different ways. This reduces the replication 2.11.3 Boundary Value Analysis: The systematic testing of error handling is called boundary testing. During your pedal-to-the-floor, no-test-plan testing project, boundary testing refers to the testing of forms and data inputs, starting from known good values, and progressing through reasonable but invalid inputs all the way to known extreme and invalid values. The logic for boundary testing forms is straightforward: start with known good and valid values because if the system chokes on that, it's not ready for testing.

45

Move through expected bad values because if those fail, the system isn't ready for testing. Try reasonable and predictable mistakes because users are likely to make such mistakes -- we all screw up on forms eventually. Then start hammering on the form logic with extreme errors and crazy inputs in order to catch problems that might affect the site's functioning. Good Values Enter in data formatted as the interface requires. Include all required fields. Use valid and current information (what "valid and current" means will depend on the test system, so some systems will have a set of data points that are valid for the context of that test system). Do not try to cause errors. Expected Bad Values Some invalid data entries are intrinsic to the interface and concept domain. For example, any credit card information form will expect expired credit card dates -- and should trap for them. Every form that specifies some fields as required should trap for those fields being left blank.

46

Every form that has drop-down menus that default to an instruction ("select one", etc.) should trap for that instruction. What about punctuation in name fields? 2.11.4 STRESS TESTING Testing conducted to evaluate a system or component at or beyond the limits of its specified requirements. Syn: testing, boundary value testing, structural. (1) Testing that takes into account the internal mechanism [structure] of a system or component. Types include branch testing, path testing, statement testing. (2) Testing to insure each program statement is made to execute during testing and that each program statement performs its intended function. Contrast with functional testing. Syn: white-box testing, glass-box testing, logic driven testing.

2.12 IMPLEMENTATION

In the Transmitter window we are having one local host section, here we are going to give the ip address and port number of the local machine. Then in the Targets section give the ip address and port number of the target machine. After that select the option button Add Target.

47

So now we can see in the white screen, from which machine to which machine the transmission is going to occur. After that give the name of the movie files and where it is stored in the Media locator text box. Then click the option button Start Transmitter. Now Transmitter is in the ready state to transmit the movie files in to the receiver. In the Transmitter window we are having another one option button that is loop. Suppose we select this option button the transmission is occurring again and again. Then we have another one option button RTCP monitor, If select this button it we can how transmission is going to occur. In the receiver side window, we are having one local host section; here we are going to give the ip address of the local machine. In the Targets section, we give the ip address and port number of the local machine, and then we give the port number of the Target machine. After that click the option button Add Target. So now we can see from which machine to which machine the transmission is going to occur in the white screen. After that we click the Start Receiver option button. So now Receiver is get ready to receive the video files from the transmitter.

2.13 RESULTS AND ANALYSIS

48

2.13.1 STEPS OF EXECUTION FOR TRANSMITTER In the Transmitter window we are having one local host section, here we are going to give the ip address and port number of the local machine. Then in the Targets section give the ip address and port number of the target machine. After that select the option button Add Target. So now we can see in the white screen, from which machine to which machine the transmission is going to occur. After that give the name of the movie files and where it is stored in the Media locator text box. Then click the option button Start Transmitter. Now Transmitter is in the ready state to transmit the movie files in to the receiver. In the Transmitter window we are having another one option button that is loop. Suppose we select this option button the transmission is occurring again and again. Then we have another one option button RTCP monitor, If select this button it we can how transmission is going to occur. 2.13.2 STEPS OF EXECUTION FOR RECEIVER In the receiver side window, we are having one local host section; here we are going to give the ip address of the local machine. In the Targets section, we give the ip address and port number of the local machine. Then we give the port number of the Target machine. After that click the option button Add Target. So now we can see from which machine to which machine the transmission is going to occur in the white screen. After that we click the Start Receiver option button. So now Receiver is get ready to receive the video files from the transmitter.

49

2.14 SOURCE CODE TRANSMITTER import java.io.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.util.*; import javax.media.rtp.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.border.*; public class CTLTransmitter extends JFrame implements ActionListener, KeyListener, MouseListener, WindowListener { Vector targets; JList list; JButton startXmit; JButton rtcp; JButton update; JButton expiration; JButton statistics; JButton addTarget; JButton removeTarget; JTextField tf_remote_address; JTextField tf_remote_data_port; JTextField tf_media_file; JTextField tf_data_port; TargetListModel listModel; AVTransmitter avTransmitter; RTCPViewer rtcpViewer; JCheckBox cb_loop; Configuration config; public CTLTransmitter() { setTitle( "Video Broadcasting Over IP : Transmitter");

50

config= new Configuration(); GridBagLayout gridBagLayout= new GridBagLayout(); GridBagConstraints gbc; JPanel p= new JPanel(); p.setLayout( gridBagLayout); JPanel localPanel= createLocalPanel(); gbc= new GridBagConstraints(); gbc.gridx= 0; gbc.gridy= 0; gbc.gridwidth= 2; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( localPanel, gbc); p.add( localPanel); JPanel targetPanel= createTargetPanel(); gbc= new GridBagConstraints(); gbc.gridx= 1; gbc.gridy= 1; gbc.weightx= 1.0; gbc.weighty= 1.0; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( targetPanel, gbc); p.add( targetPanel); JPanel mediaPanel= createMediaPanel(); gbc= new GridBagConstraints(); gbc.gridx= 1; gbc.gridy= 2; gbc.weightx= 1.0;

51

gbc.weighty= 1.0; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( mediaPanel, gbc); p.add( mediaPanel); JPanel buttonPanel= new JPanel(); rtcp= new JButton( "RTCP Monitor"); update= new JButton( "Transmission Status"); update.setEnabled( false); rtcp.addActionListener( this); update.addActionListener( this); buttonPanel.add( rtcp); buttonPanel.add( update); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.gridwidth= 2; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( buttonPanel, gbc); p.add( buttonPanel); getContentPane().add( p); list.addMouseListener( this); addWindowListener( this);

52

pack(); setVisible( true); } private JPanel createMediaPanel() { JPanel p= new JPanel(); GridBagLayout gridBagLayout= new GridBagLayout(); GridBagConstraints gbc; p.setLayout( gridBagLayout); JLabel label= new JLabel( "Media Locator:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( label, gbc); p.add( label); tf_media_file= new JTextField( 35); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( tf_media_file, gbc); p.add( tf_media_file);

53

tf_media_file.setText( config.media_locator); cb_loop= new JCheckBox( "loop"); startXmit= new JButton( "Start Transmission"); startXmit.setEnabled( true); startXmit.addActionListener( this); gbc= new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( cb_loop, gbc); p.add( cb_loop); cb_loop.setSelected( true); cb_loop.addActionListener( this); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( startXmit, gbc); p.add( startXmit); TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Source"); p.setBorder( titledBorder); return p; }

54

private JPanel createTargetPanel() { JPanel p= new JPanel(); GridBagLayout gridBagLayout= new GridBagLayout(); GridBagConstraints gbc; p.setLayout( gridBagLayout); targets= new Vector(); for( int i= 0; i < config.targets.size(); i++) { targets.addElement( config.targets.elementAt( i)); } listModel= new TargetListModel( targets); list= new JList( listModel); list.addKeyListener( this); list.setPrototypeCellValue( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); JScrollPane scrollPane= new JScrollPane( list, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); gbc= new GridBagConstraints(); gbc.gridx= 0; gbc.gridy= 0; gbc.weightx= 1.0; gbc.weighty= 1.0; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( scrollPane, gbc); p.add( scrollPane);

55

JPanel p1= new JPanel(); p1.setLayout( gridBagLayout); JLabel label= new JLabel( "IP Address:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( label, gbc); p1.add( label); tf_remote_address= new JTextField( 15); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( gbc); p1.add( tf_remote_address); label= new JLabel( "Data Port:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE;

tf_remote_address,

56

gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( label, gbc); p1.add( label); tf_remote_data_port= new JTextField( 15); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( gbc); p1.add( tf_remote_data_port); JPanel p2= new JPanel(); addTarget= new JButton( "Add Target"); removeTarget= new JButton( "Remove Target"); p2.add( addTarget); p2.add( removeTarget); addTarget.addActionListener( this); removeTarget.addActionListener( this); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridwidth= 2; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets( 20,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( p2, gbc);

tf_remote_data_port,

57

p1.add( p2); gbc= new GridBagConstraints(); gbc.gridx= 1; gbc.gridy= 0; gbc.weightx= 1.0; gbc.weighty= 1.0; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( p1, gbc); p.add( p1); TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Targets"); p.setBorder( titledBorder); return p; } private JPanel createLocalPanel() { JPanel p= new JPanel(); GridBagLayout gridBagLayout= new GridBagLayout(); GridBagConstraints gbc; p.setLayout( gridBagLayout); JLabel label= new JLabel( "IP Address:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5);

58

((GridBagLayout)p.getLayout()).setConstraints( label, gbc); p.add( label); JTextField tf_local_host= new JTextField( 15); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p.getLayout()).setConstraints( tf_local_host, gbc); p.add( tf_local_host); try { String host= InetAddress.getLocalHost().getHostAddress(); tf_local_host.setText( host); } catch( UnknownHostException e) { } label= new JLabel( "Data Port:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p.getLayout()).setConstraints( label, gbc); p.add( label); tf_data_port= new JTextField( 15); gbc= new GridBagConstraints(); gbc.gridx = 1;

59

gbc.gridy = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( tf_data_port, gbc); p.add( tf_data_port); tf_data_port.setText( config.local_data_port); TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Local Host"); p.setBorder( titledBorder); return p; } public void actionPerformed( ActionEvent event) { Object source= event.getSource(); if( source == addTarget) { String ip= tf_remote_address.getText().trim(); String port= tf_remote_data_port.getText().trim(); String localPort= tf_data_port.getText().trim(); addTargetToList( localPort, ip, port); if( avTransmitter != null) { avTransmitter.addTarget( ip, port); } } else if( source == removeTarget) { int index= list.getSelectedIndex(); if( index != -1) { Target target= (Target) targets.elementAt( index); if( avTransmitter != null) { avTransmitter.removeTarget( target.ip, target.port);

60

} targets.removeElement( target); listModel.setData( targets); } } else if( source == startXmit) { if( startXmit.getLabel().equals( "Start Transmission")) { int data_port= new Integer( tf_data_port.getText()).intValue(); avTransmitter= new AVTransmitter(this, data_port); avTransmitter.start( tf_media_file.getText().trim(), targets); avTransmitter.setLooping( cb_loop.isSelected()); startXmit.setLabel( "Stop Transmission"); } else if( startXmit.getLabel().equals( "Stop Transmission")) { avTransmitter.stop(); avTransmitter= null; removeNonBaseTargets();

RECEIVER

import java.awt.*; import java.awt.event.*; import java.net.*; import java.util.*; import javax.media.rtp.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.border.*; public class CTLReceiver extends JFrame implements ActionListener, KeyListener, MouseListener, WindowListener { Vector targets; JList list; JButton rtcp;
61

JButton startRx; JButton expiration; JButton statistics; JButton addTarget; JButton removeTarget; JTextField tf_remote_address; JTextField tf_remote_data_port; JTextField tf_local_data_port; JTextField tf_media_file; TargetListModel listModel; RTCPViewer rtcpViewer; JCheckBox cb_loop; Configuration config; AVReceiver avReceiver; public CTLReceiver() { setTitle( "Video Broadcasting Over IP : Receiver"); config= new Configuration(); GridBagLayout gridBagLayout= new GridBagLayout(); GridBagConstraints gbc; JPanel p= new JPanel(); p.setLayout( gridBagLayout); JPanel localPanel= createLocalPanel(); gbc= new GridBagConstraints(); gbc.gridx= 0; gbc.gridy= 0; gbc.gridwidth= 2; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( localPanel, gbc); p.add( localPanel); JPanel targetPanel= createTargetPanel();

62

gbc= new GridBagConstraints(); gbc.gridx= 1; gbc.gridy= 1; gbc.weightx= 1.0; gbc.weighty= 1.0; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( targetPanel, gbc); p.add( targetPanel); JPanel buttonPanel= new JPanel(); rtcp= new JButton( "RTCP Monitor"); startRx= new JButton( "Start Receiver"); rtcp.addActionListener( this); startRx.addActionListener( this); buttonPanel.add( rtcp); buttonPanel.add( startRx); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.gridwidth= 2; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( buttonPanel, gbc); p.add( buttonPanel); getContentPane().add( p); list.addMouseListener( this);

63

addWindowListener( this); pack(); setVisible( true); } private JPanel createTargetPanel() { JPanel p= new JPanel(); GridBagLayout gridBagLayout= new GridBagLayout(); GridBagConstraints gbc; p.setLayout( gridBagLayout); targets= config.targets; listModel= new TargetListModel( targets); list= new JList( listModel); list.addKeyListener( this); list.setPrototypeCellValue( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); JScrollPane scrollPane= new JScrollPane( list, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); gbc= new GridBagConstraints(); gbc.gridx= 0; gbc.gridy= 0; gbc.weightx= 1.0; gbc.weighty= 1.0; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( scrollPane, gbc); p.add( scrollPane);

64

JPanel p1= new JPanel(); p1.setLayout( gridBagLayout); JLabel label= new JLabel( "Sender IP:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( label, gbc); p1.add( label); tf_remote_address= new JTextField( 15); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( gbc); p1.add( tf_remote_address); label= new JLabel( "Sender Port:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 0.0; gbc.weighty = 0.0;

tf_remote_address,

65

gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( label, gbc); p1.add( label); tf_remote_data_port= new JTextField( 15); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( gbc); p1.add( tf_remote_data_port); label= new JLabel( "Local Port:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( label, gbc); p1.add( label); tf_local_data_port= new JTextField( 15); gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.weightx = 0.0; gbc.weighty = 0.0;

tf_remote_data_port,

66

gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( gbc); p1.add( tf_local_data_port); JPanel p2= new JPanel(); addTarget= new JButton( "Add Target"); removeTarget= new JButton( "Remove Target"); p2.add( addTarget); p2.add( removeTarget); addTarget.addActionListener( this); removeTarget.addActionListener( this);

tf_local_data_port,

gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridwidth= 2; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets( 20,5,0,5); ((GridBagLayout)p1.getLayout()).setConstraints( p2, gbc); p1.add( p2); gbc= new GridBagConstraints(); gbc.gridx= 1; gbc.gridy= 0; gbc.weightx= 1.0; gbc.weighty= 1.0; gbc.anchor= GridBagConstraints.CENTER; gbc.fill= GridBagConstraints.BOTH; gbc.insets= new Insets( 10, 5, 0, 0); ((GridBagLayout)p.getLayout()).setConstraints( p1, gbc);

67

p.add( p1); TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Targets"); p.setBorder( titledBorder); if( targets.size() > 0) { removeTarget.setEnabled( true); } else { removeTarget.setEnabled( false); } return p; } private JPanel createLocalPanel() { JPanel p= new JPanel(); GridBagLayout gridBagLayout= new GridBagLayout(); GridBagConstraints gbc; p.setLayout( gridBagLayout); JLabel label= new JLabel( "IP Address:"); gbc= new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,0,5); ((GridBagLayout)p.getLayout()).setConstraints( label, gbc); p.add( label); JTextField tf_local_host= new JTextField( 15);

68

gbc= new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 5,5,10,5); ((GridBagLayout)p.getLayout()).setConstraints( tf_local_host, gbc); p.add( tf_local_host); try { String host= InetAddress.getLocalHost().getHostAddress(); tf_local_host.setText( host); } catch ( UnknownHostException e) { } TitledBorder titledBorder= new TitledBorder( new EtchedBorder(), "Local Host"); p.setBorder( titledBorder); return p; } public void actionPerformed( ActionEvent event) { Object source= event.getSource(); if( source == addTarget) { String ip= tf_remote_address.getText().trim(); String port= tf_remote_data_port.getText().trim(); String localPort= tf_local_data_port.getText().trim(); if( avReceiver != null) { avReceiver.addTarget( ip, port, localPort); } addTargetToList( localPort, ip, port); } else if( source == removeTarget) {

69

String ip= tf_remote_address.getText().trim(); String port= tf_remote_data_port.getText().trim(); int index= list.getSelectedIndex(); if( index != -1) { Target target= (Target) targets.elementAt( index); if( avReceiver != null) { avReceiver.removeTarget( ip, port); } targets.removeElement( target); listModel.setData( targets); if( targets.size() == 0) { removeTarget.setEnabled( false); } if( targets.size() > 0) { if( index > 0) { index--; } else { index= 0; } list.setSelectedIndex( index); setTargetFields(); } else { list.setSelectedIndex( -1); } } } else if( source == rtcp) { if( rtcpViewer == null) { rtcpViewer= new RTCPViewer(); } else { rtcpViewer.setVisible( true); rtcpViewer.toFront(); }

70

} else if( source == startRx) { if( startRx.getLabel().equals( "Start Receiver")) { avReceiver= new AVReceiver( this, targets); startRx.setLabel( "Stop Receiver"); } else { avReceiver.close(); avReceiver= null; startRx.setLabel( "Start Receiver"); } } } synchronized public void addTargetToList( String localPort, String ip, String port) { ListUpdater listUpdater= new ListUpdater( localPort, ip,port, listModel, targets, removeTarget); //ListUpdater listUpdater= new ListUpdater( "44444", "127.0.0.1","22222", listModel, targets,removeTarget); SwingUtilities.invokeLater( listUpdater); } public void rtcpReport( String report) { if( rtcpViewer != null) { rtcpViewer.report( report); } } public void windowClosing( WindowEvent event) { config.write(); System.exit( 0); } public void windowClosed( WindowEvent event) { } public void windowDeiconified( WindowEvent event) { }

71

public void windowIconified( WindowEvent event) { } public void windowActivated( WindowEvent event) { } public void windowDeactivated( WindowEvent event) { } public void windowOpened( WindowEvent event) { } public void keyPressed( KeyEvent event) { } public void keyReleased( KeyEvent event) { Object source= event.getSource(); if( source == list) { int index= list.getSelectedIndex(); } } public void keyTyped( KeyEvent event) { } public void mousePressed( MouseEvent e) { } public void mouseReleased( MouseEvent e) { } public void mouseEntered( MouseEvent e) { } public void mouseExited( MouseEvent e) { } public void mouseClicked( MouseEvent e) { Object source= e.getSource();

72

if( source == list) { setTargetFields(); } } public void setTargetFields() { int index= list.getSelectedIndex(); if( index != -1) { Target target= (Target) targets.elementAt( index); tf_remote_address.setText( target.ip); tf_remote_data_port.setText( target.port); tf_local_data_port.setText( target.localPort); } } public static void main( String[] args) { new CTLReceiver(); } } class TargetListModel extends AbstractListModel { private Vector options; public TargetListModel( Vector options) { this.options= options; } public int getSize() { int size; if( options == null) { size= 0; } else { size= options.size(); } return size;

73

} public Object getElementAt( int index) { String name; if( index < getSize()) { Target o= (Target)options.elementAt( index); name= o.localPort + " <--- " + o.ip + ":" + o.port; } else { name= null; } return name; } public void setData( Vector data) { options= data; fireContentsChanged( this, 0, data.size()); } } class ListUpdater implements Runnable { String localPort, ip, port; TargetListModel listModel; Vector targets; JButton removeTarget; public ListUpdater( String localPort, String ip, String port, TargetListModel listModel, Vector targets, JButton removeTarget) { this.localPort= localPort; this.ip= ip; this.port= port; this.listModel= listModel; this.targets= targets; this.removeTarget= removeTarget; }

74

public void run() { Target target= new Target( localPort, ip, port); if( !targetExists( localPort, ip, port)) { targets.addElement( target); listModel.setData( targets); removeTarget.setEnabled( true); } } public boolean targetExists( String localPort, String ip, String port) { boolean exists= false; for( int i= 0; i < targets.size(); i++) { Target target= (Target) targets.elementAt( i); if( target.localPort.equals( localPort) && target.ip.equals( ip) && target.port.equals( port)) { exists= true; break; } } return exists;}}

75

2.15 SCREEN SHOTS 2.15.1 LOGIN PAGE:

76

2.15.2 MAIN PAGE:

77

2.15.3 SENDER PAGE:

78

2.15.4 RECEIVER PAGE:

79

2.15.5 EXECUTION PAGE:

80

2.15.6 OUTPUT PAGE:

81

CHAPTER III

CONCLUSION

82

CHAPTER III
CONCLUSION Our project Video Broadcasting over Internet Protocol is mainly used in Real Time Application like Video Conferences in any organization. One of the major feature of our project is it reduce the bandwidth for transmission. So it reduces the cost of transmission. Transmission speed is also high. So these are all main advantages of our project.

83

3.1

FUTURE ENHANCEMENTS

Main features of the project are that it supports capturing media data. Enable the development of media streaming and conferencing applications in java. This solution provides a better utilization bandwidth and also reduces the traffic by which congestion.

84

BIBLIOGRAPHY

1.

Java 2 complete reference and JMF reference Patrick Naughton, Java 2:The Complete Reference,

1999,McGraw-Hill The Java 2 Enterprise Edition Developers Guide,

2000,SunMicroSystems

David H.Silber , Java CGI HOW TO ,GNU Publishers Monica pawlon,Essentials of the java Programming

2.

Language, Java Developer connection

Software Engineering Roger S. Pressman , The Complete Reference, 2000,McGraw-Hill

3.

System Analysis
Cathy. Nicolis, G. (EDT) Nicolis

85

You might also like