// format a frame description into a GDB string // format a frame description into a GDB string char * formatFrame (SBFrame frame, FrameDetails framedetails) { static StringB framedescB(LINE_MAX); framedescB.clear(); return formatFrame (framedescB, frame, framedetails); }
char * formatThreadInfo (StringB &threaddescB, SBProcess process, int threadindexid) { logprintf (LOG_TRACE, "formatThreadInfo (0x%x, 0x%x, %d)\n", &threaddescB, &process, threadindexid); threaddescB.clear(); if (!process.IsValid()) return threaddescB.c_str(); int pid=process.GetProcessID(); int state = process.GetState (); if (state == eStateStopped) { int tmin, tmax; bool useindexid; if (threadindexid < 0) { tmin = 0; tmax = process.GetNumThreads(); useindexid = false; } else{ tmin = threadindexid; tmax = threadindexid+1; useindexid = false; } const char *separator=""; for (int ithread=tmin; ithread<tmax; ithread++) { SBThread thread; if (useindexid) thread = process.GetThreadByIndexID(ithread); else thread = process.GetThreadAtIndex(ithread); if (!thread.IsValid()) continue; int tid=thread.GetThreadID(); threadindexid=thread.GetIndexID(); int frames = getNumFrames (thread); if (frames > 0) { SBFrame frame = thread.GetFrameAtIndex(0); if (frame.IsValid()) { char * framedescstr = formatFrame (frame, WITH_LEVEL_AND_ARGS); threaddescB.catsprintf ( "%s{id=\"%d\",target-id=\"Thread 0x%x of process %d\",%s,state=\"stopped\"}", separator, threadindexid, tid, pid, framedescstr); } } separator=","; } } return threaddescB.c_str(); }
// take a buffer and swscale it to the requested dimensions FFBuffer * ffmpegWidget::falseFrame(FFBuffer *src, PixelFormat pix_fmt) { FFBuffer *yuv = NULL; switch (src->pix_fmt) { case PIX_FMT_YUV420P: //< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) case PIX_FMT_YUV411P: //< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) case PIX_FMT_YUVJ420P: //< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range case PIX_FMT_NV12: //< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) case PIX_FMT_NV21: //< as above, but U and V bytes are swapped case PIX_FMT_YUV422P: //< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) case PIX_FMT_YUVJ422P: //< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range case PIX_FMT_YUV440P: //< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) case PIX_FMT_YUVJ440P: //< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range case PIX_FMT_YUV444P: //< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) case PIX_FMT_YUVJ444P: //< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range yuv = src; break; default: yuv = formatFrame(src, PIX_FMT_YUVJ420P); } /* Now we have our YUV frame, generate YUV data */ FFBuffer *dest = findFreeBuffer(outbuffers); // make sure we got a buffer if (dest == NULL) { // get rid of the original if (yuv != src) yuv->release(); return NULL; } // fill in multiples of 8 that we can cope with dest->width = src->width - src->width % 8; dest->height = src->height - src->height % 2; dest->pix_fmt = pix_fmt; unsigned char *yuvdata = (unsigned char *) yuv->pFrame->data[0]; unsigned char *destdata = (unsigned char *) dest->pFrame->data[0]; if (pix_fmt == PIX_FMT_YUVJ420P) { const unsigned char * colorMapY, * colorMapU, * colorMapV; switch(_fcol) { case 2: colorMapY = IronColorY; colorMapU = IronColorU; colorMapV = IronColorV; break; default: colorMapY = RainbowColorY; colorMapU = RainbowColorU; colorMapV = RainbowColorV; break; } // Y planar data for (int h=0; h<dest->height; h++) { unsigned int line_start = yuv->pFrame->linesize[0] * h; for (int w=0; w<dest->width; w++) { *destdata++ = colorMapY[yuvdata[line_start + w]]; } } // UV planar data for (int h=0; h<dest->height; h+=2) { unsigned int line_start = yuv->pFrame->linesize[0] * h; for (int w=0; w<dest->width; w+=2) { unsigned char y = yuvdata[line_start + w]; destdata[h*dest->width/4 + w/2] = colorMapU[y]; destdata[dest->height*dest->width/4 + h*dest->width/4 + w/2] = colorMapV[y]; } } } else { // fill in RGB data const unsigned char * colorMapR, * colorMapG, * colorMapB; switch(this->_fcol) { case 2: colorMapR = IronColorR; colorMapG = IronColorG; colorMapB = IronColorB; break; default: colorMapR = RainbowColorR; colorMapG = RainbowColorG; colorMapB = RainbowColorB; break; } // RGB packed data for (int h=0; h<dest->height; h++) { unsigned int line_start = yuv->pFrame->linesize[0] * h; for (int w=0; w<dest->width; w++) { *destdata++ = colorMapR[yuvdata[line_start + w]]; *destdata++ = colorMapG[yuvdata[line_start + w]]; *destdata++ = colorMapB[yuvdata[line_start + w]]; } } } // get rid of the original if (yuv != src) yuv->release(); return dest; }