void alloc_picture(void *userdata) { VideoState *is = (VideoState *)userdata; VideoPicture *vp; vp = &is->pictq[is->pictq_windex]; if(vp->bmp) { // we already have one make another, bigger/smaller freeOverlay(&is->video_player, vp->bmp); //free(vp->bmp); //vp->bmp_size = 0; } // // Allocate a place to put our YUV image on that screen // vp->bmp = SDL_CreateYUVOverlay(is->video_st->codec->width, // is->video_st->codec->height, // SDL_YV12_OVERLAY, // is->audio_player->screen); //int numBytes = avpicture_get_size(TARGET_IMAGE_FORMAT, is->video_st->codec->width, is->video_st->codec->height); //vp->bmp = (uint8_t *) av_malloc(numBytes * sizeof(uint8_t)); // Allocate a place to put our YUV image on that screen vp->bmp = createOverlay(&is->video_player, is->video_st->codec->width, is->video_st->codec->height); vp->width = is->video_st->codec->width; vp->height = is->video_st->codec->height; pthread_mutex_lock(is->pictq_mutex); vp->allocated = 1; pthread_cond_signal(is->pictq_cond); pthread_mutex_unlock(is->pictq_mutex); }
int releaseOverlay(const char *name) { int overlayIdx = findOverlayByName(name); if (overlayIdx == -4) return -4; return freeOverlay(overlayIdx); }
void freeOverlayTable() { for (int i = 0; i < 90; i++) { if (overlayTable[i].alreadyLoaded) freeOverlay(i); } }