summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Zhao2016-06-19 00:09:22 +0200
committerMax Zhao2016-06-19 00:09:22 +0200
commit96b0344ece2e7d9cafc800f95cabc906c9daa957 (patch)
treece5fdf3546fba8540de96621dc93bc29329fe861
downloadaur-96b0344ece2e7d9cafc800f95cabc906c9daa957.tar.gz
initial
-rw-r--r--.SRCINFO24
-rw-r--r--PKGBUILD59
-rw-r--r--ffmpeg.patch102
-rwxr-xr-xhiptext.sh2
4 files changed, 187 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..7e8b15707a31
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,24 @@
+pkgbase = hiptext
+ pkgdesc = hiptext is command line tool for rendering images and videos inside terminals.
+ pkgver = r101.1cc777a
+ pkgrel = 1
+ url = https://github.com/jart/hiptext
+ arch = any
+ license = GPL
+ makedepends = libpng12
+ makedepends = libjpeg-turbo
+ makedepends = freetype2
+ makedepends = giflib
+ makedepends = ragel
+ makedepends = ffmpeg
+ makedepends = gflags
+ makedepends = google-glog
+ source = hiptext::git://github.com/jart/hiptext.git
+ source = ffmpeg.patch
+ source = hiptext.sh
+ md5sums = SKIP
+ md5sums = 86ade16ec71e7a49cb6136973419547f
+ md5sums = f2e8f04076e10dbbaf13118d44998a9d
+
+pkgname = hiptext
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..2fab6f57db32
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,59 @@
+# Maintainer: Max Zhao <alcasa.mz@gmail.com>
+pkgname=hiptext
+pkgver=r101.1cc777a
+pkgrel=1
+pkgdesc="hiptext is command line tool for rendering images and videos inside terminals."
+arch=('any')
+url="https://github.com/jart/hiptext"
+license=('GPL')
+groups=()
+depends=()
+makedepends=(
+"libpng12"
+"libjpeg-turbo"
+"freetype2"
+"giflib"
+"ragel"
+"ffmpeg"
+"gflags"
+"google-glog"
+)
+checkdepends=()
+optdepends=()
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+changelog=
+source=("hiptext::git://github.com/jart/hiptext.git"
+ "ffmpeg.patch"
+ "hiptext.sh")
+noextract=()
+md5sums=('SKIP'
+ '86ade16ec71e7a49cb6136973419547f'
+ 'f2e8f04076e10dbbaf13118d44998a9d')
+
+pkgver() {
+ cd "$pkgname"
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+prepare() {
+ cd "$pkgname"
+ patch -p1 -i "../ffmpeg.patch"
+}
+
+build() {
+ cd "$pkgname"
+ make
+}
+
+package() {
+ cd "$pkgname"
+ mkdir -p "$pkgdir/usr/share/$pkgname/bin"
+ mkdir -p "$pkgdir/usr/bin"
+ make PREFIX="$pkgdir/usr/share/$pkgname" install
+ cp "$srcdir/hiptext.sh" "$pkgdir/usr/bin/hiptext"
+ cp "$srcdir/$pkgname/DejaVuSansMono.ttf" "$pkgdir/usr/share/$pkgname/dejavu.ttf"
+}
diff --git a/ffmpeg.patch b/ffmpeg.patch
new file mode 100644
index 000000000000..1440a22ba4ef
--- /dev/null
+++ b/ffmpeg.patch
@@ -0,0 +1,102 @@
+diff --git a/graphic.cc b/graphic.cc
+index 419d7df..ec5acf1 100644
+--- a/graphic.cc
++++ b/graphic.cc
+@@ -55,7 +55,7 @@ Graphic& Graphic::Equalize() {
+ return std::min(255, std::max(0, static_cast<int>(v * kBins)));
+ };
+
+- // Count the occurrence of each color into bins.
++ // Count the occurence of each color into bins.
+ for (int y = 0; y < height_; ++y) {
+ for (int x = 0; x < width_; ++x) {
+ const Pixel& pixel = Get(x, y);
+diff --git a/hiptext.cc b/hiptext.cc
+index a23fa02..f21c483 100644
+--- a/hiptext.cc
++++ b/hiptext.cc
+@@ -250,12 +250,13 @@ int main(int argc, char** argv) {
+ }
+ string path = argv[1];
+ string extension = GetExtension(path);
++ string uri_sig = "://"; // Given this string signature, assume that it's a video stream
+ if (extension == "png") {
+ artiste.PrintImage(LoadPNG(path));
+ } else if (extension == "jpg" || extension == "jpeg") {
+ artiste.PrintImage(LoadJPEG(path));
+ } else if (extension == "mov" || extension == "mp4" || extension == "flv" ||
+- extension == "avi" || extension == "mkv") {
++ extension == "avi" || extension == "mkv" || path.find(uri_sig) != string::npos) {
+ artiste.PrintMovie(Movie(path));
+ } else {
+ fprintf(stderr, "Unknown Filetype: %s\n", extension.data());
+diff --git a/macterm.cc b/macterm.cc
+index 1042a9a..20ba55f 100644
+--- a/macterm.cc
++++ b/macterm.cc
+@@ -99,7 +99,7 @@ MactermColor::MactermColor(const Pixel& top, const Pixel& bot) {
+ // Terminal.app on Mac OS X is interesting. First of all, it doesn't follow the
+ // xterm-256color standard, but that's probably for the best since xterm's
+ // palette was obviously chosen by engineers rather than designers. The problem
+-// is I'm not quite sure what Terminal.app is doing. It slightly adjusts the
++// is I'm not quite sure what Terminal.app is doing. It slightly ajusts the
+ // color when displaying foregrounds and backgrounds but I'm not sure what
+ // formula they're using to do it. They also seem to slightly alter colors
+ // depending on the terminal theme. The following colors are what I scraped
+diff --git a/movie.cc b/movie.cc
+index 9ad9368..4fb6b73 100644
+--- a/movie.cc
++++ b/movie.cc
+@@ -53,7 +53,7 @@ void Movie::PrepareRGB(int width, int height) {
+
+ // Prepare context for scaling and converting to RGB.
+ sws_ = sws_getContext(context_->width, context_->height, context_->pix_fmt,
+- width_, height_, PIX_FMT_RGB24, SWS_FAST_BILINEAR,
++ width_, height_, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR,
+ nullptr, nullptr, nullptr);
+ CHECK(codec_ = avcodec_find_decoder(context_->codec_id))
+ << "Unsupported codec.\n";
+@@ -61,13 +61,13 @@ void Movie::PrepareRGB(int width, int height) {
+ << "Could not open codec.\n";
+
+ // Allocate Raw + RGB frame buffers.
+- CHECK(frame_ = avcodec_alloc_frame());
+- CHECK(frame_rgb_ = avcodec_alloc_frame());
+- int rgb_bytes = avpicture_get_size(PIX_FMT_RGB24, width_, height_);
++ CHECK(frame_ = av_frame_alloc());
++ CHECK(frame_rgb_ = av_frame_alloc());
++ int rgb_bytes = avpicture_get_size(AV_PIX_FMT_RGB24, width_, height_);
+ buffer_ = static_cast<uint8_t*>(av_malloc(rgb_bytes));
+ LOG(INFO) << "RGB Buffer: " << rgb_bytes << " bytes.";
+ int prep = avpicture_fill(reinterpret_cast<AVPicture*>(frame_rgb_),
+- buffer_, PIX_FMT_RGB24, width_, height_);
++ buffer_, AV_PIX_FMT_RGB24, width_, height_);
+ CHECK_GE(prep, 0) << "Failed to prepare RGB buffer.";
+ LOG(INFO) << "RGB dimensions: " << width_ << "x" << height_;
+ }
+diff --git a/pixel.cc b/pixel.cc
+index eb52f61..2a6ecdf 100644
+--- a/pixel.cc
++++ b/pixel.cc
+@@ -166,7 +166,7 @@ Pixel& Pixel::Mix(const Pixel& other) {
+
+ // http://www.springerreference.com/docs/html/chapterdbid/212829.html
+ static double A(double c) {
+- // This is K/S part of the equations on that website.
++ // This is K/S part of the the equations on that website.
+ // a = (1 - c)^2 / (2c)
+ return std::pow(1.0 - c, 2.0) / (2.0 * max(c, 1e-6));
+ }
+diff --git a/xterm256.cc b/xterm256.cc
+index 0db765e..1622255 100644
+--- a/xterm256.cc
++++ b/xterm256.cc
+@@ -6,7 +6,7 @@
+ #include <glog/logging.h>
+ #include "pixel.h"
+
+-DEFINE_bool(fast, false, "Use O(1) xterm256 approximate color quantizer.");
++DEFINE_bool(fast, false, "Use O(1) xterm256 aproximate color quantizer.");
+
+ static const uint8_t g_cube_steps[] = {0, 95, 135, 175, 215, 255};
+
diff --git a/hiptext.sh b/hiptext.sh
new file mode 100755
index 000000000000..8f4c591be33a
--- /dev/null
+++ b/hiptext.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+/usr/share/hiptext/bin/hiptext --font=/usr/share/hiptext/dejavu.ttf $1