summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-03-25 15:26:18 +0000
committerRodeo <[email protected]>2012-03-25 15:26:18 +0000
commit5e7d2b28710ff665bcf64e212becab8f30012911 (patch)
tree8e5e1aea17c27b6a636ce46475bf84e14032218d
parent1b8b6752bea35f523c93dd30225cd69a4a531ee1 (diff)
0.9.x: add Auto Passthru support to manicure.
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.9.x@4540 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rwxr-xr-xscripts/manicure.rb325
-rw-r--r--test/test.c4
2 files changed, 279 insertions, 50 deletions
diff --git a/scripts/manicure.rb b/scripts/manicure.rb
index bfa4f685a..8f7b063e0 100755
--- a/scripts/manicure.rb
+++ b/scripts/manicure.rb
@@ -361,22 +361,24 @@ class Display
audioEncoders << "lame"
when /FLAC/
audioEncoders << "ffflac"
+ when /Auto Pass/
+ audioEncoders << "copy"
end
#Mixdowns
case audioTrack["AudioMixdown"]
- when /Mono/
- audioMixdowns << "mono"
- when /Stereo/
- audioMixdowns << "stereo"
- when /Dolby Surround/
- audioMixdowns << "dpl1"
- when /Dolby Pro Logic II/
- audioMixdowns << "dpl2"
- when /discrete/
- audioMixdowns << "6ch"
- when /None/
- audioMixdowns << "auto"
+ when /Mono/
+ audioMixdowns << "mono"
+ when /Stereo/
+ audioMixdowns << "stereo"
+ when /Dolby Surround/
+ audioMixdowns << "dpl1"
+ when /Dolby Pro Logic II/
+ audioMixdowns << "dpl2"
+ when /discrete/
+ audioMixdowns << "6ch"
+ when /None/
+ audioMixdowns << "auto"
end
#Samplerates
@@ -404,6 +406,63 @@ class Display
commandString << " -6 " << audioMixdowns
commandString << " -R " << audioSamplerates
commandString << " -D " << audioTrackDRCs
+
+ #Auto Passthru Mask
+ audioCopyMask = ""
+
+ if hash["AudioAllowAACPass"].to_i == 1
+ audioCopyMask << "aac"
+ end
+ if hash["AudioAllowAC3Pass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "ac3"
+ end
+ if hash["AudioAllowDTSHDPass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "dtshd"
+ end
+ if hash["AudioAllowDTSPass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "dts"
+ end
+ if hash["AudioAllowMP3Pass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "mp3"
+ end
+
+ if audioCopyMask.size > 0
+ commandString << " --audio-copy-mask " << audioCopyMask
+ end
+
+ #Auto Passthru Fallback
+ audioEncoderFallback = ""
+
+ case hash["AudioEncoderFallback"]
+ when /AC3/
+ audioEncoderFallback << "ffac3"
+ when "AAC (ffmpeg)"
+ audioEncoderFallback << "ffaac"
+ when /AAC/
+ audioEncoderFallback << "faac"
+ when /Vorbis/
+ audioEncoderFallback << "vorbis"
+ when /MP3/
+ audioEncoderFallback << "lame"
+ when /FLAC/
+ audioEncoderFallback << "ffflac"
+ end
+
+ if audioEncoderFallback.size > 0
+ commandString << " --audio-fallback " << audioEncoderFallback
+ end
#Container
commandString << " -f "
@@ -632,22 +691,24 @@ class Display
audioEncoders << "lame"
when /FLAC/
audioEncoders << "ffflac"
+ when /Auto Pass/
+ audioEncoders << "copy"
end
#Mixdowns
case audioTrack["AudioMixdown"]
- when /Mono/
- audioMixdowns << "mono"
- when /Stereo/
- audioMixdowns << "stereo"
- when /Dolby Surround/
- audioMixdowns << "dpl1"
- when /Dolby Pro Logic II/
- audioMixdowns << "dpl2"
- when /discrete/
- audioMixdowns << "6ch"
- when /None/
- audioMixdowns << "auto"
+ when /Mono/
+ audioMixdowns << "mono"
+ when /Stereo/
+ audioMixdowns << "stereo"
+ when /Dolby Surround/
+ audioMixdowns << "dpl1"
+ when /Dolby Pro Logic II/
+ audioMixdowns << "dpl2"
+ when /discrete/
+ audioMixdowns << "6ch"
+ when /None/
+ audioMixdowns << "auto"
end
#Samplerates
@@ -676,6 +737,63 @@ class Display
commandString << " -R " << audioSamplerates
commandString << " -D " << audioTrackDRCs
+ #Auto Passthru Mask
+ audioCopyMask = ""
+
+ if hash["AudioAllowAACPass"].to_i == 1
+ audioCopyMask << "aac"
+ end
+ if hash["AudioAllowAC3Pass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "ac3"
+ end
+ if hash["AudioAllowDTSHDPass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "dtshd"
+ end
+ if hash["AudioAllowDTSPass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "dts"
+ end
+ if hash["AudioAllowMP3Pass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "mp3"
+ end
+
+ if audioCopyMask.size > 0
+ commandString << " --audio-copy-mask " << audioCopyMask
+ end
+
+ #Auto Passthru Fallback
+ audioEncoderFallback = ""
+
+ case hash["AudioEncoderFallback"]
+ when /AC3/
+ audioEncoderFallback << "ffac3"
+ when "AAC (ffmpeg)"
+ audioEncoderFallback << "ffaac"
+ when /AAC/
+ audioEncoderFallback << "faac"
+ when /Vorbis/
+ audioEncoderFallback << "vorbis"
+ when /MP3/
+ audioEncoderFallback << "lame"
+ when /FLAC/
+ audioEncoderFallback << "ffflac"
+ end
+
+ if audioEncoderFallback.size > 0
+ commandString << " --audio-fallback " << audioEncoderFallback
+ end
+
#Container
commandString << " -f "
case hash["FileFormat"]
@@ -903,22 +1021,24 @@ class Display
audioEncoders << "lame"
when /FLAC/
audioEncoders << "ffflac"
+ when /Auto Pass/
+ audioEncoders << "copy"
end
#Mixdowns
case audioTrack["AudioMixdown"]
- when /Mono/
- audioMixdowns << "mono"
- when /Stereo/
- audioMixdowns << "stereo"
- when /Dolby Surround/
- audioMixdowns << "dpl1"
- when /Dolby Pro Logic II/
- audioMixdowns << "dpl2"
- when /discrete/
- audioMixdowns << "6ch"
- when /None/
- audioMixdowns << "auto"
+ when /Mono/
+ audioMixdowns << "mono"
+ when /Stereo/
+ audioMixdowns << "stereo"
+ when /Dolby Surround/
+ audioMixdowns << "dpl1"
+ when /Dolby Pro Logic II/
+ audioMixdowns << "dpl2"
+ when /discrete/
+ audioMixdowns << "6ch"
+ when /None/
+ audioMixdowns << "auto"
end
#Samplerates
@@ -976,6 +1096,56 @@ class Display
commandString << "\");\n "
commandString << "}\n "
+ #Auto Passthru Mask
+ if hash["AudioAllowAACPass"]
+ commandString << "if( allowed_audio_copy == -1 )\n "
+ commandString << "{\n "
+ commandString << " allowed_audio_copy = 0;\n "
+ if hash["AudioAllowAACPass"].to_i == 1
+ commandString << " allowed_audio_copy |= HB_ACODEC_AAC_PASS;\n "
+ end
+ if hash["AudioAllowAC3Pass"].to_i == 1
+ commandString << " allowed_audio_copy |= HB_ACODEC_AC3_PASS;\n "
+ end
+ if hash["AudioAllowDTSHDPass"].to_i == 1
+ commandString << " allowed_audio_copy |= HB_ACODEC_DCA_HD_PASS;\n "
+ end
+ if hash["AudioAllowDTSPass"].to_i == 1
+ commandString << " allowed_audio_copy |= HB_ACODEC_DCA_PASS;\n "
+ end
+ if hash["AudioAllowMP3Pass"].to_i == 1
+ commandString << " allowed_audio_copy |= HB_ACODEC_MP3_PASS;\n "
+ end
+ commandString << " allowed_audio_copy &= HB_ACODEC_PASS_MASK;\n "
+ commandString << "}\n "
+ end
+
+ #Auto Passthru Fallback
+ audioEncoderFallback = ""
+
+ case hash["AudioEncoderFallback"]
+ when /AC3/
+ audioEncoderFallback << "HB_ACODEC_AC3"
+ when "AAC (ffmpeg)"
+ audioEncoderFallback << "HB_ACODEC_FFAAC"
+ when /AAC/
+ audioEncoderFallback << "HB_ACODEC_FAAC"
+ when /Vorbis/
+ audioEncoderFallback << "HB_ACODEC_VORBIS"
+ when /MP3/
+ audioEncoderFallback << "HB_ACODEC_LAME"
+ when /FLAC/
+ audioEncoderFallback << "HB_ACODEC_FFFLAC"
+ end
+
+ if audioEncoderFallback.size > 0
+ commandString << "if( !acodec_fallback )\n "
+ commandString << "{\n "
+ commandString << " acodec_fallback = " << audioEncoderFallback
+ commandString << ";\n "
+ commandString << "}\n "
+ end
+
#Cropping
if hash["PictureAutoCrop"] == 0
commandString << "job->crop[0] = " << hash["PictureTopCrop"].to_s << ";\n "
@@ -1201,22 +1371,24 @@ class Display
audioEncoders << "lame"
when /FLAC/
audioEncoders << "ffflac"
+ when /Auto Pass/
+ audioEncoders << "copy"
end
#Mixdowns
case audioTrack["AudioMixdown"]
- when /Mono/
- audioMixdowns << "mono"
- when /Stereo/
- audioMixdowns << "stereo"
- when /Dolby Surround/
- audioMixdowns << "dpl1"
- when /Dolby Pro Logic II/
- audioMixdowns << "dpl2"
- when /discrete/
- audioMixdowns << "6ch"
- when /None/
- audioMixdowns << "auto"
+ when /Mono/
+ audioMixdowns << "mono"
+ when /Stereo/
+ audioMixdowns << "stereo"
+ when /Dolby Surround/
+ audioMixdowns << "dpl1"
+ when /Dolby Pro Logic II/
+ audioMixdowns << "dpl2"
+ when /discrete/
+ audioMixdowns << "6ch"
+ when /None/
+ audioMixdowns << "auto"
end
#Samplerates
@@ -1245,6 +1417,63 @@ class Display
commandString << " -R " << audioSamplerates
commandString << " -D " << audioTrackDRCs
+ #Auto Passthru Mask
+ audioCopyMask = ""
+
+ if hash["AudioAllowAACPass"].to_i == 1
+ audioCopyMask << "aac"
+ end
+ if hash["AudioAllowAC3Pass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "ac3"
+ end
+ if hash["AudioAllowDTSHDPass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "dtshd"
+ end
+ if hash["AudioAllowDTSPass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "dts"
+ end
+ if hash["AudioAllowMP3Pass"].to_i == 1
+ if audioCopyMask.size > 0
+ audioCopyMask << ","
+ end
+ audioCopyMask << "mp3"
+ end
+
+ if audioCopyMask.size > 0
+ commandString << " --audio-copy-mask " << audioCopyMask
+ end
+
+ #Auto Passthru Fallback
+ audioEncoderFallback = ""
+
+ case hash["AudioEncoderFallback"]
+ when /AC3/
+ audioEncoderFallback << "ffac3"
+ when "AAC (ffmpeg)"
+ audioEncoderFallback << "ffaac"
+ when /AAC/
+ audioEncoderFallback << "faac"
+ when /Vorbis/
+ audioEncoderFallback << "vorbis"
+ when /MP3/
+ audioEncoderFallback << "lame"
+ when /FLAC/
+ audioEncoderFallback << "ffflac"
+ end
+
+ if audioEncoderFallback.size > 0
+ commandString << " --audio-fallback " << audioEncoderFallback
+ end
+
#Container
commandString << " -f "
case hash["FileFormat"]
diff --git a/test/test.c b/test/test.c
index 99161d276..17f4b5a73 100644
--- a/test/test.c
+++ b/test/test.c
@@ -66,7 +66,7 @@ static int vcodec = HB_VCODEC_FFMPEG_MPEG4;
static hb_list_t * audios = NULL;
static hb_audio_config_t * audio = NULL;
static int num_audio_tracks = 0;
-static int allowed_audio_copy = HB_ACODEC_PASS_MASK;
+static int allowed_audio_copy = -1;
static char * mixdowns = NULL;
static char * dynamic_range_compression = NULL;
static char * audio_gain = NULL;
@@ -2082,7 +2082,7 @@ static int HandleEvents( hb_handle_t * h )
if( audio->out.codec == HB_ACODEC_AUTO_PASS )
{
// Auto Passthru
- job->acodec_copy_mask = allowed_audio_copy;
+ job->acodec_copy_mask = allowed_audio_copy == -1 ? HB_ACODEC_PASS_MASK : allowed_audio_copy;
job->acodec_fallback = acodec_fallback ? get_acodec_for_string( acodec_fallback ) : 0;
// sanitize the fallback; -1 isn't a valid HB_ACODEC_* value
if( job->acodec_fallback == -1 )