zoukankan      html  css  js  c++  java
  • 同步相关 及音量

    #include <windows.h>
    #include <mutex>
    #include "SDL.h"
    
    #define REFRESH_EVENT  (SDL_USEREVENT + 1)
    
    static SDL_Thread* refresh_thread;
    static SDL_Event event;
    
    static int thread_exit = 0;
    static int refresh_video(void* opaque) {
        while (thread_exit == 0) {
            SDL_Event event;
            event.type = REFRESH_EVENT;
            SDL_PushEvent(&event);
            SDL_Delay(4000);
        }
        return 0;
    }
    
    
    
    int main(int argc, char** argv)
    {
    
        refresh_thread = SDL_CreateThread(refresh_video, NULL, NULL);
    
        while (1) {
            SDL_WaitEvent(&event);
            if (event.type == REFRESH_EVENT) {
                printf("REFRESH_EVENT \n");
            }else if (event.type == SDL_QUIT) {
                printf("SDL_QUIT \n");
                break;
            }
            printf("while\n");
        }
        return 0;
    }
        SDL_Event event;
        double remaining_time = 0.0;
        SDL_PumpEvents();
        //while (!SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) 
        SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
        {
    
            sdlRender->Display((uint8_t**)frame->data, frame->linesize);
    
    #define DelayTime 5
            if (lastDts >= 0)
            {
                auto diff = frame->pkt_pts - lastDts;
                int duration = diff * 1000 / (video_stream->time_base.den
                    / video_stream->time_base.num);
                if (duration > DelayTime && duration < 1000)
                {
                    Sleep(duration - DelayTime);
                    printf("Sleep %d ----------\n", duration - DelayTime);
                }
            }
            lastDts = frame->pkt_pts;
    
    
            SDL_PumpEvents();
        }

    音量

    https://blog.csdn.net/weixinhum/article/details/34864625

  • 相关阅读:
    gitlab详解
    Centos7源码安装MySQL5.7
    git常用语句
    jenkins的Pipeline代码流水线管理
    jenkins配置Maven的私有仓库Nexus
    jenkins按角色授权
    jenkins集群节点构建maven(几乎是坑最多的)
    jenkins按版本发布maven项目
    jenkins发布java项目
    实现拷贝函数(strcpy)
  • 原文地址:https://www.cnblogs.com/cnchengv/p/15753738.html
Copyright © 2011-2022 走看看