zoukankan      html  css  js  c++  java
  • ffmpeg入门之 Tutorial02 分类: ffmpeg-SDL-VLC-Live555 2013-08-26 08:48 520人阅读 评论(0) 收藏

    02实际是在01的基础上添加了 SDL显示yuv部分,这部分相对独立。

      if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER))
      {
        fprintf(stderr, "Could not initialize SDL - %s ", SDL_GetError());
        exit(1);
      }

    screen = SDL_SetVideoMode(pCodecCtx->width, pCodecCtx->height, 0, 0);

      
      // Allocate a place to put our YUV image on that screen
      bmp = SDL_CreateYUVOverlay(pCodecCtx->width,
         pCodecCtx->height,
         SDL_YV12_OVERLAY,
         screen);

     SDL_LockYUVOverlay(bmp);

     pict.data[0] = bmp->pixels[0];
     pict.data[1] = bmp->pixels[2];
     pict.data[2] = bmp->pixels[1];

     SDL_UnlockYUVOverlay(bmp);
     
     rect.x = 0;
     rect.y = 0;
     rect.w = pCodecCtx->width;
     rect.h = pCodecCtx->height;


     SDL_DisplayYUVOverlay(bmp, &rect);

        SDL_PollEvent(&event);
        switch(event.type)
     {
        case SDL_QUIT:
          SDL_Quit();
          exit(0);
          break;
        default:
          break;
        }
     SDL_Delay(40);

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    Python闭包
    使用python在极坐标中生成一条直线
    使用python生成c文件模板
    使用python转换markdown to html
    使用python转换编码格式
    安装PyQt5和Eric6
    2.深入剖析地址转化
    1.MMU功能解析
    37.C与汇编混合编程
    36.从汇编到C(bl1到bl2)
  • 原文地址:https://www.cnblogs.com/mao0504/p/4706827.html
Copyright © 2011-2022 走看看