hi, I try to use SurfaceComposerClient and SurfaceFlinger to create a
Surface, but all failed, the point = null, can you help how to create
a surface?
when I try to sp<Surface> mysurface = client->createSurface(getpid(),
0, info.w , info.h, info.pixelFormatInfo.format , 0);
and sp<ISurface> myISurface = FlingerClient->createSurface
(¶m ,getpid(), 0, info.w , info.h, info.pixelFormatInfo.format,0);
all failed, the pointer return null
////////my code////////////////////
sp<SurfaceComposerClient> client;
DisplayInfo info;
uint32_t flags = 0x00000000;
client = new SurfaceComposerClient;
sp<IBinder> mybinder = client->connection();
client->openTransaction();
client->openGlobalTransaction();
ssize_t number = client->getNumberOfDisplays();
printf("number =%d \n", number);
client->getDisplayInfo(0,&info);
printf("w =%d h=%d format =%d \n", info.w,info.h,
info.pixelFormatInfo.format);
w=100; h=100;
sp<Surface> mysurface = client->createSurface(getpid(), 0,
info.w , info.h, info.pixelFormatInfo.format , 0);
if(mysurface == NULL){
printf(" create surface failed ! \n");
}
sp<ISurfaceComposer> SurfaceFlinger = _get_surface_manager();
if(SurfaceFlinger == NULL)
printf("SurfaceFlinger == null\n");
sp<ISurfaceFlingerClient> FlingerClient = SurfaceFlinger-
>createConnection();
if(FlingerClient == NULL)
printf("SurfaceFlingerclient == null\n");
ISurfaceFlingerClient::surface_data_t param;
sp<ISurface> myISurface = FlingerClient->createSurface
(¶m ,getpid(), 0, info.w , info.h, info.pixelFormatInfo.format,0);
if( myISurface == NULL)
printf(" myISurface == null\n");
/////my output//////////////////////
./myclient
Running in emulation - fallback to software codecs
number =1
w =320 h=480 format =4
create surface failed !
myISurface == null
myclient quit
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---