C++远程监控系统接收端- RevPlayMDIChildWnd.cpp

DWORD CRevPlayWnd::Parse(PBYTE Ptr, DWORD dwSize, LONGLONG *llTime)
{
    DWORD    RetV;
    DWORD LeftBytes = dwSize;
    while ((LONGLONG)LeftBytes >= 4 ) {
        if (!NextStartCode ((const BYTE **)&Ptr, &LeftBytes))
            break;
        DWORD Code = DWORD_SWAP(*(UNALIGNED DWORD *)Ptr);
        
        if (VALID_PACKET(Code)) {
            PBYTE PcktPtr;
            DWORD  Remain;
            DWORD PtsPos;
            RetV = ParseMPEG1Packet(Ptr, LeftBytes, &PacketData, &PtsPos);
            
            PcktPtr = Ptr+4;
            Remain = RetV;
            while ((LONG)Remain > 4) {
                if (!NextStartCode ((const BYTE **)&PcktPtr, &Remain))
                    break;
                DWORD PcktCode = DWORD_SWAP(*(UNALIGNED DWORD *)PcktPtr);
                switch (PcktCode) {
                case SEQUENCE_HEADER_CODE:
                    ParseSequenceHeader(PcktPtr, 0, &SeqInfo);
                    return (SeqInfo.dwBitRate);
                }
                PcktPtr += 4;
                Remain -=4 ;
            }
            
        } else {
            switch (Code) {
            case PACK_START_CODE:
                GetClock (Ptr+4, llTime);
                RetV = PACK_HEADER_LENGTH;
                break;
            case SYSTEM_HEADER_START_CODE:
                RetV = ParseSystemHeader(Ptr, LeftBytes);
                break;
            default:
                RetV = 4;
                break;
            }
        }
        
        Ptr += RetV;
        LeftBytes -= RetV;
        if (RetV <=0)
            break;
    }
    return 0;
}

void CRevPlayWnd::OnSize(UINT nType, int cx, int cy)
{
    CWnd::OnSize(nType, cx, cy);
    
    // TODO: Add your message handler code here
    CRect rect;
    GetClientRect(&rect);
    if(m_pivw)
        m_pivw -> SetWindowPosition(rect.left, rect.top, rect.right, rect.bottom);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
好的,我明白了。这是一道关于数据结构中顺序栈的编程题目。我们可以按照以下步骤进行: 1. 首先,我们需要定义顺序栈的结构体和一些基本操作函数,比如栈的初始化、入栈、出栈、取栈顶元素等。下面是一个简单的顺序栈的实现代码,文件名为SqStack.cpp: ```c++ #define MaxSize 50 typedef int ElemType; typedef struct { ElemType data[MaxSize]; int top; }SqStack; void InitStack(SqStack &S){ S.top = -1; } bool StackEmpty(SqStack S){ if (S.top == -1) return true; else return false; } bool Push(SqStack &S, ElemType x){ if (S.top == MaxSize - 1) return false; S.top++; S.data[S.top] = x; return true; } bool Pop(SqStack &S, ElemType &x){ if (S.top == -1) return false; x = S.data[S.top]; S.top--; return true; } bool GetTop(SqStack S, ElemType &x){ if (S.top == -1) return false; x = S.data[S.top]; return true; } ``` 2. 接下来,我们需要编写一个测试代码test3-1.cpp,来测试顺序栈的各项操作是否正确。下面是一个简单的测试代码: ```c++ #include <iostream> #include "SqStack.cpp" using namespace std; int main(){ SqStack s; InitStack(s); for (int i = 0; i < 10; i++){ Push(s, i); } ElemType x; while (!StackEmpty(s)){ Pop(s, x); cout << x << " "; } return 0; } ``` 上面的测试代码实现了将0~9的数字依次入栈,并将它们全部出栈并输出。我们可以运行这段代码来测试我们的顺序栈实现是否正确。 注意,为了测试方便,我们将SqStack.cpp文件包含在了test3-1.cpp中。在实际编写中,我们应该将SqStack.cpp和test3-1.cpp分别保存为两个不同的文件。 希望我的回答能够帮助到你,如果有问题可以继续提问哦。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

D20187

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值