本文整理汇总了Java中org.red5.io.IStreamableFile类的典型用法代码示例。如果您正苦于以下问题:Java IStreamableFile类的具体用法?Java IStreamableFile怎么用?Java IStreamableFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IStreamableFile类属于org.red5.io包,在下文中一共展示了IStreamableFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* Initialization
*
* @throws IOException
* I/O exception
*/
private void init() throws IOException {
file = new File(OmFileHelper.getStreamsSubDir(scope.getName()), OmFileHelper.getName(streamName, EXTENSION_FLV));
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class,
StreamableFileFactory.class);
if (!file.isFile()) {
// Maybe the (previously existing) file has been deleted
file.createNewFile();
} else if (!file.canWrite()) {
throw new IOException("The file is read-only");
}
IStreamableFileService service = factory.getService(file);
IStreamableFile flv = service.getStreamableFile(file);
writer = flv.getWriter();
}
示例2: init
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* Initializes file provider. Creates streamable file factory and service, seeks to start position
*/
private void init() throws IOException {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service == null) {
log.error("No service found for {}", file.getAbsolutePath());
return;
}
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
if (start > 0) {
seek(start);
}
}
示例3: getStreamLength
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* Returns stream length. This is a hook so it may be removed.
*
* @param name
* Stream name
* @return Stream length in seconds (?)
*/
public double getStreamLength(String name) {
double duration = 0;
IProviderService provider = (IProviderService) ScopeUtils.getScopeService(scope, IProviderService.class, ProviderService.class);
File file = provider.getVODProviderFile(scope, name);
if (file != null && file.canRead()) {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service != null) {
ITagReader reader = null;
try {
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
duration = (double) reader.getDuration() / 1000;
} catch (IOException e) {
log.error("Error read stream file {}. {}", file.getAbsolutePath(), e);
} finally {
if (reader != null) {
reader.close();
}
}
} else {
log.error("No service found for {}", file.getAbsolutePath());
}
file = null;
}
return duration;
}
示例4: init
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* Initializes file provider. Creates streamable file factory and service, seeks to start position
*/
private void init() throws IOException {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service == null) {
log.error("No service found for {}", file.getAbsolutePath());
return;
}
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
if (start > 0) {
seek(start);
}
}
示例5: getStreamLength
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* Returns stream length. This is a hook so it may be removed.
*
* @param name
* Stream name
* @return Stream length in seconds (?)
*/
public double getStreamLength(String name) {
double duration = 0;
IProviderService provider = (IProviderService) ScopeUtils.getScopeService(scope, IProviderService.class, ProviderService.class);
File file = provider.getVODProviderFile(scope, name);
if (file != null && file.canRead()) {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service != null) {
ITagReader reader = null;
try {
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
duration = (double) reader.getDuration() / 1000;
} catch (IOException e) {
log.error("Error read stream file {}. {}", file.getAbsolutePath(), e);
} finally {
if (reader != null) {
reader.close();
}
}
} else {
log.error("No service found for {}", file.getAbsolutePath());
}
file = null;
}
return duration;
}
示例6: getFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/** {@inheritDoc}
*/
public IStreamableFile getFile() {
// TODO wondering if we need to have a reference
return null;
}
示例7: getFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/** {@inheritDoc}
*/
public IStreamableFile getFile() {
return flv;
}
示例8: getFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/** {@inheritDoc} */
public IStreamableFile getFile() {
return null;
}
示例9: getFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public IStreamableFile getFile() {
// TODO wondering if we need to have a reference
return null;
}
示例10: getFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public IStreamableFile getFile() {
return flv;
}
示例11: getFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public IStreamableFile getFile() {
return null;
}
示例12: getStreamableFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public IStreamableFile getStreamableFile(File file) throws IOException {
return new M4A(file);
}
示例13: getStreamableFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public IStreamableFile getStreamableFile(File file) throws IOException {
return new MP4(file);
}
示例14: getStreamableFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public IStreamableFile getStreamableFile(File file) throws IOException {
return new FLV(file, generateMetadata);
}
示例15: getStreamableFile
import org.red5.io.IStreamableFile; //导入依赖的package包/类
/** {@inheritDoc} */
public abstract IStreamableFile getStreamableFile(File file) throws IOException;