#include "stdafx.h"
#include "CppUnitTest.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
/*
Ttile: 演示live555-liveMedia中BitVector class 比特流类的使用.
Author: Kagula
Date: 2019-1-16
environment: Visual studio community 2017 update5
Live555 reference MEDIA_SERVER_VERSION_STRING "0.93"
Native unit test project
Description:
通过对AudioSpecificConfig结构体前两个字节的读写
演示[1]字节流转比特流工具的使用[2]如何从比特流中解析数据[3]如何把bit结构数据写到比特流中.
相对于C++自带的bit struct, 好处是没有自动单,双,四字节对齐的问题.
比如说7字节的AAC头的解析和合成, 就不能用c++ bit struct正确读写了.
Note:
实际用的时候, 可以把BitVector从live555中提取出来.
*/
#include <sstream>
#include "../KagulaCommon/AAC.h"
#include "../liveMedia/include/BitVector.hh"
using namespace std;
namespace UnitTestBitVector
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestBitStream)
{
//下面测试读比特流
kagula::AudioSpecificConfig asc;
std::string strASCIIHex("121056E500");
asc.parseFromASCIIHexStr(strASCIIHex);
stringstream ss;
ss << "audioObjectType = " << asc.audioObjectType << ","
<< "samplingFrequencyIndex = " << asc.samplingFrequencyIndex << ","
<< "channelConfiguration = " << asc.channelConfiguration << ","
<< "frameLengthFlag = " << asc.fr
演示live555-liveMedia中BitVector class 比特流类的使用
最新推荐文章于 2022-04-03 19:44:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)