From 7801205f524ffd62cc9280e7e82540db4bc31f5a Mon Sep 17 00:00:00 2001 From: Juan Martin Runge Date: Thu, 2 Jan 2014 13:12:47 -0300 Subject: [PATCH 1/4] Added support for images to melted node driver Signed-off-by: Juan Martin Runge --- drivers/mvcp/melted-node-driver.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/mvcp/melted-node-driver.js b/drivers/mvcp/melted-node-driver.js index 1de951b..756961c 100644 --- a/drivers/mvcp/melted-node-driver.js +++ b/drivers/mvcp/melted-node-driver.js @@ -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); From 0866cfd664d8cf81f56d6143dfa4046424babd86 Mon Sep 17 00:00:00 2001 From: Juan Martin Runge Date: Thu, 2 Jan 2014 13:13:09 -0300 Subject: [PATCH 2/4] Passing media type to models instead of hardcoding "default" Signed-off-by: Juan Martin Runge --- drivers/playlists/mongo-driver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/playlists/mongo-driver.js b/drivers/playlists/mongo-driver.js index 881a289..6903a6e 100644 --- a/drivers/playlists/mongo-driver.js +++ b/drivers/playlists/mongo-driver.js @@ -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; From 81cac76ee6409adb5316589796f4ed1f65ed5cdf Mon Sep 17 00:00:00 2001 From: Juan Martin Runge Date: Thu, 2 Jan 2014 13:13:45 -0300 Subject: [PATCH 3/4] Changed default value of media type Signed-off-by: Juan Martin Runge --- models/Mosto.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/Mosto.js b/models/Mosto.js index 71c73bc..8078995 100644 --- a/models/Mosto.js +++ b/models/Mosto.js @@ -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, From 9e4512ebff71442fed1a8b19e21d8ccd0c492628 Mon Sep 17 00:00:00 2001 From: Juan Martin Runge Date: Thu, 2 Jan 2014 13:14:10 -0300 Subject: [PATCH 4/4] Fixed tests to use media type attribute Signed-off-by: Juan Martin Runge --- test/media_helpers.js | 3 ++- test/mvcp-driver-test.js | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/media_helpers.js b/test/media_helpers.js index 5f06e4d..b024a33 100644 --- a/test/media_helpers.js +++ b/test/media_helpers.js @@ -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; @@ -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; diff --git a/test/mvcp-driver-test.js b/test/mvcp-driver-test.js index 0746de0..83743cb 100644 --- a/test/mvcp-driver-test.js +++ b/test/mvcp-driver-test.js @@ -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; @@ -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; @@ -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; @@ -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; @@ -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++;