Hi Veritatis.
I completely agree with you on the formatting part (I have the byte array
which I can convert into any format and I am doing it via bitmap only)

Here is the code :

//initializing the compression and Byte Stream Part

ByteArrayOutputStream bs = new ByteArrayOutputStream();
YuvImage yuv_image = new YuvImage(*buffer1*,20 , 640, 480, null);


// Doing the Compression part

Rect rect = new Rect(0, 0, 640, 480);
yuv_image.compressToJpeg(rect, 70, bs);


//Finalzing the image writing part as JPEG

outStream = new FileOutputStream(String.format("/my/image/location"));
outStream.write(bs.toByteArray());


 jpgView= (ImageView)findViewById(R.id.jpgview1);


//Bitmap Part

 BitmapFactory.Options options = new BitmapFactory.Options();
 options.inSampleSize = 1;
  Bitmap bm = BitmapFactory.decodeFile("/my/image/location");
  bm =
BitmapFactory.decodeByteArray(baos.toByteArray(),0,bs.toByteArray().length);



*bs is of type --> ByteArrayOutputStream
and jpgView --> ImageView*

If I supply the continous frames buffer1 to I YuvImage will be able to see
the video on the ImageView.

So now instead of previewing it on Imageview I wanted to Utilize the
existing camera Viewfinder(Surface Holder- Surface-Jsurface>..) to preview
image and videos but to do that I dont know whether I have to tweak
Framework/base/* camera files or that can be done on the Application level
only(the android application - and not Application framework)


One neat hack will be to preview everything on some media player(not via
using android media framework - that can be but not sure wether it will fit
as it is tagged with the camera internally)so that it will give the user
the impression that the viewfinder is turned ON though the media player
will be ON displaying the continous frames and not the Camera Viewfinder.


PS : Title of this post is about giving the frames(Dummy as for now) to the
Camera ViewFinder.Just a summary :) !
Rgds,
Saurabh





What "continuous jpeg frames"? The only 'continuous' frames in the
viewfinder are the preview frames, and those are not jpeg: they are
YCrCb at 15 fps. Unless you make your own jpeg out of YCrBb, but why
bother? You need a Bitmap for the Canvas for SurfaceView anyway: you
may as well use RGB or ARGB instead of JPEG (see Bitmap.Config). Then
no conversion is necessary. In fact, it is not useful with a Canvas,
since it is not among the formats listed on Bitmap.Config.





"..pain is temporary.....quitting lasts forever......"



On Fri, Nov 18, 2011 at 8:33 AM, Indicator Veritatis <mej1...@yahoo.com>wrote:

> What "continuous jpeg frames"? The only 'continuous' frames in the
> viewfinder are the preview frames, and those are not jpeg: they are
> YCrCb at 15 fps. Unless you make your own jpeg out of YCrBb, but why
> bother? You need a Bitmap for the Canvas for SurfaceView anyway: you
> may as well use RGB or ARGB instead of JPEG (see Bitmap.Config). Then
> no conversion is necessary. In fact, it is not useful with a Canvas,
> since it is not among the formats listed on Bitmap.Config.
>
> Now if you are willing to live with the Camera object's preview, you
> can let it display the frames, but capture the frames also for your
> own processing using the Camera.setPreviewCallback() method to
> register your own handler for each frame.
>
> I realize this does not do exactly what you asked for, but it is a lot
> less work than what you are proposing, and gives you much of what you
> probably really need.
>
> On Nov 17, 11:26 am, "s.rawat" <imsaurabhra...@gmail.com> wrote:
> > Hi,
> > I am trying to by-pass the default camera viewfinder and making an
> > application which will give the Surfaceview some continuous jpeg frames
> > (instead of getting it from Camera view finder)., but I have realized its
> > quiet a gigantic task and I have to modify the files in the
> > framework/core/jni(native calls), framework/core/java and services and
> > client as well and even the CameraHardware.cpp for this
> > as Surfaceview(Surfaceholder instance) connected with the mCamera
> > instance (as  the fully initialized SurfaceHolder is to be passed to the
> > setPreviewDisplay()(which is connectd with the Camera Hardware code).So i
> > wanted to ask these questions:
> >
> > (1) Is it possible to bypass the default camera view finder at the
> > application (android application code) level.
> > (2) I am able to generate the video by passing the continuous jpeg
> frames to
> > * image view*(running in a thread being spawned form the main thread
> until
> > i press stop), can I also  in some way pass these frames to Surface
> > holder(surface view so that I can see the video in the viewfinder- my
> > understanding is that Surface holder is responsible for the viewfinder on
> > the camera)
> > (3) Any other way to implement this without delving deep into the Android
> > framework.
> > Plz suggest .
> > Rgds and Thanks for your reply
> > Saurabh
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to