allocate a picture (needs to do that in main thread to avoid potential locking problems */
| 1298 | /* allocate a picture (needs to do that in main thread to avoid |
| 1299 | potential locking problems */ |
| 1300 | static void alloc_picture(void *opaque) |
| 1301 | { |
| 1302 | VideoState *is = opaque; |
| 1303 | VideoPicture *vp; |
| 1304 | |
| 1305 | vp = &is->pictq[is->pictq_windex]; |
| 1306 | |
| 1307 | if (vp->bmp) |
| 1308 | SDL_FreeYUVOverlay(vp->bmp); |
| 1309 | |
| 1310 | #if CONFIG_AVFILTER |
| 1311 | if (vp->picref) |
| 1312 | avfilter_unref_pic(vp->picref); |
| 1313 | vp->picref = NULL; |
| 1314 | |
| 1315 | vp->width = is->out_video_filter->inputs[0]->w; |
| 1316 | vp->height = is->out_video_filter->inputs[0]->h; |
| 1317 | vp->pix_fmt = is->out_video_filter->inputs[0]->format; |
| 1318 | #else |
| 1319 | vp->width = is->video_st->codec->width; |
| 1320 | vp->height = is->video_st->codec->height; |
| 1321 | vp->pix_fmt = is->video_st->codec->pix_fmt; |
| 1322 | #endif |
| 1323 | |
| 1324 | vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height, |
| 1325 | SDL_YV12_OVERLAY, |
| 1326 | screen); |
| 1327 | |
| 1328 | SDL_LockMutex(is->pictq_mutex); |
| 1329 | vp->allocated = 1; |
| 1330 | SDL_CondSignal(is->pictq_cond); |
| 1331 | SDL_UnlockMutex(is->pictq_mutex); |
| 1332 | } |
| 1333 | |
| 1334 | /** |
| 1335 | * |
no test coverage detected