- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
寻找一种聪明的方式来转换gstreamer / glib GError:
struct GError {
GQuark domain;
gint code;
gchar* message;
};
到boost::system::error_code。通常,您可以创建一个类别并注册一个枚举来增强。 GStreamer使用枚举,但是代码以int形式返回。 GQuark是一个类别。
最佳答案
GQuark is a category.
Quarks are associations between strings and integer identifiers. Given either the string or the Quark identifier it is possible to retrieve the other.
GQuark
实际上代表一个字符串,您希望将其视为类别。好吧。
using boost::system::error_code;
using boost::system::error_condition;
enum class MyCoreError {
failed, // a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
too_lazy, // do not use this except as a placeholder for deciding where to go while developing code.
not_implemented, // use this when you do not want to implement this functionality yet.
state_change, // used for state change errors.
pad, // used for pad-related errors.
thread, // used for thread-related errors.
negotiation, // used for negotiation-related errors.
event, // used for event-related errors.
seek, // used for seek-related errors.
caps, // used for caps-related errors.
tag, // used for negotiation-related errors.
missing_plugin, // used if a plugin is missing.
clock, // used for clock related errors.
disabled, // used if functionality has been disabled at compile time.
num_errors, // the number of core error types.
};
namespace boost::system { template<> struct is_error_code_enum<MyCoreError> : std::true_type {}; }
namespace detail {
class my_core_category : public boost::system::error_category {
public:
const char* name() const noexcept override {
return g_quark_to_string(GST_CORE_ERROR);
}
std::string message(int ev) const override {
switch (static_cast<MyCoreError>(ev)) {
case MyCoreError::failed: return "a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.";
case MyCoreError::too_lazy: return "do not use this except as a placeholder for deciding where to go while developing code.";
case MyCoreError::not_implemented: return "use this when you do not want to implement this functionality yet.";
case MyCoreError::state_change: return "used for state change errors.";
case MyCoreError::pad: return "used for pad-related errors.";
case MyCoreError::thread: return "used for thread-related errors.";
case MyCoreError::negotiation: return "used for negotiation-related errors.";
case MyCoreError::event: return "used for event-related errors.";
case MyCoreError::seek: return "used for seek-related errors.";
case MyCoreError::caps: return "used for caps-related errors.";
case MyCoreError::tag: return "used for negotiation-related errors.";
case MyCoreError::missing_plugin: return "used if a plugin is missing.";
case MyCoreError::clock: return "used for clock related errors.";
case MyCoreError::disabled: return "used if functionality has been disabled at compile time.";
case MyCoreError::num_errors: return "the number of core error types.";
default: return "unknown core error";
}
}
error_condition default_error_condition(int ev) const noexcept override {
return error_condition{ ev, *this };
}
bool equivalent(int ev, error_condition const& condition) const noexcept override {
return condition.value() == ev && &condition.category() == this;
}
bool equivalent(error_code const& error, int ev) const noexcept override {
return error.value() == ev && &error.category() == this;
}
};
}
error_code make_error_code(MyCoreError se)
{
static detail::my_core_category const cat{};
return error_code{static_cast<std::underlying_type<MyCoreError>::type>(se), cat};
}
现在你可以
auto code = MyCoreError::missing_plugin;
throw boost::system::system_error(make_error_code(code));
它会神奇地做正确的事。
boost::system::error_code make_error_code(GError const& err) {
if (err.domain == GST_CORE_ERROR) {
return make_error_code(MyCoreError(err.code));
}
if (err.domain == GST_LIBRARY_ERROR) {
return make_error_code(MyLibraryError(err.code));
}
if (err.domain == GST_RESOURCE_ERROR) {
return make_error_code(MyResourceError(err.code));
}
if (err.domain == GST_STREAM_ERROR) {
return make_error_code(MyStreamError(err.code));
}
// decide on how to represent unknown errors? Just throw, or translate into
// MyCoreError::failed?
}
关于c++ - GStreamer GError boost::: system::error_code?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62782777/
是否有人尝试将 Gstreamer SDK 教程移植到 http://docs.gstreamer.com/display/GstSDK/Tutorials到 gstreamer 1.0? 我尝试将
我正在尝试构建和安装 gst-plugin-bad-1.4.0,但在为我的硬件目标运行配置脚本时出现以下错误。我正在我的 Ubuntu 上安装的目标 SDK/linux-devkit/中运行构建,并且
我想制作某种流媒体服务器。我希望它通过网络从实时流(例如网络摄像头、ipcam 等)接收 RTSP 流,然后使用不同的 URL 在我的本地网络上广播相同的流。我知道 gstreamer 可以做得很好,
在将解复用的 h264 解码输出发送到 gstreamer 管道中的 autovideosink 之前,是否可以在两者之间提供一些延迟。如果是这样,任何人都可以发布示例管道来做到这一点。 我使用的管道
我需要捕获第二个显示器的屏幕并在主显示器中的一个窗口内“监视”它(以 x0.5 缩放并使用相邻插值,因为我更喜欢性能与质量)。从这里 link ,我有这个截屏命令: gst-launch ximage
与 stagefright 相比,使用 gstreamer 有哪些优势?谁能指出其中的区别。 最佳答案 一开始,一个非常笼统的评论。如果GStreamer 是非常值得商榷的。优于 Stagefrigh
我确定我已经让这个管道在我设置的早期 Ubuntu 系统上运行(为了便于阅读而格式化): playbin uri=rtspt://user:pswd@192.168.xxx.yyy/ch1/m
我创建了一个管道,如下所示: v4l2src -> tee -> queue -> encoder -> avimux -> filesink tee -> queue -> v
在执行以下命令时, gst-launch-1.0 filesrc location=Wildlife.wmv ! decodebin ! queue ! ffmpegcolorspace ! auto
我想将二进制数据直接写入 gstreamer 管道,但我无法这样做。 我试过 rawaudioparse 插件。我已将二进制数据写入 .raw 文件并尝试使用此命令播放此二进制数据。 gst-laun
如何查看 GST_CAT_INFO、GST_DEBUG 等函数的输出? 我需要使用调试级别设置自己编译 gstreamer 还是可以在应用程序级别完成? 最佳答案 可以使用 GST_DEBUG 环境变
我想编写(但首先我想了解如何做)基于 GStreamer 框架的应用程序(不止一个),这些应用程序将同时共享相同的硬件资源。 例如:有硬件加速的视频解码。我想使用硬件加速同时启动两个能够解码不同视频流
我有一个 gstreamer 管道,它可以完美地工作并获取相机流,将其编码为 H.264 视频,将其保存到文件中并按如下方式在屏幕上显示: gst-launch-1.0 -v autovideosrc
我正在开发 C 程序来执行自适应流,但我无法使用 g_object_set() 函数更改 x264enc 元素的“比特率”属性。我该如何更改它? 谢谢。 最佳答案 安装git版本的gstreamer丑
我有一个 gstreamer 管道,它可以完美地工作并获取相机流,将其编码为 H.264 视频,将其保存到文件中并按如下方式在屏幕上显示: gst-launch-1.0 -v autovideosrc
我跑 ./autogen.sh在克隆的 repo 中,它没有说以下内容: configure: No package 'gstreamer-plugins-base-1.0' found config
引用http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-dynamic-pipelines.htm
我有一个项目,我们正在使用 gstreamer、x264 等通过本地网络将视频流多播到多个接收器(连接到监视器的专用计算机)。我们在视频源(相机)系统和显示器上都使用了 gstreamer。 我们使用
我正在尝试使用 GStreamer 作为我们正在内部开发的软电话的视频后端。我们的软电话不是基于 GLib 的,有自己的事件循环。是否可以在没有 GMainLoop 的情况下设置 gst 管道并进入各
关于 gstreamer 元素的一些信息,我必须发出一个查询,比如 gst_element_query_position(data.playbin,GST_FORMAT_TIME,¤t)
我是一名优秀的程序员,十分优秀!