From 922f83357f7a8787f159ab8bd641c9debaa91085 Mon Sep 17 00:00:00 2001
From: Lars Jung <lrsjng@gmail.com>
Date: Fri, 20 Jun 2014 22:06:50 +0200
Subject: [PATCH] Prefer avconv over ffmpeg.

---
 src/_h5ai/server/php/inc/class-thumb.php | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/_h5ai/server/php/inc/class-thumb.php b/src/_h5ai/server/php/inc/class-thumb.php
index 308707f4..17ce4412 100644
--- a/src/_h5ai/server/php/inc/class-thumb.php
+++ b/src/_h5ai/server/php/inc/class-thumb.php
@@ -16,6 +16,10 @@ class Thumb {
 		$this->app = $app;
 		$this->thumbs_path = CACHE_PATH . "/" . Thumb::$THUMB_CACHE;
 		$this->thumbs_href = CACHE_HREF . Thumb::$THUMB_CACHE;
+
+		if (!is_dir($this->thumbs_path)) {
+			@mkdir($this->thumbs_path, 0755, true);
+		}
 	}
 
 
@@ -29,10 +33,10 @@ class Thumb {
 		if ($type === "img") {
 			$capture_path = $source_path;
 		} else if ($type === "mov") {
-			if (HAS_CMD_FFMPEG) {
-				$capture_path = $this->capture(Thumb::$FFMPEG_CMDV, $source_path);
-			} else if (HAS_CMD_AVCONV) {
+			if (HAS_CMD_AVCONV) {
 				$capture_path = $this->capture(Thumb::$AVCONV_CMDV, $source_path);
+			} else if (HAS_CMD_FFMPEG) {
+				$capture_path = $this->capture(Thumb::$FFMPEG_CMDV, $source_path);
 			}
 		} else if ($type === "doc" && HAS_CMD_CONVERT) {
 			$capture_path = $this->capture(Thumb::$CONVERT_CMDV, $source_path);
@@ -48,10 +52,6 @@ class Thumb {
 			return null;
 		}
 
-		if (!is_dir($this->thumbs_path)) {
-			@mkdir($this->thumbs_path, 0755, true);
-		}
-
 		$name = "thumb-" . sha1("$source_path-$width-$height-$mode") . ".jpg";
 		$thumb_path = $this->thumbs_path . "/" . $name;
 		$thumb_url = $this->thumbs_href . "/" . $name;