コード例 #1
0
/**
 * Find the end of the current frame in the bitstream.
 * @return the position of the first byte of the next frame, or -1
 */
static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf,
                              int buf_size)
{
    int start_found, i;
    uint64_t state;
    ParseContext *pc = &pc1->pc;

    start_found = pc->frame_start_found;
    state       = pc->state64;

    i = 0;
    if (!start_found) {
        for (i = 0; i < buf_size; i++) {
            state = (state << 8) | buf[i];
            if (IS_MARKER(state)) {
                if (!pc1->lastmarker ||
                    pc1->lastmarker == CORE_MARKER(state) ||
                    pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM) {
                    start_found = 1;
                    if (IS_EXSS_MARKER(state))
                        pc1->lastmarker = EXSS_MARKER(state);
                    else
                        pc1->lastmarker = CORE_MARKER(state);
                    i++;
                    break;
                }
            }
        }
    }
    if (start_found) {
        for (; i < buf_size; i++) {
            pc1->size++;
            state = (state << 8) | buf[i];
            if (IS_MARKER(state) &&
                (pc1->lastmarker == CORE_MARKER(state) ||
                 pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM)) {
                if (pc1->framesize > pc1->size)
                    continue;
                pc->frame_start_found = 0;
                pc->state64           = -1;
                pc1->size             = 0;
                return IS_EXSS_MARKER(state) ? i - 3 : i - 5;
            }
        }
    }
    pc->frame_start_found = start_found;
    pc->state64           = state;
    return END_NOT_FOUND;
}
コード例 #2
0
ファイル: dca_parser.c プロジェクト: AWilco/xbmc
/**
 * finds the end of the current frame in the bitstream.
 * @return the position of the first byte of the next frame, or -1
 */
static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
                              int buf_size)
{
    int start_found, i;
    uint32_t state;
    ParseContext *pc = &pc1->pc;

    start_found = pc->frame_start_found;
    state = pc->state;

    i = 0;
    if (!start_found) {
        for (i = 0; i < buf_size; i++) {
            state = (state << 8) | buf[i];
            if (IS_MARKER(state, i, buf, buf_size)) {
                if (pc1->lastmarker && state == pc1->lastmarker) {
                    start_found = 1;
                    break;
                } else if (!pc1->lastmarker) {
                    start_found = 1;
                    pc1->lastmarker = state;
                    break;
                }
            }
        }
    }
    if (start_found) {
        for (; i < buf_size; i++) {
            pc1->size++;
            state = (state << 8) | buf[i];
            if (state == DCA_HD_MARKER && !pc1->hd_pos)
                pc1->hd_pos = pc1->size;
            if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) {
                if(pc1->framesize > pc1->size)
                    continue;
                if(!pc1->framesize){
                    pc1->framesize = pc1->hd_pos ? pc1->hd_pos : pc1->size;
                }
                pc->frame_start_found = 0;
                pc->state = -1;
                pc1->size = 0;
                return i - 3;
            }
        }
    }
    pc->frame_start_found = start_found;
    pc->state = state;
    return END_NOT_FOUND;
}
コード例 #3
0
ファイル: extract_extradata_bsf.c プロジェクト: mpc-hc/FFmpeg
static int extract_extradata_vc1(AVBSFContext *ctx, AVPacket *pkt,
                                 uint8_t **data, int *size)
{
    ExtractExtradataContext *s = ctx->priv_data;
    const uint8_t *ptr = pkt->data, *end = pkt->data + pkt->size;
    uint32_t state = UINT32_MAX;
    int has_extradata = 0, extradata_size = 0;

    while (ptr < end) {
        ptr = avpriv_find_start_code(ptr, end, &state);
        if (state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT) {
            has_extradata = 1;
        } else if (has_extradata && IS_MARKER(state)) {
            extradata_size = ptr - 4 - pkt->data;
            break;
        }
    }

    if (extradata_size) {
        *data = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
        if (!*data)
            return AVERROR(ENOMEM);

        memcpy(*data, pkt->data, extradata_size);
        *size = extradata_size;

        if (s->remove) {
            pkt->data += extradata_size;
            pkt->size -= extradata_size;
        }
    }

    return 0;
}
コード例 #4
0
ファイル: dca_parser.c プロジェクト: Arcen/FFmpeg
/**
 * finds the end of the current frame in the bitstream.
 * @return the position of the first byte of the next frame, or -1
 */
