各位大神大家好,目前在阅读代码时,发现有这么一个用法【f->keep_last = !!keep_last;】这个【!!】是个什么意思?这么用有什么好处呢?
- static int frame_queue_init(FrameQueue *f, PacketQueue *pktq, int max_size, int keep_last)
- {
- int i;
- memset(f, 0, sizeof(FrameQueue));
- if (!(f->mutex = SDL_CreateMutex())) {
- av_log(NULL, AV_LOG_FATAL, "SDL_CreateMutex(): %s
", SDL_GetError());
- return AVERROR(ENOMEM);
- }
- if (!(f->cond = SDL_CreateCond())) {
- av_log(NULL, AV_LOG_FATAL, "SDL_CreateCond(): %s
", SDL_GetError());
- return AVERROR(ENOMEM);
- }
- f->pktq = pktq;
- f->max_size = FFMIN(max_size, FRAME_QUEUE_SIZE);
- f->keep_last = !!keep_last;
- for (i = 0; i < f->max_size; i++)
- if (!(f->queue[i].frame = av_frame_alloc()))
- return AVERROR(ENOMEM);
- return 0;
- }
复制代码
此帖出自
Linux与安卓论坛
嗯嗯,懂了。谢谢
嗯嗯,明白了。十分感谢。
一周热门 更多>