传递H264的时候,RTSP抓包获得的pps sps,怎么解析
答案:2 悬赏:10 手机版
解决时间 2021-01-27 14:51
- 提问者网友:城市野鹿
- 2021-01-27 01:08
传递H264的时候,RTSP抓包获得的pps sps,怎么解析
最佳答案
- 五星知识达人网友:不想翻身的咸鱼
- 2021-01-27 02:01
#pragma comment(lib,"crypt32")
#include
#include
#include
//+-------------------------------------------------------------------------
// convert formatted string to binary
// If cchString is 0, then pszString is NULL terminated and
// cchString is obtained via strlen() + 1.
// dwFlags defines string format
// if pbBinary is NULL, *pcbBinary returns the size of required memory
// *pdwSkip returns the character count of skipped strings, optional
// *pdwFlags returns the actual format used in the conversion, optional
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptStringToBinaryA(
IN LPCSTR pszString,
IN DWORD cchString,
IN DWORD dwFlags,
IN BYTE *pbBinary,
IN OUT DWORD *pcbBinary,
OUT DWORD *pdwSkip, //OPTIONAL
OUT DWORD *pdwFlags //OPTIONAL
);
//+-------------------------------------------------------------------------
// convert formatted string to binary
// If cchString is 0, then pszString is NULL terminated and
// cchString is obtained via strlen() + 1.
// dwFlags defines string format
// if pbBinary is NULL, *pcbBinary returns the size of required memory
// *pdwSkip returns the character count of skipped strings, optional
// *pdwFlags returns the actual format used in the conversion, optional
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptStringToBinaryW(
IN LPCWSTR pszString,
IN DWORD cchString,
IN DWORD dwFlags,
IN BYTE *pbBinary,
IN OUT DWORD *pcbBinary,
OUT DWORD *pdwSkip, //OPTIONAL
OUT DWORD *pdwFlags //OPTIONAL
);
#ifdef UNICODE
#define CryptStringToBinary CryptStringToBinaryW
#else
#define CryptStringToBinary CryptStringToBinaryA
#endif // !UNICODE
//+-------------------------------------------------------------------------
// convert binary to formatted string
// dwFlags defines string format
// if pszString is NULL, *pcchString returns the size of required memory in byte
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptBinaryToStringA(
IN CONST BYTE *pbBinary,
IN DWORD cbBinary,
IN DWORD dwFlags,
IN LPSTR pszString,
IN OUT DWORD *pcchString
);
//+-------------------------------------------------------------------------
// convert binary to formatted string
// dwFlags defines string format
// if pszString is NULL, *pcchString returns the size of required memory in byte
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptBinaryToStringW(
IN CONST BYTE *pbBinary,
IN DWORD cbBinary,
IN DWORD dwFlags,
IN LPWSTR pszString,
IN OUT DWORD *pcchString
);
#ifdef UNICODE
#define CryptBinaryToString CryptBinaryToStringW
#else
#define CryptBinaryToString CryptBinaryToStringA
#endif // !UNICODE
// dwFlags has the following defines
#define CRYPT_STRING_BASE64HEADER 0x00000000
#define CRYPT_STRING_BASE64 0x00000001
#define CRYPT_STRING_BINARY 0x00000002
#define CRYPT_STRING_BASE64REQUESTHEADER 0x00000003
#define CRYPT_STRING_HEX 0x00000004
#define CRYPT_STRING_HEXASCII 0x00000005
#define CRYPT_STRING_BASE64_ANY 0x00000006
#define CRYPT_STRING_ANY 0x00000007
#define CRYPT_STRING_HEX_ANY 0x00000008
#define CRYPT_STRING_BASE64X509CRLHEADER 0x00000009
#define CRYPT_STRING_HEXADDR 0x0000000a
#define CRYPT_STRING_HEXASCIIADDR 0x0000000b
#define CRYPT_STRING_NOCR 0x80000000
// CryptBinaryToString uses the following flags
// CRYPT_STRING_BASE64HEADER - base64 format with certificate begin
// and end headers
// CRYPT_STRING_BASE64 - only base64 without headers
// CRYPT_STRING_BINARY - pure binary copy
// CRYPT_STRING_BASE64REQUESTHEADER - base64 format with request begin
// and end headers
// CRYPT_STRING_BASE64X509CRLHEADER - base64 format with x509 crl begin
// and end headers
// CRYPT_STRING_HEX - only hex format
// CRYPT_STRING_HEXASCII - hex format with ascii char display
// CRYPT_STRING_HEXADDR - hex format with address display
// CRYPT_STRING_HEXASCIIADDR - hex format with ascii char and address display
//
// CryptBinaryToString accepts CRYPT_STRING_NOCR or'd into one of the above.
// When set, line breaks contain only LF, instead of CR-LF pairs.
// CryptStringToBinary uses the following flags
// CRYPT_STRING_BASE64_ANY tries the following, in order:
// CRYPT_STRING_BASE64HEADER
// CRYPT_STRING_BASE64
// CRYPT_STRING_ANY tries the following, in order:
// CRYPT_STRING_BASE64_ANY
// CRYPT_STRING_BINARY -- should always succeed
// CRYPT_STRING_HEX_ANY tries the following, in order:
// CRYPT_STRING_HEXADDR
// CRYPT_STRING_HEXASCIIADDR
// CRYPT_STRING_HEXASCII
// CRYPT_STRING_HEX
char *flags[12]={
"CRYPT_STRING_BASE64HEADER",
"CRYPT_STRING_BASE64",
"CRYPT_STRING_BINARY",
"CRYPT_STRING_BASE64REQUESTHEADER",
"CRYPT_STRING_HEX",
"CRYPT_STRING_HEXASCII",
"CRYPT_STRING_BASE64_ANY",
"CRYPT_STRING_ANY",
"CRYPT_STRING_HEX_ANY",
"CRYPT_STRING_BASE64X509CRLHEADER",
"CRYPT_STRING_HEXADDR",
"CRYPT_STRING_HEXASCIIADDR",
};
#define MAXC 1024
BYTE b[22]={
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
0x41,0x42,0xB0,0xA1,0x4A,0x55,
};
BOOL r;
DWORD len,dwFlags;
TCHAR s[MAXC];
int _tmain() {
_tprintf(_T("API CryptBinaryToString in crypt32.dll Demonstration:\n"));
for (dwFlags=0;dwFlags<12;dwFlags++) {
if (dwFlags==2
|| dwFlags==6
|| dwFlags==7
|| dwFlags==8) continue;
r=CryptBinaryToString(b,22,dwFlags,NULL,&len);
if (!r) {
_tprintf(_T("CryptBinaryToString error!\n"));
return 1;
}
if (len>MAXC) {
_tprintf(_T("%d==len>MAXC==%d!\n"),len,MAXC);
return 2;
}
r=CryptBinaryToString(b,22,dwFlags,s,&len);
if (!r) {
_tprintf(_T("CryptBinaryToString error!\n"));
return 3;
}
_tprintf(_T("\n%s:[\n%s]\n"),flags[dwFlags],s);
}
return 0;
}
//API CryptBinaryToString in crypt32.dll Demonstration:
//
//CRYPT_STRING_BASE64HEADER:[
//-----BEGIN CERTIFICATE-----
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//-----END CERTIFICATE-----
//]
//
//CRYPT_STRING_BASE64:[
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//]
//
//CRYPT_STRING_BASE64REQUESTHEADER:[
//-----BEGIN NEW CERTIFICATE REQUEST-----
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//-----END NEW CERTIFICATE REQUEST-----
//]
//
//CRYPT_STRING_HEX:[
// 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
// 41 42 b0 a1 4a 55
//]
//
//CRYPT_STRING_HEXASCII:[
// 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................
// 41 42 b0 a1 4a 55 AB..JU
//]
//
//CRYPT_STRING_BASE64X509CRLHEADER:[
//-----BEGIN X509 CRL-----
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//-----END X509 CRL-----
//]
//
//CRYPT_STRING_HEXADDR:[
//0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
//0010 41 42 b0 a1 4a 55
//]
//
//CRYPT_STRING_HEXASCIIADDR:[
//0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................
//0010 41 42 b0 a1 4a 55 AB..JU
//]
//
#include
#include
#include
//+-------------------------------------------------------------------------
// convert formatted string to binary
// If cchString is 0, then pszString is NULL terminated and
// cchString is obtained via strlen() + 1.
// dwFlags defines string format
// if pbBinary is NULL, *pcbBinary returns the size of required memory
// *pdwSkip returns the character count of skipped strings, optional
// *pdwFlags returns the actual format used in the conversion, optional
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptStringToBinaryA(
IN LPCSTR pszString,
IN DWORD cchString,
IN DWORD dwFlags,
IN BYTE *pbBinary,
IN OUT DWORD *pcbBinary,
OUT DWORD *pdwSkip, //OPTIONAL
OUT DWORD *pdwFlags //OPTIONAL
);
//+-------------------------------------------------------------------------
// convert formatted string to binary
// If cchString is 0, then pszString is NULL terminated and
// cchString is obtained via strlen() + 1.
// dwFlags defines string format
// if pbBinary is NULL, *pcbBinary returns the size of required memory
// *pdwSkip returns the character count of skipped strings, optional
// *pdwFlags returns the actual format used in the conversion, optional
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptStringToBinaryW(
IN LPCWSTR pszString,
IN DWORD cchString,
IN DWORD dwFlags,
IN BYTE *pbBinary,
IN OUT DWORD *pcbBinary,
OUT DWORD *pdwSkip, //OPTIONAL
OUT DWORD *pdwFlags //OPTIONAL
);
#ifdef UNICODE
#define CryptStringToBinary CryptStringToBinaryW
#else
#define CryptStringToBinary CryptStringToBinaryA
#endif // !UNICODE
//+-------------------------------------------------------------------------
// convert binary to formatted string
// dwFlags defines string format
// if pszString is NULL, *pcchString returns the size of required memory in byte
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptBinaryToStringA(
IN CONST BYTE *pbBinary,
IN DWORD cbBinary,
IN DWORD dwFlags,
IN LPSTR pszString,
IN OUT DWORD *pcchString
);
//+-------------------------------------------------------------------------
// convert binary to formatted string
// dwFlags defines string format
// if pszString is NULL, *pcchString returns the size of required memory in byte
//--------------------------------------------------------------------------
BOOL
WINAPI
CryptBinaryToStringW(
IN CONST BYTE *pbBinary,
IN DWORD cbBinary,
IN DWORD dwFlags,
IN LPWSTR pszString,
IN OUT DWORD *pcchString
);
#ifdef UNICODE
#define CryptBinaryToString CryptBinaryToStringW
#else
#define CryptBinaryToString CryptBinaryToStringA
#endif // !UNICODE
// dwFlags has the following defines
#define CRYPT_STRING_BASE64HEADER 0x00000000
#define CRYPT_STRING_BASE64 0x00000001
#define CRYPT_STRING_BINARY 0x00000002
#define CRYPT_STRING_BASE64REQUESTHEADER 0x00000003
#define CRYPT_STRING_HEX 0x00000004
#define CRYPT_STRING_HEXASCII 0x00000005
#define CRYPT_STRING_BASE64_ANY 0x00000006
#define CRYPT_STRING_ANY 0x00000007
#define CRYPT_STRING_HEX_ANY 0x00000008
#define CRYPT_STRING_BASE64X509CRLHEADER 0x00000009
#define CRYPT_STRING_HEXADDR 0x0000000a
#define CRYPT_STRING_HEXASCIIADDR 0x0000000b
#define CRYPT_STRING_NOCR 0x80000000
// CryptBinaryToString uses the following flags
// CRYPT_STRING_BASE64HEADER - base64 format with certificate begin
// and end headers
// CRYPT_STRING_BASE64 - only base64 without headers
// CRYPT_STRING_BINARY - pure binary copy
// CRYPT_STRING_BASE64REQUESTHEADER - base64 format with request begin
// and end headers
// CRYPT_STRING_BASE64X509CRLHEADER - base64 format with x509 crl begin
// and end headers
// CRYPT_STRING_HEX - only hex format
// CRYPT_STRING_HEXASCII - hex format with ascii char display
// CRYPT_STRING_HEXADDR - hex format with address display
// CRYPT_STRING_HEXASCIIADDR - hex format with ascii char and address display
//
// CryptBinaryToString accepts CRYPT_STRING_NOCR or'd into one of the above.
// When set, line breaks contain only LF, instead of CR-LF pairs.
// CryptStringToBinary uses the following flags
// CRYPT_STRING_BASE64_ANY tries the following, in order:
// CRYPT_STRING_BASE64HEADER
// CRYPT_STRING_BASE64
// CRYPT_STRING_ANY tries the following, in order:
// CRYPT_STRING_BASE64_ANY
// CRYPT_STRING_BINARY -- should always succeed
// CRYPT_STRING_HEX_ANY tries the following, in order:
// CRYPT_STRING_HEXADDR
// CRYPT_STRING_HEXASCIIADDR
// CRYPT_STRING_HEXASCII
// CRYPT_STRING_HEX
char *flags[12]={
"CRYPT_STRING_BASE64HEADER",
"CRYPT_STRING_BASE64",
"CRYPT_STRING_BINARY",
"CRYPT_STRING_BASE64REQUESTHEADER",
"CRYPT_STRING_HEX",
"CRYPT_STRING_HEXASCII",
"CRYPT_STRING_BASE64_ANY",
"CRYPT_STRING_ANY",
"CRYPT_STRING_HEX_ANY",
"CRYPT_STRING_BASE64X509CRLHEADER",
"CRYPT_STRING_HEXADDR",
"CRYPT_STRING_HEXASCIIADDR",
};
#define MAXC 1024
BYTE b[22]={
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
0x41,0x42,0xB0,0xA1,0x4A,0x55,
};
BOOL r;
DWORD len,dwFlags;
TCHAR s[MAXC];
int _tmain() {
_tprintf(_T("API CryptBinaryToString in crypt32.dll Demonstration:\n"));
for (dwFlags=0;dwFlags<12;dwFlags++) {
if (dwFlags==2
|| dwFlags==6
|| dwFlags==7
|| dwFlags==8) continue;
r=CryptBinaryToString(b,22,dwFlags,NULL,&len);
if (!r) {
_tprintf(_T("CryptBinaryToString error!\n"));
return 1;
}
if (len>MAXC) {
_tprintf(_T("%d==len>MAXC==%d!\n"),len,MAXC);
return 2;
}
r=CryptBinaryToString(b,22,dwFlags,s,&len);
if (!r) {
_tprintf(_T("CryptBinaryToString error!\n"));
return 3;
}
_tprintf(_T("\n%s:[\n%s]\n"),flags[dwFlags],s);
}
return 0;
}
//API CryptBinaryToString in crypt32.dll Demonstration:
//
//CRYPT_STRING_BASE64HEADER:[
//-----BEGIN CERTIFICATE-----
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//-----END CERTIFICATE-----
//]
//
//CRYPT_STRING_BASE64:[
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//]
//
//CRYPT_STRING_BASE64REQUESTHEADER:[
//-----BEGIN NEW CERTIFICATE REQUEST-----
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//-----END NEW CERTIFICATE REQUEST-----
//]
//
//CRYPT_STRING_HEX:[
// 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
// 41 42 b0 a1 4a 55
//]
//
//CRYPT_STRING_HEXASCII:[
// 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................
// 41 42 b0 a1 4a 55 AB..JU
//]
//
//CRYPT_STRING_BASE64X509CRLHEADER:[
//-----BEGIN X509 CRL-----
//AAECAwQFBgcICQoLDA0OD0FCsKFKVQ==
//-----END X509 CRL-----
//]
//
//CRYPT_STRING_HEXADDR:[
//0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
//0010 41 42 b0 a1 4a 55
//]
//
//CRYPT_STRING_HEXASCIIADDR:[
//0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................
//0010 41 42 b0 a1 4a 55 AB..JU
//]
//
全部回答
- 1楼网友:忘川信使
- 2021-01-27 03:20
ffmpeg是目前被应用最广泛的编解码软件库,支持多种流行的编解码器,它是c语言实现的,不仅被集成到各种pc软件,也经常被移植到多种嵌入式设备中。使用面向对象的办法来设想这样一个编解码库,首先让人想到的是构造各种编解码器的类,然后对于它...
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