How to stop the encoding ?plz see the code and correct it

public class NewClass
    /** Creates a new instance of NewClass */
    public NewClass ()
        StateHelper sh=null;
        Processor p=null;
        try
            p=Manager.createProcessor (new URL ("file:///ring.wav"));
            sh = new StateHelper (p);
            p.configure ();
        catch (NoProcessorException ex)
            ex.printStackTrace ();
        catch (IOException ex)
            ex.printStackTrace ();
        p.setContentDescriptor (new FileTypeDescriptor (FileTypeDescriptor.MPEG_AUDIO));       
        TrackControl track[] = p.getTrackControls ();
        boolean encodingPossible = false;
        for (int i = 0; i < track.length; i++)
            try
                track.setFormat (new AudioFormat (AudioFormat.MPEG));
encodingPossible = true;
catch (Exception e)
track[i].setEnabled (false);
if (!sh.realize (10000))
System.exit (-1);
DataSource source = p.getDataOutput ();
MediaLocator dest = new MediaLocator ("file://ring1.mpg");
DataSink filewriter = null;
try
filewriter = Manager.createDataSink (source, dest);
filewriter.open ();
filewriter.addDataSinkListener (new DataSinkListener ()
public void dataSinkUpdate (DataSinkEvent e)
if(e instanceof javax.media.datasink.EndOfStreamEvent)
DataSink ds=e.getSourceDataSink ();
try
ds.stop ();
System.out.println ("finished write");
catch (IOException ex)
ex.printStackTrace ();
filewriter.start ();
catch (NoDataSinkException e)
System.exit (-1);
catch (IOException e)
System.exit (-1);
catch (SecurityException e)
System.exit (-1);
p.start ();
p.addControllerListener (new ControllerAdapter ()
public void endOfMedia (EndOfMediaEvent e)
Controller controller = (Controller) e.getSource ();
controller.stop ();
controller.deallocate ();
System.out.println ("finished run through");
public static void main (String[] args)
new NewClass ();
o/p is "finished run through",the EndOfStreamEvent never occurs.please correct if anything is wrong.when i manually stop the program then only the encoded file appears on the disk. this has to used from the other class and i cannot afford to use exit().help me.

Try this - it seems to work
public class NewClass
    Processor p = null;
    DataSink sink = null;
     /** Creates a new instance of NewClass */
    public NewClass ()
        try{
            p = Manager.createProcessor (new URL ("file:C:/WINDOWS/Media/Windows XP Startup.wav"));
            p.addControllerListener (new ControllerAdapter ()
                 public void configureComplete(ConfigureCompleteEvent e){
                    System.out.println ("ConfigureCompleteEvent");
                    Processor p = (Processor)e.getSourceController();
                    processConfigured(p);
                 public void realizeComplete(RealizeCompleteEvent e){
                    System.out.println ("RealizeCompleteEvent");
                    Processor p = (Processor)e.getSourceController();
                    processrealized(p);
                 public void controllerClosed(ControllerClosedEvent e){
                    System.out.println ("ControllerClosedEvent");
                 public void endOfMedia (EndOfMediaEvent e)
                    System.out.println ("EndOfMediaEvent");
                    Processor p = (Processor)e.getSourceController();
                    p.stop();
                 public void stop(StopEvent e){
                    System.out.println ("StopEvent");
                    Processor p = (Processor)e.getSourceController();
                    p.close();
            p.configure();
        }catch (NoProcessorException ex){
             ex.printStackTrace ();
        }catch (IOException ex){
             ex.printStackTrace ();
    private void processrealized(Processor p){
         MediaLocator dest = new MediaLocator("file:C:/Workspace/ring1.mpg");
         try{
              sink = Manager.createDataSink(p.getDataOutput(), dest);
             sink.addDataSinkListener(new DataSinkListener(){
                  public void dataSinkUpdate(DataSinkEvent e){
                       if(e instanceof EndOfStreamEvent){
                        System.out.println ("EndOfStreamEvent");
                            sink.close();
              sink.open();
              sink.start();
         }catch(Exception eX){
         p.start();
    private void processConfigured(Processor p){
        p.setContentDescriptor (new FileTypeDescriptor (FileTypeDescriptor.MPEG_AUDIO));       
        TrackControl track[] = p.getTrackControls ();
        boolean encodingPossible = false;
        for (int i = 0; i < track.length; i++){
             try{
                  track.setFormat (new AudioFormat (AudioFormat.MPEG));
          encodingPossible = true;
     }catch (Exception e){
          track[i].setEnabled (false);
p.realize();
public static void main (String[] args)
new NewClass ();
`

Similar Messages

  • I've down loaded adobe flash player but when I try to veiw video on firefox I'm still told that I need adobe flash player. How do I get firefox to see the flash player download?

    I was trying to view a video I uploaded to facebook using firefox. The system told me to down load adobe flash player. I did but still get the message that I need to down load flash player. How do I get firefox to see the down loaded adobe flash player?

    by installing from within Firefox, Internet Explorer has its own version (Active-X).
    Make sure you are starting in the correct place for Flash
    * http://www.adobe.com/software/flash/about/
    If you want to read PDF files in you browser, you might also want
    * http://get.adobe.com/reader/
    After the download,
    #bring up the download manager ("Ctrl+J") and start your installs. As soon as the install comes up,
    #close Firefox with '''File > Exit''' or "Firefox" button > Exit. Give Firefox some time to close.
    #If install does not proceed, '''terminate "firefox.exe"''' and '''"plugin-container.exe"''' from the "Processes" tab in the Windows Task Manager.
    #* Windows 7 shortcut to the WTM is "Ctrl+Shift+Esc"
    #* or on any Windows system from "Ctrl+Shift+Esc" then choose Windows Task Manager.
    #*Make sure that "firefox.exe" is no longer running -- if it is still running then terminate it by selecting the use "End Process" button or from context menu, and do the same for "plugin-container.exe" if it is found there.
    #proceed with the install.
    '''Warning''': this is the Adobe site and they have chosen to to provide crapware along with their own product. Only install the product you were planning to install. Do not install additional products: including -- "Free! McAfee Security Scan Plus" or "Google Chrome". Installing Google Chrome on your own and installing it because it is offered on the Adobe site are two different things.
    Find updates for your installed plugins at http://www.mozilla.com/plugincheck/ mozilla.com/plugincheck
    -- best to use Adobe's site to really see if their plug-ins are up to date.
    Please fix your caps lock or read what you type, do you think anybody could read my answer if I typed in all caps.
    If the above fails to correct the problem, I would try uninstalling Adobe Flash from your system entirely first, from the control panel then "Programs and Features".

  • I have been sampling new imported drum loops. And if I adjust region to song or time strecth it updates the audio file in the library. How to stop this? I lost the original setting to one loop. automatically doing it ??

    I have been sampling new imported drum loops. And if I adjust region to song or time strecth it updates the audio file in the library. How to stop this? I lost the original setting to one loop. automatically doing it ??

    This "original file cannot be found" thing happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout,or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    Alternatively, as long as you can find a location holding the missing files, then you should be able to use my FindTracks script to reconnect them to iTunes .
    tt2

  • My iMac does not see the new Toshiba external drive in Finder or Disk Utility.  How can I get it to see the drive?

    My iMac does not see the new Toshiba external drive in Finder or Disk Utility.  How can I get it to see the drive?

    From the menu bar, select
               ▹ System Preferences ▹ Energy Saver ▹ Power Adapter  
    and uncheck the box labeled Put the hard disk(s) to sleep when possible, if it's checked.
    If the drive has more than one interface (USB, FireWire, Thunderbolt, eSATA), try one of the other interfaces.
    Check that the data cable is securely inserted at both ends.
    Try a different cable.
    If you're connecting the drive through a hub, connect it directly to a built-in port on the Mac.
    If you're connecting it directly, try a different port.
    Disconnect all other devices on the bus, or as many as possible.
    Test the drive with another Mac. Test another drive with this Mac.
    If the drive is bus-powered, but has an AC adapter, connect the adapter.
    Start up in Recovery mode and launch Disk Utility. Is the drive recognized?
    Start up in Safe Mode and test.
    Reset the NVRAM.
    Reset the System Management Controller.
    If the drive doesn't work under any of the above conditions, and if another drive does work with the same Mac, then the drive is malfunctioning.

  • How can I get iPhoto to see the edited iPhone 4s photo?

    I have a new iPhone 4s.  I take a picture. I edit it and save it to the iPhone.  Then, I sync my phone with my Mac, open iPhoto.  Only the original photos appear, not the one I edited and saved.  Yet, if I e-mail the photo to myself, I can see the edited version.  So, how do I get iPhoto to see the edited version.

    8 MP is the resolution of the camera sensor.  Images are compressed when stored so quite a bit smaller.  The compression ratio depends on the level of detail in the image.

  • I updated my I Phone 4 to the os 5.1.1 but lost all of my contacts.  I believe it should still be stored in my laptop Apple file but don't know how to restore.  I only see the restore option to the factory settings.

    I updated my I Phone 4 to the os 5.1.1 but lost all of my contacts.  I believe it should still be stored in my laptop Apple file but don't know how to restore.  I only see the restore option to the factory settings.  I have never used the I Cloud.

    If you did not sync afterwards, follow this article to restore from your latest backup:
    iTunes: Backing up, updating, and restoring iOS software

  • How can i refresh the mail, to see the latest email received from my hotmail account. If i close Mail, the program, and re-open, then I can see the latest mail received. Is there a key combo-short-cut to do this.

    how can i refresh the mail, to see the latest email received from my hotmail account. If i close Mail, the program, and re-open, then I can see the latest mail received. Is there a key combo-short-cut to do this.

    isaackito wrote:
    how can i refresh the mail, to see the latest email received from my hotmail account. If i close Mail, the program, and re-open, then I can see the latest mail received. Is there a key combo-short-cut to do this.
    Mailbox menu>Get New Mail:

  • How do I add the option to see the artwork (in the lower left hand corner of the sidebar) of the song currently playing in my library, like I could in previous versions of itunes?

    How do I add the option to see the artwork (in the lower left hand corner of the sidebar) of the song currently playing in my library, like I could in previous versions of itunes?

    Along with iTunes DJ & Cover Flow, that option has gone...
    tt2

  • How do I turn on the notification for pop-up blocker? I accidentally clicked the option saying "do not show this notification again." I want the notification so I have the option of seeing the pop-up or not, but don't know how to turn this back on.

    How do I turn on the notification for pop-up blocker? I accidentally clicked the option saying "do not show this notification again." I want the notification so I have the option of seeing the pop-up or not, but don't know how to turn this back on.

    Type "about:config" in the location bar.
    Filter for "privacy.popups.showBrowserMessage"
    Change this to true by double clicking the preference (or right click and choose Reset)

  • I have 3,500  photos on my MacBook that I would like to copy to my Windows 7 PC. The PC CAN "see" the MacBook on the wi-fi network but I can't find the picture files through that route on the MacBook.

    I took 3500 pictures with an iPhone 5 and a Canon Ixus camera whil on holiday in China. I downloaded them onto my MacBook every day.
    Now we're back home I want to back them up onto my Windows 7 PC as it has a 1 TB HDD.
    My PC and MacBook can see each other over the wi-fi network (the PC has an Ethernet connection to the wifi router) and the MacBook can copy files from the PC but not vice versa although the PC can "see" the MacBook - just not copy or transfer any files.
    Also when I look for the jpegs for my holiday pics I can't find them on the MacBook though they open happily in iPhoto. When I look in my iPhoto library it seems to have (among other things) an XML file as a database but no actual jpegs. There are some jpegs on the MacBook but these are from photos I transferred from the PC before I out the 1TB HDD in.
    Where are the actual photos stored and how can I transfer them to the PC over the wifi network?

    Selectthem in  iPhoto and export to a desktop folder - see the user tip on exporting for edtails on the options available - from there it has not involvement of iPhoto - what access you have andhow you access the Mac disk is a subject for a differnt forum
    Direct access to the contents of the ihoto library - a SQLite database - is not supported
    LN

  • I bought about 350 musics on iTunes but when I click on the link to see the musics I bought, it shows only 204 musics

    I bought about 350 musics on iTunes since I started using iPhone, but when I click on the link to see the items I have bought, iTunes shows me only 204 musics. This is a problem that annoys me because I have authorized a new device where I'd like to listen to all musics I have bought. I have already turned on the automatic transferences on the iTunes preferences so that all musics, books and apps are automatically transferred to the device. Even so, iTunes continues to show only 204 musics and I am not able to see all musics I have bought.
    So, is there anything I'm missing here? Is there other local on iTunes where I could see all musics I have bought instead of only a subset of them?
    Thanks in advance for any help,
    Márcio

    Just to better clarify what is happening: when I click on the link to show the musics I have bought on iTunes, musics that I had already bought some time ago do not appear anymore. So, I'm not able to download them anymore. For instance, in the set of the musics iTunes does not show me anymore there are 17 Peter Gabriel's musics. They are not shown and I cannot download them. So, how could I be able to download all musics I have bought instead of only 204 musics?
    Thanks again
    Márcio

  • What is the command to see the database

    what is the command to see the database?iam using oracle express edition in that i tried to create a database but it showing database already created.
    i need to check which database is created.

    Probably you are thinking that Oracle database is a kind of file something like which we sees other files like .txt, .doc, .pdf etc which we sees by ls or dir commands.  Of course there are files for Oracle database, but they have their own nomenclature and setup which finds in C:\oraclexe\oradata\XE\ (For example in Windows) or /usr/lib/oracle/xe/oradata/XE/ (For example in Linux).
    By default, the database is started for you after installation and every time your computer is restarted. However, to reduce the overall performance load on the system, you can manually stop the database, and then manually restart it later.
    Oracle&amp;reg; Database Express Edition
    Ok, now if you wish to login to the database (we don't says "see" the database, because database is different thing than a picture or image ), you just open your command window and say :
    sqlplus sys/your_password_of_sys_user as sysdba
    If you get SQL> prompt, you have logged in the database as sys user and this is your database. 
    If you wish to login with different user then you can :
    1.login from command window by sqlplus username/password
    2.login from SQL> prompt by connect username/password
    Regards
    Girish Sharma

  • HT4623 Does anyone have an issue with your iPhone 5 when trying to play music? Mine won't, on the screen you see the player run through songs very quickly but never playing.... Help!

    Does anyone have an issue with your iPhone 5 when trying to play music? Mine won't, on the screen you see the player run through songs very quickly but never playing.... Help!

    Try this > Start a song, tap the screen, under the left side of the scrubberbar that appears, tap the icon to stop shuffle.

  • If two iPhones are linked to the same Apple ID can the other phone see the iMessages I'm sending, received or both?

    If two iPhones are linked to the same Apple ID can the other phone see the iMessages I'm sending, received or both?

    Yes, if both devices is using the same apple id for imessage.

  • On Pages, let's say you have two similar documents, but you need to compare the two to see the differences.  Is there a way to do that?

    On Pages, let's say you have two similar documents. Two versions of the same document, but not merged in Cloud and saved as two separate files. B ut you need to compare the two to see the differences, some things on one, but not in the other.  In Word, they would merge the two and differences would be highlighted in red.  Is there a way to do something like that?

    Not actually in Pages, but there is third party software that purports to do this, google around.
    Peter

  • HT5312 what if ive forgotten my security questions, but the email to see the answers to these is no longer able to use

    what if ive forgotten my security questions, but the email to see the answers is no longer available

    contact AppleCare

Maybe you are looking for

  • Where is the start of the audio file/recording?

    I'm emailing mixdowns to a studio where they will lay the files to movie timecodes that I have specified in a cue sheet. I'm a bit worried that the timecodes are incorrect. The possible issue concerns the start of the audio files. I recorded the trac

  • Function module to find parent organization ID

    Dear gurus, I am searching the function module to find a parent Organization ID from Org plan base on an existing that I know.  The objective is to go up in the hierarchy t o create via BADI a header level hierarchy approval using the Org plan as sou

  • When printing off the web i get this error dll.preview not detected

    i cannot print email's or other web content but I can print from microsoft office from the internet I get the error URL  res://ieframe.dll/preview.js

  • Difference B/W TECO (Technically Closed) and Business Closed.

    Hi, I want knw the differnce B/w the technically Completeion of PM  order and Business Completion. The difference i understood is that TECO status is set to system after all the Technical work is over, that means when no technical  work is pending bt

  • Pricing Procedure determination in Purchase info record

    Dear Experts I would like to understand how pricing procedure is determined in Purchase info Record. While creating purchase info record, system is identifying some standard pricing procedure rather my own pricing procedure. Hence i couldnt able to s