OSDN Git Service

bump ffmpeg from svn 25689 to git 185a155
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 4 Feb 2011 19:38:03 +0000 (19:38 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 4 Feb 2011 19:38:03 +0000 (19:38 +0000)
Fixes a couple h.264 decode issues
Fixes uft16-le chapter names in mov/mp4 files
Improved ac3 encoder
Numerous other bug fixes and improvements

git-svn-id: svn://localhost/HandBrake/trunk@3779 b64f7644-9d1e-0410-96f1-a4d463321fa5

contrib/ffmpeg/A00-mov-utf16-chapters.patch [deleted file]
contrib/ffmpeg/module.defs
libhb/encac3.c
libhb/sync.c

diff --git a/contrib/ffmpeg/A00-mov-utf16-chapters.patch b/contrib/ffmpeg/A00-mov-utf16-chapters.patch
deleted file mode 100644 (file)
index 1dfde74..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-diff --git a/libavformat/mov.c b/libavformat/mov.c
-index 4370b48..b28c9ae 100644
---- a/libavformat/mov.c
-+++ b/libavformat/mov.c
-@@ -2334,6 +2334,20 @@ static void mov_read_chapters(AVFormatContext *s)
-             av_freep(&title);
-             title = utf8;
-         }
-+        else if (AV_RL16(title+2) == 0xfeff) {
-+            uint8_t *utf8 = av_malloc(2*len+3);
-+
-+            i8 = i16 = 0;
-+            while (i16 < len) {
-+                uint32_t ch;
-+                uint8_t tmp;
-+                GET_UTF16(ch, i16 < len ? AV_RL16(title + (i16+=2)) : 0, break;)
-+                PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;)
-+            }
-+            utf8[2+i8] = 0;
-+            av_freep(&title);
-+            title = utf8;
-+        }
-         ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2);
-         av_freep(&title);
index 304183f..bda0e81 100644 (file)
@@ -1,7 +1,7 @@
 $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,BZIP2 FAAD2 ZLIB))
 $(eval $(call import.CONTRIB.defs,FFMPEG))
 
-FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-r25689.tar.bz2
+FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-git-185a155.tar.bz2
 
 FFMPEG.CONFIGURE.deps =
 FFMPEG.CONFIGURE.env  =
index 5c45b98..1790866 100644 (file)
@@ -18,7 +18,7 @@ struct hb_work_private_s
     unsigned long    output_bytes;
     hb_list_t      * list;
     uint8_t        * buf;
-    int16_t        * samples;
+    float          * samples;
 };
 
 int  encac3Init( hb_work_object_t *, hb_job_t * );
@@ -53,7 +53,7 @@ int encac3Init( hb_work_object_t * w, hb_job_t * job )
     pv->output_bytes = AC3_MAX_CODED_FRAME_SIZE;
 
     pv->buf = malloc( pv->input_samples * sizeof( float ) );
-    pv->samples = malloc( pv->input_samples * sizeof( int16_t ) );
+    pv->samples = malloc( pv->input_samples * sizeof( float ) );
 
     codec = avcodec_find_encoder( CODEC_ID_AC3 );
     if( !codec )
@@ -62,6 +62,7 @@ int encac3Init( hb_work_object_t * w, hb_job_t * job )
                 "failed" );
     }
     context = avcodec_alloc_context();
+    avcodec_get_context_defaults3(context, codec);
 
     context->channel_layout = CH_LAYOUT_STEREO;
     switch( audio->config.out.mixdown )
@@ -88,6 +89,7 @@ int encac3Init( hb_work_object_t * w, hb_job_t * job )
     context->bit_rate = audio->config.out.bitrate * 1000;
     context->sample_rate = audio->config.out.samplerate;
     context->channels = pv->out_discrete_channels;
+    context->sample_fmt = AV_SAMPLE_FMT_FLT;
 
     if( hb_avcodec_open( context, codec ) )
     {
@@ -188,12 +190,13 @@ static hb_buffer_t * Encode( hb_work_object_t * w )
     
     for (ii = 0; ii < pv->input_samples; ii++)
     {
-        pv->samples[ii] = (int16_t)((float*)pv->buf)[ii];
+        // ffmpeg float samples are -1.0 to 1.0
+        pv->samples[ii] = ((float*)pv->buf)[ii] / 32768.0;
     }
 
     buf = hb_buffer_init( pv->output_bytes );
     buf->size = avcodec_encode_audio( pv->context, buf->data, buf->alloc,
-                                          pv->samples );
+                                      (short*)pv->samples );
 
     buf->start = pts + 90000 * pos / pv->out_discrete_channels / sizeof( float ) / audio->config.out.samplerate;
     buf->stop  = buf->start + 90000 * AC3_SAMPLES_PER_FRAME / audio->config.out.samplerate;
index b44765e..322dc78 100644 (file)
@@ -1154,6 +1154,7 @@ static void InitAudio( hb_job_t * job, hb_sync_common_t * common, int i )
         c->bit_rate    = w->audio->config.in.bitrate;
         c->sample_rate = w->audio->config.in.samplerate;
         c->channels    = HB_INPUT_CH_LAYOUT_GET_DISCRETE_COUNT( w->audio->config.in.channel_layout );
+        c->sample_fmt  = AV_SAMPLE_FMT_FLT;
 
         if( hb_avcodec_open( c, codec ) < 0 )
         {
@@ -1162,7 +1163,7 @@ static void InitAudio( hb_job_t * job, hb_sync_common_t * common, int i )
         }
 
         zeros          = calloc( AC3_SAMPLES_PER_FRAME *
-                                 sizeof( short ) * c->channels, 1 );
+                                 sizeof( float ) * c->channels, 1 );
         sync->ac3_size = w->audio->config.in.bitrate * AC3_SAMPLES_PER_FRAME /
                              w->audio->config.in.samplerate / 8;
         sync->ac3_buf  = malloc( sync->ac3_size );