sps编程模型中打开站点的几种方法

 

打开站点的几种方法

1、如果你想打开的是你这个WEBPart所在的站点,直接使用SPWeb和SPControl打开。

注意:想要引用Microsoft.sharpoint和Microsoft.Sharpoint.WebControls

SPWeb mySite=SPControl.GetContextWeb(Context);

 

2、如果要访问当前虚拟服务器的其他站点

SPWeb site=SPControl.GetContextSite(Context).AllWebs[@"/C1/文档中心/"];

 

也可以:

SPSite myWeb=SPControl.GetContextSite(Context);

SPWeb mySite=myWeb.AllWebs[@"/C1/文档中心/"];

 

3、访问不同虚拟服务器的不同站点

SPSite siteCollection=new SPSite("http://zhouyi1095.test.net/");

 SPWeb site=siteCollection.AllWebs[@"/C1/文档中心/"];

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
在 GStreamer 获取 H264 码流 SPS 和 PPS 信息的方法如下: 1. 使用 `h264parse` 元素将 H264 码流解析为 NAL 单元。 2. 使用 `capsfilter` 元素设置 `video/x-h264, stream-format=byte-stream` 的媒体格式。 3. 使用 `splitter` 元素将 NAL 单元分离为 SPS、PPS 和 IDR 帧等单元。 4. 使用 `queue` 元素对 SPS 和 PPS 单元进行缓存。 5. 在需要使用 SPS 和 PPS 信息的地方,从 `queue` 元素获取 SPS 和 PPS 单元,并合并成完整的 SPS 和 PPS 数据。 以下是示例代码: ```python import gi gi.require_version('Gst', '1.0') from gi.repository import Gst Gst.init(None) pipeline = Gst.Pipeline() src = Gst.ElementFactory.make('filesrc', 'src') src.set_property('location', 'test.h264') h264parse = Gst.ElementFactory.make('h264parse', 'parse') caps = Gst.Caps.from_string('video/x-h264, stream-format=byte-stream') capsfilter = Gst.ElementFactory.make('capsfilter', 'caps') capsfilter.set_property('caps', caps) splitter = Gst.ElementFactory.make('splitter', 'split') queue_sps = Gst.ElementFactory.make('queue', 'sps') queue_pps = Gst.ElementFactory.make('queue', 'pps') sink = Gst.ElementFactory.make('fakesink', 'sink') pipeline.add(src) pipeline.add(h264parse) pipeline.add(capsfilter) pipeline.add(splitter) pipeline.add(queue_sps) pipeline.add(queue_pps) pipeline.add(sink) src.link(h264parse) h264parse.link(capsfilter) capsfilter.link(splitter) splitter.link(queue_sps) splitter.link(queue_pps) queue_sps.link(sink) pipeline.set_state(Gst.State.PLAYING) bus = pipeline.get_bus() msg = bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.STATE_CHANGED | Gst.MessageType.ERROR) if msg.type == Gst.MessageType.ERROR: error, debug = msg.parse_error() print('Error received from element %s: %s' % (msg.src.get_name(), error)) print('Debugging information: %s' % debug) else: print('Pipeline started') sps_data = None pps_data = None while True: sample = queue_sps.get_upstream_buffer() if sample: buf = sample.get_buffer() sps_data = buf.extract_dup(0, buf.get_size()) break while True: sample = queue_pps.get_upstream_buffer() if sample: buf = sample.get_buffer() pps_data = buf.extract_dup(0, buf.get_size()) break print('SPS:', sps_data) print('PPS:', pps_data) pipeline.set_state(Gst.State.NULL) ``` 这段代码可以从文件读取 H264 码流,并获取其SPS 和 PPS 数据。需要注意的是,从队列获取数据时需要使用 `get_upstream_buffer()` 方法,否则可能会遇到阻塞的情况。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

想好点

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值