[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [405] Expermental support for quality (360p, 48
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [405] Expermental support for quality (360p, 480p etc) and format (WebM, MP4, FLV etc) selection. |
Date: |
Mon, 10 Jun 2013 20:09:30 +0000 |
Revision: 405
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=405
Author: valkov
Date: 2013-06-10 20:09:30 +0000 (Mon, 10 Jun 2013)
Log Message:
-----------
Expermental support for quality (360p, 480p etc) and format (WebM, MP4, FLV
etc) selection.
Modified Paths:
--------------
trunk/src/lm_compute_preferred_hd_link.js
trunk/src/lm_config_options.js
trunk/src/lm_constructors.js
trunk/src/lm_init_options.js
Modified: trunk/src/lm_compute_preferred_hd_link.js
===================================================================
--- trunk/src/lm_compute_preferred_hd_link.js 2013-06-02 14:20:11 UTC (rev
404)
+++ trunk/src/lm_compute_preferred_hd_link.js 2013-06-10 20:09:30 UTC (rev
405)
@@ -57,7 +57,35 @@
var quality = Math.abs(this.preferred_hd_quality);
preferred_link_index = Math.floor(((hd_links.length)*quality));
}
+ else if (/^[0-9]+p$/i.test(this.preferred_hd_quality))
+ {
+ var match = this.preferred_hd_quality.split(/p/)[0];
+ var width_re = new RegExp(
+ match);
+ var width_format_re = new RegExp(
+ match+".*"+this.format,
+ "i");
+
+ var hd_index = -1;
+ for (var i=0,l=hd_links.length; i<l; i++)
+ {
+ if (hd_links[i].label.match(width_re))
+ {
+ hd_index = hd_links.length - i;
+ }
+
+ if (hd_links[i].label.match(width_format_re))
+ {
+ hd_index = hd_links.length - i;
+ break;
+ }
+
+ }
+
+ preferred_link_index = (hd_index >=0) ? hd_index : 0;
+ }
+
// Ensure correct index. The hd_links.length is greater by one
// then the number of links.
if (preferred_link_index == 0)
Modified: trunk/src/lm_config_options.js
===================================================================
--- trunk/src/lm_config_options.js 2013-06-02 14:20:11 UTC (rev 404)
+++ trunk/src/lm_config_options.js 2013-06-10 20:09:30 UTC (rev 405)
@@ -213,7 +213,7 @@
var set_quality_to = quality ? quality : "low";
var err = null;
- if (!/^(low|medium|high|[0-9]+|[0-9.,]+%)$/i.test(set_quality_to) ||
+ if (!/^(low|medium|high|[0-9]+|[0-9.,]+%|[0-9]+p)$/i.test(set_quality_to)
||
/^low$/i.test(set_quality_to))
{
// Low
@@ -229,7 +229,7 @@
// High
set_quality_to = -1;
}
- else if (/^[0-9]+$/i.test(set_quality_to))
+ else if (/^[0-9]+$/i.test(set_quality_to))
{
// Set to link number
set_quality_to = parseInt(set_quality_to);
@@ -273,3 +273,14 @@
this.web_log_expand = web_log_expand;
}
+
+LinternaMagica.prototype.set_format = function(format)
+{
+ if (!/^(webm|flv|mp4|3gp|h264)$/i.test(format))
+ {
+ format = "";
+ }
+
+ this.format = format;
+}
+
Modified: trunk/src/lm_constructors.js
===================================================================
--- trunk/src/lm_constructors.js 2013-06-02 14:20:11 UTC (rev 404)
+++ trunk/src/lm_constructors.js 2013-06-10 20:09:30 UTC (rev 405)
@@ -97,6 +97,7 @@
this.set_wait_xhr(params.wait_xhr);
this.set_check_updates(params.updates);
this.set_hd_link_quality(params.quality);
+ this.set_format(params.format);
// check_for_updates() MUST be called only if there is video object
// found. The only place where the user can be informed is in the
Modified: trunk/src/lm_init_options.js
===================================================================
--- trunk/src/lm_init_options.js 2013-06-02 14:20:11 UTC (rev 404)
+++ trunk/src/lm_init_options.js 2013-06-10 20:09:30 UTC (rev 405)
@@ -92,7 +92,15 @@
// <number>%: Start the link that corresponds to <number>
// percent from the list. Float numbers are allowed - 34.56%,
// 18,6%.
+ //
+ // <width>p: Start the clip with the specified with. For
+ // example 480p
+ //
"quality": "low",
+ // Preferred video format
+ // webm/mp4/flv/3gp/h264
+ //
+ "format": "mp4",
};
// NO MINIMISATION ABOVE THIS LINE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [405] Expermental support for quality (360p, 480p etc) and format (WebM, MP4, FLV etc) selection.,
Ivaylo Valkov <=