-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #269 from ksvc/v5.0.0-28654
update to v5.0.0-28654
- Loading branch information
Showing
218 changed files
with
41,411 additions
and
5,134 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
demo/src/com/ksyun/media/streamer/demo/ImgTexGPUImageFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.ksyun.media.streamer.demo; | ||
|
||
import android.util.Log; | ||
|
||
import com.ksyun.media.streamer.filter.imgtex.ImgTexFilterBase; | ||
import com.ksyun.media.streamer.framework.ImgTexFormat; | ||
import com.ksyun.media.streamer.framework.ImgTexFrame; | ||
import com.ksyun.media.streamer.util.gles.GLRender; | ||
import com.ksyun.media.streamer.util.gles.GlUtil; | ||
import com.ksyun.media.streamer.util.gles.TexTransformUtil; | ||
|
||
import java.nio.FloatBuffer; | ||
|
||
import jp.co.cyberagent.android.gpuimage.GPUImageFilter; | ||
|
||
/** | ||
* Wrapper to compat with android-gpuimage filters. | ||
*/ | ||
|
||
public class ImgTexGPUImageFilter extends ImgTexFilterBase { | ||
private static final String TAG = "ImgTexGPUImageFilter"; | ||
|
||
private GPUImageFilter mGPUImageFilter; | ||
private ImgTexFormat mOutFormat; | ||
|
||
public ImgTexGPUImageFilter(GLRender glRender, GPUImageFilter gpuImageFilter) { | ||
super(glRender); | ||
mGPUImageFilter = gpuImageFilter; | ||
} | ||
|
||
public GPUImageFilter getGPUImageFilter() { | ||
return mGPUImageFilter; | ||
} | ||
|
||
@Override | ||
public int getSinkPinNum() { | ||
return 1; | ||
} | ||
|
||
@Override | ||
protected ImgTexFormat getSrcPinFormat() { | ||
return mOutFormat; | ||
} | ||
|
||
@Override | ||
protected void onFormatChanged(int inIdx, ImgTexFormat format) { | ||
mOutFormat = new ImgTexFormat(ImgTexFormat.COLOR_RGBA, format.width, format.height); | ||
Log.d(TAG, "init GPUImage filter " + format.width + "x" + format.height); | ||
mGPUImageFilter.init(); | ||
mGPUImageFilter.onOutputSizeChanged(format.width, format.height); | ||
} | ||
|
||
@Override | ||
protected void onDraw(ImgTexFrame[] frames) { | ||
int textureId = frames[mMainSinkPinIndex].textureId; | ||
mGPUImageFilter.onDraw(textureId, getVertexCoords(), getTexCoords()); | ||
GlUtil.checkGlError("GPUImageFilter onDraw"); | ||
} | ||
|
||
@Override | ||
protected void onRelease() { | ||
mGPUImageFilter.destroy(); | ||
super.onRelease(); | ||
} | ||
|
||
protected FloatBuffer getTexCoords() { | ||
return TexTransformUtil.getTexCoordsBuf(); | ||
} | ||
|
||
protected FloatBuffer getVertexCoords() { | ||
return TexTransformUtil.getVertexCoordsBuf(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.