summaryrefslogtreecommitdiff
path: root/includes/inc_files.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/inc_files.php')
-rwxr-xr-xincludes/inc_files.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/includes/inc_files.php b/includes/inc_files.php
new file mode 100755
index 0000000..f6dff09
--- /dev/null
+++ b/includes/inc_files.php
@@ -0,0 +1,36 @@
+<?php
+
+function mediagetinfostream($stream = "")
+{
+
+ global $mediainfopath, $ffmpegpath;
+
+ // Get info
+ exec($mediainfopath ." \"" .$stream ."\"", $mediainfo);
+
+ $info = "";
+ $title = "";
+
+ // Parse info
+ $count = count($mediainfo);
+ for ($i = 0; $i < $count; $i++)
+ {
+ if (!strncmp($mediainfo[$i], "Video", strlen("Video")) || !strncmp($mediainfo[$i], "Audio", strlen("Audio")))
+ break;
+
+ if (!strncmp($mediainfo[$i], "Format", strlen("Format")))
+ $title = substr(strstr($mediainfo[$i], ": "), 2);
+ else if (!strncmp($mediainfo[$i], "Format/Info", strlen("Format/Info")))
+ $title = substr(strstr($mediainfo[$i], ": "), 2);
+ else if (!strncmp($mediainfo[$i], "Duration", strlen("Duration")))
+ $info = substr(strstr($mediainfo[$i], ": "), 2);
+ }
+
+ // Extract a thumbnail
+ exec("rm ram/stream-tb.png");
+ exec($ffmpegpath ." -y -i \"" .$stream ."\" -an -ss 00:00:05.00 -r 1 -vframes 1 -s 80x80 -f mjpeg ram/stream-tb.png");
+
+ return array($title, $info);
+}
+
+