MediaCodec: implement persistent input surface APIs

Bug: 19127604
Bug: 19489395

Change-Id: If0d723c9ecd6fe81d9df210bd2fd026b8603ea4a
This commit is contained in:
Chong Zhang
2015-04-28 13:38:48 -07:00
parent 574f53793d
commit 8034d60f6e
3 changed files with 185 additions and 5 deletions

View File

@@ -681,12 +681,20 @@ final public class MediaCodec {
*/
@NonNull
public static Surface createPersistentInputSurface() {
// TODO implement this
return new PersistentSurface();
return native_createPersistentInputSurface();
}
static class PersistentSurface extends Surface {
PersistentSurface() {}
@SuppressWarnings("unused")
PersistentSurface() {} // used by native
@Override
public void release() {
native_releasePersistentInputSurface(this);
super.release();
}
private long mPersistentObject;
};
/**
@@ -700,9 +708,17 @@ final public class MediaCodec {
* {@link #createPersistentInputSurface}.
*/
public void usePersistentInputSurface(@NonNull Surface surface) {
throw new IllegalArgumentException("not implemented");
if (!(surface instanceof PersistentSurface)) {
throw new IllegalArgumentException("not a PersistentSurface");
}
native_usePersistentInputSurface(surface);
}
@NonNull
private static native final PersistentSurface native_createPersistentInputSurface();
private static native final void native_releasePersistentInputSurface(@NonNull Surface surface);
private native final void native_usePersistentInputSurface(@NonNull Surface surface);
private native final void native_setCallback(@Nullable Callback cb);
private native final void native_configure(