head	1.5;
access;
symbols
	start:1.1.1.1 salsaman:1.1.1;
locks; strict;
comment	@# @;


1.5
date	2008.01.22.16.04.21;	author gfinch;	state Exp;
branches;
next	1.4;

1.4
date	2007.06.29.17.18.15;	author gfinch;	state Exp;
branches;
next	1.3;

1.3
date	2005.12.07.03.43.59;	author gfinch;	state Exp;
branches;
next	1.2;

1.2
date	2005.07.23.17.08.48;	author gfinch;	state Exp;
branches;
next	1.1;

1.1
date	2004.11.22.15.47.40;	author gfinch;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2004.11.22.15.47.40;	author gfinch;	state Exp;
branches;
next	;


desc
@@


1.5
log
@advanced encoders pt 1
@
text
@#!/usr/bin/perl

# (c) G. Finch (salsaman)

# released under the GNU GPL 3 or later
# see file COPYING or www.gnu.org for details

#######################################################################
# LiVES qtutils encoder plugin v0.3

# 0.3 add (undocumented) -l $length to get it working

#######################################################################
my $oggfile="audiodump.ogg";


if (!defined($standalone)) {
    my $smogrify=`which smogrify`;
    chomp($smogrify);
    require $smogrify;
}
else {
    $command=$ARGV[0];
}


#######################################################################


if ($command eq "version") {
    print "qtutils encoder plugin v0.2\n";
    exit 0;
}


if ($command eq "init") {
    # perform any initialisation needed
    # On error, print error message and exit 1
    # otherwise exit 0

    if (&location("qtsg") eq "") {
	print "qtsg was not found. Please install it and try again.";
	exit 1;
    }
    if (&location("oggenc") eq "") {
	print "oggenc was not found. Please install it and try again.";
	exit 1;
    }
    
    # end init code
    print "initialised\n";
    exit 0;
}



if ($command eq "get_capabilities") {
    # bit 0 - takes extra parameters (using RFX request)
    # bit 1 - unused
    # bit 2 - can encode png
    # bit 3 - not pure perl
    print "0\n";
    exit 0;
}



if ($command eq "get_formats") {
   # for each format: -
   # return format_name|display_name|audio_types|restrictions|extension|

   # audio types are: 0 - cannot encode audio, 1 - can encode using
   #  mp3, 2 - can encode using pcm, 3 - can encode using pcm and mp3

#   print "qt|Quicktime for Linux|8|none|mov|";

# TODO - try and fix audio encoding in qtsg
   print "qt|Quicktime for Linux|0|none|mov|";

   exit 0;
}



if ($command eq "encode") {
    # encode 

    $err=">/dev/null 2>&1";
    if (defined($DEBUG_ENCODERS)) {
	$err="";
    }

    $length=($end - $start + 1);

    if (-f "audiodump.wav") {
	if (defined($DEBUG_ENCODERS)) {
	    print "encoder command 1 is: oggenc -q 10 -o $oggfile audiodump.wav\n";
	}
	system("oggenc -q 10 -o $oggfile audiodump.wav $err");
	if (defined($DEBUG_ENCODERS)) {
	    print "encoder command 2 is: qtsg -o \"$nfile\" -c twos -a $oggfile -r $fps *.jpg\n";
	}
	system("qtsg -o \"$nfile\" -c twos -a $oggfile -r $fps *.jpg $err");
    }
    else {
	if (defined($DEBUG_ENCODERS)) {
	    print "encoder command is: qtsg -o \"$nfile\" -l $length -r $fps *.jpg\n";
	}
	system("qtsg -o \"$nfile\" -l $length -r $fps *.jpg $err");
    }
    # required
    &sig_complete;
    exit 0;
}


if ($command eq "clear") {
    # this is called after "encode"
    # note that encoding could have been stopped at any time
    if (-f $oggfile) {
	unlink $oggfile;
    }
    &sig_complete;
    exit 0;
}


if ($command eq "finalise") {
    # do any finalising code

    # ...

    # end finalising code
    print "finalised\n";
    exit 0;
}


###### subroutines #######




sub get_format_request {
    # return the code for how we would like audio and video delivered
    # this is a bitmap field composed of:
    # bit 0 - unset=raw pcm audio; set=pcm audio with wav header
    # bit 1 - unset=all audio; set=clipped audio
    # bit 2 - unset=all frames; set=frames for selection only

    return 7; # clipped pcm wav, clipped frames
}

@


1.4
log
@update to gpl 3; other fixes
@
text
@d58 4
a61 3
    # return capabilities - this is a bitmap field
    # 1 = can encode with frame changes (with an event.frames file)
    # 2 = can encode with fps changes (with an event.fps file)
@


1.3
log
@encoder plugin fixes
@
text
@d5 1
a5 1
# relesed under the GNU GPL 2
@


1.2
log
@make sure all files have license/copyright
@
text
@d9 3
a11 1
# LiVES qtutils encoder plugin v0.2
d92 2
d95 3
d99 3
d105 4
a108 1
	system("qtsg -o \"$nfile\" -r $fps *.jpg $err");
@


1.1
log
@Initial revision
@
text
@d3 5
@


1.1.1.1
log
@initial
@
text
@@
