我使用gstreamer从IP摄像机(如Axis)播放RTSP流.我使用如下命令行:
gst-launch-0.10 rtspsrc location=rtsp://192.168.0.127/axis-media/media.amp latency=0 ! decodebin ! autovideosink
Run Code Online (Sandbox Code Playgroud)
它工作正常.
我想用pygtk中的gui控制它,所以我使用gstreamer python绑定.我写了这段代码:
[...]
self.player = gst.Pipeline("player")
source = gst.element_factory_make("rtspsrc", "source")
source.set_property("location", "rtsp://192.168.0.127/axis-media/media.amp")
decoder = gst.element_factory_make("decodebin", "decoder")
sink = gst.element_factory_make("autovideosink", "sink")
self.player.add(source, decoder, sink)
gst.element_link_many(source, decoder, sink)
bus = self.player.get_bus()
bus.add_signal_watch()
bus.enable_sync_message_emission()
bus.connect("message", self.on_message)
bus.connect("sync-message::element", self.on_sync_message)
[...]
Run Code Online (Sandbox Code Playgroud)
但它不起作用并退出此消息:
gst.element_link_many(source, decoder,sink)
gst.LinkError: failed to link source with decoder
Run Code Online (Sandbox Code Playgroud)
我也尝试用这个来改进我的CLI,因为我只使用h264:
gst-launch-0.10 -v rtspsrc location=rtsp://192.168.0.127/axis-media/media.amp ! rtph264depay ! ffdec_h264 ! xvimagesink
Run Code Online (Sandbox Code Playgroud)
并在我的python代码中实现它:
[...]
self.player = gst.Pipeline("player")
source = gst.element_factory_make("rtspsrc", "source")
depay = gst.element_factory_make("rtph264depay", "depay") …Run Code Online (Sandbox Code Playgroud) 我有一个文档库列表.我在该列表中创建了文件夹,并将一些文件上传到这些子文件夹.如何使用SPQuery获取该文档库列表中子文件夹中的所有这些文件?
我试图基本上这样做,所以用户不能连续两次点击#shareheart,使动画搞砸了.也许你可以说我试图创建一个活动状态而不添加和删除类?
为什么这不起作用?第一段代码是什么不起作用,它不遵循这个if语句,我在这里做错了吗?
if($('.share-text').not(':animated') && $('.share-text span').is(':visible')) {
// do something
}
Run Code Online (Sandbox Code Playgroud)
这是完整的代码:
$('#shareheart').click(function() {
if ($('.share-text:animated').length == 0 && $('.share-text span').is(':visible')) {
$('.share-text span').animate({'opacity': '0'}, 800, function() {
$("#share-what").fadeOut(400)
$('.share-text').stop(true, false).animate({'width': 'toggle','padding-left': 'toggle','padding-right': 'toggle'}, 800)
$('#short-url').css('background-image', "url('images/drink.png')");
})
} else {
$('.share-text').stop(false, true).animate({'width': 'toggle','padding-left': 'toggle','padding-right': 'toggle'}, 800, function() {
$('.share-text span').animate({'opacity': '1'}, 800)
});
}
});
Run Code Online (Sandbox Code Playgroud) 你能告诉我什么是可用的软件架构设计模式吗?
为了详细说明我的问题,我想阅读不同的架构设计模式,并确定哪些适合我的项目要求?
例如,有企业应用程序设计模式,企业集成设计模式,ESB模式,SOA模式等.
在他的Google I/O 2009"App Engine上的离线处理:前瞻性"演示(视频,幻灯片)中,Brett Slatkin展示了Task Queue服务.
他说
Pub-sub系统最大化事务,解耦:
- 每秒大量小额交易
- 一对多扇出,更换接收器
- 保证订购,过滤,两阶段提交
并特别强调
我们的新API实现了排队,而不是pub-sub
我只对这些功能的一部分感兴趣:
有针对性的目标是简化在同一Web应用程序的不同模块之间发布通知/消息.示例使用场景案例将是:
在Task Queue服务之上实现这些的正确方法是什么?
google-app-engine publish-subscribe task-queue google-cloud-pubsub
我正在尝试序列化一个 Hashset,但我没有运气。每当我尝试打开序列化数据时,都会得到一个空的 HashSet。但是,列表工作正常。示例代码:
[Serializable()]
public class MyClass : ISerializable
{
public MyClass(SerializationInfo info, StreamingContext ctxt)
{
HashSet<string> hashset = (HashSet<string>)info.GetValue("hashset", typeof(HashSet<string>));
List<string> list = (List<string>)info.GetValue("list", typeof(List<string>));
Console.WriteLine("Printing Hashset:");
foreach (string line in hashset)
{
Console.WriteLine(line);
}
Console.WriteLine("Printing List:");
foreach (string line in list)
{
Console.WriteLine(line);
}
}
public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
{
HashSet<string> hashset = new HashSet<string>();
hashset.Add("One");
hashset.Add("Two");
hashset.Add("Three");
info.AddValue("hashset", hashset);
List<string> list = new List<string>();
list.Add("One");
list.Add("Two");
list.Add("Three");
info.AddValue("list", list);
}
}
Run Code Online (Sandbox Code Playgroud)
当运行时,它打印出:
Printing Hashset:
Printing …Run Code Online (Sandbox Code Playgroud) 可能重复:
(C#)获取当前foreach迭代的索引
早上好,
有没有办法Enumerator在不使用辅助变量的情况下获取当前元素的索引(在这种情况下,是字符串中的字符)?我知道如果我使用一个while或者forcicle,这可能会更容易,但使用枚举器循环一个字符串更优雅......这个案例的唯一缺点是我真的需要得到每个字符的当前索引.
非常感谢你.
首先,我想删除www.来自我的域名
http://www.example.com => http://example.com
我还希望某些目录是安全的(https),而其余的仍然是http
http://example.com/login => https://example.com/login
显然它需要适用于所有条件,例如,如果有人输入:
http://www.example.com/login => https://example.com/login
此外,当人们离开登录页面时,它返回到http.目前在.htaccess中是由我正在使用的软件自动完成的,我想它需要在那里工作:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php
Run Code Online (Sandbox Code Playgroud)
关于如何实现梦想控制所有这些事情的任何想法?
提前致谢!
===================
@Gumbo根据你的建议,这是我完整的.htaccess
RewriteEngine On
# remove www from host
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
# force HTTPS
RewriteCond %{HTTPS} =off
RewriteRule ^(login)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# force HTTP
RewriteCond %{HTTPS} =on
RewriteRule !^(login)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php
Options -Indexes
Run Code Online (Sandbox Code Playgroud)
导航到http:// example/login仍然会转到 …
有很多相关的问题,但我正在寻找一个特定于我的案例的解决方案.有一个(通常)14个整数的数组,每个整数在1到34的范围内.如何快速判断特定静态列表中的每个int是否在此数组中至少出现一次?
作为参考,我目前正在使用这个代码,尽可能地编写类似于规范的代码,所以它当然可以大大改进:
if (array.Count < 13) {
return;
}
var required = new int[] {
0*9 + 1,
0*9 + 9,
1*9 + 1,
1*9 + 9,
2*9 + 1,
2*9 + 9,
3*9 + 1,
3*9 + 2,
3*9 + 3,
3*9 + 4,
3*9 + 5,
3*9 + 6,
3*9 + 7,
};
IsThirteenOrphans = !required.Except (array).Any ();
Run Code Online (Sandbox Code Playgroud)
所需列表不是动态的,即在运行时它将始终相同.使用Linq是可选的,主要方面是性能.
编辑:
更新:我也对排序输入数组的解决方案感兴趣.
我刚刚发现LINQ,请跟我一起全面!:-)
所以!我有一个数据层提供谁我的数据表,我想将它们转换为对象的列表.这些对象在spécific层DTO(数据传输对象)中定义.
如何将我的数据表的每一行映射到对象,并把所有的对象到一个列表?(今天我在场后"手动"字段)是否可以使用LINQ?我听说过LINQ2Entities?我对吗?
感谢帮助初学者理解......