Save Image To SAP From Clipboard

Hi gurus,
I want to get an image saved with print screen from clipboard and save it to the SAP with FM BDS_BUSINESSDOCUMENT_CREA_TAB. I can get image with WS_UPLOAD and save with BDS_BUSINESSDOCUMENT_CREA_TAB but i want to do it directly with print screen. Is it possible?
Regards,

Hi,
you do not need WS_UPLOAD.
There is class CL_GUI_FRONTEND_SERVICES with method CLIPBOARD_IMPORT.
You can do anything with data received.
Regards,
Przemysław

Similar Messages

  • Save Image to system's ClipBoard .PLEASE HELP!!!!!

    Hi,
    I'm trying to save an Image from my GUI to the System's ClipBoard but I just can't get it to work.
    I've overriden a JPanel's paint() method where I draw my own stuff.
    I've used the following code which I found in the forum :
    class ImageSelection implements Transferable,ClipboardOwner
    private DataFlavor ImageFlavor;
    private DataFlavor[] flavors = new DataFlavor[1];
    private Image image;
    public ImageSelection(Image an_image)
    this.image = an_image;
    try
    ImageFlavor = new DataFlavor(Class.forName("java.awt.Image"),"AWT Image");
    flavors[0] = ImageFlavor;
    catch(ClassNotFoundException e)
    e.printStackTrace();
    public synchronized DataFlavor[] getTransferDataFlavors()
    return flavors;
    public boolean isDataFlavorSupported(DataFlavor flavor)
    return flavor.equals(ImageFlavor);
    public synchronized Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException
    if(flavor.equals(ImageFlavor))
    return image;
    else throw new UnsupportedFlavorException(flavor);
    public void lostOwnership(Clipboard c, Transferable t)
    When I want to save my Graphics into the clipboard I do the following:
    ImageSelection temp = new ImageSelection(my_graphics.offImage);
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents(temp,temp);
    You may also need the following :
    class My_Stuff extends JPanel
    Graphics2D offGraphics2D = null;
    Image offImage = null;
    void init_graphics()
    offImage = this.createImage(100,100);
    offGraphics2D = offImage.getGraphics();
    void paint(Graphics g)
    Graphics2D g2 = (Graphics2D)g;
    offGraphics2D.fillRect(0,0,200,200);
    // bla bla bla .........................
    g2.drawImage(offImage,0,0,null);
    and finally : My_Stuff my_graphics = new My_Stuff();
    As you observe variable my_graphics is of type My_Stuff , so I pass its field : offImage , as the argument for the ImageSelection 's Constructor which in turn expects an Image...
    I am "saving" the Image to the system's ClipBoard and I try to Paste it in MS Word but the 'Paste' feature is inactive ( I guess Clipboard is empty... )
    Can you please help me out in this one???
    I use JDK 1.4.0 and Win2000.
    Thank you my friends!

    If you use JDK1.4, simply use DataFlavor.imageFlavor insteads
    of your own. Java will do the rest. Word cannot paste because
    it does not recognise the flavor you put on the clipboard!
    You can use this code that does it fine for me (JDK1.4.1)!
    public class ImageSelection implements Transferable
    private java.awt.Image image;
    public ImageSelection(Image i) {
    image = i;
    public Object getTransferData(DataFlavor flavor)
    throws UnsupportedFlavorException
    if (flavor.equals(DataFlavor.imageFlavor)) {
    return image;
    throw new UnsupportedFlavorException(flavor);
    public boolean isDataFlavorSupported(DataFlavor flavor) {
    if (flavor.equals(DataFlavor.imageFlavor)) {
    return true;
    return false;
    public DataFlavor[] getTransferDataFlavors() {
    return new DataFlavor[] {DataFlavor.imageFlavor};
    }

  • Using Photoshop CC I cannot save images to folder from Camera Raw as Tif. I get message 'write permission error'. I am using Widows 7 Professional.

    I have just changed to Photoshop CC from CS4 and cannot now save images from Camera Raw. I get message 'write permission error'. I assume there is some permissions setting which did not exist with CS4.
    I cannot progress unless I revert to CS4. What am I failing to do?

    See if the suggestions, here, help, although this was back with CS6-cloud, not CC, so may not apply 100%:
    http://forums.adobe.com/message/4758115
    I'd suggest that rather than deleting the file, you move it out of the folder to somewhere else, in case things get worse and you need to put it back.
    I found this by Googling the error message. 
    If you can't figure it out, you might post in the "Downloading, Installing and Set Up" or "Adobe Creative Cloud" forums  since it seems to be related to the Cloud updates, and not necessarily ACR plug-in functionality, and I've seen India support people actually tackle problems posted there, which rarely happens in the ACR forum, although an ACR engineer may sometimes pop in to answer questions, they'd be less likely to know how to fix deployment issues.

  • Safari 6.0.5 Mac won't "SAVE IMAGE AS" jpegs from web pages

    Hi. Trying to figure out what has changed here.
    In the past, when I've located a specific graphic on a web page — say, a .png or .jpg file through a Google image search in Safari — I could right click and choose "SAVE IMAGE AS" and download the image to my desktop.
    No more.
    Now Safari insists on appending ".webarchive" to the end of the file (for example, "image.jpg.webarchive" or "image.png.webarchive"), but won't let me download it. I tried to "SAVE IMAGE AS" a file called 27.png from a web page, for example, and got this error message:
    If I try to remove the ".webarchive" extension, I get this error message:
    I used to be able to simply right click an image, select "SAVE IMAGE AS" and save .jpg and .png files to my desktop. It still works that way in Firefox.
    I am not looking for workarounds or other ways to do this, as I have spent many years doing it this way and it has become habit; I am trying to find out how I can get the old Safari behavior back. Any ideas on why this behavior changed in Safari and how I can revert?

    @andyBall_uk
    Inexplicably, it is now working as it should. I don't get it, but I am not going to question it. I tried to figure it out for an hour, then read your reply, did the duck search you linked to and had no trouble "SAVING PICTURE AS" in .jpg form. It now works on the original images I was trying to download as well. I did not close or open Safari, nor did I restart my computer.
    I'm just going to go ahead and say that you fixed whatever was wrong. Nice work!

  • Unable to save images linked to from InDesign CS4

    A very annoying issue.  If images are linked to from InDesign, and a user on the network has opened that InDesign file, changes to the image cannot be saved.  On a mac we get a warning that the file is 'in use'.  The PCs give no warning, and apprently save the changes made in Photoshop or Illustrator.  However, the changes are not saved.  It make no difference whether the InDesign file is still open or has been closed.  The only way to get round this problem that we have found is to either save as a new image name and re-link to that, or to close down InDesign on the offending workstation and then re-open after the image has been saved.
    This might be a similar issue to that described in this discussion:
    http://forums.adobe.com/message/2015431
    I've opened a new discussion, as the one in the link above is shown as partially answered, but I cannot see an answer which helps us.
    Anyone got a solution?

    I'm not sure if it sounds the same or not, but it sure doesn't sound "normal," but I don't work much with network-stored images and other users who might have linked to them. As far as I know there is nothing in link in ID that would cause it to appear to be open, but as I see inthe other thread I once had the problem myself, so who knows.
    Are you patched to 6.0.6? I don't see anything in the release notes specifically related to the can't save problem, but there were a number of image and link related fixes.

  • How to save image catch from USB camera to database ?

    Hi guys.
    I needed help on IMAQdx tools. But i dont know how to save image that catch from USB camera to database.

    So you can acquire the image OK?
    And you want to save it to a SQL database?
    See here:
    http://zone.ni.com/devzone/cda/epd/p/id/5210

  • Is ImageIO going to be the default way to save images in JavaFX

    I have noticed that in examples where we save images to files from JavaFX (for example screenshot and then save out), ImageIO is used. There are still areas where ImageIO lags behind the now essentially dead JAI libraries (which do a much better job on Png compression sizes and you need for JPEG2000). Is the long-term plan for JavaFX
    1. to have a new way to save images from JavaFX (to avoid bouncing then through a BufferedImage)
    2. develop ImageIO more.
    3. Leave it for third-party developers to fill the gap.
    Image support has been stagnant on the Java platform (and it was lacking in several areas to start with). So it would be really helpful to know Oracle's plan (if there is one).

    Thanks for the suggestions as to setting the default values for "view options" - but I have been doing exactly as you describe and the default - at least for the main hard drive folder - doesn't hold. I want to see all my folders in list view, but every time after I shut down my Mac and then restart and open the main hard drive folder for my MacBook Pro (early 2008), it opens in icon view and I have reset its vie default to list view. I've had to do this almost every day for three months (I chose Always show as List in the Finder toolbar, check the Always show as List, modify one list option so the "Use as Default" option is active and then select Use as Default). Note that the default list view seems to be sticking with some of the folders I use more regularly - or created in list view.
    Do you know how I can get the hard drive window to hold the list view as the default?
    Thanks for your help.

  • Displya image through SAP Report ?

    Dear experts,
    I have requirement to Display images witch is store in local PC, and the image output will display as sap report.
    Each time user captures the image of material before entering, the material in our plant and this image is saving into the local image server and we have provided entry screen through which user can enter the local image server path, and this path is saving into the SAP tables.
    Now we want to prepare a report to view these images in SAP from the local path.
    Note: We are not saving these images in SAP server, only path of these images we are saving.
    Please help me to solve this issue.
    Thanks,
    Abhilash

    hi ,
    Full Program
    *& Module Pool       ZUPLOADIMAGE
    *&Author: Tanmaya Gupta
    *&Date: 24-09-09
    *&Description: This Program will upload Image/Logo in the Module Pool Program.
    INCLUDE ZUPLOADIMAGETOP                         .    " global Data
    INCLUDE ZUPLOADIMAGEO01                         .  " PBO-Modules
    INCLUDE ZUPLOADIMAGEF01                         .  " FORM-Routines
    *& Include ZUPLOADIMAGETOP                                   Module Pool      ZUPLOADIMAGE
    PROGRAM  ZUPLOADIMAGE.
    DATA CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA PICTURE TYPE REF TO CL_GUI_PICTURE.
    DATA URL(256).
    *&  Include           ZUPLOADIMAGEO01
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module STATUS_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
        CREATE OBJECT CONTAINER
           EXPORTING CONTAINER_NAME = 'CONTAINER'.
        CREATE OBJECT PICTURE
           EXPORTING  PARENT = CONTAINER
           EXCEPTIONS ERROR = 1.
    CLEAR url.
        PERFORM load_pic_from_db CHANGING url.
    CALL METHOD picture->load_picture_from_url
    EXPORTING
    url = url.
    endmodule.                 " STATUS_0100  OUTPUT
    *&  Include           ZUPLOADIMAGEF01
    *&      Form  LOAD_PIC_FROM_DB
    *       text
    *      <--P_URL  text
    form LOAD_PIC_FROM_DB  changing p_url.
      DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
      DATA html_table LIKE w3html OCCURS 1.
      DATA return_code LIKE  w3param-ret_code.
      DATA content_type LIKE  w3param-cont_type.
      DATA content_length LIKE  w3param-cont_len.
      DATA pic_data LIKE w3mime OCCURS 0.
      DATA pic_size TYPE i.
      REFRESH query_table.
      query_table-name = '_OBJECT_ID'.
      query_table-value = 'ZLOGO.GIF'."name of logo
      APPEND query_table.
      CALL FUNCTION 'WWW_GET_MIME_OBJECT'
        TABLES
          query_string        = query_table
          html                = html_table
          mime                = pic_data
        CHANGING
          return_code         = return_code
          content_type        = content_type
          content_length      = content_length
        EXCEPTIONS
          object_not_found    = 1
          parameter_not_found = 2
          OTHERS              = 3.
      IF sy-subrc = 0.
        pic_size = content_length.
      ENDIF.
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          type     = 'image'
          subtype  = cndp_sap_tab_unknown
          size     = pic_size
          lifetime = cndp_lifetime_transaction
        TABLES
          data     = pic_data
        CHANGING
          url      = url
        EXCEPTIONS
          OTHERS   = 1.
    ENDFORM.                    " LOAD_PIC_FROM_DB
    Thanks
    Tanmaya

  • How to save image from Clipboard to disk?

    Hello;
    I want to take a screen capture of the entire screen, not only the front
    panel and save it to a file. Don't care about the image format right now.
    I am able to simulate a PrintScreen key using a call to user32.dll
    "keybd_event" in Win2K, but I am stuck here. How do I get that image that is
    now in the clipboard to disk? I have searched NI's website high and low, and
    nothing yet.
    Thanks is advance,
    /JB
    LabVIEW 6.1

    I've kind of done it "programmatically".... using the "system exec.vi" I've
    started mspaint.exe... then, I paste the image and save it to disk (too bad
    the last two steps are manually done!!!)
    The limited documentation on System Exec says it has a Standard Input
    terminal... but, I haven't figured out how to programmatically send CTRL-V
    or ALT-E to the MSPAINT application as command inputs...
    Any further ideas?
    Bill
    Jimmy Brain wrote in message
    news:[email protected]..
    > Thanks Labviewguru, but those examples deal with copying text to/from
    > clipboard.
    > There was an example from a shareware program, but it does not allow
    > to save the image. The links to register it at the his website
    are
    > dead also.
    >
    > Nobody here has ever had the need to copy programmaticaly an image in
    > the clipboard and save it to disk?
    >
    > I know that IMAQ Vision can do it, but I do not have that.
    >
    > PS: I found this OCX ( http://www.simtel.net/pub/pd/57740.html ) on
    > the web that does this, but I haven't been able to get it to work from
    > inside LabVIEW. The Visual Basic example works, but I can't seem to
    > replicate the call to this OCX in LabVIEW.
    > I am mostly trying to learn on my own, that is why I want to much to
    > solve this.
    >
    > Thanks in advance for any help out there. I have become frustrated
    > with this little problem. I know someone might have an easy answer,
    > but I haven't found it yet. Thanks!!!! :-)
    > /JB
    > LabVIEW 6.1

  • I'd like to save to file/database image from clipboard

    Hi, I've got following problem.
    In my swing application I would like to pase image from clipboard (f.ex. copied from msword). I use following code to do that:
    TransferHandler handler=jLabel.getTransferHandler();
    handler.importData(jLabel,clipData);
    Then I want to save image to database.
    I know it should look like this:
    ImageIO.write(RenderedImage im, String formatName, OutputStream output);
    But how to transform image from clipboard or graphics from jLabel1.getGraphics into RenderedImage ???
    thanx in advance !

    Starting with the original image I adjusted the levels (Image>Adjustments>Levels (Ctrl L) to the following settings:
    Then using the marquee tool I selected the areas not in use and filled with white:
    Till you get something like this:
    Then I used the brush tool to fill the other bits of the lines in white using these settings:
    Once you are happy with the result with a white background go to the Blending Options on your layer:
    and set the blend as below and press ok:
    This will make your layer look like its got a transparent background, then create a new transparent layer and place underneath:
    When you have done this combine the 2 layer by selecting both and then right click and merge layers:
    After these steps save as a .psd file then you can copy anything you need from this file.
    I hope this all makes sense and you get the result you want. Like I said fiddly! :-)
    End result:

  • How can I get the image data from Clipboard with LV

    Anybody knows How can get the image data after pressd "print screen button" with LV?
    I want to program a software which can save a image as a bmp or jpeg etc, and the image data is from pressed print screen button. 
    How to get it out from clipboard. I am trapping about. thanks in advance.
    Try to make everything Automatic

    You can have a look at Rolf Kalbermatter's post here (give him stars) or, if you're using scripting, you can use the Application class Get Clipboard Image method.
    Try to take over the world!

  • Copy & Paste images to forms from the clipboard

    hello,
    Java Plug-in 1.6.0_33
    Using JRE version 1.6.0_33-b05 Java HotSpot(TM) Client VM
    Forms Applet version is 11.1.2.0
    Windows 7 64bitForms has successfully done the drag&drop,save image file images to javabeans then save & retrieve it from database.
    Laf project has an example of table-block copy/paste from/to the clipboard feature. You can populate a table-block with the content of the clipboard (Excel, Word,...) and also send to the clipboard with the content of a table-block.
    But a how about the copy & paste images to forms?
    It is posible?Any one tried this one?
    Charles
    Edited by: ck on Aug 12, 2012 3:09 AM

    bump...

  • How can i read a image from clipboard

    Hi all,
     Can you anyone help me to figure out this problem,actually i have an VI that capture screen image(similiar to print screen option in windows) & save it in a file.and now the thing is,its working in code,once if i converted that to EXE it is not reading that image from the clipboard .I have attached that VI along with this thread please check it.
    Attachments:
    Clipboard.vi ‏20 KB

    Hey,
    It seems that the Get Image from Clipboard method is not available for executables.
    The following thread gives a working example with a CIN -> http://forums.ni.com/ni/board/message?board.id=170&message.id=35987&requireLogin=False
    Christian

  • After downloading IO6, can't capture photos from Facebook. I get "save photo" instead of "save image".  While browsing, save image comes up and photos save to camera roll.  Seems to be a problem only on FB.

    Downloaded IO6 on my iPhone 4s.  Now I can't capture a photo off Facebook to the camera roll.  When I try, I get a "Save Photo" tab rather than a "Save Image" button,  The photo does not save to camera roll.  For email images and Safari images, "save image" comes up and save to camera roll.  Seems only a problem with images on FB.  Any ideas?  Thanks

    You launched iPhoto and from its Preferences you selected Connecting camera opens.....

  • How to play/record at same time and save image from video

    i started working on a project and that made my life hell although it was so simple. reason was that i couldnt find small/simple code to understand problems and no proper documents. . finally i have done that. and here is the code (without much complex code of interface). it shows vidoe, records a small part of it at start and takes a snapshot (no buttons or events involved). hope it might help someone starting to learn JMF.
    import java.io.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.media.*;
    import javax.media.rtp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.AudioFormat;
    import javax.media.format.VideoFormat;
    import javax.media.Format;
    import javax.media.format.FormatChangeEvent;
    import javax.media.control.BufferControl;
    import javax.media.control.FrameGrabbingControl;
    import javax.imageio.ImageIO;
    import java.util.Date;
    import javax.media.util.BufferToImage;
    import java.awt.image.BufferedImage;
    * AVReceive2 to receive RTP transmission using the new RTP API.
    public class AVReceive2 implements ReceiveStreamListener, SessionListener,
    ControllerListener
    public static DataSource ds2, ds, ds3;
    String sessions[] = null;
    RTPManager mgrs[] = null;
    Vector playerWindows = null;
    boolean dataReceived = false;
    Object dataSync = new Object();
    public AVReceive2(String sessions[]) {
    this.sessions = sessions;
    public static DataSource getData() {
    return ds;
    protected boolean initialize() {
    try {
    InetAddress ipAddr;
    SessionAddress localAddr = new SessionAddress();
    SessionAddress destAddr;
    mgrs = new RTPManager[sessions.length];
    playerWindows = new Vector();
    SessionLabel session;
    // Open the RTP sessions.
    for (int i = 0; i < sessions.length; i++) {
    // Parse the session addresses.
    try {
    session = new SessionLabel(sessions);
    } catch (IllegalArgumentException e) {
    System.err.println("Failed to parse the session address given: " + sessions[i]);
    return false;
    System.err.println(" - Open RTP session for: addr: " + session.addr + " port: " + session.port + " ttl: " + session.ttl);
    mgrs[i] = (RTPManager) RTPManager.newInstance();
    mgrs[i].addSessionListener(this);
    mgrs[i].addReceiveStreamListener(this);
    ipAddr = InetAddress.getByName(session.addr);
    if( ipAddr.isMulticastAddress()) {
    // local and remote address pairs are identical:
    localAddr= new SessionAddress( ipAddr,
    session.port,
    session.ttl);
    destAddr = new SessionAddress( ipAddr,
    session.port,
    session.ttl);
    } else {
    localAddr= new SessionAddress( InetAddress.getLocalHost(),
    session.port);
    destAddr = new SessionAddress( ipAddr, session.port);
    mgrs[i].initialize( localAddr);
    // You can try out some other buffer size to see
    // if you can get better smoothness.
    BufferControl bc = (BufferControl)mgrs[i].getControl("javax.media.control.BufferControl");
    if (bc != null)
    bc.setBufferLength(350);
    mgrs[i].addTarget(destAddr);
    } catch (Exception e){
    System.err.println("Cannot create the RTP Session: " + e.getMessage());
    return false;
    // Wait for data to arrive before moving on.
    long then = System.currentTimeMillis();
    long waitingPeriod = 30000; // wait for a maximum of 30 secs.
    try{
    synchronized (dataSync) {
    while (!dataReceived &&
    System.currentTimeMillis() - then < waitingPeriod) {
    if (!dataReceived)
    System.err.println(" - Waiting for RTP data to arrive...");
    dataSync.wait(1000);
    } catch (Exception e) {}
    if (!dataReceived) {
    System.err.println("No RTP data was received.");
    close();
    return false;
    return true;
    public boolean isDone() {
    //return playerWindows.size() == 0;
    return false;
    * Close the players and the session managers.
    protected void close() {
    for (int i = 0; i < playerWindows.size(); i++) {
    try {
    ((PlayerWindow)playerWindows.elementAt(i)).close();
    } catch (Exception e) {}
    playerWindows.removeAllElements();
    // close the RTP session.
    for (int i = 0; i < mgrs.length; i++) {
    if (mgrs[i] != null) {
    mgrs[i].removeTargets( "Closing session from AVReceive2");
    mgrs[i].dispose();
    mgrs[i] = null;
    PlayerWindow find(Player p) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.player == p)
    return pw;
    return null;
    PlayerWindow find(ReceiveStream strm) {
    for (int i = 0; i < playerWindows.size(); i++) {
    PlayerWindow pw = (PlayerWindow)playerWindows.elementAt(i);
    if (pw.stream == strm)
    return pw;
    return null;
    * SessionListener.
    public synchronized void update(SessionEvent evt) {
    if (evt instanceof NewParticipantEvent) {
    Participant p = ((NewParticipantEvent)evt).getParticipant();
    System.err.println(" - A new participant had just joined: " + p.getCNAME());
    * ReceiveStreamListener
    public synchronized void update( ReceiveStreamEvent evt) {
    RTPManager mgr = (RTPManager)evt.getSource();
    Participant participant = evt.getParticipant();     // could be null.
    ReceiveStream stream = evt.getReceiveStream(); // could be null.
    if (evt instanceof RemotePayloadChangeEvent) {
    System.err.println(" - Received an RTP PayloadChangeEvent.");
    System.err.println("Sorry, cannot handle payload change.");
    System.exit(0);
    else if (evt instanceof NewReceiveStreamEvent) {
    try {
    stream = ((NewReceiveStreamEvent)evt).getReceiveStream();
    //DataSource
    ds2 = stream.getDataSource(); // this original cant be used now
    // ds is used to play video
    ds = Manager.createCloneableDataSource(ds2);
    // ds3 is used to record video
    ds3 = ((SourceCloneable)ds).createClone();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    if (ctl != null){
    System.err.println(" - Recevied new RTP stream: " + ctl.getFormat());
    } else
    System.err.println(" - Recevied new RTP stream");
    if (participant == null)
    System.err.println(" The sender of this stream had yet to be identified.");
    else {
    System.err.println(" The stream comes from: " + participant.getCNAME());
    // create a player by passing datasource to the Media Manager
    Player p = javax.media.Manager.createPlayer(ds);
    if (p == null)
    return;
    p.addControllerListener(this);
    p.realize();
    PlayerWindow pw = new PlayerWindow(p, stream);
    playerWindows.addElement(pw);
    // Notify intialize() that a new stream had arrived.
    synchronized (dataSync) {
    dataReceived = true;
    dataSync.notifyAll();
    } catch (Exception e) {
    e.printStackTrace();
    return;
    else if (evt instanceof StreamMappedEvent) {
    if (stream != null && stream.getDataSource() != null) {
    DataSource ds = stream.getDataSource();
    // Find out the formats.
    RTPControl ctl = (RTPControl)ds.getControl("javax.media.rtp.RTPControl");
    System.err.println(" - The previously unidentified stream ");
    if (ctl != null)
    System.err.println(" " + ctl.getFormat());
    System.err.println(" had now been identified as sent by: " + participant.getCNAME());
    else if (evt instanceof ByeEvent) {
    System.err.println(" - Got \"bye\" from: " + participant.getCNAME());
    PlayerWindow pw = find(stream);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    * ControllerListener for the Players.
    public synchronized void controllerUpdate(ControllerEvent ce) {
    Player p = (Player)ce.getSourceController();
    if (p == null)
    return;
    // Get this when the internal players are realized.
    if (ce instanceof RealizeCompleteEvent) {
    PlayerWindow pw = find(p);
    if (pw == null) {
    // Some strange happened.
    System.err.println("Internal error!");
    System.exit(-1);
    pw.initialize();
    pw.setVisible(true);
    p.start();
    try {
    // make it wait so that video can start otherwise image will be null. u must call this method with a button
    Thread.sleep(2500);
    catch (Exception e) {
    e.printStackTrace();
    // Grab a frame from the capture device
    FrameGrabbingControl frameGrabber = (FrameGrabbingControl) p.getControl(
    "javax.media.control.FrameGrabbingControl");
    Buffer buf = frameGrabber.grabFrame();
    // Convert frame to an buffered image so it can be processed and saved
    Image img = (new BufferToImage( (VideoFormat) buf.getFormat()).
    createImage(buf));
    BufferedImage buffImg = new BufferedImage(img.getWidth(null),
    img.getHeight(null),
    BufferedImage.TYPE_INT_RGB);
    Graphics2D g = buffImg.createGraphics();
    g.drawImage(img, null, null);
    // Overlay curent time on image
    g.setColor(Color.RED);
    g.setFont(new Font("Verdana", Font.BOLD, 12));
    g.drawString( (new Date()).toString(), 10, 25);
    try { // Save image to disk as PNG
    ImageIO.write(buffImg, "jpeg", new File("c:\\webcam.jpg"));
    catch (Exception e) {
    e.printStackTrace();
    // this will record the video for a few seconds. this should also be called properly by menu or buttons
    record(ds3);
    if (ce instanceof ControllerErrorEvent) {
    p.removeControllerListener(this);
    PlayerWindow pw = find(p);
    if (pw != null) {
    pw.close();
    playerWindows.removeElement(pw);
    System.err.println("AVReceive2 internal error: " + ce);
    * A utility class to parse the session addresses.
    class SessionLabel {
    public String addr = null;
    public int port;
    public int ttl = 1;
    SessionLabel(String session) throws IllegalArgumentException {
    int off;
    String portStr = null, ttlStr = null;
    if (session != null && session.length() > 0) {
    while (session.length() > 1 && session.charAt(0) == '/')
    session = session.substring(1);
    // Now see if there's a addr specified.
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    addr = session;
    } else {
    addr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a port specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    portStr = session;
    } else {
    portStr = session.substring(0, off);
    session = session.substring(off + 1);
    // Now see if there's a ttl specified
    off = session.indexOf('/');
    if (off == -1) {
    if (!session.equals(""))
    ttlStr = session;
    } else {
    ttlStr = session.substring(0, off);
    if (addr == null)
    throw new IllegalArgumentException();
    if (portStr != null) {
    try {
    Integer integer = Integer.valueOf(portStr);
    if (integer != null)
    port = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    } else
    throw new IllegalArgumentException();
    if (ttlStr != null) {
    try {
    Integer integer = Integer.valueOf(ttlStr);
    if (integer != null)
    ttl = integer.intValue();
    } catch (Throwable t) {
    throw new IllegalArgumentException();
    * GUI classes for the Player.
    class PlayerWindow extends Frame {
    Player player;
    ReceiveStream stream;
    PlayerWindow(Player p, ReceiveStream strm) {
    player = p;
    stream = strm;
    public void initialize() {
    add(new PlayerPanel(player));
    public void close() {
    player.close();
    setVisible(false);
    dispose();
    public void addNotify() {
    super.addNotify();
    pack();
    * GUI classes for the Player.
    class PlayerPanel extends Panel {
    Component vc, cc;
    PlayerPanel(Player p) {
    setLayout(new BorderLayout());
    if ((vc = p.getVisualComponent()) != null)
    add("Center", vc);
    if ((cc = p.getControlPanelComponent()) != null)
    add("South", cc);
    public Dimension getPreferredSize() {
    int w = 0, h = 0;
    if (vc != null) {
    Dimension size = vc.getPreferredSize();
    w = size.width;
    h = size.height;
    if (cc != null) {
    Dimension size = cc.getPreferredSize();
    if (w == 0)
    w = size.width;
    h += size.height;
    if (w < 160)
    w = 160;
    return new Dimension(w, h);
    public void record(DataSource ds) {
    Format formats[] = new Format[1];
    formats[0] = new VideoFormat(VideoFormat.CINEPAK);
    FileTypeDescriptor outputType =
    new FileTypeDescriptor("video.x_msvideo");
    Processor p = null;
    try {
    p = Manager.createRealizedProcessor(new ProcessorModel(ds,formats,
    outputType));
    } catch (IOException e) {
    e.printStackTrace();
    } catch (NoProcessorException e) {
    e.printStackTrace();
    } catch (CannotRealizeException e) {
    e.printStackTrace();
    // get the output of the processor
    DataSource source = p.getDataOutput();
    // create a File protocol MediaLocator with the location
    // of the file to
    // which bits are to be written
    MediaLocator dest = new MediaLocator("file://vvv.mpeg");
    // create a datasink to do the file writing & open the
    // sink to make sure
    // we can write to it.
    DataSink filewriter = null;
    try {
    filewriter = Manager.createDataSink(source, dest);
    filewriter.open();
    } catch (NoDataSinkException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    } catch (SecurityException e) {
    e.printStackTrace();
    // now start the filewriter and processor
    try {
    filewriter.start();
    } catch (IOException e) {
    e.printStackTrace();
    p.start();
    try {
    Thread.sleep(10000);
    }catch(Exception e) { }
    p.close();
    filewriter.close();
    // stop and close the processor when done capturing...
    // close the datasink when EndOfStream event is received...
    public static void main(String argv[]) {
    //     if (argv.length == 0)
    //     prUsage();
    String[] a = new String[1];
    a[0] = ("192.168.0.45/4002");
    AVReceive2 avReceive = new AVReceive2(a);
    if (!avReceive.initialize()) {
    System.err.println("Failed to initialize the sessions.");
    System.exit(-1);
    // Check to see if AVReceive2 is done.
    try {
    while (!avReceive.isDone())
    Thread.sleep(1000);
    } catch (Exception e) {}
    System.err.println("Exiting AVReceive2");
    static void prUsage() {
    System.err.println("Usage: AVReceive2 <session> <session> ...");
    System.err.println(" <session>: <address>/<port>/<ttl>");
    //System.exit(0);
    }// end of AVReceive2
    so here the code. all messed up. coz i have just completed it and havent worked on interface or formatting this code properly (didnt have much time). but hope it will help. ask me if u have any questions. dont want others to have those basic problems that i had to face.

    u did a good effort for the JMF beginners i appreciate that....thanks i lot....i need you help in a project in
    which i have to connect to a d-link 950G IP camera and process that
    mpeg-4 stream (i know there are some problems in JMF and mpeg4) and show it over applet of JFrame.
    IP is 172.25.35.22
    Edited by: alchemist on Jul 16, 2008 6:09 AM

Maybe you are looking for

  • Tagging in iCal (or any other calendar app)

    I'm looking for a calendar program that has tagging. I've found 2 so far: Chandler, which is pretty clunky, and crashes more than i'm comfortable with; and NowX, which is also a bit awkward, far more crash-prone, and very slow. What i'd really like i

  • Error accessing tape

    Running OSB on Windows 2003 x64 with HP C7438A DAT Drive. I've installed everything OK. No HP drivers are installed for the tape and I've disabled the removable storage service. I notice that the Oracle driver does not show up in Device Manager as it

  • Disable links to how-to videos

    It seems microsoft has listened and allowed the complete removal of ads, at least on my version(6.21.0.104), but now have added these links to how-to videos that I can't get to go away. I have disabled targeted advertising and help and skype tips, bu

  • Do all namespaces have to live in the 'DFSRoots' folder?

    Running through DFSN PS commands for the 70-411... My question is, do all DFS namespaces have to have their root shared folder in the 'DFSRoots' folder? Working through the 70-411 Exam Ref handbook, and entering.. New-DfsnRoot -TargetPath \\trey-dc-0

  • Xml extract problem

    I have a problem about sql to extract xml node,the sql followed: select a.disptx.extract('/Record/_20/text()').getStringVal() from swifti a where swidty = '6666666666666666666' and the clob is : <Record> <swrctm>2223</swrctm> <swintm>22:23:13</swintm