static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
                              int buf_size)
{
    int start_found, i;
    uint32_t state;
    ParseContext *pc = &pc1->pc;

    start_found = pc->frame_start_found;
    state = pc->state;

    i = 0;
    if (!start_found) {
        for (i = 0; i < buf_size; i++) {
            state = (state << 8) | buf[i];
            if (IS_MARKER(state, i, buf, buf_size)) {
                if (!pc1->lastmarker || state == pc1->lastmarker || pc1->lastmarker == DCA_HD_MARKER) {
                    start_found = 1;
                    pc1->lastmarker = state;
                    break;
                }
            }
        }
    }
    if (start_found) {
        for (; i < buf_size; i++) {
            pc1->size++;
            state = (state << 8) | buf[i];
            if (state == DCA_HD_MARKER && !pc1->hd_pos)
                pc1->hd_pos = pc1->size;
            if (IS_MARKER(state, i, buf, buf_size) && (state == pc1->lastmarker || pc1->lastmarker == DCA_HD_MARKER)) {
                if(pc1->framesize > pc1->size)
                    continue;
                // We have to check that we really read a full frame here, and that it isn't a pure HD frame, because their size is not constant.
                if(!pc1->framesize && state == pc1->lastmarker && state != DCA_HD_MARKER){
                    pc1->framesize = pc1->hd_pos ? pc1->hd_pos : pc1->size;
                }
                pc->frame_start_found = 0;
                pc->state = -1;
                pc1->size = 0;
                return i - 3;
            }
        }
    }
    pc->frame_start_found = start_found;
    pc->state = state;
    return END_NOT_FOUND;
}
コード例 #5
0
ファイル: LuaCommon.cpp プロジェクト: EagleShen/MTA
CMarker* lua_tomarker ( lua_State* luaVM, int iArgument )
{
    CElement* pElement = lua_toelement ( luaVM, iArgument );
    if ( pElement && IS_MARKER ( pElement ) )
        return static_cast < CMarker* > ( pElement );
    else
        return NULL;
}
コード例 #6
0
ファイル: VC1HeaderParser.cpp プロジェクト: Brijen/LAVFilters
/** Find VC-1 marker in buffer
* @return position where next marker starts or end of buffer if no marker found
*/
static inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end)
{
  uint32_t mrk = 0xFFFFFFFF;

  if(end-src < 4) return end;
  while(src < end){
    mrk = (mrk << 8) | *src++;
    if(IS_MARKER(mrk))
      return src-4;
  }
  return end;
}
コード例 #7
0
static int vc1_split(AVCodecContext *avctx,
                           const uint8_t *buf, int buf_size)
{
    uint32_t state = -1;
    int charged = 0;
    const uint8_t *ptr = buf, *end = buf + buf_size;

    while (ptr < end) {
        ptr = avpriv_find_start_code(ptr, end, &state);
        if (state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT) {
            charged = 1;
        } else if (charged && IS_MARKER(state))
            return ptr - 4 - buf;
    }

    return 0;
}
コード例 #8
0
/**
 * finds the end of the current frame in the bitstream.
 * @return the position of the first byte of the next frame, or -1
 */
