010-68421378
sales@cogitosoft.com
当前您所在的位置:首页>新闻中心>新品发布

Wowza :如何获得输入流的音视频编码信息?

发布时间:2021/01/28 浏览量:2179
需要Wowza Media Server? 3.0.0 及更高版本的支持

注意:需要Wowza Media Server® 3.0.0 及更高版本的支持。

新版的IMediaStreamActionNotify 接口IMediaStreamActionNotify3 增加了对以下功能的支持:

Code:

voidonCodecInfoVideo(IMediaStream stream, MediaCodecInfoVideo codecInfoVideo);

voidonCodecInfoAudio(IMediaStream stream, MediaCodecInfoAudio codecInfoAudio);

这个新的事件将监听音视频流的编码信息。

Code:

package test;

 

importcom.wowza.wms.amf.*;

importcom.wowza.wms.application.*;

importcom.wowza.wms.module.*;

importcom.wowza.wms.stream.*;

importcom.wowza.wms.media.model.*;

 

public classModuleMediaStreamActionNotify3Example extends ModuleBase

{

 

        class StreamListener implementsIMediaStreamActionNotify3

        {

               public voidonMetaData(IMediaStream stream, AMFPacket metaDataPacket)

               {

                       System.out.println("onMetaData["+ stream.getContextStr() + "]: " + metaDataPacket.toString());

               }

 

               public voidonPauseRaw(IMediaStream stream, boolean isPause, double location)

               {

                       System.out.println("onPauseRaw["+ stream.getContextStr() + "]: isPause:" + isPause + " location:"+ location);

               }

 

               public void onPause(IMediaStreamstream, boolean isPause, double location)

               {

                       System.out.println("onPause["+ stream.getContextStr() + "]: isPause:" + isPause + "location:" + location);

               }

 

               public void onPlay(IMediaStreamstream, String streamName, double playStart, double playLen, int playReset)

               {

                       System.out.println("onPlay["+ stream.getContextStr() + "]: playStart:" + playStart + "playLen:" + playLen + " playReset:" + playReset);

               }

 

               public void onPublish(IMediaStreamstream, String streamName, boolean isRecord, boolean isAppend)

               {

                       System.out.println("onPublish["+ stream.getContextStr() + "]: isRecord:" + isRecord + "isAppend:" + isAppend);

               }

 

               public void onSeek(IMediaStreamstream, double location)

               {

                       System.out.println("onSeek["+ stream.getContextStr() + "]: location:" + location);

               }

 

               public void onStop(IMediaStreamstream)

               {

                       System.out.println("onStop["+ stream.getContextStr() + "]: ");

               }

 

               public void onUnPublish(IMediaStreamstream, String streamName, boolean isRecord, boolean isAppend)

               {

                       System.out.println("onUnPublish["+ stream.getContextStr() + "]: streamName:" + streamName + "isRecord:" + isRecord + " isAppend:" + isAppend);

               }

 

               public voidonCodecInfoAudio(IMediaStream stream,

                               MediaCodecInfoAudiocodecInfoAudio) {

                       System.out.println("onCodecInfoAudio["+ stream.getContextStr() + " Audio Codec" +codecInfoAudio.toCodecsStr() + "]: ");

               }

 

               public voidonCodecInfoVideo(IMediaStream stream,

                               MediaCodecInfoVideocodecInfoVideo) {

                       System.out.println("onCodecInfoVideo["+ stream.getContextStr() + " Video Codec" +codecInfoVideo.toCodecsStr() + "]: ");

               }

        }

 

        public void onStreamCreate(IMediaStreamstream)

        {

               getLogger().info("onStreamCreate["+stream+"]:clientId:" + stream.getClientId());

               IMediaStreamActionNotify2actionNotify = new StreamListener();

 

               WMSProperties props =stream.getProperties();

               synchronized (props)

               {

                       props.put("streamActionNotifier",actionNotify);

               }

               stream.addClientListener(actionNotify);

        }

 

        public void onStreamDestroy(IMediaStreamstream)

        {

               getLogger().info("onStreamDestroy["+stream+"]:clientId:" + stream.getClientId());

 

               IMediaStreamActionNotify2 actionNotify= null;

               WMSProperties props =stream.getProperties();

               synchronized (props)

               {

                       actionNotify =(IMediaStreamActionNotify2)stream.getProperties().get("streamActionNotifier");

               }

               if (actionNotify != null)

               {

                       stream.removeClientListener(actionNotify);

                       getLogger().info("removeClientListener:" + stream.getSrc());

               }

        }

 

}

 

Wowza Streaming Engine 4是业界功能强大、API接口丰富的流媒体Server产品,采用它作为流媒体服务器产品的案例很多,直播、在线教育、IPTV都有它的用武之地。

下一篇:创建Web应用的UI控件Kendo UI正式发布R2 2020 SP1
上一篇:报表服务器全新发布Telerik Report Server发布

                               

 京ICP备09015132号-996网络文化经营许可证京网文[2017]4225-497号 | 违法和不良信息举报电话:4006561155

                                   © Copyright 2000-2023 北京哲想软件有限公司版权所有 | 地址:北京市海淀区西三环北路50号豪柏大厦C2座11层1105室

                         北京哲想软件集团旗下网站:哲想软件 | 哲想动画

                            华滋生物