Note that there are some explanatory texts on larger screens.

plurals
  1. POOn iOS4.0 play yuv420 fails, but on iOS5.0 success
    primarykey
    data
    text
    <p>On iOS5.0 video captured from camera with the codes as following can play well,</p> <pre><code> glActiveTexture(GL_TEXTURE0); CVReturn err = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault, videoTextureCache, pixelBuffer, NULL, GL_TEXTURE_2D, GL_RED_EXT, videoWidth, videoHeight, GL_RED_EXT, GL_UNSIGNED_BYTE, 0, &amp;lumaTexture); if (!lumaTexture || err) { NSLog(@"CVOpenGLESTextureCacheCreateTextureFromImage failed (error: %d)", err); return; } glBindTexture(CVOpenGLESTextureGetTarget(lumaTexture), CVOpenGLESTextureGetName(lumaTexture)); // Set texture parameters glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glActiveTexture(GL_TEXTURE1); err = CVOpenGLESTextureCacheCreateTextureFromImage(kCFAllocatorDefault, videoTextureCache, pixelBuffer, NULL, GL_TEXTURE_2D, GL_RG_EXT, videoWidth / 2, videoHeight / 2, GL_RG_EXT, GL_UNSIGNED_BYTE, 1, &amp;chromaTexture); if (!chromaTexture || err) { NSLog(@"CVOpenGLESTextureCacheCreateTextureFromImage failed (error: %d)", err); return; } glBindTexture(CVOpenGLESTextureGetTarget(chromaTexture), CVOpenGLESTextureGetName(chromaTexture)); // Set texture parameters glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); </code></pre> <p>On iOS4.0 the following codes works well,</p> <pre><code> CVPixelBufferLockBaseAddress(pixelBuffer, 0); void * baseAddress = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer,0); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, spriteTexture[0]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RED_EXT, videoWidth, videoHeight, 0, GL_RED_EXT, GL_UNSIGNED_BYTE, baseAddress); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); void *baseAddress1 = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer,1); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, spriteTexture[1]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RG_EXT, videoWidth / 2, videoHeight / 2, 0, GL_RG_EXT, GL_UNSIGNED_BYTE,baseAddress1); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); CVPixelBufferUnlockBaseAddress(pixelBuffer, 0); </code></pre> <p>But when play video read from local mp4 file the second methods fails,and the first works well, it is very strange, I am delusive. Then how to fix it? and why this happened? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload