Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jmrunge/image support #144

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions drivers/mvcp/melted-node-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,22 @@ melted.prototype.sendClip = function(clip, command) {
logger.debug(this.uuid + " - Generating file " + filename);

logger.debug(this.uuid + " - Adding media [" + file + "] to file " + filename);
var video = new melted_xml.Producer.Video({ source: file, startFrame: clip.in, length: clip.length });
xml.push(video);
var media = undefined;
if (clip.type === 'video') {
media = new melted_xml.Producer.Video({ source: file, startFrame: clip.in, length: clip.length });
} else if (clip.type === 'image') {
media = new melted_xml.Producer.Image({ source: file, startFrame: clip.in, length: clip.length });
} else {
var err = new Error("Media Type not supported:", clip.type);
logger.error(err);
throw err;
}

xml.push(media);

logger.debug(this.uuid + " - Creating playlist xml object for file " + filename);
var pl = new melted_xml.Playlist;
pl.entry({producer: video});
pl.entry({producer: media});
xml.push(pl);

logger.debug(this.uuid + " - Creating track xml object for file " + filename);
Expand Down
2 changes: 1 addition & 1 deletion drivers/playlists/mongo-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mongo_driver.prototype.createPlaylist = function(sched, callback) {
var orig_order = order;
var clip_name = block.name;
// TODO: don't know what goes in type
var type = "default";
var type = block.type;
var file = block.file;
var length = moment(block.durationraw, "HH:mm:ss.SSS");
var fps = block.video.fps;
Expand Down
2 changes: 1 addition & 1 deletion models/Mosto.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Mosto.Media = Backbone.Model.extend({
// playlist_order: undefined,
// actual_order: undefined,
name: '',
type: 'default',
type: 'video',
// file: undefined,
// length: undefined,
// fps: undefined,
Expand Down
3 changes: 2 additions & 1 deletion test/media_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports.getMedia = function(path) {
m.file = process.cwd() + "/" + path + elem.filename;
m.fps = parseInt(elem.data["mlt"]["profile"][0]["$"]["frame_rate_num"], 10);
m.playlist_id = "generated";
m.type = "xml";
m.type = "video";

// Milliseconds = Frames / FPS * 1000
var ms_length = parseInt(elem.data["mlt"]["producer"][0]["$"]["out"], 10) / m.fps * 1000;
Expand Down Expand Up @@ -84,6 +84,7 @@ exports.getMBCMedia = function(path) {
var frames = parseInt(elem.data.mlt.producer[0]["$"].out, 10);
var duration = moment("0:0:0.0", "HH:mm:ss.SSS").add(exports.framesToMilliseconds(frames, params.fps));
params.durationraw = duration.format("HH:mm:ss.SSS");
params.type = 'video';
return new CMedia.Model(params);
});
return medias;
Expand Down
10 changes: 5 additions & 5 deletions test/mvcp-driver-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('start mvcp-driver test', function(done) {
var pl = undefined;
var st = undefined;
before(function(done) {
var clip = getMedia(1, 0, 1, file1.substring(file1.lastIndexOf("/") + 1), "default", file1, 1600, 25);
var clip = getMedia(1, 0, 1, file1.substring(file1.lastIndexOf("/") + 1), "video", file1, 1600, 25);
// server.stop().then(server.clearPlaylist()).then(server.loadClip(clip)).then(function() {
// return server.getServerPlaylist().then(function(playlist) {
// pl = playlist;
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('start mvcp-driver test', function(done) {
var pl = undefined;
var st = undefined;
before(function(done) {
var clip = getMedia(2, 1, 1, file2.substring(file1.lastIndexOf("/") + 1), "default", file2, 3200, 25);
var clip = getMedia(2, 1, 1, file2.substring(file1.lastIndexOf("/") + 1), "video", file2, 3200, 25);
server.appendClip(clip).then(function() {
return server.getServerPlaylist().then(function(playlist) {
pl = playlist;
Expand Down Expand Up @@ -260,7 +260,7 @@ describe('start mvcp-driver test', function(done) {
var pl = undefined;
var st = undefined;
before(function(done) {
var clip = getMedia(3, 2, 1, file3.substring(file1.lastIndexOf("/") + 1), "default", file3, 6400, 25);
var clip = getMedia(3, 2, 1, file3.substring(file1.lastIndexOf("/") + 1), "video", file3, 6400, 25);
server.insertClip(clip, 1).then(function() {
return server.getServerPlaylist().then(function(playlist) {
pl = playlist;
Expand Down Expand Up @@ -420,7 +420,7 @@ describe('start mvcp-driver test', function(done) {
var pl = undefined;
var st = undefined;
before(function(done) {
var clip = getMedia(4, 3, 1, file2.substring(file1.lastIndexOf("/") + 1), "default", file2, 3200, 25);
var clip = getMedia(4, 3, 1, file2.substring(file1.lastIndexOf("/") + 1), "video", file2, 3200, 25);
server.appendClip(clip).then(function() {
return server.getServerPlaylist().then(function(playlist) {
pl = playlist;
Expand Down Expand Up @@ -794,7 +794,7 @@ describe('start mvcp-driver test', function(done) {
});
list.forEach(function(f, i) {
var clip = getMedia(i, 0, 1, f.substring(f.lastIndexOf("/") + 1),
"default", f, 1600, 25);
"video", f, 1600, 25);
server.appendClip(clip).then(function() {
assert.equal(count, i);
count++;
Expand Down