summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-03-25 15:24:50 +0000
committerRodeo <[email protected]>2012-03-25 15:24:50 +0000
commit5f9578cc46e6b7c88477542815b6f8c3eaa6ee5f (patch)
tree1724d5b8256e4f32758ae5793e274058ba2f48df
parent763a1742df56afd54602dea5c42c4fb6d0f27ef5 (diff)
Add Auto Passthru support to manicure.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4539 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 0f2edc8a6..b600577d3 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;
@@ -2084,7 +2084,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 )