当前位置: 首页>>代码示例>>Java>>正文


Java IBroadcastStream类代码示例

本文整理汇总了Java中org.red5.server.api.stream.IBroadcastStream的典型用法代码示例。如果您正苦于以下问题:Java IBroadcastStream类的具体用法?Java IBroadcastStream怎么用?Java IBroadcastStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IBroadcastStream类属于org.red5.server.api.stream包,在下文中一共展示了IBroadcastStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: packetReceived

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
@Override
public void packetReceived(IBroadcastStream broadcastStream, IStreamPacket streampacket) {
	try {
		CachedEvent cachedEvent = new CachedEvent();
		cachedEvent.setData(streampacket.getData().duplicate());
		cachedEvent.setDataType(streampacket.getDataType());
		cachedEvent.setTimestamp(streampacket.getTimestamp());
		cachedEvent.setCurrentTime(new Date());
		if (streampacket instanceof VideoData) {
			cachedEvent.setFrameType(((VideoData) streampacket).getFrameType());
		}

		if (log.isTraceEnabled()) {
			log.trace("##REC:: Packet recieved. type: {} frame type: {}", cachedEvent.getDataType(), cachedEvent.getFrameType());
		}
		streamWriter.append(cachedEvent);
	} catch (Exception e) {
		log.error("##REC:: [packetReceived]", e);
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:21,代码来源:StreamListener.java

示例2: streamBroadcastClose

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
@Override
public void streamBroadcastClose(IBroadcastStream stream) {
	// TODO Auto-generated method stub
	log.debug("Inside streamBroadcastClose");
	
	String streamFullName = DVRUtils.getStreamFullName(stream.getPublishedName());
	IDVRStream dvrStream = this.getStream(streamFullName, false);
	
	if(dvrStream != null)
	{
		IConnection conn = Red5.getConnectionLocal();
		dvrStream.unpublish(conn);
	}
	
	super.streamBroadcastClose(stream);
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:17,代码来源:Application.java

示例3: streamBroadcastClose

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
@Override
public void streamBroadcastClose(IBroadcastStream arg0) {
	// TODO Auto-generated method stub
	super.streamBroadcastClose(arg0);
	
	/* fire request */
	try 
	{
		ITranscoderFacade facade = Red5TranscoderFacade.getInstance();
		facade.abortTranscode();
	} 
	catch (Exception e) 
	{
		e.printStackTrace();
	} 
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:17,代码来源:Application.java

示例4: packetReceived

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public void packetReceived(IBroadcastStream stream, IStreamPacket packet) {
    if (recording.get()) {
        // store everything we would need to perform a write of the stream data
        CachedEvent event = new CachedEvent();
        event.setData(packet.getData().duplicate());
        event.setDataType(packet.getDataType());
        event.setReceivedTime(System.currentTimeMillis());
        event.setTimestamp(packet.getTimestamp());
        // queue the event
        if (!queue.add(event)) {
            log.debug("Event packet not added to recording queue");
        }
    } else {
        log.info("A packet was received by recording listener, but it's not recording anymore. {}", stream.getPublishedName());
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:18,代码来源:RecordingListener.java

示例5: publish

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public void publish(Boolean dontStop) {
    // null is as good as false according to Boolean.valueOf() so if null, interpret as false
    if (dontStop == null || !dontStop) {
        IConnection conn = Red5.getConnectionLocal();
        if (conn instanceof IStreamCapableConnection) {
            IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
            Number streamId = conn.getStreamId();
            IClientStream stream = streamConn.getStreamById(streamId);
            if (stream instanceof IBroadcastStream) {
                IBroadcastStream bs = (IBroadcastStream) stream;
                if (bs.getPublishedName() != null) {
                    IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
                    if (bsScope != null) {
                        bsScope.unsubscribe(bs.getProvider());
                        if (conn instanceof BaseConnection) {
                            ((BaseConnection) conn).unregisterBasicScope(bsScope);
                        }
                    }
                    bs.close();
                    streamConn.deleteStreamById(streamId);
                }
            }
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:27,代码来源:StreamService.java

示例6: packetReceived

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
public void packetReceived(IBroadcastStream arg0, IStreamPacket packet) {

		if (done) {
			arg0.removeStreamListener(this);
			return;
		}

		messages = Red5.getConnectionLocal().getWrittenMessages() + Red5.getConnectionLocal().getReadMessages();

		bytesUp = Red5.getConnectionLocal().getReadBytes();

		bytesDown = Red5.getConnectionLocal().getWrittenBytes();

		if (packet instanceof Notify) {

			endpoint().invoke("onBWChunk", new Object[] { chunk });
			chunks++;
			//  Input reader = new Input(((Notify)packet).getData()); 
			//  reader.readDataType();//string
			//  String  method=reader.readString(null);
			//  reader.readDataType();//object
			//  Map invokeData=  (Map) reader.readMap(new Deserializer(), null);            
			//  System.out.println(method+""+invokeData.get("data").toString());	
		}
	}
 
开发者ID:Red5,项目名称:red5-rtsp-restreamer,代码行数:26,代码来源:BandwidthChecker.java

示例7: packetReceived

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
@Override
public void packetReceived(IBroadcastStream stream, IStreamPacket packet) {

	RTMPMessage m = RTMPMessage.build((IRTMPEvent) packet, packet.getTimestamp());

	try {

		limiter--;
		if (limiter > 1) {
			streamer.pushMessage(null, m);
		} else {
			if (streamer != null) {
				stream.removeStreamListener(this);
				streamer.stop();
				streamer = null;
			}
		}

	} catch (IOException e) {

		e.printStackTrace();
	}

}
 
开发者ID:Red5,项目名称:red5-rtsp-restreamer,代码行数:25,代码来源:Application.java

示例8: unregisterBroadcastStream

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public boolean unregisterBroadcastStream(IScope scope, String name, IBroadcastStream bs) {
    if (log.isDebugEnabled()) {
        log.debug("Unregistering - name: {} stream: {} scope: {}", new Object[] { name, bs, scope });
        ((Scope) scope).dump();
    }
    IBroadcastScope broadcastScope = scope.getBroadcastScope(name);
    if (bs != null) {
        log.debug("Unsubscribing scope {} from provider {}", broadcastScope, bs.getProvider());
        broadcastScope.unsubscribe(bs.getProvider());
        // if the scope has no listeners try to remove it
        if (!((BasicScope) broadcastScope).hasEventListeners()) {
            if (log.isDebugEnabled()) {
                log.debug("Scope has no event listeners attempting removal");
            }
            scope.removeChildScope(broadcastScope);
        }            
    } else {
        log.debug("Broadcast scope was null for {}", name);
    }
    // verify that scope was removed
    return scope.getBasicScope(ScopeType.BROADCAST, name) == null;
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:24,代码来源:ProviderService.java

示例9: start

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
/**
 * Creates and starts a facade and adds an audio mux for the given scope.
 * 
 * @param scope
 * @param stream
 * @param useRTMPReader
 */
public void start(IScope scope, IBroadcastStream stream, boolean useRTMPReader) {
	log.debug("start - scope: {} stream: {} rtmp reader: {}", scope.getName(), stream.getPublishedName(), useRTMPReader);
	String streamName = stream.getPublishedName();
	start(streamName, useRTMPReader);
	// add the mux associated with the given scope
	AudioMux mux = muxService.getAudioMux(scope.getName());
	if (mux != null) {
		// get the facade for this stream
		segmentMap.get(streamName).setAudioMux(mux);
		// add the streams audio track to the muxer
		mux.addTrack(2, streamName); // TODO create a better way to know what our output channels are (defaulting to 2 / stereo)
	} else {
		log.warn("Audio mux service was not found");
	}
}
 
开发者ID:Red5,项目名称:red5-hls-plugin,代码行数:23,代码来源:SegmenterService.java

示例10: unregisterBroadcastStream

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public boolean unregisterBroadcastStream(IScope scope, String name, IBroadcastStream bs) {
	log.debug("Unregistering - name: {} stream: {} scope: {}", new Object[] { name, bs, scope });
	if (log.isTraceEnabled()) {
		((Scope) scope).dump();
	}
	IBroadcastScope broadcastScope = scope.getBroadcastScope(name);
	if (bs != null) {
		log.debug("Unsubscribing scope {} from provider {}", broadcastScope, bs.getProvider());
		broadcastScope.unsubscribe(bs.getProvider());
	}
	// if the scope has no listeners try to remove it
	if (!((BasicScope) broadcastScope).hasEventListeners()) {
		log.debug("Scope has no event listeners attempting removal");
		scope.removeChildScope(broadcastScope);
	}
	// verify that scope was removed
	return scope.getBasicScope(ScopeType.BROADCAST, name) == null;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:20,代码来源:ProviderService.java

示例11: publish

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public void publish(Boolean dontStop) {
	if (!dontStop) {
		IConnection conn = Red5.getConnectionLocal();
		if (conn instanceof IStreamCapableConnection) {
			IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
			int streamId = getCurrentStreamId();
			IClientStream stream = streamConn.getStreamById(streamId);
			if (stream instanceof IBroadcastStream) {
				IBroadcastStream bs = (IBroadcastStream) stream;
				if (bs.getPublishedName() != null) {
					IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
					if (bsScope != null) {
						bsScope.unsubscribe(bs.getProvider());
						if (conn instanceof BaseConnection) {
							((BaseConnection) conn).unregisterBasicScope(bsScope);
						}
					}
					bs.close();
					streamConn.deleteStreamById(streamId);
				}
			}
		}
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:26,代码来源:StreamService.java

示例12: streamPublishStart

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
@Override
public void streamPublishStart(IBroadcastStream stream) {
	// TODO Auto-generated method stub
	log.debug("Inside streamPublishStart");
	
	String streamFullName = DVRUtils.getStreamFullName(stream.getPublishedName());
	IDVRStream dvrStream = this.getStream(streamFullName, true);
	
	IConnection conn = Red5.getConnectionLocal();
	dvrStream.publish(conn);
	
	super.streamPublishStart(stream);
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:14,代码来源:Application.java

示例13: streamRecordStop

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
@Override
public void streamRecordStop(IBroadcastStream stream) {
	// TODO Auto-generated method stub
	log.debug("Inside streamRecordStop");
	
	super.streamRecordStop(stream);
}
 
开发者ID:rajdeeprath,项目名称:red5-server-apps,代码行数:8,代码来源:Application.java

示例14: streamBroadcastClose

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
@Override
public void streamBroadcastClose(IBroadcastStream stream) {
	log.debug("Broadcast close called. Stream name: {}", stream.getName());
	super.streamBroadcastClose(stream);
	// TODO: call the process to move the flv to S3 because its not possible to stream the bytes directly to S3 during flv write
	if (persistToS3) {
   		// move the completed flv to S3
   		S3FilenameGenerator.upload("Session-" + System.currentTimeMillis(), stream.getPublishedName());
	}
}
 
开发者ID:Red5,项目名称:red5-examples,代码行数:11,代码来源:Application.java

示例15: getBroadcastStream

import org.red5.server.api.stream.IBroadcastStream; //导入依赖的package包/类
/** {@inheritDoc} */
public IBroadcastStream getBroadcastStream(IScope scope, String name) {
    IStreamService service = (IStreamService) ScopeUtils.getScopeService(scope, IStreamService.class, StreamService.class);
    if (service instanceof StreamService) {
        IBroadcastScope bs = ((StreamService) service).getBroadcastScope(scope, name);
        if (bs != null) {
            return bs.getClientBroadcastStream();
        }
    }
    return null;
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:12,代码来源:MultiThreadedApplicationAdapter.java


注:本文中的org.red5.server.api.stream.IBroadcastStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。