uvc_video.c -- USB Video Class driver - Video handling

uvc_video.c  --  USB Video Class driver - Video handling
uvc_video.c  --  USB Video Class driver - Video handling
// test.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

#include <iostream>
using namespace std;


struct queue_e
{
	struct queue_e *next;
};

typedef struct queue_e *q_ptr;

#define  queue_e q_ptr

typedef struct queue_s
{
	queue_e head;
	queue_e tail;
	int   len;
	int   max_len;
	int   min_len;
} QUEUE, *PQUEUE;


void *DeQueue( QUEUE *q)
{
	queue_e   temp = q->head;

	if ( temp == 0)
	{
		if (q->len != 0)
		 
		return  (void *)0;
	}

	q->head = temp->next;
	temp->next = 0;

	if ( q->head == 0)
	{
		q->tail = 0;
	}

	q->len--;

	if ( q->len < q->min_len)
	{
		q->min_len = q->len;
	}

	return ((void*)temp);
}

void EnQueue( QUEUE *q, void *e)
{
	((q_ptr)e)->next = 0;

	if ( q->head == 0)
	{
		q->head = (q_ptr)e;
	}
	else
	{
		q->tail->next = (q_ptr)e;
	}

	q->tail = (q_ptr)e;

	if ( ++(q->len) > q->max_len)
	{
		q->max_len = q->len;
	}
}

void ResetQueue( QUEUE *q)
{
	q->head = 0;
	q->tail = 0;
	q->len = 0;
	q->max_len = 0;
	q->min_len = 9999;
}


int _tmain(int argc, _TCHAR* argv[])
{


 
	system("PAUSE");

	return 0;
}

  

 

posted on 2023-03-02 07:33  lydstory  阅读(21)  评论(0编辑  收藏  举报

导航