비디오 재생을을 구현하였습니다. TextureView나 SurfaceView를 이용해서 영상을 연결 시켜서 재생 중이구요.
여기서 특정 영역을 선택하는 좌표 값 x, y, w, h 값은 전부 가져오고 있습니다.
근데 실제로 textureview나 surfaceview에서 matrix를 이용해 scale을 줘봐도 위치값이 맞질 않네요.
뭐가 문제인지 잘 모르겠네요. 혹시 아시는 분 계신가요? 위치 값 구하는 아래 소스입니다.
public void onCrop(int nLeft, int nTop, int nRight, int nBottom, int nCenterX, int nCenterY, int nCropWidth, int nCropHight)
{
float fScaleX = (float)m_TextureView.getWidth() / (float)nCropWidth;
float fScaleY = (float)m_TextureView.getHeight() / (float)nCropHight;
Matrix matrix = m_TextureView.getMatrix();
matrix.setScale(fScaleX, fScaleY, nCenterX, nCenterY);
m_TextureView.setTransform(matrix);
if (nCropWidth < nCropHight)
{
m_TextureView.setLayoutParams(new FrameLayout.LayoutParams(m_nBottom - m_nTop, m_nRight - m_nLeft, Gravity.CENTER));
}
else if(nCropHight < nCropWidth)
{
m_TextureView.setLayoutParams(new FrameLayout.LayoutParams(m_nRight - m_nLeft, m_nBottom - m_nTop, Gravity.CENTER));
}
}