static int vc1_find_frame_end(ParseContext *pc, const uint8_t *buf,
                              int buf_size)
{
	int pic_found, i;
	uint32_t state;

	pic_found= pc->frame_start_found;
	state= pc->state;

	i=0;
	if(!pic_found)
	{
		for(i=0; i<buf_size; i++)
		{
			state= (state<<8) | buf[i];
			if(state == VC1_CODE_FRAME || state == VC1_CODE_FIELD)
			{
				i++;
				pic_found=1;
				break;
			}
		}
	}

	if(pic_found)
	{
		/* EOF considered as end of frame */
		if (buf_size == 0)
			return 0;
		for(; i<buf_size; i++)
		{
			state= (state<<8) | buf[i];
			if(IS_MARKER(state) && state != VC1_CODE_FIELD && state != VC1_CODE_SLICE)
			{
				pc->frame_start_found=0;
				pc->state=-1;
				return i-3;
			}
		}
	}
	pc->frame_start_found= pic_found;
	pc->state= state;
	return END_NOT_FOUND;
}
コード例 #9
0
static int vc1_split(AVCodecContext *avctx,
                           const uint8_t *buf, int buf_size)
{
    int i;
    uint32_t state= -1;
    int charged=0;

    for(i=0; i<buf_size; i++){
        state= (state<<8) | buf[i];
        if(IS_MARKER(state)){
            if(state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT){
                charged=1;
            }else if(charged){
                return i-3;
            }
        }
    }
    return 0;
}
コード例 #10
0
ファイル: vaapi_vc1.c プロジェクト: Flameeyes/libav
static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
{
    VC1Context * const v = avctx->priv_data;
    MpegEncContext * const s = &v->s;
    VASliceParameterBufferVC1 *slice_param;

    av_dlog(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);

    /* Current bit buffer is beyond any marker for VC-1, so skip it */
    if (avctx->codec_id == AV_CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) {
        buffer += 4;
        size -= 4;
    }

    /* Fill in VASliceParameterBufferVC1 */
    slice_param = (VASliceParameterBufferVC1 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
    if (!slice_param)
        return -1;
    slice_param->macroblock_offset       = get_bits_count(&s->gb);
    slice_param->slice_vertical_position = s->mb_y;
    return 0;
}
コード例 #11
0
ファイル: extract_extradata_bsf.c プロジェクト: libav/libav
static int extract_extradata_vc1(AVBSFContext *ctx, AVPacket *pkt,
                                 uint8_t **data, int *size)
{
    ExtractExtradataContext *s = ctx->priv_data;
    uint32_t state = UINT32_MAX;
    int has_extradata = 0, extradata_size = 0;
    int i;

    for (i = 0; i < pkt->size; i++) {
        state = (state << 8) | pkt->data[i];
        if (IS_MARKER(state)) {
            if (state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT) {
                has_extradata = 1;
            } else if (has_extradata) {
                extradata_size = i - 3;
                break;
            }
        }
    }

    if (extradata_size) {
        *data = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
        if (!*data)
            return AVERROR(ENOMEM);

        memcpy(*data, pkt->data, extradata_size);
        memset(*data + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
        *size = extradata_size;

        if (s->remove) {
            pkt->data += extradata_size;
            pkt->size -= extradata_size;
        }
    }

    return 0;
}
コード例 #12
0
ファイル: wmv9.cpp プロジェクト: betaking/LAVFilters
static AVPictureType parse_picture_type(const uint8_t *buf, int buflen, CVC1HeaderParser *vc1Header)
{
  AVPictureType pictype = AV_PICTURE_TYPE_NONE;
  int skipped = 0;
  const BYTE *framestart = buf;
  if (IS_MARKER(AV_RB32(buf))) {
    framestart = NULL;
    const BYTE *start, *end, *next;
    next = buf;
    for (start = buf, end = buf + buflen; next < end; start = next) {
      if (AV_RB32(start) == VC1_CODE_FRAME) {
        framestart = start + 4;
        break;
      }
      next = find_next_marker(start + 4, end);
    }
  }
  if (framestart) {
    GetBitContext gb;
    init_get_bits(&gb, framestart, (buflen - (framestart-buf))*8);
    if (vc1Header->hdr.profile == PROFILE_ADVANCED) {
      int fcm = PROGRESSIVE;
      if (vc1Header->hdr.interlaced)
        fcm = decode012(&gb);
      if (fcm == ILACE_FIELD) {
        int fptype = get_bits(&gb, 3);
        pictype = (fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
        if (fptype & 4) // B-picture
          pictype = (fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B;
      } else {
        switch (get_unary(&gb, 0, 4)) {
        case 0:
            pictype = AV_PICTURE_TYPE_P;
            break;
        case 1:
            pictype = AV_PICTURE_TYPE_B;
            break;
        case 2:
            pictype = AV_PICTURE_TYPE_I;
            break;
        case 3:
            pictype = AV_PICTURE_TYPE_BI;
            break;
        case 4:
            pictype = AV_PICTURE_TYPE_P; // skipped pic
            skipped = 1;
            break;
        }
      }
    } else {
      if (vc1Header->hdr.finterp)
        skip_bits1(&gb);
      skip_bits(&gb, 2); // framecnt
      if (vc1Header->hdr.rangered)
        skip_bits1(&gb);
      int pic = get_bits1(&gb);
      if (vc1Header->hdr.bframes) {
        if (!pic) {
          if (get_bits1(&gb)) {
            pictype = AV_PICTURE_TYPE_I;
          } else {
            pictype = AV_PICTURE_TYPE_B;
          }
        } else {
          pictype = AV_PICTURE_TYPE_P;
        }
      } else {
        pictype = pic ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
      }
    }
  }
  return pictype;
}
コード例 #13
0
ファイル: wmv9.cpp プロジェクト: betaking/LAVFilters
STDMETHODIMP CDecWMV9::InitDecoder(AVCodecID codec, const CMediaType *pmt)
{
  HRESULT hr = S_OK;
  DbgLog((LOG_TRACE, 10, L"CDecWMV9::InitDecoder(): Initializing WMV9 DMO decoder"));

  DestroyDecoder(false);

  BITMAPINFOHEADER *pBMI = NULL;
  REFERENCE_TIME rtAvg = 0;
  DWORD dwARX = 0, dwARY = 0;
  videoFormatTypeHandler(*pmt, &pBMI, &rtAvg, &dwARX, &dwARY);
  
  size_t extralen = 0;
  BYTE *extra = NULL;
  getExtraData(*pmt, NULL, &extralen);
  if (extralen > 0) {
    extra = (BYTE *)av_mallocz(extralen + FF_INPUT_BUFFER_PADDING_SIZE);
    getExtraData(*pmt, extra, &extralen);
  }

  if (codec == AV_CODEC_ID_VC1 && extralen) {
    size_t i = 0;
    for (i = 0; i < (extralen - 4); i++) {
      uint32_t code = AV_RB32(extra+i);
      if (IS_MARKER(code))
        break;
    }
    if (i == 0) {
      memmove(extra+1, extra, extralen);
      *extra = 0;
      extralen++;
    } else if (i > 1) {
      DbgLog((LOG_TRACE, 10, L"-> VC-1 Header at position %u (should be 0 or 1)", i));
    }
  }

  /* Create input type */

  GUID subtype = codec == AV_CODEC_ID_VC1 ? MEDIASUBTYPE_WVC1 : MEDIASUBTYPE_WMV3;
  m_nCodecId = codec;

  mtIn.SetType(&MEDIATYPE_Video);
  mtIn.SetSubtype(&subtype);
  mtIn.SetFormatType(&FORMAT_VideoInfo);
  mtIn.SetTemporalCompression(TRUE);
  mtIn.SetSampleSize(0);
  mtIn.SetVariableSize();
  
  VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)mtIn.AllocFormatBuffer((ULONG)(sizeof(VIDEOINFOHEADER) + extralen));
  memset(vih, 0, sizeof(VIDEOINFOHEADER));
  vih->bmiHeader.biWidth       = pBMI->biWidth;
  vih->bmiHeader.biHeight      = pBMI->biHeight;
  vih->bmiHeader.biPlanes      = 1;
  vih->bmiHeader.biBitCount    = 24;
  vih->bmiHeader.biSizeImage   = pBMI->biWidth * pBMI->biHeight * 3 / 2;
  vih->bmiHeader.biSize        = (DWORD)(sizeof(BITMAPINFOHEADER) + extralen);
  vih->bmiHeader.biCompression = subtype.Data1;
  vih->AvgTimePerFrame = rtAvg;
  SetRect(&vih->rcSource, 0, 0, pBMI->biWidth, pBMI->biHeight);
  vih->rcTarget = vih->rcSource;
  
  if (extralen > 0) {
    memcpy((BYTE *)vih + sizeof(VIDEOINFOHEADER), extra, extralen);
    av_freep(&extra);
    extra = (BYTE *)vih + sizeof(VIDEOINFOHEADER);
  }

  hr = m_pDMO->SetInputType(0, &mtIn, 0);
  if (FAILED(hr)) {
    DbgLog((LOG_TRACE, 10, L"-> Failed to set input type on DMO"));
    return hr;
  }

  /* Create output type */
  int idx = 0;
  while(SUCCEEDED(hr = m_pDMO->GetOutputType(0, idx++, &mtOut))) {
    if (mtOut.subtype == MEDIASUBTYPE_NV12) {
      hr = m_pDMO->SetOutputType(0, &mtOut, 0);
      m_OutPixFmt = LAVPixFmt_NV12;
      break;
    } else if (mtOut.subtype == MEDIASUBTYPE_YV12) {
      hr = m_pDMO->SetOutputType(0, &mtOut, 0);
      m_OutPixFmt = LAVPixFmt_YUV420;
      break;
    }
  }

  if (FAILED(hr)) {
    DbgLog((LOG_TRACE, 10, L"-> Failed to set output type on DMO"));
    return hr;
  }

  videoFormatTypeHandler(mtOut, &pBMI);
  m_pRawBufferSize = pBMI->biSizeImage + FF_INPUT_BUFFER_PADDING_SIZE;

  m_bInterlaced = FALSE;
  memset(&m_StreamAR, 0, sizeof(m_StreamAR));
  if (extralen > 0) {
    m_vc1Header = new CVC1HeaderParser(extra, extralen, codec);
    if (m_vc1Header->hdr.valid) {
      m_bInterlaced = m_vc1Header->hdr.interlaced;
      m_StreamAR = m_vc1Header->hdr.ar;
    }
  }

  m_bManualReorder = (codec == AV_CODEC_ID_VC1) && !(m_pCallback->GetDecodeFlags() & LAV_VIDEO_DEC_FLAG_VC1_DTS);

  return S_OK;
}
コード例 #14
0
ファイル: menu.c プロジェクト: max1325/uae-wii
static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_size)
{
	static SDL_Thread *thread = NULL;  
	quit_thread = 1;
	
	int font_height = TTF_FontHeight(p_menu->p_font);
	int line_height = font_height + font_height/16 +(font_height==24);
	int x_start = p_menu->x1+6/RATIO;
	int y_start = p_menu->y1 + line_height;
	SDL_Rect r;
	int entries_visible = (p_menu->y2 - p_menu->y1 -5) / line_height - 1;

	int i, y;
	
	SDL_Rect r_ext = {p_menu->x1, p_menu->y1,
				p_menu->x2 - p_menu->x1, p_menu->y2 - p_menu->y1+2/RATIO};
	SDL_Rect r_int = {p_menu->x1+4/RATIO, p_menu->y1,
				p_menu->x2 - p_menu->x1-8/RATIO, p_menu->y2 - p_menu->y1-2/RATIO};	
				
	
	SDL_FillRect(screen, &r_ext, SDL_MapRGB(screen->format, 116, 117, 206));
	SDL_BlitSurface(image_window, &r_int, screen, &r_int);
		
	if ( p_menu->n_entries * line_height > p_menu->y2 )
		y_start = p_menu->y1 + line_height;

	if (p_menu->cur_sel - p_menu->start_entry_visible > entries_visible)
	{
		while (p_menu->cur_sel - p_menu->start_entry_visible > entries_visible)
		{
			p_menu->start_entry_visible ++;
			if (p_menu->start_entry_visible > p_menu->n_entries)
			{
				p_menu->start_entry_visible = 0;
				break;
			}
		}
	}
	else if ( p_menu->cur_sel < p_menu->start_entry_visible )
		p_menu->start_entry_visible = p_menu->cur_sel;

	if (strlen(p_menu->title))
	{
		r.x = p_menu->x1;
		r.y = p_menu->y1;
		r.w = p_menu->x2 - p_menu->x1;
		r.h = line_height-1;
		if (sel < 0)
			SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0x40, 0x00, 0x00));
		else
			SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 116, 117, 206)); //Title
		menu_print_font(screen, 255,255,255, p_menu->x1+4/RATIO, p_menu->y1, p_menu->title, font_size);
	}

	for (i = p_menu->start_entry_visible; i <= p_menu->start_entry_visible + entries_visible; i++)
	{
		const char *msg = p_menu->pp_msgs[i];

		if (i >= p_menu->n_entries)
			break;
		if (IS_MARKER(msg))
			p_menu->cur_sel = atoi(&msg[1]);
		else
		{
			y = (i - p_menu->start_entry_visible) * line_height;

			if (sel < 0)
				menu_print_font(screen, 0x40,0x40,0x40,
						x_start, y_start + y, msg, font_size);
			else if (p_menu->cur_sel == i) /* Selected - color */
				{
					if (strlen(msg)<=_MAX_STRING) menu_print_font(screen, 0,128,0,
						x_start, y_start + y, msg, font_size);
					else
					{
						if (thread) SDL_WaitThread(thread, NULL);
						thread_struct.screen=screen;
						thread_struct.x=x_start;
						thread_struct.y=y_start + y;
						thread_struct.msg=msg;
						thread_struct.font_size=font_size;
						quit_thread=0;
						thread = SDL_CreateThread(menu_thread, NULL );
					}
				}
			else if (IS_SUBMENU(msg))
			{
				if (p_menu->cur_sel == i-1) /* Selected - color */
					menu_print_font(screen, 0,128,0,
							x_start, y_start + y, msg, font_size);
				else
					menu_print_font(screen, 20,20,20,
							x_start, y_start + y, msg, font_size);
			}
			else if (msg[0] == '#')
			{
				switch (msg[1])
				{
				case '1':
					menu_print_font(screen, 116,117,206,
							x_start, y_start + y, msg+2, font_size);
					break;
				case '2':
					menu_print_font(screen, 25,0,231,
							x_start, y_start + y, msg+2, font_size);
					break;
				default:
					menu_print_font(screen, 0x40,0x40,0x40,
							x_start, y_start + y, msg, font_size);
					break;							
				}
			}
			else //Not selected
				menu_print_font(screen, 20,20,20,
						x_start, y_start + y, msg, font_size);
			if (IS_SUBMENU(msg))
			{
				submenu_t *p_submenu = find_submenu(p_menu, i);
				int n_pipe = 0;
				int n;

				for (n=0; msg[n] != '\0'; n++)
				{
					/* Underline the selected entry */
					if (msg[n] == '|')
					{
						int16_t n_chars;

						for (n_chars = 1; msg[n+n_chars] && msg[n+n_chars] != '|'; n_chars++);

						n_pipe++;
						if (p_submenu->sel == n_pipe-1)
						{
							int w;
							int h;

							if (TTF_SizeText(p_menu->p_font, "X", &w, &h) < 0)
							{
								fw = w;
								fh = h;
								write_log("%s\n", TTF_GetError());
								exit(1);
							}

							r = (SDL_Rect){ x_start + (n+1) * w, y_start + (i+ 1 - p_menu->start_entry_visible) * line_height -3/RATIO, (n_chars - 1) * w, 2};
							if (p_menu->cur_sel == i-1)
								SDL_FillRect(screen, &r,
										SDL_MapRGB(screen->format, 255,0,0));
							else
								SDL_FillRect(screen, &r,
										SDL_MapRGB(screen->format, 20,20,20));
							break;
						}
					}
				}
			}
		}
	}
}