public RtmpReader getReader(final String rawName) { final String streamName = Utils.trimSlashes(rawName); final String path = RtmpConfig.SERVER_HOME_DIR + "/apps/" + name + "/"; final String readerPlayName; try { if (streamName.startsWith("mp4:")) { readerPlayName = streamName.substring(4); return new F4vReader(path + readerPlayName); } else { if (streamName.lastIndexOf('.') < streamName.length() - 4) { readerPlayName = streamName + ".flv"; } else { readerPlayName = streamName; } return new FlvReader(path + readerPlayName); } } catch (Exception e) { logger.info("reader creation failed: {}", e.getMessage()); return null; } }
public RtmpWriter getWriter(final String rawName) { final String streamName = Utils.trimSlashes(rawName); final String path = RtmpConfig.SERVER_HOME_DIR + "/apps/" + name + "/"; return new FlvWriter(path + streamName + ".flv"); }
private static String cleanName(final String raw) { return Utils.trimSlashes(raw).toLowerCase(); }