aboutsummaryrefslogtreecommitdiffhomepage
path: root/TOOLS
diff options
context:
space:
mode:
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/binary_codecs.sh219
-rwxr-xr-xTOOLS/file2string.py8
-rwxr-xr-xTOOLS/matroska.py10
-rwxr-xr-xTOOLS/mpv_identify.sh (renamed from TOOLS/mplayer2_identify.sh)37
-rwxr-xr-xTOOLS/vdpau_functions.py2
-rw-r--r--TOOLS/vf_dlopen/telecine.c19
6 files changed, 44 insertions, 251 deletions
diff --git a/TOOLS/binary_codecs.sh b/TOOLS/binary_codecs.sh
deleted file mode 100755
index 5ab3b3993c..0000000000
--- a/TOOLS/binary_codecs.sh
+++ /dev/null
@@ -1,219 +0,0 @@
-#!/bin/sh
-set -e
-
-# avoid insecure tempfile creation
-umask 0022
-
-# This script will download binary codecs for MPlayer unto a Debian system.
-
-# Author: thuglife, mennucc1
-#
-
-CODECDIR=/usr/lib/codecs
-PREFDIR=/var/lib/mplayer/prefs
-MYSITE='http://people.debian.org/~mennucc1/mplayer'
-
-dpkgarch=$(dpkg --print-architecture)
-
-[ -d $PREFDIR ] || mkdir -v $PREFDIR
-[ -d $CODECDIR ] || mkdir -v $CODECDIR
-cd $CODECDIR
-[ -d mplayer_binary_codecs ] || mkdir -v mplayer_binary_codecs
-
-choosemirror ()
-{
- cd $PREFDIR
-
- #if [ ! -r mirrors ] || find mirrors -mtime +20 ; then
- echo "Downloading mirrors list"
- wget -nv -c -N $MYSITE/mirrors || true
- #fi
- if [ ! -r bestsites ] || [ mirrors -nt bestsites ] || \
- find bestsites -mtime +20 | grep -q bestsites ; then
- if which netselect > /dev/null ; then
- echo Choosing best mirrors using netselect
- netselect -s 5 -t 5 $( cat mirrors ) | awk '{print $2}' > bestsites
- elif which fping > /dev/null ; then
- fping -C 1 $( sed 's#.*//##;s#/.*##' mirrors ) 2>&1 | \
- egrep -v 'bytes.*loss' | sort -n -k3 | \
- grep -v ': *-' | awk '/:/{print $1}' | head -5 | ( while read mainsite ; do
- grep $mainsite $PREFDIR/mirrors ; done ) > bestsites
- else
- echo "(If you install 'netselect' or 'fping', it will select the best mirror for you"
- echo " you may wish to stop this script and rerun after installation)"
- sleep 3
- fi
- fi
-}
-
-INSTALL () {
- filename="$3"
- dir="$2"
- url="$1"
-
- cd $CODECDIR/mplayer_binary_codecs
-
- if [ -r $filename ] ; then
- cp $filename $filename.bak
- fi
-
- if [ "$url" = @MAINSITE@ ] ; then
- list=$PREFDIR/bestsites
- test -r $list || list=$PREFDIR/mirrors
- cat $list | while read mainsite ; do
- echo Downloading $filename from $mainsite ...
- wget -c -N $mainsite/$dir/$filename || true
- if [ -r "$filename" ] ; then
- UNPACK "$filename"
- return 0
- fi
- done
- else
- wget -c -N $url/$dir/$filename || true
- if [ -r "$filename" ] ; then
- UNPACK "$filename"
- return 0
- fi
- fi
-}
-
-
-UNPACK ()
-{
- filename="$1"
- if [ -r $filename.bak ] && cmp $filename.bak $filename && [ -r $filename.list ] ; then
- echo It appears that $filename was already succesfully installed
- [ -r $filename.bak ] && rm $filename.bak
- else
- if grep -q " $filename$" $PREFDIR/MD5SUMS ; then
- echo Checking MD5 for $filename
- grep " $filename$" $PREFDIR/MD5SUMS | md5sum -c -
- else
- echo Warning: no MD5 for $filename were found. Hit enter to continue.
- read dummy
- fi
- echo Installing $filename ...
- if [ -r $filename.list ] ; then
- tr '\n' '\000' < $filename.list | xargs -r0 rm || true
- UNLINK $filename.list
- rm $filename.list
- fi
-
- tarfail () { echo FAILED $filename ; rm $filename.list ; exit 1 ; }
-
- case "$filename" in
- *.tar.gz)
- tar xvzf $filename > $filename.list || tarfail
- #rm $filename
- ;;
- *.tgz)
- tar xvzf $filename > $filename.list || tarfail
- #rm $filename
- ;;
- *.tar.bz2)
- tar --bzip2 -xvf $filename > $filename.list || tarfail
- #rm $filename
- ;;
- esac
- [ -r $filename.bak ] && rm $filename.bak
- LINK $filename.list
- echo "Installed $filename Succesfully!"
- fi
-}
-
-LINK () {
- cd $CODECDIR/
- cat $CODECDIR/mplayer_binary_codecs/$1 | while read f ; do
- ln -sbf mplayer_binary_codecs/"$f" .
- done
-}
-
-UNLINK () {
-### FIXME
-# cd $CODECDIR
-# cat $CODECDIR/mplayer_binary_codecs/$1 | while f do
-# ln -sbf mplayer_binary_codecs/"$f"
-# done
- if which symlinks > /dev/null ; then
- symlinks -d $CODECDIR
- fi
-}
-
-if [ `whoami` != root ]; then
- echo "You must be 'root' to use this script. Login as root first!"
- exit 1
-fi
-
-case "$1" in
- install)
- if test -x /bin/bzip2 || test -x /usr/bin/bzip2 ; then : ; else
- echo You need to install bzip2
- exit 1
- fi
- choosemirror
- cd $PREFDIR
- #if [ ! -r codecs_list ] || find codecs_list -mtime +20 ; then
- echo "Getting codecs list"
- wget -nv -c -N $MYSITE/codecs_list || true
- #fi
-
- cd $PREFDIR
- echo Downloading MD5 sums from main site
- [ -r MD5SUMS ] && mv MD5SUMS MD5SUMS.bak
- if wget -nv -N http://www.mplayerhq.hu/MPlayer/releases/codecs/MD5SUMS ; then
- [ -r MD5SUMS.bak ] && rm MD5SUMS.bak
- else
- echo "failed"
- if [ -r MD5SUMS.bak ] ; then
- echo "trying to use backup"
- mv MD5SUMS.bak MD5SUMS
- fi
- fi
-
- if grep -q "^$dpkgarch" $PREFDIR/codecs_list ; then
- egrep -v "^[[:space:]]*(#|$)" $PREFDIR/codecs_list | \
- while read arch url dir file info ; do
- if [ "$dpkgarch" = "$arch" ]; then
- echo Downloading and installing $file $info...
- INSTALL "$url" "$dir" "$file"
- fi
- done
- needlibstd=no
- test "$dpkgarch" = "powerpc" && needlibstd=yes
- test "$dpkgarch" = "i386" && needlibstd=yes
- if test "$needlibstd" = "yes" && ! test -r /usr/lib/libstdc++.so.5 ; then
- echo "Warning: you need to install libstdc++ 5 libraries"
- echo -n "Do it now? "
- read R
- case $R in
- y*) apt-get install libstdc++5 ;;
- *) echo "If you change your mind, use the command"
- echo " apt-get install libstdc++5" ;;
- esac
- fi
- else
- echo "Sorry, no codecs for your arch '$dpkgarch'. Sorry dude :("
- exit 1
- fi
- ;;
-
- uninstall)
- cd $CODECDIR/
- rm -rf mplayer_binary_codecs
- #FIXME we need a better clean system
- if which symlinks > /dev/null ; then
- symlinks -d .
- else
- echo "please install the package 'symlinks' and run 'symlinks -d $CODECDIR' "
- fi
- echo "Uninstalled Succesfully!"
- ;;
-
- *)
- echo "Usage: {install|uninstall}"
- echo "This program will install binary codecs for MPlayer."
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/TOOLS/file2string.py b/TOOLS/file2string.py
index cb121e4884..6cdd1a72ae 100755
--- a/TOOLS/file2string.py
+++ b/TOOLS/file2string.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# Convert the contents of a file into a C string constant.
# Note that the compiler will implicitly add an extra 0 byte at the end
@@ -7,6 +7,10 @@
import sys
+# Indexing a byte string yields int on Python 3.x, and a str on Python 2.x
+def pord(c):
+ return ord(c) if type(c) == str else c
+
def main(infile):
conv = ['\\' + ("%03o" % c) for c in range(256)]
safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" \
@@ -16,7 +20,7 @@ def main(infile):
for c, esc in ("\nn", "\tt", r"\\", '""'):
conv[ord(c)] = '\\' + esc
for line in infile:
- sys.stdout.write('"' + ''.join(conv[c] for c in line) + '"\n')
+ sys.stdout.write('"' + ''.join(conv[pord(c)] for c in line) + '"\n')
with open(sys.argv[1], 'rb') as infile:
sys.stdout.write("// Generated from %s\n\n" % sys.argv[1])
diff --git a/TOOLS/matroska.py b/TOOLS/matroska.py
index ffa388e47b..848b033cbd 100755
--- a/TOOLS/matroska.py
+++ b/TOOLS/matroska.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
"""
Generate C definitions for parsing Matroska files.
Can also be used to directly parse Matroska files and display their contents.
@@ -22,6 +22,8 @@ Can also be used to directly parse Matroska files and display their contents.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+# for compatibility with Python 2.x
+from __future__ import print_function
elements_ebml = (
'EBML, 1a45dfa3, sub', (
@@ -205,7 +207,7 @@ class MatroskaElement(object):
def __init__(self, name, elid, valtype, namespace):
self.name = name
- self.definename = '{}_ID_{}'.format(namespace, name.upper())
+ self.definename = '{0}_ID_{1}'.format(namespace, name.upper())
self.fieldname = camelcase_to_words(name)
self.structname = 'ebml_' + self.fieldname
self.elid = elid
@@ -290,7 +292,7 @@ def generate_C_definitions():
print()
if el.subelements:
print('#define N', el.fieldname)
- print('E_S("{}", {})'.format(el.name, len(el.subelements)))
+ print('E_S("{0}", {1})'.format(el.name, len(el.subelements)))
for subel, multiple in el.subelements:
print('F({0.definename}, {0.fieldname}, {1})'.format(
subel, int(multiple)))
@@ -391,7 +393,7 @@ def parse_one(s, depth, parent, maxlen):
if len(t) < 20:
t = hexlify(t).decode('ascii')
else:
- t = '<skipped {} bytes>'.format(len(t))
+ t = '<skipped {0} bytes>'.format(len(t))
print('binary', t, dec)
elif elem.valtype == 'uint':
print('uint', read_uint(s, length))
diff --git a/TOOLS/mplayer2_identify.sh b/TOOLS/mpv_identify.sh
index 04902124ab..d09504ab57 100755
--- a/TOOLS/mplayer2_identify.sh
+++ b/TOOLS/mpv_identify.sh
@@ -3,22 +3,22 @@
# file identification script
#
# manual usage:
-# mplayer2_identify.sh foo.mkv
+# mpv_identify.sh foo.mkv
#
# sh/dash/ksh/bash usage:
-# . mplayer2_identify.sh FOO_ foo.mkv
+# . mpv_identify.sh FOO_ foo.mkv
# will fill properties into variables like FOO_length
#
# zsh usage:
-# mplayer2_identify() { emulate -L sh; . mplayer2_identify.sh "$@"; }
-# mplayer2_identify FOO_ foo.mkv
+# mpv_identify() { emulate -L sh; . mpv_identify.sh "$@"; }
+# mpv_identify FOO_ foo.mkv
# will fill properties into variables like FOO_length
#
# When multiple files were specified, their info will be put into FOO_* for the
# first file, FOO_1_* for the second file, FOO_2_* for the third file, etc.
case "$0" in
- mplayer2_identify.sh|*/mplayer2_identify.sh)
+ mpv_identify.sh|*/mpv_identify.sh)
# we are NOT being sourced
case "$1" in
'')
@@ -59,30 +59,29 @@ fi
__midentify__allprops="
filename
path
- stream_start
- stream_end
- stream_length
+ stream-start
+ stream-end
+ stream-length
demuxer
- switch_program
length
chapters
editions
titles
- switch_audio
- audio_bitrate
- audio_codec
- audio_format
+ audio
+ audio-bitrate
+ audio-codec
+ audio-format
channels
samplerate
- switch_video
+ video
angle
- video_bitrate
- video_codec
- video_format
+ video-bitrate
+ video-codec
+ video-format
aspect
fps
width
@@ -90,7 +89,7 @@ __midentify__allprops="
sub
"
-# TODO add metadata support once mplayer can do it
+# TODO add metadata support once mpv can do it
__midentify__propstr="X-MIDENTIFY-START:\\n"
for __midentify__key in $__midentify__allprops; do
@@ -98,7 +97,7 @@ for __midentify__key in $__midentify__allprops; do
eval unset $__midentify__nextprefix$__midentify__key
done
-__midentify__output=`mplayer --playing-msg="$__midentify__propstr" --vo=null --ao=null --frames=0 "$@"`
+__midentify__output=`mpv --playing-msg="$__midentify__propstr" --vo=null --ao=null --frames=0 "$@"`
__midentify__fileindex=0
__midentify__prefix=
while :; do
diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py
index 39e38a8bbe..85e6f1d942 100755
--- a/TOOLS/vdpau_functions.py
+++ b/TOOLS/vdpau_functions.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# Generate vdpau_template.c
diff --git a/TOOLS/vf_dlopen/telecine.c b/TOOLS/vf_dlopen/telecine.c
index 109fef2d6b..1b3db26a20 100644
--- a/TOOLS/vf_dlopen/telecine.c
+++ b/TOOLS/vf_dlopen/telecine.c
@@ -11,7 +11,7 @@
/*
* telecine filter
*
- * usage: -vf dlopen=./telecine.so:t:32
+ * usage: -vf dlopen=./telecine.so:t:23
*
* Parameter: first parameter is "t" for top field first, "b" for bottom field first
* then digits (0-9) for how many fields a frame is to be displayed
@@ -44,6 +44,7 @@ typedef struct {
int occupied;
double lastpts_in;
double lastpts_out;
+ int first_frame_of_group;
} tc_data_t;
static int tc_config(struct vf_dlopen_context *ctx)
@@ -116,9 +117,9 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
if (tc->pattern_pos == 0 && !tc->occupied) {
// at the start of the pattern, reset pts
- double newpts = ctx->inpic.pts - (delta * tc->pts_num) / tc->pts_denom;
- // printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, newpts, newpts - tc->lastpts_out);
- tc->lastpts_out = newpts;
+ // printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, ctx->inpic.pts, ctx->inpic.pts - tc->lastpts_out);
+ tc->lastpts_out = ctx->inpic.pts;
+ tc->first_frame_of_group = 1;
}
++tc->pattern_pos;
if (!tc->pattern[tc->pattern_pos])
@@ -150,7 +151,10 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
(ctx->inpic.planeheight[p] - !tc->firstfield + 1) / 2
);
}
- tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ if (tc->first_frame_of_group)
+ tc->first_frame_of_group = 0;
+ else
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;
@@ -167,7 +171,10 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
ctx->inpic.planeheight[p]
);
- tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ if (tc->first_frame_of_group)
+ tc->first_frame_of_group = 0;
+ else
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;