乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      sdl 播放yuv

       水中麒麟 2015-07-17
      LRESULT CVideoPlayerPropPage::OnInitSDL(WPARAM wParam,LPARAM lParam)
      {
      #ifdef _SDL_H
      // 初始化 需要很多時間  會影響ocx 界面的顯示
      if( SDL_Init(SDL_INIT_EVERYTHING) == -1)
      {
      TTRACE("%s SDL_Init is failed \r\n", __FUNCTION__);
      }
      //用mfc窗口句柄創(chuàng)建一個sdl window
          m_pSDLWindow = SDL_CreateWindowFrom( (void *)(m_ImgWnd->m_hWnd) );
      #endif
      return TRUE;

      }




      void CVideoPlayerPropPage::PlayMediaYuvData( ST_YUV_VIDEO_DATA &stYuvData )
      {
      STRY;
      #ifdef _SDL_H

      m_nWidth = stYuvData.nWidth;
      m_nHeight = stYuvData.nHeight;
      //SDL  Show YUV data
      if(m_nMagnification == 0) //正常播放  沒有縮放
      {
      m_sdlSrcRect.h = stYuvData.nHeight;
      m_sdlSrcRect.w = stYuvData.nWidth;
      m_sdlSrcRect.x = 0;
      m_sdlSrcRect.y = 0;
      }
      SDL_Rect srcRT;
          srcRT.h = stYuvData.nHeight;
          srcRT.w = stYuvData.nWidth;
          srcRT.x = 0;
          srcRT.y = 0;

          SDL_Rect dstRT;
          dstRT.h = stYuvData.nHeight;
          dstRT.w = stYuvData.nWidth;
          dstRT.x = 0;
          dstRT.y = 0;

          int iW = stYuvData.nWidth;
          int iH = stYuvData.nHeight;    

          char szPrint[256] = {0};
          
          //計算yuv一行數(shù)據(jù)占的字節(jié)數(shù)
          int iPitch = iW*SDL_BYTESPERPIXEL(SDL_PIXELFORMAT_YV12);    

          int iWidth = 0;
          int iHeight = 0;
          SDL_GetWindowSize( m_pSDLWindow, &iWidth, &iHeight );
          dstRT.h = iHeight;
          dstRT.w = iWidth;   
          if(m_pSDLRender == NULL)
      {
      int nDriversCount = SDL_GetNumRenderDrivers();
      //創(chuàng)建渲染器,第二個參數(shù)為選用的畫圖驅(qū)動,0代表d3d
      m_pSDLRender = SDL_CreateRenderer( m_pSDLWindow, 0, SDL_RENDERER_ACCELERATED );
      if(m_pSDLRender == NULL)
      {
      TTRACE("%s SDL_GetError() =%s ",__FUNCTION__,SDL_GetError());

      }
      SDL_RendererInfo info;
      SDL_GetRendererInfo(m_pSDLRender, &info);
      }

          //創(chuàng)建紋理
      if(m_pSDLTexture == NULL)
      {
      m_pSDLTexture = SDL_CreateTexture( m_pSDLRender,SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, iW, iH ); 
      }

      int nRet = FALSE;

      nRet = SDL_UpdateYUVTexture(m_pSDLTexture,&srcRT,stYuvData.pData[0],stYuvData.nLineSize[0],\
      stYuvData.pData[1],stYuvData.nLineSize[1],stYuvData.pData[2],stYuvData.nLineSize[2]);

      //nRet = SDL_UpdateTexture( m_pSDLTexture, &srcRT, stYuvData.pYuvbuf, iPitch );
      nRet = SDL_RenderClear( m_pSDLRender );

      //if( !m_bIsSpecilReToShow )//不是指定區(qū)域顯示
      {
      if(m_bIsZoom)
      {
      m_bIsZoom = FALSE;
      if(m_nMagnification > m_nOldMagnification)
      {
      if(m_nMagnification < stYuvData.nWidth)
      {
      m_sdlSrcRect.x += m_nMagnification;
      }
      if(m_nMagnification < stYuvData.nHeight )
      {
      m_sdlSrcRect.y += m_nMagnification;
      }
      if( (m_nMagnification*2 + m_sdlSrcRect.x ) < m_sdlSrcRect.w )
      {
      m_sdlSrcRect.w -= m_nMagnification;
      m_sdlSrcRect.w -= m_nMagnification;
      }
      if( (m_nMagnification*2 + m_sdlSrcRect.y ) < m_sdlSrcRect.h )
      {
      m_sdlSrcRect.h -= m_nMagnification;
      m_sdlSrcRect.h -= m_nMagnification;
      }

      //SetBrightness(stYuvData.pYuvbuf,m_nWidth,m_nHeight,g_nBrightness);
      }
      else
      {
      if(m_nMagnification < stYuvData.nWidth)
      {
      m_sdlSrcRect.x -= m_nMagnification;
      }

      if(m_nMagnification < stYuvData.nHeight )
      {
      m_sdlSrcRect.y -= m_nMagnification;
      }
      // if( (m_nMagnification + m_sdlSrcRect.x + 100) < m_sdlSrcRect.w )
      {
      m_sdlSrcRect.w += m_nMagnification;
      m_sdlSrcRect.w += m_nMagnification;
      }
      // if( (m_nMagnification + m_sdlSrcRect.y + 100) < m_sdlSrcRect.h )
      {
      m_sdlSrcRect.h += m_nMagnification;
      m_sdlSrcRect.h += m_nMagnification;
      }
      }
      m_nOldMagnification = m_nMagnification;

      /*
      // if( (m_nMagnification + m_sdlSrcRect.x + 100) < m_sdlSrcRect.w )
      {
      srcRT.w -= m_nMagnification;
      srcRT.w -= m_nMagnification;
      m_sdlSrcRect.w =  srcRT.w;

      }
      // if( (m_nMagnification + m_sdlSrcRect.y + 100) < m_sdlSrcRect.h )
      {
      srcRT.h -= m_nMagnification;
      srcRT.h -= m_nMagnification;
      m_sdlSrcRect.h = srcRT.h;
      }
      */

      m_rectCurZoom.left = m_sdlSrcRect.x;
      m_rectCurZoom.top = m_sdlSrcRect.y;
      m_rectCurZoom.right = m_rectCurZoom.left + m_sdlSrcRect.w;
      m_rectCurZoom.bottom = m_rectCurZoom.top + m_sdlSrcRect.h;
      }

      }
      //else //指定區(qū)域顯示
      {
      /*
         m_sdlSrcRect.x = m_rectCurZoom.left;
      m_sdlSrcRect.y = m_rectCurZoom.right;
      m_sdlSrcRect.w = m_rectCurZoom.Width();
      m_sdlSrcRect.h = m_rectCurZoom.Height();
      */

      }


      SDL_RenderCopy( m_pSDLRender, m_pSDLTexture, &m_sdlSrcRect, &dstRT );

      // SDL_RenderCopy( m_pSDLRender, m_pSDLTexture, &sdlRT, &dstRT );
      SDL_RenderPresent( m_pSDLRender );
      #endif
      return;
      SCATCH;
      return;
      }








        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約