/* this function determines the color that the given message should be and then passes it to writeMessage [BDyess] */ void print_message(char *message, unsigned int flags, unsigned int from, unsigned int to) { register int len; W_Color color; W_Window targwin; #define take MTEAM + MTAKE + MVALID #define destroy MTEAM + MDEST + MVALID #define kill MALL + MKILL + MVALID #define killp MALL + MKILLP + MVALID #define killa MALL + MKILLA + MVALID #define bomb MTEAM + MBOMB + MVALID #define team MTEAM + MVALID #define conq MALL + MCONQ + MVALID len = strlen(message); if (from == 254) { /* client passing info around */ switch (showPhaser) { case 0: break; case 1: writeMessage(message, textColor, len, WA_KILL | WA_REVIEW); break; case 2: writeMessage(message, textColor, len, WA_REVIEW | WA_PHASER); break; case 3: writeMessage(message, textColor, len, WA_REVIEW); break; } return; } if (from == 255) { if (flags == MCONFIG + MINDIV + MVALID) { CheckFeatures(message); return; } /* From God */ color = textColor; } else { /* kludge to fix the occasional incorrect color message */ if (*message == ' ' && from != me->p_no) { /* XXX fix to handle funky teams */ switch (*(message + 1)) { case 'F': color = W_Yellow; break; case 'R': color = W_Red; break; case 'K': color = W_Green; break; case 'O': color = W_Cyan; break; case 'I': color = W_Grey; break; default: color = playerColor(&(players[from])); } } else color = playerColor(&(players[from])); } /* added/modified to fit with the scrollback feature 1/94 -JR */ if (!paradise && niftyNewMessages) { if (flags == conq) { /* output conquer stuff to stdout in addition to message window */ fprintf(stdout, "%s\n", message); if (strstr(message, "kill")) { fprintf(stdout, "NOTE: The server here does not properly set message flags\n"); fprintf(stdout, "You should probably pester the server god to update....\n"); } } if ((flags == team) || (flags == take) || (flags == destroy)) { writeMessage(message, color, len, WA_TEAM | WA_REVIEW); targwin = messWin[WTEAM].window; } else if ((flags == kill) || (flags == killp) || (flags == killa) || (flags == bomb)) { writeMessage(message, color, len, WA_KILL | (reportKills ? WA_REVIEW : 0)); targwin = messWin[WKILL].window; } else if (flags & MINDIV) { writeMessage(message, color, len, (WA_INDIV | WA_REVIEW)); targwin = messWin[WINDIV].window; } else if (flags == (MMACRO | MALL)) { writeMessage(message, color, len, (WA_MACRO | WA_REVIEW)); targwin = messWin[WALL].window; } else { /* if we don't know where the message belongs by this time, stick it in the all board... */ writeMessage(message, color, len, (WA_ALL | WA_REVIEW)); targwin = messWin[WALL].window; } } else { /* Kludge stuff for report kills... */ if ((strncmp(message, "GOD->ALL", 8) == 0 && (strstr(message, "was kill") || strstr(message, "killed by"))) || strstr(message, "burned to a crisp by") || strstr(message, "shot down by") || (*message != ' ' && strstr(message, "We are being attacked"))) { /* strip off the useless GOD->ALL by adding 9 to message [BDyess] */ message += 9; writeMessage(message, color, len, WA_KILL | (reportKills ? WA_REVIEW : 0)); return; } /* note: messages are kept track of even if the associated window is not mapped. This allows the window to be later mapped and have all the past messages. [BDyess] */ if (flags & MTEAM) { writeMessage(message, color, len, WA_TEAM | WA_REVIEW); targwin = messWin[WTEAM].window; } else if (flags & MINDIV) { writeMessage(message, color, len, WA_INDIV | WA_REVIEW); targwin = messWin[WINDIV].window; } else if (flags == (MMACRO | MALL)) { writeMessage(message, color, len, WA_MACRO | WA_REVIEW); targwin = messWin[WALL].window; } else { writeMessage(message, color, len, WA_ALL | WA_REVIEW); targwin = messWin[WALL].window; } } /* send warnings to warning or message window, if player doesn't have messag es mapped */ if ((use_msgw && (targwin == messWin[WINDIV].window || targwin == messWin[WTEAM].window)) || (!W_IsMapped(targwin) && !W_IsMapped(messWin[WREVIEW].window))) { if (!messpend && messagew) { /* don't collide with messages being written! */ W_ClearWindow(messagew); W_WriteText(messagew, 5, 5, color, message, len, W_RegularFont); } else warning(message); } }
int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame) { //CLog::Log(LOGNOTICE,"%s",__FUNCTION__); VdpStatus vdp_st; VdpTime time; if (CheckRecover(false)) return VC_FLUSHED; if (!vdpauConfigured) return VC_ERROR; outputSurface = outputSurfaces[surfaceNum]; CheckFeatures(); if (( (int)outRectVid.x1 != OutWidth ) || ( (int)outRectVid.y1 != OutHeight )) { outRectVid.x0 = 0; outRectVid.y0 = 0; outRectVid.x1 = OutWidth; outRectVid.y1 = OutHeight; } EDEINTERLACEMODE mode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; EINTERLACEMETHOD method = g_settings.m_currentVideoSettings.m_InterlaceMethod; if(pFrame) { // we have a new frame from decoder vdpau_render_state * render = (vdpau_render_state*)pFrame->data[2]; if(!render) // old style ffmpeg gave data on plane 0 render = (vdpau_render_state*)pFrame->data[0]; if(!render) return VC_ERROR; render->state |= FF_VDPAU_STATE_USED_FOR_RENDER; ClearUsedForRender(&past[0]); past[0] = past[1]; past[1] = current; current = future; future = render; DVDVideoPicture DVDPic; memset(&DVDPic, 0, sizeof(DVDVideoPicture)); ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(&DVDPic); m_DVDVideoPics.push(DVDPic); int pics = m_DVDVideoPics.size(); if (pics < 2) return VC_BUFFER; else if (pics > 2) { // this should not normally happen CLog::Log(LOGERROR, "CVDPAU::Decode - invalid number of pictures in queue"); while (pics-- != 2) m_DVDVideoPics.pop(); } if (mode == VS_DEINTERLACEMODE_FORCE || (mode == VS_DEINTERLACEMODE_AUTO && m_DVDVideoPics.front().iFlags & DVP_FLAG_INTERLACED)) { if((method == VS_INTERLACEMETHOD_AUTO || method == VS_INTERLACEMETHOD_VDPAU_BOB || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF || method == VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE )) { if(method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF || method == VS_INTERLACEMETHOD_VDPAU_TEMPORAL_SPATIAL_HALF || avctx->skip_frame == AVDISCARD_NONREF) m_mixerstep = 0; else m_mixerstep = 1; if(m_DVDVideoPics.front().iFlags & DVP_FLAG_TOP_FIELD_FIRST) m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; else m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD; } else { m_mixerstep = 0; m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; } } else { m_mixerstep = 0; m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; } } else if(m_mixerstep == 1) { // no new frame given, output second field of old frame if(avctx->skip_frame == AVDISCARD_NONREF) { ClearUsedForRender(&past[1]); m_DVDVideoPics.pop(); return VC_BUFFER; } m_mixerstep = 2; if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD) m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD; else m_mixerfield = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; } else { CLog::Log(LOGERROR, "CVDPAU::Decode - invalid mixer state reached"); return VC_BUFFER; } VdpVideoSurface past_surfaces[2] = { VDP_INVALID_HANDLE, VDP_INVALID_HANDLE }; VdpVideoSurface futu_surfaces[1] = { VDP_INVALID_HANDLE }; if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME) { if (past[0]) past_surfaces[1] = past[0]->surface; if (past[1]) past_surfaces[0] = past[1]->surface; futu_surfaces[0] = future->surface; } else { if(m_mixerstep == 1) { // first field if (past[1]) { past_surfaces[1] = past[1]->surface; past_surfaces[0] = past[1]->surface; } futu_surfaces[0] = current->surface; } else { // second field if (past[1]) past_surfaces[1] = past[1]->surface; past_surfaces[0] = current->surface; futu_surfaces[0] = future->surface; } } vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,outputSurface,&time); vdp_st = vdp_video_mixer_render(videoMixer, VDP_INVALID_HANDLE, 0, m_mixerfield, 2, past_surfaces, current->surface, 1, futu_surfaces, NULL, outputSurface, &(outRectVid), &(outRectVid), 0, NULL); CheckStatus(vdp_st, __LINE__); surfaceNum++; if (surfaceNum >= totalAvailableOutputSurfaces) surfaceNum = 0; if(m_mixerfield == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME) { ClearUsedForRender(&past[0]); return VC_BUFFER | VC_PICTURE; } else { if(m_mixerstep == 1) return VC_PICTURE; else { ClearUsedForRender(&past[1]); return VC_BUFFER | VC_PICTURE; } } }
dmessage(char *message, unsigned char flags, unsigned char from, unsigned char to) { register int len; W_Color color; char timebuf[10]; LONG curtime; struct tm *tm; char buf[80]; int take, destroy, team, kill, killp, killa, bomb, conq; struct distress dist; take = MTEAM + MTAKE + MVALID; destroy = MTEAM + MDEST + MVALID; kill = MALL + MKILL + MVALID; killp = MALL + MKILLP + MVALID; killa = MALL + MKILLA + MVALID; bomb = MTEAM + MBOMB + MVALID; team = MTEAM + MVALID; conq = MALL + MCONQ + MVALID; time(&curtime); tm = localtime(&curtime); sprintf(timebuf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); len = strlen(message); if (from == 255) { /* From God */ color = textColor; } else { color = playerColor(&(players[from])); } if (censorMessages) if ((flags != kill) && (flags != killp) && (flags != killa) && (flags != bomb) && (flags != take) && (flags != destroy)) censor(message); /* aha! A new type distress/macro call came in. parse it appropriately */ if (flags == (MTEAM | MDISTR | MVALID)) { HandleGenDistr(message, from, to, &dist); len = makedistress(&dist, message, distmacro[dist.distype].macro); #ifdef BEEPLITE if (UseLite) rcdlite(&dist); #endif if (len <= 0) return; flags ^= MDISTR; } if (niftyNewMessages) { if (logmess) { if (logFile != NULL) { fprintf(logFile, "%s: %s\n", timebuf, message); fflush(logFile); } else { printf("%s: %s\n", timebuf, message); } } if (!(logmess && logFile == NULL) && flags == conq) { /* output conquer stuff to stdout in addition to message window */ fprintf(stdout, "%s\n", message); if (instr(message, "kill")) { fprintf(stdout, "NOTE: The server here does not properly set message flags\n"); fprintf(stdout, "You should probably pester the server god to update....\n"); } } if (flags == (MCONFIG + MINDIV + MVALID)) { if (from == 255) CheckFeatures(message); return; } if ((flags == team) || (flags == take) || (flags == destroy)) { W_WriteText(messwt, 0, 0, color, message, len, shipFont(me)); if ((flags == team) && !strncmp(message + 10, " ", 5) && (message[15] == 0)) { printf("dmessage:flags==team PIG call from=%d\n", from); pmessage(cowid, from, MINDIV); } } else if ((flags == kill) || (flags == killp) || (flags == killa) || (flags == bomb)) { W_WriteText(messwk, 0, 0, color, message, len, 0); if (!reportKills) return; /* HW */ } else if (flags & MINDIV) { W_WriteText(messwi, 0, 0, color, message, len, 0); if (!strncmp(message + 10, " ", 5) && (message[15] == 0)) { printf("dmessage:MINDIV PIG call from=%d\n", from); pmessage(cowid, from, MINDIV); } } else { /* if we don't know where * * * the message beLONGs by * * * this time, stick it * in * * the all board... */ W_WriteText(messwa, 0, 0, color, message, len, 0); if (!strncmp(message + 10, " ", 5) && (message[15] == 0)) { pmessage(cowid, from, MINDIV); } } W_WriteText(reviewWin, 0, 0, color, message, len, 0); } else { /* ok, here we have the old kludge nastiness that we can turn on if we * * * HAVE to. yuk, blech, ptooie... */ if ((strncmp(message, "GOD->ALL", 8) == 0 && (instr(message, "was kill") || instr(message, "killed by"))) || (*message != ' ' && instr(message, "We are being attacked"))) { W_WriteText(messwk, 0, 0, color, message, len, 0); if (!reportKills) return; W_WriteText(reviewWin, 0, 0, color, message, len, 0); if (logmess) { if (logFile != NULL) { fprintf(logFile, "%s ", timebuf); fprintf(logFile, "%s\n", message); fflush(logFile); } else { printf("%s ", message); printf("%s\n", timebuf); } } return; } switch (flags & (MTEAM | MINDIV | MALL)) { case MTEAM: W_WriteText(messwt, 0, 0, color, message, len, 0); if (!strncmp(message + 10, " ", 5) && (message[15] == 0)) { pmessage(cowid, from, MINDIV); } if (logmess) { if (logFile != NULL) { fprintf(logFile, "%s ", timebuf); fprintf(logFile, "%s\n", message); fflush(logFile); } else { printf("%s ", message); printf("%s\n", timebuf); } } break; case MINDIV: if (!(flags & MCONFIG)) W_WriteText(messwi, 0, 0, color, message, len, 0); if (!strncmp(message + 10, " ", 5) && (message[15] == 0)) { pmessage(cowid, from, MINDIV); } if (logmess) { if (logFile != NULL) { fprintf(logFile, "%s ", timebuf); fprintf(logFile, "%s\n", message); fflush(logFile); } else { printf("%s ", message); printf("%s\n", timebuf); } } break; default: W_WriteText(messwa, 0, 0, color, message, len, 0); if (!strncmp(message + 10, " ", 5) && (message[15] == 0)) { pmessage(cowid, from, MINDIV); } if (logmess) { if (logFile != NULL) { fprintf(logFile, "%s ", timebuf); fprintf(logFile, "%s\n", message); fflush(logFile); } else { printf("%s", message); printf("%s\n", timebuf); } } break; } W_WriteText(reviewWin, 0, 0, color, message, len, 0); } }