Hi,

I am trying to play the video on android device.  I did the coding as follows.

in ".H" file.


Code:
osg::ref_ptr<osg::Geode> geode;
osg::ref_ptr<osg::Texture2D> mVideoTexture;
osg::Image* img;
osg::ref_ptr<osg::ImageStream> videoStream[2];
osg::ref_ptr<osg::MatrixTransform> mtForMarker[2];
    osg::ref_ptr<osg::Switch> modelSwitch;




In ".CPP" file


Code:
int idx=0;
img = osgDB::readImageFile("1.mp4.mpeg");
videoStream[idx] = dynamic_cast<osg::ImageStream*>(img);
if (videoStream[idx].valid())
        {
                LOG( "Got movie");
                videoStream[idx]->setLoopingMode( osg::ImageStream::NO_LOOPING);
                videoStream[idx]->seek(0);
                videoStream[idx]->play();
        }
        else
           {
                  LOG( "No movie!");
           }
aspectRatio = (float)img->t() / (float)img->s();
         videoWidth = img->s();
         videoHeight =videoWidth * aspectRatio;

         mVideoTexture = new osg::Texture2D;
         geode = new osg::Geode;
         mVideoTexture->setImage( videoStream[idx].get() );

         geode->addDrawable(osg::createTexturedQuadGeometry(
                         osg::Vec3(0.0f, 0.0f, 0.0f),
                         osg::Vec3(videoWidth, 0.0f, 0.0f),
                         osg::Vec3(0.0f, 0.0f, videoHeight)
                        
                         ));
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, mVideoTexture, 
osg::StateAttribute::ON );

                mtForMarker[idx] = new osg::MatrixTransform();
                mtForMarker[idx]->addChild(geode.get());


                 modelSwitch->addChild(mtForMarker[idx]);




With this code the video displayed in  a small size (like 50X50) around the 
centre of the device (Not exactly at the centre of the device). The original 
video size is 640X480. Video is also displaying in upside down.

I am sung ffmpeg plug in for android. 

Can you please suggest me what could be the mistake.
... 

Thank you!

Cheers,
Koduri

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55425#55425




_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to