gpt4 book ai didi

C++/DLNA : Generate DLNA. ORG_FLAGS

转载 作者:行者123 更新时间:2023-11-30 03:55:13 27 4
gpt4 key购买 nike

我尝试用在 Linux 上运行的 C++ 开发某种 DLNA 媒体服务器。目前,我正在努力生成所需的 DLNA.ORG_FLAGS 值。我在网上找到了以下帮助:

/* DLNA.ORG_FLAGS, padded with 24 trailing 0s
* 80000000 31 senderPaced
* 40000000 30 lsopTimeBasedSeekSupported
* 20000000 29 lsopByteBasedSeekSupported
* 10000000 28 playcontainerSupported
* 8000000 27 s0IncreasingSupported
* 4000000 26 sNIncreasingSupported
* 2000000 25 rtspPauseSupported
* 1000000 24 streamingTransferModeSupported
* 800000 23 interactiveTransferModeSupported
* 400000 22 backgroundTransferModeSupported
* 200000 21 connectionStallingSupported
* 100000 20 dlnaVersion15Supported
*
* Example: (1 << 24) | (1 << 22) | (1 << 21) | (1 << 20)
* DLNA.ORG_FLAGS=01700000[000000000000000000000000] // [] show padding
*/
typedef enum {
DLNA_ORG_FLAG_SENDER_PACED = (1 << 31),
DLNA_ORG_FLAG_TIME_BASED_SEEK = (1 << 30),
DLNA_ORG_FLAG_BYTE_BASED_SEEK = (1 << 29),
DLNA_ORG_FLAG_PLAY_CONTAINER = (1 << 28),
DLNA_ORG_FLAG_S0_INCREASE = (1 << 27),
DLNA_ORG_FLAG_SN_INCREASE = (1 << 26),
DLNA_ORG_FLAG_RTSP_PAUSE = (1 << 25),
DLNA_ORG_FLAG_STREAMING_TRANSFER_MODE = (1 << 24),
DLNA_ORG_FLAG_INTERACTIVE_TRANSFERT_MODE = (1 << 23),
DLNA_ORG_FLAG_BACKGROUND_TRANSFERT_MODE = (1 << 22),
DLNA_ORG_FLAG_CONNECTION_STALL = (1 << 21),
DLNA_ORG_FLAG_DLNA_V15 = (1 << 20),
} dlna_org_flags_t;

但现在我不知道如何获取包含所需“DLNA.ORG_FLAGS=xxxx”的字符串。所以我的问题是如何从这些值中获取所需的字符串?

最佳答案

以防万一有人遇到同样的问题。这是我想出的解决方案:

typedef enum 
{
DLNA_ORG_FLAG_SENDER_PACED = (1 << 31),
DLNA_ORG_FLAG_TIME_BASED_SEEK = (1 << 30),
DLNA_ORG_FLAG_BYTE_BASED_SEEK = (1 << 29),
DLNA_ORG_FLAG_PLAY_CONTAINER = (1 << 28),
DLNA_ORG_FLAG_S0_INCREASE = (1 << 27),
DLNA_ORG_FLAG_SN_INCREASE = (1 << 26),
DLNA_ORG_FLAG_RTSP_PAUSE = (1 << 25),
DLNA_ORG_FLAG_STREAMING_TRANSFER_MODE = (1 << 24),
DLNA_ORG_FLAG_INTERACTIVE_TRANSFERT_MODE = (1 << 23),
DLNA_ORG_FLAG_BACKGROUND_TRANSFERT_MODE = (1 << 22),
DLNA_ORG_FLAG_CONNECTION_STALL = (1 << 21),
DLNA_ORG_FLAG_DLNA_V15 = (1 << 20)
} dlna_org_flags;

std::string dlnaFlags = "";
char dlna_info[448];

sprintf(dlna_info, "%s=%.8x%.24x", "DLNA.ORG_FLAGS", DLNA_ORG_FLAG_TIME_BASED_SEEK | DLNA_ORG_FLAG_BYTE_BASED_SEEK | DLNA_ORG_FLAG_STREAMING_TRANSFER_MODE), 0);
dlnaFlags = std::string(dlna_info);

现在如本示例所示,此代码使字符串“dlnaFlags”包含所需的字符串“DLNA.ORG_FLAGS=xxxx”。以基于时间的寻道、基于字节的寻道和流式传输模式为例。

关于C++/DLNA : Generate DLNA. ORG_FLAGS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29182754/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com