diff options
author | rhester <[email protected]> | 2006-09-30 16:21:26 +0000 |
---|---|---|
committer | rhester <[email protected]> | 2006-09-30 16:21:26 +0000 |
commit | 1806e33ca8df880e33657d3a30e537ae620fadef (patch) | |
tree | 69482a657f855d09d669e94ec0bd3251d6092406 | |
parent | 5f8684be8ecc912a8828ae3c21857125255a590b (diff) |
HandBrake 0.7.1a1
Made H.264 baseline levels more generic
Added iPod 640x480 support to libhb, HBTest and MacOS X GUI
Added proper iPod 640x480 muxing
Modified rate control for more accurate ending video bitrates
Updated ffmpeg and x264 base sources to more current levels
Removed inlined ff_get_fourcc (now in ffmpeg)
Updated patches for xvidcore, libdvdread, x264, and ffmpeg
Relocated contrib files to local web server and updated version files to new site
Renamed contrib files and patches to consistent naming standard
Updated contrib Jamfile to support new patches and naming standard
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@70 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | Jamrules | 4 | ||||
-rw-r--r-- | contrib/Jamfile | 15 | ||||
-rw-r--r-- | contrib/patch-ffmpeg.patch | 197 | ||||
-rw-r--r-- | contrib/patch-libdvdread.patch | 10 | ||||
-rw-r--r-- | contrib/patch-x264-macintel.patch | 48 | ||||
-rw-r--r-- | contrib/patch-xvidcore.patch (renamed from contrib/xvidcore.patch) | 0 | ||||
-rw-r--r-- | contrib/version_a52dec.txt | 2 | ||||
-rw-r--r-- | contrib/version_faac.txt | 2 | ||||
-rw-r--r-- | contrib/version_ffmpeg.txt | 2 | ||||
-rw-r--r-- | contrib/version_lame.txt | 2 | ||||
-rw-r--r-- | contrib/version_libdvdcss.txt | 2 | ||||
-rw-r--r-- | contrib/version_libdvdread.txt | 2 | ||||
-rw-r--r-- | contrib/version_libogg.txt | 2 | ||||
-rw-r--r-- | contrib/version_libsamplerate.txt | 2 | ||||
-rw-r--r-- | contrib/version_libvorbis.txt | 2 | ||||
-rw-r--r-- | contrib/version_mpeg2dec.txt | 2 | ||||
-rw-r--r-- | contrib/version_x264.txt | 2 | ||||
-rw-r--r-- | contrib/version_xvidcore.txt | 2 | ||||
-rw-r--r-- | libhb/common.c | 1 | ||||
-rw-r--r-- | libhb/common.h | 4 | ||||
-rw-r--r-- | libhb/dvd.c | 2 | ||||
-rw-r--r-- | libhb/encx264.c | 89 | ||||
-rw-r--r-- | libhb/muxcommon.c | 1 | ||||
-rw-r--r-- | libhb/muxmp4.c | 78 | ||||
-rw-r--r-- | libhb/muxogm.c | 2 | ||||
-rw-r--r-- | libhb/scan.c | 2 | ||||
-rw-r--r-- | macosx/Controller.mm | 16 | ||||
-rw-r--r-- | test/test.c | 28 |
28 files changed, 362 insertions, 159 deletions
@@ -11,8 +11,8 @@ if ! $(DEFINES) Exit "Please run ./configure first." ; } -HB_VERSION = 0.7.1 ; -HB_BUILD = 2006022400 ; +HB_VERSION = 0.7.1a1 ; +HB_BUILD = 20060923 ; DEFINES += HB_VERSION=\\\"$(HB_VERSION)\\\" HB_BUILD=$(HB_BUILD) ; LANGUAGES = fr de it pl ru nl es pt ja ; RM = rm -rf ; diff --git a/contrib/Jamfile b/contrib/Jamfile index 0add85ed9..92666a903 100644 --- a/contrib/Jamfile +++ b/contrib/Jamfile @@ -54,8 +54,8 @@ rule LibAvCodec actions LibAvCodec { cd `dirname $(>)` && CONTRIB=`pwd` && - rm -rf ffmpeg-20060326 && tar xzf ffmpeg.tar.gz && - cd ffmpeg-20060326 && $(FFMPEG_PATCH) && + rm -rf ffmpeg && tar xzf ffmpeg.tar.gz && + cd ffmpeg && $(FFMPEG_PATCH) && ./configure --prefix=$CONTRIB $(FFMPEG_OPTIONS) --enable-gpl --disable-audio-beos && make lib && make install-libs install-headers && strip -S $CONTRIB/lib/libavcodec.a @@ -95,6 +95,7 @@ LibDvdCss $(SUBDIR)/lib/libdvdcss.a : $(SUBDIR)/libdvdcss.tar.gz ; # libdvdread rule LibDvdRead { + LIBDVDREAD_PATCH = "patch -p1 < ../patch-libdvdread.patch" ; Depends $(<) : $(>) ; Depends lib : $(<) ; } @@ -102,6 +103,7 @@ actions LibDvdRead { cd `dirname $(>)` && CONTRIB=`pwd` && rm -rf libdvdread && tar xzf libdvdread.tar.gz && cd libdvdread && + $(LIBDVDREAD_PATCH) && ./configure --prefix=$CONTRIB --disable-shared --with-libdvdcss=$CONTRIB && make && make install && strip -S $CONTRIB/lib/libdvdread.a @@ -225,13 +227,18 @@ LibVorbisEnc $(SUBDIR)/lib/libvorbisenc.a : $(SUBDIR)/lib/libvorbis.a ; # libx264 rule LibX264 { + LIBX264_PATCH = "" ; + if $(OS) = MACOSX && $(OSPLAT) = X86 + { + LIBX264_PATCH = " patch -p1 < ../patch-x264-macintel.patch && " ; + } Depends $(<) : $(>) ; Depends lib : $(<) ; } actions LibX264 { cd `dirname $(>)` && CONTRIB=`pwd` && - rm -rf x264 && tar xzf x264.tar.gz && cd x264 && + rm -rf x264 && tar xzf x264.tar.gz && cd x264 && $(LIBX264_PATCH) ./configure --prefix=$CONTRIB --enable-pthread && make && make install && strip -S $CONTRIB/lib/libx264.a @@ -249,7 +256,7 @@ actions LibXvidCore { cd `dirname $(>)` && CONTRIB=`pwd` && rm -rf xvidcore && tar xzf xvidcore.tar.gz && - cd xvidcore && patch -p1 < ../xvidcore.patch && + cd xvidcore && patch -p1 < ../patch-xvidcore.patch && cd build/generic/ && ./configure && make libxvidcore.a && cp ./=build/libxvidcore.a $CONTRIB/lib/ && cp ../../src/xvid.h $CONTRIB/include/ && diff --git a/contrib/patch-ffmpeg.patch b/contrib/patch-ffmpeg.patch index c65364138..c9cc5fae4 100644 --- a/contrib/patch-ffmpeg.patch +++ b/contrib/patch-ffmpeg.patch @@ -1,85 +1,130 @@ -diff -ru ffmpeg-20060326-bak/configure ffmpeg-20060326/configure ---- ffmpeg-20060326-bak/configure 2006-03-26 22:04:53.000000000 +0200 -+++ ffmpeg-20060326/configure 2006-04-26 16:48:00.000000000 +0200 -@@ -272,7 +272,7 @@ +--- ffmpeg/configure 2006-09-23 14:22:08.000000000 -0400 ++++ ffmpeg-patched/configure 2006-09-23 14:37:49.000000000 -0400 +@@ -493,7 +493,7 @@ 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc" mmx="no" ;; -*20010315*) echo "BeBits gcc" +*20010315*|2.95.3*) echo "BeBits gcc" - CFLAGS="$CFLAGS -fno-expensive-optimizations" + add_cflags "-fno-expensive-optimizations" ;; esac -diff -ru ffmpeg-20060326-bak/libavformat/movenc.c ffmpeg-20060326/libavformat/movenc.c ---- ffmpeg-20060326-bak/libavformat/movenc.c 2006-03-26 22:04:53.000000000 +0200 -+++ ffmpeg-20060326/libavformat/movenc.c 2006-04-26 16:48:54.000000000 +0200 -@@ -22,6 +22,10 @@ - #include "avio.h" - #include "mov.h" +--- ffmpeg/libavformat/movenc.c 2006-09-23 14:22:08.000000000 -0400 ++++ ffmpeg-patched/libavformat/movenc.c 2006-09-23 14:49:42.000000000 -0400 +@@ -34,6 +34,7 @@ + #define MODE_PSP 3 // example working PSP command line: + // ffmpeg -i testinput.avi -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4 + #define MODE_3G2 4 ++#define MODE_IPOD 5 -+#ifndef UINT32_MAX -+#define UINT32_MAX (4294967295U) -+#endif -+ - #undef NDEBUG - #include <assert.h> - -@@ -435,11 +439,6 @@ - end = track->vosData + track->vosLen; - - put_byte(pb, 1); /* version */ -- put_byte(pb, 77); /* profile */ -- put_byte(pb, 64); /* profile compat */ -- put_byte(pb, 30); /* level */ -- put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */ -- put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ - - /* look for sps and pps */ - while (buf < end) { -@@ -458,6 +457,12 @@ - } - assert(sps); - assert(pps); -+ -+ put_byte(pb, sps[1]); /* profile */ -+ put_byte(pb, sps[2]); /* profile compat */ -+ put_byte(pb, sps[3]); /* level */ -+ put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */ -+ put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ - put_be16(pb, sps_size); - put_buffer(pb, sps, sps_size); - put_byte(pb, 1); /* number of pps */ -@@ -621,6 +626,18 @@ + typedef struct MOVIentry { + unsigned int flags, size; +@@ -600,6 +601,18 @@ return tag; } +static int mov_write_colr_tag(ByteIOContext *pb) +{ -+ put_be32( pb, 0x12 ); -+ put_tag( pb, "colr" ); -+ put_tag( pb, "nclc" ); -+ put_be16( pb, 6 ); -+ put_be16( pb, 1 ); -+ put_be16( pb, 6 ); -+ put_be32( pb, 0 ); -+ return 0x12; ++ put_be32( pb, 0x12 ); ++ put_tag( pb, "colr" ); ++ put_tag( pb, "nclc" ); ++ put_be16( pb, 6 ); ++ put_be16( pb, 1 ); ++ put_be16( pb, 6 ); ++ put_be32( pb, 0 ); ++ return 0x12; +} + static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track) { offset_t pos = url_ftell(pb); -@@ -670,6 +687,8 @@ - else if(track->enc->codec_id == CODEC_ID_H264) - mov_write_avcc_tag(pb, track); - -+ mov_write_colr_tag(pb); +@@ -649,8 +662,21 @@ + mov_write_d263_tag(pb); + else if(track->enc->codec_id == CODEC_ID_SVQ3) + mov_write_svq3_tag(pb); +- else if(track->enc->codec_id == CODEC_ID_H264) +- mov_write_avcc_tag(pb, track); ++ else if(track->enc->codec_id == CODEC_ID_H264) { ++ mov_write_avcc_tag(pb, track); ++ if (track->mode == MODE_IPOD) { ++ put_be32(pb, 0x1C); /* size ... reports as 28 in mp4box! */ ++ put_tag(pb, "uuid"); ++ put_be32(pb, 0x6B6840F2); ++ put_be32(pb, 0x5F244FC5); ++ put_be32(pb, 0xBA39A51B); ++ put_be32(pb, 0xCF0323F3); ++ put_be32(pb, 0x00000001); ++ put_be32(pb, 0x0000039C); ++ } ++ } + ++ mov_write_colr_tag(pb); + return updateSize (pb, pos); } +@@ -903,6 +929,10 @@ + /* Track width and height, for visual only */ + if(track->enc->codec_type == CODEC_TYPE_VIDEO) { + double sample_aspect_ratio = av_q2d(track->enc->sample_aspect_ratio); ++ if (track->mode == MODE_IPOD) { ++ /* FIXME , I do not believe this is needed, bad assumption */ ++ sample_aspect_ratio = 1; ++ } + if( !sample_aspect_ratio ) sample_aspect_ratio = 1; + put_be32(pb, sample_aspect_ratio * track->enc->width*0x10000); + put_be32(pb, track->enc->height*0x10000); +@@ -1348,6 +1378,8 @@ + put_tag(pb, "MSNV"); + else if ( mov->mode == MODE_MP4 ) + put_tag(pb, "isom"); ++ else if ( mov->mode == MODE_IPOD ) ++ put_tag(pb, "isom"); + else + put_tag(pb, "qt "); -diff -ru ffmpeg-20060326-bak/libavformat/tcp.c ffmpeg-20060326/libavformat/tcp.c ---- ffmpeg-20060326-bak/libavformat/tcp.c 2006-03-26 22:04:53.000000000 +0200 -+++ ffmpeg-20060326/libavformat/tcp.c 2006-04-26 16:48:00.000000000 +0200 +@@ -1359,6 +1391,8 @@ + put_tag(pb, "3g2a"); + else if ( mov->mode == MODE_PSP ) + put_tag(pb, "MSNV"); ++ else if ( mov->mode == MODE_IPOD ) ++ put_tag(pb, "mp41"); + else if ( mov->mode == MODE_MP4 ) + put_tag(pb, "mp41"); + else +@@ -1440,7 +1474,8 @@ + else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2; + else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; + else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; +- ++ else if (!strcmp("ipod", s->oformat->name)) mov->mode = MODE_IPOD; ++ + mov_write_ftyp_tag(pb,s); + if ( mov->mode == MODE_PSP ) { + if ( s->nb_streams != 2 ) { +@@ -1640,6 +1675,21 @@ + .flags = AVFMT_GLOBALHEADER, + }; + #endif ++#ifdef CONFIG_IPOD_MUXER ++AVOutputFormat ipod_muxer = { ++ "ipod", ++ "ipod mp4 format", ++ "application/mp4", ++ "mp4,m4v,ipod", ++ sizeof(MOVContext), ++ CODEC_ID_AAC, ++ CODEC_ID_MPEG4, ++ mov_write_header, ++ mov_write_packet, ++ mov_write_trailer, ++ .flags = AVFMT_GLOBALHEADER, ++}; ++#endif + #ifdef CONFIG_PSP_MUXER + AVOutputFormat psp_muxer = { + "psp", +--- ffmpeg/libavformat/tcp.c 2006-09-23 14:22:08.000000000 -0400 ++++ ffmpeg-patched/libavformat/tcp.c 2006-09-23 14:34:32.000000000 -0400 @@ -112,11 +112,13 @@ break; } @@ -94,3 +139,35 @@ diff -ru ffmpeg-20060326-bak/libavformat/tcp.c ffmpeg-20060326/libavformat/tcp.c } s->fd = fd; return 0; +--- ffmpeg/libavformat/allformats.h 2006-09-23 14:22:08.000000000 -0400 ++++ ffmpeg-patched/libavformat/allformats.h 2006-09-23 15:02:41.000000000 -0400 +@@ -74,6 +74,7 @@ + extern AVOutputFormat mov_muxer; + extern AVOutputFormat tgp_muxer; + extern AVOutputFormat mp4_muxer; ++extern AVOutputFormat ipod_muxer; + extern AVOutputFormat psp_muxer; + extern AVOutputFormat tg2_muxer; + extern AVInputFormat mp3_demuxer; +--- ffmpeg/libavformat/allformats.c 2006-09-23 14:22:08.000000000 -0400 ++++ ffmpeg-patched/libavformat/allformats.c 2006-09-23 14:26:11.000000000 -0400 +@@ -204,6 +204,9 @@ + #ifdef CONFIG_PSP_MUXER + av_register_output_format(&psp_muxer); + #endif ++#ifdef CONFIG_IPOD_MUXER ++ av_register_output_format(&ipod_muxer); ++#endif + #ifdef CONFIG_TG2_MUXER + av_register_output_format(&tg2_muxer); + #endif +--- ffmpeg/libavformat/Makefile 2006-09-23 14:22:08.000000000 -0400 ++++ ffmpeg-patched/libavformat/Makefile 2006-09-23 20:15:09.000000000 -0400 +@@ -62,6 +62,7 @@ + OBJS-$(CONFIG_TGP_MUXER) += movenc.o riff.o isom.o + OBJS-$(CONFIG_MP4_MUXER) += movenc.o riff.o isom.o + OBJS-$(CONFIG_PSP_MUXER) += movenc.o riff.o isom.o ++OBJS-$(CONFIG_IPOD_MUXER) += movenc.o riff.o isom.o + OBJS-$(CONFIG_TG2_MUXER) += movenc.o riff.o isom.o + OBJS-$(CONFIG_MP3_DEMUXER) += mp3.o + OBJS-$(CONFIG_MP2_MUXER) += mp3.o diff --git a/contrib/patch-libdvdread.patch b/contrib/patch-libdvdread.patch new file mode 100644 index 000000000..8ff5333b6 --- /dev/null +++ b/contrib/patch-libdvdread.patch @@ -0,0 +1,10 @@ +--- libdvdread/dvdread/nav_read.c 2005-09-05 22:11:16.000000000 -0400 ++++ libdvdread-patched/dvdread/nav_read.c 2006-09-23 14:14:43.000000000 -0400 +@@ -204,6 +204,6 @@ + /* Asserts */ + + /* dsi dsi gi */ +- CHECK_VALUE(dsi->dsi_gi.zero1 == 0); ++// CHECK_VALUE(dsi->dsi_gi.zero1 == 0); + } + diff --git a/contrib/patch-x264-macintel.patch b/contrib/patch-x264-macintel.patch new file mode 100644 index 000000000..b2219fd9d --- /dev/null +++ b/contrib/patch-x264-macintel.patch @@ -0,0 +1,48 @@ +--- x264/common/i386/i386inc.asm 2006-09-23 14:01:05.000000000 -0400 ++++ x264-patched/common/i386/i386inc.asm 2006-09-24 09:21:27.000000000 -0400 +@@ -40,12 +40,12 @@ + ; is unable to compute address offsets outside of .text so we use the .text + ; section instead until NASM is fixed. + %macro SECTION_RODATA 0 +- %ifidn __OUTPUT_FORMAT__,macho +- SECTION .text +- fakegot: +- %else ++; %ifidn __OUTPUT_FORMAT__,macho ++; SECTION .text ++; fakegot: ++; %else + SECTION .rodata data align=16 +- %endif ++; %endif + %endmacro + + ; PIC support macros. All these macros are totally harmless when __PIC__ is +--- x264/common/i386/predict-a.asm 2006-09-23 14:01:05.000000000 -0400 ++++ x264-patched/common/i386/predict-a.asm 2006-09-24 09:21:27.000000000 -0400 +@@ -191,7 +191,6 @@ + %assign Y (Y-1) + movq [edx + Y*FDEC_STRIDE], mm1 + +- picpop ebx + ret + + ;----------------------------------------------------------------------------- +@@ -228,7 +227,6 @@ + %assign Y (Y-1) + movq [edx + Y*FDEC_STRIDE], mm0 + +- picpop ebx + ret + + ;----------------------------------------------------------------------------- +@@ -269,8 +267,7 @@ + %endrep + movq [edx + Y *FDEC_STRIDE], mm3 + movq [edx + (Y+1)*FDEC_STRIDE], mm0 +- +- picpop ebx ++ + ret + + ;----------------------------------------------------------------------------- diff --git a/contrib/xvidcore.patch b/contrib/patch-xvidcore.patch index 51cb94c6d..51cb94c6d 100644 --- a/contrib/xvidcore.patch +++ b/contrib/patch-xvidcore.patch diff --git a/contrib/version_a52dec.txt b/contrib/version_a52dec.txt index 86617fd36..784ed9f76 100644 --- a/contrib/version_a52dec.txt +++ b/contrib/version_a52dec.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/a52dec-0.7.4.tar.gz +http://multics.dynalias.com/handbrake/contrib/a52dec-0.7.4.tar.gz diff --git a/contrib/version_faac.txt b/contrib/version_faac.txt index e3466666b..c79fdb938 100644 --- a/contrib/version_faac.txt +++ b/contrib/version_faac.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/faac-1.24.tar.gz +http://multics.dynalias.com/handbrake/contrib/faac-1.24.tar.gz diff --git a/contrib/version_ffmpeg.txt b/contrib/version_ffmpeg.txt index a13a33806..e784fb835 100644 --- a/contrib/version_ffmpeg.txt +++ b/contrib/version_ffmpeg.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/ffmpeg-20060326.tar.gz +http://multics.dynalias.com/handbrake/contrib/ffmpeg-6324.tar.gz diff --git a/contrib/version_lame.txt b/contrib/version_lame.txt index b4bb63c81..fcee5aaec 100644 --- a/contrib/version_lame.txt +++ b/contrib/version_lame.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/lame-3.96.1.tar.gz +http://multics.dynalias.com/handbrake/contrib/lame-3.96.1.tar.gz diff --git a/contrib/version_libdvdcss.txt b/contrib/version_libdvdcss.txt index 81d1ef157..f4ee8b1d2 100644 --- a/contrib/version_libdvdcss.txt +++ b/contrib/version_libdvdcss.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/libdvdcss-1.2.9.tar.gz +http://multics.dynalias.com/handbrake/contrib/libdvdcss-1.2.9.tar.gz diff --git a/contrib/version_libdvdread.txt b/contrib/version_libdvdread.txt index b7be38fd7..63b29a4da 100644 --- a/contrib/version_libdvdread.txt +++ b/contrib/version_libdvdread.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/libdvdread-20050928.tar.gz +http://multics.dynalias.com/handbrake/contrib/libdvdread-20050928.tar.gz diff --git a/contrib/version_libogg.txt b/contrib/version_libogg.txt index 57daaf702..48cb46dcd 100644 --- a/contrib/version_libogg.txt +++ b/contrib/version_libogg.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/libogg-1.1.2.tar.gz +http://multics.dynalias.com/handbrake/contrib/libogg-1.1.2.tar.gz diff --git a/contrib/version_libsamplerate.txt b/contrib/version_libsamplerate.txt index a0f5b3804..c7d75ca57 100644 --- a/contrib/version_libsamplerate.txt +++ b/contrib/version_libsamplerate.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/libsamplerate-0.1.2.tar.gz +http://multics.dynalias.com/handbrake/contrib/libsamplerate-0.1.2.tar.gz diff --git a/contrib/version_libvorbis.txt b/contrib/version_libvorbis.txt index db3f67caf..18c9a7ac3 100644 --- a/contrib/version_libvorbis.txt +++ b/contrib/version_libvorbis.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/libvorbis-1.1.1.tar.gz +http://multics.dynalias.com/handbrake/contrib/libvorbis-1.1.1.tar.gz diff --git a/contrib/version_mpeg2dec.txt b/contrib/version_mpeg2dec.txt index a1e47302c..f8570015e 100644 --- a/contrib/version_mpeg2dec.txt +++ b/contrib/version_mpeg2dec.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/mpeg2dec-20051112.tar.gz +http://multics.dynalias.com/handbrake/contrib/mpeg2dec-20051112.tar.gz diff --git a/contrib/version_x264.txt b/contrib/version_x264.txt index dbf8c5768..9d6f6289f 100644 --- a/contrib/version_x264.txt +++ b/contrib/version_x264.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/x264-r401.tar.gz +http://multics.dynalias.com/handbrake/contrib/x264-r568.tar.gz diff --git a/contrib/version_xvidcore.txt b/contrib/version_xvidcore.txt index 28a7cff4b..c5b9515a3 100644 --- a/contrib/version_xvidcore.txt +++ b/contrib/version_xvidcore.txt @@ -1 +1 @@ -http://download.m0k.org/handbrake/contrib/xvidcore-1.1.0.tar.gz +http://multics.dynalias.com/handbrake/contrib/xvidcore-1.1.0.tar.gz diff --git a/libhb/common.c b/libhb/common.c index 105fa44f5..e9d366f75 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -116,6 +116,7 @@ int hb_calc_bitrate( hb_job_t * job, int size ) { case HB_MUX_MP4: case HB_MUX_PSP: + case HB_MUX_IPOD: overhead = 6; break; case HB_MUX_AVI: diff --git a/libhb/common.h b/libhb/common.h index 866eb98b2..0bd8971e3 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -115,6 +115,7 @@ struct hb_job_s #define HB_VCODEC_FFMPEG 0x000001 #define HB_VCODEC_XVID 0x000002 #define HB_VCODEC_X264 0x000004 + int vcodec; float vquality; int vbitrate; @@ -122,6 +123,7 @@ struct hb_job_s int vrate_base; int pass; int h264_13; + int h264_level; /* Audio tracks: Indexes in hb_title_t's audios list, starting from 0. @@ -158,6 +160,8 @@ struct hb_job_s #define HB_MUX_PSP 0x020000 #define HB_MUX_AVI 0x040000 #define HB_MUX_OGM 0x080000 +#define HB_MUX_IPOD 0x100000 + int mux; char * file; diff --git a/libhb/dvd.c b/libhb/dvd.c index faa82b2e0..4082a18d3 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -183,7 +183,7 @@ hb_title_t * hb_dvd_title_scan( hb_dvd_t * d, int t ) title->cell_end, title->block_start, title->block_end, title->block_count ); - if( title->block_count < 2048 ) + if( title->block_count < 2048 ) { hb_log( "scan: title too short (%d blocks), ignoring", title->block_count ); diff --git a/libhb/encx264.c b/libhb/encx264.c index 13faadc39..53950fa5e 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -1,8 +1,8 @@ /* $Id: encx264.c,v 1.21 2005/11/04 13:09:41 titer Exp $ - This file is part of the HandBrake source code. - Homepage: <http://handbrake.m0k.org/>. - It may be used under the terms of the GNU General Public License. */ +This file is part of the HandBrake source code. +Homepage: <http://handbrake.m0k.org/>. +It may be used under the terms of the GNU General Public License. */ #include <stdarg.h> @@ -29,32 +29,32 @@ struct hb_work_private_s x264_t * x264; x264_picture_t pic_in; x264_picture_t pic_out; - + char filename[1024]; }; /*********************************************************************** - * hb_work_encx264_init - *********************************************************************** - * - **********************************************************************/ +* hb_work_encx264_init +*********************************************************************** +* +**********************************************************************/ int encx264Init( hb_work_object_t * w, hb_job_t * job ) { x264_param_t param; x264_nal_t * nal; int nal_count; int i, size; - + hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) ); w->private_data = pv; - + pv->job = job; - + memset( pv->filename, 0, 1024 ); hb_get_tempory_filename( job->h, pv->filename, "x264.log" ); - + x264_param_default( ¶m ); - + param.i_threads = hb_get_cpu_count(); param.i_width = job->width; param.i_height = job->height; @@ -62,16 +62,19 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) param.i_fps_den = job->vrate_base; param.i_keyint_max = 20 * job->vrate / job->vrate_base; param.i_log_level = X264_LOG_NONE; - if( job->h264_13 ) + + if( job->h264_level ) { - param.i_threads = 1; - param.b_cabac = 0; - param.i_level_idc = 13; + param.i_threads = 1; + param.b_cabac = 0; + param.i_level_idc = job->h264_level; + hb_log( "encx264: encoding at level %i", + param.i_level_idc ); } - + /* Slightly faster with minimal quality lost */ param.analyse.i_subpel_refine = 4; - + if( job->vquality >= 0.0 && job->vquality <= 1.0 ) { /* Constant QP */ @@ -81,29 +84,40 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) } else { - /* Rate control */ - param.rc.b_cbr = 1; + + /* Rate control */ + /* no longer in x264 - see rc.i_rc_method in x264.h */ + /* param.rc.b_cbr = 1; */ + + /* these were the only settings I could use to get accurate ending video bitrate */ + param.rc.i_rc_method = X264_RC_CRF; + param.rc.i_vbv_max_bitrate = job->vbitrate; + param.rc.i_vbv_buffer_size = 224; + param.rc.i_rf_constant = 1; + param.rc.i_bitrate = job->vbitrate; switch( job->pass ) { case 1: + param.rc.i_rc_method = X264_RC_ABR; param.rc.b_stat_write = 1; param.rc.psz_stat_out = pv->filename; break; case 2: + param.rc.i_rc_method = X264_RC_ABR; param.rc.b_stat_read = 1; param.rc.psz_stat_in = pv->filename; break; } } - + hb_log( "encx264: opening libx264 (pass %d)", job->pass ); pv->x264 = x264_encoder_open( ¶m ); - + w->config->mpeg4.length = 0; - + x264_encoder_headers( pv->x264, &nal, &nal_count ); - + for( i = 0; i < nal_count; i++ ) { size = sizeof( w->config->mpeg4.bytes ) - w->config->mpeg4.length; @@ -111,10 +125,10 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) &size, 1, &nal[i] ); w->config->mpeg4.length += size; } - + x264_picture_alloc( &pv->pic_in, X264_CSP_I420, job->width, job->height ); - + return 0; } @@ -122,12 +136,12 @@ void encx264Close( hb_work_object_t * w ) { hb_work_private_t * pv = w->private_data; x264_encoder_close( pv->x264 ); - + /* TODO */ } int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, - hb_buffer_t ** buf_out ) + hb_buffer_t ** buf_out ) { hb_work_private_t * pv = w->private_data; hb_job_t * job = pv->job; @@ -135,7 +149,7 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, int i_nal; x264_nal_t * nal; int i; - + /* XXX avoid this memcpy ? */ memcpy( pv->pic_in.img.plane[0], in->data, job->width * job->height ); if( job->grayscale ) @@ -151,19 +165,22 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, memcpy( pv->pic_in.img.plane[2], in->data + 5 * job->width * job->height / 4, job->width * job->height / 4 ); } - + pv->pic_in.i_type = X264_TYPE_AUTO; pv->pic_in.i_qpplus1 = 0; - + x264_encoder_encode( pv->x264, &nal, &i_nal, &pv->pic_in, &pv->pic_out ); - + + + /* Should be way too large */ buf = hb_buffer_init( 3 * job->width * job->height / 2 ); buf->start = in->start; buf->stop = in->stop; buf->key = ( pv->pic_out.i_type == X264_TYPE_IDR ); - + + buf->size = 0; for( i = 0; i < i_nal; i++ ) { @@ -175,9 +192,9 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in, buf->size += size; } } - + *buf_out = buf; - + return HB_WORK_OK; } diff --git a/libhb/muxcommon.c b/libhb/muxcommon.c index 8deba08e3..93fa773e3 100644 --- a/libhb/muxcommon.c +++ b/libhb/muxcommon.c @@ -71,6 +71,7 @@ static void MuxerFunc( void * _mux ) { case HB_MUX_MP4: case HB_MUX_PSP: + case HB_MUX_IPOD: m = hb_mux_mp4_init( job ); break; case HB_MUX_AVI: diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index 21aea7a53..971c4bfbb 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -1,25 +1,21 @@ /* $Id: muxmp4.c,v 1.24 2005/11/04 13:09:41 titer Exp $ - This file is part of the HandBrake source code. - Homepage: <http://handbrake.m0k.org/>. - It may be used under the terms of the GNU General Public License. */ +This file is part of the HandBrake source code. +Homepage: <http://handbrake.m0k.org/>. +It may be used under the terms of the GNU General Public License. */ #include <ffmpeg/avformat.h> #include "hb.h" int64_t ff_gcd(int64_t a, int64_t b); -static inline int ff_get_fourcc(const char *s) -{ - return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); -} struct hb_mux_object_s { HB_MUX_COMMON; - + hb_job_t * job; - + AVFormatContext * format; }; @@ -29,10 +25,10 @@ struct hb_mux_data_s }; /********************************************************************** - * MP4Init - ********************************************************************** - * Allocates hb_mux_data_t structures, create file and write headers - *********************************************************************/ +* MP4Init +********************************************************************** +* Allocates hb_mux_data_t structures, create file and write headers +*********************************************************************/ static int MP4Init( hb_mux_object_t * m ) { hb_job_t * job = m->job; @@ -43,28 +39,40 @@ static int MP4Init( hb_mux_object_t * m ) AVFormatContext * oc; AVStream *st; AVFormatParameters params; - + register_protocol(&file_protocol); - movenc_init(); - + //movenc_init(); + av_register_all(); + oc = av_alloc_format_context(); - + if( job->mux & HB_MUX_PSP ) { oc->oformat = guess_format( "psp", NULL, NULL ); + hb_log( "using format psp" ); + } + else if( job->mux & HB_MUX_IPOD ) + { + /* added this format to ffmpeg source */ + oc->oformat = guess_format( "ipod", NULL, NULL ); + hb_log( "using format ipod" ); } else { oc->oformat = guess_format( "mp4", NULL, NULL ); + hb_log( "using format mp4" ); } if( !oc->oformat ) { hb_log( "guess_format failed" ); return 1; } + + hb_log( "using oformat: %s", oc->oformat->name ); + snprintf( oc->filename, sizeof( oc->filename ), "%s", job->file ); - + st = av_new_stream( oc, oc->nb_streams ); if( !st ) { @@ -75,28 +83,28 @@ static int MP4Init( hb_mux_object_t * m ) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = ( job->vcodec == HB_VCODEC_X264 ) ? - CODEC_ID_H264 : CODEC_ID_MPEG4; +CODEC_ID_H264 : CODEC_ID_MPEG4; st->codec->extradata= job->config.mpeg4.bytes; st->codec->extradata_size= job->config.mpeg4.length; st->codec->bit_rate = 1000 * job->vbitrate; i = ff_gcd( job->vrate_base, job->vrate ); st->codec->time_base = (AVRational){ job->vrate_base / i, job->vrate / i }; - + st->codec->pix_fmt = PIX_FMT_YUV420P; st->codec->width = job->width; st->codec->height = job->height; st->codec->has_b_frames = 0; - + job->mux_data = malloc( sizeof( hb_mux_data_t ) ); job->mux_data->track = 0; - + for( i = 0; i < hb_list_count( title->list_audio ); i++ ) { audio = hb_list_item( title->list_audio, i ); - + audio->mux_data = malloc( sizeof( hb_mux_data_t ) ); audio->mux_data->track = i + 1; - + st = av_new_stream( oc, oc->nb_streams ); if( !st ) { @@ -116,35 +124,35 @@ static int MP4Init( hb_mux_object_t * m ) st->codec->frame_size = 1024; st->codec->block_align = 0; } - + oc->timestamp = 0; if( url_fopen( &oc->pb, job->file, URL_WRONLY ) < 0 ) { hb_log( "url_fopen failed (%s)", job->file ); return 1; } - + memset( ¶ms, 0, sizeof( params ) ); if( av_set_parameters( oc, ¶ms ) < 0 ) { hb_log( "av_set_parameters failed" ); return 1; } - + oc->packet_size= 0; oc->mux_rate= 0; oc->preload= (int)(0.5*AV_TIME_BASE); oc->max_delay= (int)(0.7*AV_TIME_BASE); oc->loop_output = AVFMT_NOOUTPUTLOOP; - + if( av_write_header( oc ) < 0 ) { hb_log( "av_write_header failed" ); return 1; } - + m->format = oc; - + return 0; } @@ -153,19 +161,19 @@ static int MP4Mux( hb_mux_object_t * m, hb_mux_data_t * mux_data, { AVPacket pkt; av_init_packet(&pkt); - + pkt.stream_index = mux_data->track; pkt.data = buf->data; pkt.size = buf->size; pkt.pts = buf->start; - + if( buf->key ) { pkt.flags |= PKT_FLAG_KEY; } - + av_interleaved_write_frame( m->format, &pkt ); - + return 0; } @@ -174,7 +182,7 @@ static int MP4End( hb_mux_object_t * m ) av_write_trailer( m->format ); url_fclose( &m->format->pb ); av_free( m->format ); - + return 0; } diff --git a/libhb/muxogm.c b/libhb/muxogm.c index d326c9828..6a3b1ec5d 100644 --- a/libhb/muxogm.c +++ b/libhb/muxogm.c @@ -170,7 +170,7 @@ static int OGMInit( hb_mux_object_t * m ) SetWLE ( &h.i_bits_per_sample, 0 ); SetDWLE( &h.header.video.i_width, job->width ); SetDWLE( &h.header.video.i_height, job->height ); - op.packet = (char*)&h; + op.packet = (unsigned char*)&h; op.bytes = sizeof( ogg_stream_header_t ); op.b_o_s = 1; op.e_o_s = 0; diff --git a/libhb/scan.c b/libhb/scan.c index c2814f362..097f11638 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -248,7 +248,7 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title ) mpeg2 = hb_libmpeg2_init(); - for( j = 0; j < 10240; j++ ) + for( j = 0; j < 10240 ; j++ ) { if( !hb_dvd_read( data->dvd, buf_ps ) ) { diff --git a/macosx/Controller.mm b/macosx/Controller.mm index a71f121f0..10b1231c6 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -556,6 +556,19 @@ static int FormatSettings[3][4] = } if( job->vcodec & HB_VCODEC_X264 ) { + switch([fVidEncoderPopUp indexOfSelectedItem]) { + case 1: + /* Baseline Level 1.3 + For iPods pre firmware 1.2 */ + job->h264_level = 13; + break; + case 2: + /* Baseline Level 3.0 + For iPods w/ fimware 1.2 */ + job->h264_level = 30; + job->mux = HB_MUX_IPOD; + break; + } job->h264_13 = [fVidEncoderPopUp indexOfSelectedItem]; } @@ -881,7 +894,8 @@ static int FormatSettings[3][4] = /* MPEG-4 -> H.264 */ [fVidEncoderPopUp removeAllItems]; [fVidEncoderPopUp addItemWithTitle: @"x264 (Main profile)"]; - [fVidEncoderPopUp addItemWithTitle: @"x264 (Baseline profile)"]; + [fVidEncoderPopUp addItemWithTitle: @"x264 (Baseline profile level 1.3)"]; + [fVidEncoderPopUp addItemWithTitle: @"x264 (Baseline profile level 3.0)"]; } else if( ( FormatSettings[format][codecs] & HB_VCODEC_FFMPEG ) ) { diff --git a/test/test.c b/test/test.c index e01bec7a1..0f43a7f16 100644 --- a/test/test.c +++ b/test/test.c @@ -21,6 +21,7 @@ static int deinterlace = 0; static int grayscale = 0; static int vcodec = HB_VCODEC_FFMPEG; static int h264_13 = 0; +static int h264_30 = 0; static char * audios = NULL; static int sub = 0; static int width = 0; @@ -341,8 +342,12 @@ static int HandleEvents( hb_handle_t * h ) } if( h264_13 ) { - job->h264_13 = h264_13; - } + job->h264_level = 13; + } + if( h264_30 ) + { + job->h264_level = 30; + } if( vrate ) { job->vrate = 27000000; @@ -505,7 +510,7 @@ static void ShowHelp() "\n" " -s, --subtitle <number> Select subtitle (default: none)\n" " -e, --encoder <string> Set video library encoder (ffmpeg,xvid,\n" - " x264,x264b13, default: ffmpeg)\n" + " x264,x264b13,x264b30 default: ffmpeg)\n" " -E, --aencoder <string> Set audio encoder (faac/lame/vorbis/ac3, ac3\n" " meaning passthrough, default: guessed)\n" " -2, --two-pass Use two-pass mode\n" @@ -673,6 +678,11 @@ static int ParseOptions( int argc, char ** argv ) vcodec = HB_VCODEC_X264; h264_13 = 1; } + else if( !strcasecmp( optarg, "x264b30" ) ) + { + vcodec = HB_VCODEC_X264; + h264_30 = 1; + } else { fprintf( stderr, "invalid codec (%s)\n", optarg ); @@ -801,7 +811,10 @@ static int CheckOptions( int argc, char ** argv ) } else if( p && !strcasecmp( p, ".mp4" ) ) { - mux = HB_MUX_MP4; + if ( h264_30 == 1 ) + mux = HB_MUX_IPOD; + else + mux = HB_MUX_MP4; } else if( p && ( !strcasecmp( p, ".ogm" ) || !strcasecmp( p, ".ogg" ) ) ) @@ -821,7 +834,10 @@ static int CheckOptions( int argc, char ** argv ) } else if( !strcasecmp( format, "mp4" ) ) { - mux = HB_MUX_MP4; + if ( h264_30 == 1) + mux = HB_MUX_IPOD; + else + mux = HB_MUX_MP4; } else if( !strcasecmp( format, "ogm" ) || !strcasecmp( format, "ogg" ) ) @@ -837,7 +853,7 @@ static int CheckOptions( int argc, char ** argv ) if( !acodec ) { - if( mux == HB_MUX_MP4 ) + if( mux == HB_MUX_MP4 || mux == HB_MUX_IPOD ) { acodec = HB_ACODEC_FAAC; } |