Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 28
Registered: ‎12-22-2009
My Device: Bold 9000
My Carrier: MTN South Africa

Setting MetaData on a Image using the ImageFomatControl

Hi Guys,

I hope someone here has a bit advice for me. I am looking to add metadata to an image that is taken from a blackberry using the Player Video Control method. This works all very well, but trying to add metadata results in a message "Setting Metadata is not supported". i dont know why and have followed the examples on http://www.blackberry.com/developers/docs/5.0.0api/javax/microedition/amms/control/FormatControl.htm...) with no result.

The code i currently have is as follows:

First i initialize the camera:

 

player = Manager.createPlayer("capture://video");
           
            // Set the player to the REALIZED state (see Player javadoc)
            player.realize();
            player.start();
           
            control = (VideoControl)player.getControl("VideoControl");
           
            Field cameraView = (Field)control.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
            control.setDisplayFullScreen(true);
            control.setVisible(true);
           
            add(cameraView);

Once that is done, it shows the fullscreeen viewfinder - all works well.

 

Then i have a override on the click of the trackball, it calls this method:

Here i try to implement the code to set the metadata, but something seems wrong...

 

public void TakePicture()
    {
        try
        {
            String encoding = "encoding=jpeg&width=640&height=480&quality=fine";           
          
            ImageFormatControl imageFormatControl = (ImageFormatControl)player.getControl("javax.microedition.amms.control.ImageFormatControl");
            if(imageFormatControl != null)
            {
                imageFormatControl.setFormat("image/jpeg");
                imageFormatControl.setParameter(FormatControl.PARAM_VERSION_TYPE, "JPEG");
                               
                imageFormatControl.setMetadata("geo.lon", "-35.1111111");
            }
          
            _snapShot = control.getSnapshot(encoding);           
            _isInSnapshotMode = Boolean.FALSE;           
            DrawStep2();
        }
        catch(MediaException mediaException)
        {
            Dialog.inform(mediaException.getMessage());
        }
    }

 

If anyone has any ideas. please comment. i will really appreviate it.

Thanks

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Setting MetaData on a Image using the ImageFomatControl

Where does it go wrong, getting the ImageFormatControl? Getting the snapshot, etc. What is the exception?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 28
Registered: ‎12-22-2009
My Device: Bold 9000
My Carrier: MTN South Africa

Re: Setting MetaData on a Image using the ImageFomatControl

It goes wrong basically on the line where i try to set the metadata.

Exception is : "Setting metadata is not supported."

Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Setting MetaData on a Image using the ImageFomatControl

The exception is self explaining, you can't set the metadata.

 

The problem is the way the JSR process is, if RIM implements a JSR they must implement the entire JSR but they don't need to support all of it.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Highlighted
Developer
Posts: 28
Registered: ‎12-22-2009
My Device: Bold 9000
My Carrier: MTN South Africa

Re: Setting MetaData on a Image using the ImageFomatControl

Thanks for the post. As i am new to BB development i thought maybe i missed something. However i figured out a work-around for my problem... thanks again for the helop.