我正在寻找一种在QML中实现视频播放器应用程序的最佳方法.几乎所有QML示例都是从文件系统或Web读取文件:
MediaPlayer {
id: mediaplayer
source: "groovy_video.mp4"
}
VideoOutput {
anchors: parent.fill
source: mediaplayer
}
Run Code Online (Sandbox Code Playgroud)
我想指定我自己的源MediaPlayer
- 一个C++ QObject
派生类,它有一个类似的接口QIODevice
.这对我的需求来说是完美的.我需要预先加载部分视频,并将其缓存以供以后使用.
有一个简单的解决方案满足我的需求吗?(我使用的是Qt 5.2)
是否有一个数据库,其中包含每个特定设备的像素分辨率、屏幕尺寸和密度?
像这样的东西:
三星盖乐世S2 | 480 x 800 | 屏幕尺寸=正常 | 密度=hdpi
谷歌Nexus | 1280x720 | 屏幕尺寸=正常 | 密度=xhdpi
我想将 Crypto++ 密钥保存到std::vector<uint8_t>
. 不幸的是,只有CryptoPP::StringSink
, that 需要std::string
参考,但没有CryptoPP::VectorSink
那个会参考std::vector
.
以下代码工作正常
std::string spki;
CryptoPP::StringSink ss(spki);
CryptoPP::RSA::PublicKey publicKey(...);
publicKey.Save(ss);
Run Code Online (Sandbox Code Playgroud)
但我想要这个
std::vector<uint8_t> spki;
CryptoPP::VectorSink vs(spki);
CryptoPP::RSA::PublicKey publicKey(...);
publicKey.Save(vs);
Run Code Online (Sandbox Code Playgroud)
问题
VectorSink
不能仅通过使用 typedef 来创建,因为 traits_type::char_type
inside StringSinkTemplate
:
using CryptoPP::StringSinkTemplate;
typedef StringSinkTemplate< std::vector<byte> > VectorSink;
In file included from cryptopp-test.cpp:65:
In file included from /usr/local/include/cryptopp/files.h:5:
/usr/local/include/cryptopp/filters.h:590:22: error: no member named
'traits_type' in 'std::vector<unsigned char, std::allocator<unsigned char>
>'
typedef typename T::traits_type::char_type char_type;
~~~^
cryptopp-test.cpp:243:20: note: in instantiation of …
Run Code Online (Sandbox Code Playgroud) android ×1
c++ ×1
crypto++ ×1
qiodevice ×1
qmediaplayer ×1
qml ×1
qt ×1
screen-size ×1
stdvector ×1