我正在开发一个GStreamer应用程序,并为实现传入RTP流的播放器而苦苦挣扎.我正在尝试围绕gstrtpbin元素构建一个管道.我正在尝试使用gst-launch构造对管道进行建模:
VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
gst-launch -v udpsrc caps=$VIDEO_CAPS port=4444 \
! gstrtpbin .recv_rtp_sink_0 \
! rtph264depay ! ffdec_h264 ! xvimagesink
Run Code Online (Sandbox Code Playgroud)
当我启动脚本时,GStreamer报告这些错误:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0: ntp-ns-base = 3469468914024449000
New clock: GstSystemClock
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0.GstProxyPad:proxypad0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264 …
Run Code Online (Sandbox Code Playgroud) 可能重复:
如何在C#中正确清理Excel互操作对象
我用这个函数计算一些数据的线性趋势:
private string Trend(object conocido_y, object conocido_x, object nueva_matriz_x)
{
string result = String.Empty;
try {
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
result = ((Array)xlApp.WorksheetFunction.Trend(conocido_y, conocido_x, nueva_matriz_x, true)).GetValue(1).ToString();
xlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
xlApp = null;
}
catch (System.Runtime.InteropServices.COMException ex) {
DError.ReportarError(ex, false);
}
catch (Exception ex) {
DError.ReportarError(ex);
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
结果很好,但excel应用程序没有关闭,如果我打开任务管理器进程仍在运行,为什么?
我无法理解为什么Java HttpURLConnection
不遵循重定向.我使用以下代码来获取此页面:
import java.net.URL;
import java.net.HttpURLConnection;
import java.io.InputStream;
public class Tester {
public static void main(String argv[]) throws Exception{
InputStream is = null;
try {
String httpUrl = "http://httpstat.us/301";
URL resourceUrl = new URL(httpUrl);
HttpURLConnection conn = (HttpURLConnection)resourceUrl.openConnection();
conn.setConnectTimeout(15000);
conn.setReadTimeout(15000);
conn.connect();
is = conn.getInputStream();
System.out.println("Original URL: "+httpUrl);
System.out.println("Connected to: "+conn.getURL());
System.out.println("HTTP response code received: "+conn.getResponseCode());
System.out.println("HTTP response message received: "+conn.getResponseMessage());
} finally {
if (is != null) is.close();
}
}
}
Run Code Online (Sandbox Code Playgroud)
而且,我收到以下回复(看起来绝对正确!):
Original URL: http://httpstat.us/301 Connected to: …
我需要交换一些值的字节顺序,只是想知道Objective-C中是否有可用的东西,目前我用下面的CStyle函数交换字节(显然我可以重用)我只是想检查一下没有具体的我失踪?
float floatFlip(float inFloat) {
union {
int intValue;
float newFloat;
} inData, outData;
inData.newFloat = inFloat;
outData.intValue = CFSwapInt32BigToHost(inData.intValue);
return(outData.newFloat);
}
Run Code Online (Sandbox Code Playgroud)
感谢这里的指针,我有整数排序,最简单的交换浮点数的方法是什么?
int myInteger = CFSwapInt32BigToHost(myInteger);
Run Code Online (Sandbox Code Playgroud)
(以上代码更新)
float myFloat = floatFlip(myFloat);
Run Code Online (Sandbox Code Playgroud)
加里
在Coldfusion/CFML中我需要将0.85035035035转换为85%.我查看了numberFormat(),但它的输出看起来像是"0.85".似乎没有一种方法可以省略前导"0".
<cfset myNumber = 0.85035035035>
<cfoutput>
#numberFormat(myNumber, "0.00")#%
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
产出:0.85%
想法?我是否需要在第二次操作中修剪前2个字符?
<cfset myNumber = 0.85035035035>
<cfset myPercent = numberFormat(myNumber, "0.00")>
<cfoutput>
#right(myPercent, 2)# %
</cfoutput>
Run Code Online (Sandbox Code Playgroud) 我有一个使用插件架构的Java Web应用程序.我想知道是否有人有一个解决方案,其中一个可以添加一个servlet,在web应用程序运行时serlvet映射到servletconfig?这个想法是可以将类添加到/ WEB-INF/classes文件夹中,并在不重新启动Web应用程序的情况下将其作为servlet激活.同样的性质,如果用户选择删除"插件",则让代码从servletconfig中删除该类.
尝试使用Zend_Db_Select
. 任何指针?
SELECT
compounds.id as compounds_id,
reactions.id as reactions_id,
reaction_compound.number as reaction_compound_number
FROM compounds, reactions, reaction_compound
WHERE
compounds.id IN (68,74,112)
AND compounds.id = reaction_compound.compound
AND reactions.id = reaction_compound.reaction;
Run Code Online (Sandbox Code Playgroud)
具体来说,我遇到的一些问题是在 Zend 中执行多个表连接。我不确定如何使用他们的查询构建器跨多个表进行连接。
任何帮助表示赞赏!
J
当然,我知道最好的答案是"不要编写自己的跨平台代码,有人已经完成了你需要的东西",但我这样做是为了一个业余爱好/学习练习而不是任何付费容量.基本上,我正在用C++编写一个小型的控制台应用程序,我想让它跨平台,处理文件,套接字和线程等事情.OOP似乎是处理这个问题的一种很好的方法,但我还没有找到一个很好的模式来编写共享相同界面跨平台的类.
简单的方法是只计划一些元接口,在整个程序的其余部分使用它,然后根据平台编译不同文件的同一个类,但我觉得必须有一个更优雅的更好的方法; 至少,一些不会混淆IntelliSense及其同类产品的东西会很好.
我已经看了wxWidgets源代码中的一些较小的类,他们使用的方法使用保存类的私有成员,例如
class Foo
{
public:
Foo();
void Bar();
private:
FooData data;
};
Run Code Online (Sandbox Code Playgroud)
然后,您可以通过根据平台选择不同的实现文件来编译它.这种方法对我来说似乎很笨重.
我考虑的另一种方法是编写一个接口,并根据平台交换从该接口继承的类.像这样的东西:
class Foo
{
public:
virtual ~Foo() {};
virtual void Bar() = 0;
};
class Win32Foo
{
public:
Win32Foo();
~Win32Foo();
void Bar();
};
Run Code Online (Sandbox Code Playgroud)
当然这种搞砸了实际的实例化,因为你不知道创建一个对象的实现,但是可以通过使用一个函数来解决
Foo* CreateFoo();
Run Code Online (Sandbox Code Playgroud)
并根据您正在运行的平台改变功能的实现.我也不是这方面的忠实粉丝,因为它仍然看起来很笨拙,用一堆实例化方法乱丢代码(这也与创建非跨平台对象的方法不一致).
这两种方法中的哪一种更好?有没有更好的办法?
编辑:为了澄清,我的问题不是"你如何编写跨平台的C++?" 相反,它是"使用C++中的类抽象跨平台代码的最佳方法是什么,同时尽可能保留类型系统的好处?"
我有一个列表列表(使用简单的列表推导生成):
>>> base_lists = [[a, b] for a in range(1, 3) for b in range(1, 6)]
>>> base_lists
[[1,1],[1,2],[1,3],[1,4],[1,5],[2,1],[2,2],[2,3],[2,4],[2,5]]
Run Code Online (Sandbox Code Playgroud)
我想将整个列表转换为包含列表中所有值的元组,即:
resulting_tuple = (1,1,1,2,1,3,1,4,1,5,2,1,2,2,2,3,2,4,2,5)
Run Code Online (Sandbox Code Playgroud)
最有效的方法是什么?(使用列表理解生成这个相同元组的方法也是可以接受的答案.)我在这里和Python文档中查看了答案,但是我找不到合适的答案.
编辑:
非常感谢所有回答的人!
如何使用Python C API模拟以下Python函数?
def foo(bar, baz="something or other"):
print bar, baz
Run Code Online (Sandbox Code Playgroud)
(即,可以通过以下方式调用它:
>>> foo("hello")
hello something or other
>>> foo("hello", baz="world!")
hello world!
>>> foo("hello", "world!")
hello, world!
Run Code Online (Sandbox Code Playgroud)
)
java ×2
python ×2
asp.net ×1
c ×1
c# ×1
c++ ×1
class ×1
coldfusion ×1
endianness ×1
excel ×1
gstreamer ×1
https ×1
interop ×1
objective-c ×1
oop ×1
php ×1
python-c-api ×1
redirect ×1
sql ×1