• 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);

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

  • 相关阅读:
    until循环
    linux的shell使用
    shell通配符(元字符)
    linu运算
    mail邮件
    linux命令
    redis笔记
    mysql 5.7安装方法
    mysql5.7.25搭建mysql-5.7.25.tar.gz包(亲验)
    mysql数据迁移
  • 原文地址:https://www.cnblogs.com/mao0504/p/4706827.html
Copyright © 2020-2023  润新知