From: sr55 Date: Fri, 1 Mar 2013 20:55:10 +0000 (+0000) Subject: Merging Trunk into OpenCL X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f27ed840bdd9956abdae723422f2b4da7fff8c7;p=handbrake Merging Trunk into OpenCL git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5279 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/contrib/ffmpeg/A03-h264-recovery-point.patch b/contrib/ffmpeg/A01-h264-recovery-point.patch similarity index 93% rename from contrib/ffmpeg/A03-h264-recovery-point.patch rename to contrib/ffmpeg/A01-h264-recovery-point.patch index 78c182df2..8688c021c 100644 --- a/contrib/ffmpeg/A03-h264-recovery-point.patch +++ b/contrib/ffmpeg/A01-h264-recovery-point.patch @@ -1,8 +1,8 @@ diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index 3660597..bf4e072 100644 +index 848d6a2..5a12fdb 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c -@@ -2163,6 +2163,7 @@ static void flush_dpb(AVCodecContext *avctx) +@@ -2164,6 +2164,7 @@ static void flush_dpb(AVCodecContext *avctx) flush_change(h); ff_mpeg_flush(avctx); @@ -10,7 +10,7 @@ index 3660597..bf4e072 100644 } static int init_poc(H264Context *h) -@@ -3981,9 +3982,18 @@ again: +@@ -3992,9 +3993,18 @@ again: if ((err = decode_slice_header(hx, h))) break; @@ -32,7 +32,7 @@ index 3660597..bf4e072 100644 if (h->current_slice == 1) { if (!(s->flags2 & CODEC_FLAG2_CHUNKS)) diff --git a/libavcodec/h264.h b/libavcodec/h264.h -index 8596121..23daee3 100644 +index 898ebf7..42aaa6f 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -568,6 +568,13 @@ typedef struct H264Context { diff --git a/contrib/ffmpeg/A01-swscale-assert.patch b/contrib/ffmpeg/A01-swscale-assert.patch deleted file mode 100644 index 9db84b7fa..000000000 --- a/contrib/ffmpeg/A01-swscale-assert.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/libswscale/utils.c b/libswscale/utils.c -index f0a2b46..61506c6 100644 ---- a/libswscale/utils.c -+++ b/libswscale/utils.c -@@ -531,7 +531,9 @@ static int initFilter(int16_t **outFilter, int32_t **filterPos, - // FIXME try to align filterPos if possible - - // fix borders -- if (is_horizontal) { -+ // This "horizontal" only check causes a subsequent assert when -+ // upscaling. -+ /*if (is_horizontal)*/ { - for (i = 0; i < dstW; i++) { - int j; - if ((*filterPos)[i] < 0) { diff --git a/contrib/ffmpeg/A04-dca-resync.patch b/contrib/ffmpeg/A02-dca-resync.patch similarity index 100% rename from contrib/ffmpeg/A04-dca-resync.patch rename to contrib/ffmpeg/A02-dca-resync.patch diff --git a/contrib/ffmpeg/A02-truehd-channel-order.patch b/contrib/ffmpeg/A02-truehd-channel-order.patch deleted file mode 100644 index a3d767755..000000000 --- a/contrib/ffmpeg/A02-truehd-channel-order.patch +++ /dev/null @@ -1,207 +0,0 @@ -diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c -index d1a3dc1..31c79c9 100644 ---- a/libavcodec/mlp_parser.c -+++ b/libavcodec/mlp_parser.c -@@ -126,7 +126,7 @@ static uint64_t truehd_layout(int chanmap) - - int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb) - { -- int ratebits; -+ int ratebits, channel_arrangement; - uint16_t checksum; - - assert(get_bits_count(gb) == 0); -@@ -157,7 +157,9 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb) - - skip_bits(gb, 11); - -- mh->channels_mlp = get_bits(gb, 5); -+ channel_arrangement = get_bits(gb, 5); -+ mh->channels_mlp = mlp_channels[channel_arrangement]; -+ mh->channel_layout_mlp = mlp_layout[channel_arrangement]; - } else if (mh->stream_type == 0xba) { - mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere? - mh->group2_bits = 0; -@@ -168,11 +170,15 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb) - - skip_bits(gb, 8); - -- mh->channels_thd_stream1 = get_bits(gb, 5); -+ channel_arrangement = get_bits(gb, 5); -+ mh->channels_thd_stream1 = truehd_channels(channel_arrangement); -+ mh->channel_layout_thd_stream1 = truehd_layout(channel_arrangement); - - skip_bits(gb, 2); - -- mh->channels_thd_stream2 = get_bits(gb, 13); -+ channel_arrangement = get_bits(gb, 13); -+ mh->channels_thd_stream2 = truehd_channels(channel_arrangement); -+ mh->channel_layout_thd_stream2 = truehd_layout(channel_arrangement); - } else - return AVERROR_INVALIDDATA; - -@@ -316,16 +322,16 @@ static int mlp_parse(AVCodecParserContext *s, - - if (mh.stream_type == 0xbb) { - /* MLP stream */ -- avctx->channels = mlp_channels[mh.channels_mlp]; -- avctx->channel_layout = mlp_layout[mh.channels_mlp]; -+ avctx->channels = mh.channels_mlp; -+ avctx->channel_layout = mh.channel_layout_mlp; - } else { /* mh.stream_type == 0xba */ - /* TrueHD stream */ - if (mh.channels_thd_stream2) { -- avctx->channels = truehd_channels(mh.channels_thd_stream2); -- avctx->channel_layout = truehd_layout(mh.channels_thd_stream2); -+ avctx->channels = mh.channels_thd_stream2; -+ avctx->channel_layout = mh.channel_layout_thd_stream2; - } else { -- avctx->channels = truehd_channels(mh.channels_thd_stream1); -- avctx->channel_layout = truehd_layout(mh.channels_thd_stream1); -+ avctx->channels = mh.channels_thd_stream1; -+ avctx->channel_layout = mh.channel_layout_thd_stream1; - } - } - -diff --git a/libavcodec/mlp_parser.h b/libavcodec/mlp_parser.h -index 35bb312..e874426 100644 ---- a/libavcodec/mlp_parser.h -+++ b/libavcodec/mlp_parser.h -@@ -31,25 +31,28 @@ - - typedef struct MLPHeaderInfo - { -- int stream_type; ///< 0xBB for MLP, 0xBA for TrueHD -+ int stream_type; ///< 0xBB for MLP, 0xBA for TrueHD - -- int group1_bits; ///< The bit depth of the first substream -- int group2_bits; ///< Bit depth of the second substream (MLP only) -+ int group1_bits; ///< The bit depth of the first substream -+ int group2_bits; ///< Bit depth of the second substream (MLP only) - -- int group1_samplerate; ///< Sample rate of first substream -- int group2_samplerate; ///< Sample rate of second substream (MLP only) -+ int group1_samplerate; ///< Sample rate of first substream -+ int group2_samplerate; ///< Sample rate of second substream (MLP only) - -- int channels_mlp; ///< Channel arrangement for MLP streams -- int channels_thd_stream1; ///< Channel arrangement for substream 1 of TrueHD streams (5.1) -- int channels_thd_stream2; ///< Channel arrangement for substream 2 of TrueHD streams (7.1) -+ int channels_mlp; ///< Channel count for MLP streams -+ int channels_thd_stream1; ///< Channel count for substream 1 of TrueHD streams ("6-channel presentation") -+ int channels_thd_stream2; ///< Channel count for substream 2 of TrueHD streams ("8-channel presentation") -+ uint64_t channel_layout_mlp; ///< Channel layout for MLP streams -+ uint64_t channel_layout_thd_stream1; ///< Channel layout for substream 1 of TrueHD streams ("6-channel presentation") -+ uint64_t channel_layout_thd_stream2; ///< Channel layout for substream 2 of TrueHD streams ("8-channel presentation") - -- int access_unit_size; ///< Number of samples per coded frame -- int access_unit_size_pow2; ///< Next power of two above number of samples per frame -+ int access_unit_size; ///< Number of samples per coded frame -+ int access_unit_size_pow2; ///< Next power of two above number of samples per frame - -- int is_vbr; ///< Stream is VBR instead of CBR -- int peak_bitrate; ///< Peak bitrate for VBR, actual bitrate (==peak) for CBR -+ int is_vbr; ///< Stream is VBR instead of CBR -+ int peak_bitrate; ///< Peak bitrate for VBR, actual bitrate (==peak) for CBR - -- int num_substreams; ///< Number of substreams within stream -+ int num_substreams; ///< Number of substreams within stream - } MLPHeaderInfo; - - -diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c -index 3852f6e..f8c647a 100644 ---- a/libavcodec/mlpdec.c -+++ b/libavcodec/mlpdec.c -@@ -28,6 +28,7 @@ - - #include "avcodec.h" - #include "libavutil/intreadwrite.h" -+#include "libavutil/channel_layout.h" - #include "get_bits.h" - #include "internal.h" - #include "libavutil/crc.h" -@@ -56,6 +57,8 @@ typedef struct SubStream { - uint8_t max_matrix_channel; - /// For each channel output by the matrix, the output channel to map it to - uint8_t ch_assign[MAX_CHANNELS]; -+ /// The channel layout for this substream -+ uint64_t ch_layout; - - /// Channel coding parameters for channels in the substream - ChannelParams channel_params[MAX_CHANNELS]; -@@ -146,6 +149,36 @@ typedef struct MLPDecodeContext { - MLPDSPContext dsp; - } MLPDecodeContext; - -+static const uint64_t thd_channel_order[] = { -+ AV_CH_FRONT_LEFT, AV_CH_FRONT_RIGHT, // LR -+ AV_CH_FRONT_CENTER, // C -+ AV_CH_LOW_FREQUENCY, // LFE -+ AV_CH_SIDE_LEFT, AV_CH_SIDE_RIGHT, // LRs -+ AV_CH_TOP_FRONT_LEFT, AV_CH_TOP_FRONT_RIGHT, // LRvh -+ AV_CH_FRONT_LEFT_OF_CENTER, AV_CH_FRONT_RIGHT_OF_CENTER, // LRc -+ AV_CH_BACK_LEFT, AV_CH_BACK_RIGHT, // LRrs -+ AV_CH_BACK_CENTER, // Cs -+ AV_CH_TOP_CENTER, // Ts -+ AV_CH_SURROUND_DIRECT_LEFT, AV_CH_SURROUND_DIRECT_RIGHT, // LRsd -+ AV_CH_WIDE_LEFT, AV_CH_WIDE_RIGHT, // LRw -+ AV_CH_TOP_FRONT_CENTER, // Cvh -+ AV_CH_LOW_FREQUENCY_2, // LFE2 -+}; -+ -+static uint64_t thd_channel_layout_extract_channel(uint64_t channel_layout, -+ int index) -+{ -+ int i; -+ -+ if (av_get_channel_layout_nb_channels(channel_layout) <= index) -+ return 0; -+ -+ for (i = 0; i < FF_ARRAY_ELEMS(thd_channel_order); i++) -+ if (channel_layout & thd_channel_order[i] && !index--) -+ return thd_channel_order[i]; -+ return 0; -+} -+ - static VLC huff_vlc[3]; - - /** Initialize static data, constant between all invocations of the codec. */ -@@ -325,6 +358,24 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) - for (substr = 0; substr < MAX_SUBSTREAMS; substr++) - m->substream[substr].restart_seen = 0; - -+ /* Set the layout for each substream. When there's more than one, the first -+ * substream is Stereo. Subsequent substreams' layouts are indicated in the -+ * major sync. */ -+ if (m->avctx->codec_id == AV_CODEC_ID_MLP) { -+ if ((substr = (mh.num_substreams > 1))) -+ m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO; -+ m->substream[substr].ch_layout = mh.channel_layout_mlp; -+ } else { -+ if ((substr = (mh.num_substreams > 1))) -+ m->substream[0].ch_layout = AV_CH_LAYOUT_STEREO; -+ if (mh.num_substreams > 2) -+ if (mh.channel_layout_thd_stream2) -+ m->substream[2].ch_layout = mh.channel_layout_thd_stream2; -+ else -+ m->substream[2].ch_layout = mh.channel_layout_thd_stream1; -+ m->substream[substr].ch_layout = mh.channel_layout_thd_stream1; -+ } -+ - return 0; - } - -@@ -426,6 +477,12 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, - - for (ch = 0; ch <= s->max_matrix_channel; ch++) { - int ch_assign = get_bits(gbp, 6); -+ if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD) { -+ uint64_t channel = thd_channel_layout_extract_channel(s->ch_layout, -+ ch_assign); -+ ch_assign = av_get_channel_layout_channel_index(s->ch_layout, -+ channel); -+ } - if (ch_assign > s->max_matrix_channel) { - av_log_ask_for_sample(m->avctx, - "Assignment of matrix channel %d to invalid output channel %d.\n", diff --git a/contrib/ffmpeg/A05-truehd-downmix.patch b/contrib/ffmpeg/A03-truehd-downmix.patch similarity index 71% rename from contrib/ffmpeg/A05-truehd-downmix.patch rename to contrib/ffmpeg/A03-truehd-downmix.patch index 35344613f..9a9c18e13 100644 --- a/contrib/ffmpeg/A05-truehd-downmix.patch +++ b/contrib/ffmpeg/A03-truehd-downmix.patch @@ -1,8 +1,8 @@ diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c -index 3852f6e..86aecf7 100644 +index 0eaf2e3..ef1812d 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c -@@ -394,14 +394,24 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, +@@ -445,14 +445,24 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, return AVERROR_INVALIDDATA; } @@ -31,16 +31,3 @@ index 3852f6e..86aecf7 100644 } s->noise_shift = get_bits(gbp, 4); -@@ -463,8 +473,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, - cp->huff_lsbs = 24; - } - -- if (substr == m->max_decoded_substream) -- m->avctx->channels = s->max_matrix_channel + 1; -+ if (substr == m->max_decoded_substream) { -+ m->avctx->channels = s->max_matrix_channel + 1; -+ m->avctx->channel_layout = s->ch_layout; -+ } - - return 0; - } diff --git a/contrib/ffmpeg/P01-solaris.patch b/contrib/ffmpeg/P01-solaris.patch index 0a2355f91..29633e323 100644 --- a/contrib/ffmpeg/P01-solaris.patch +++ b/contrib/ffmpeg/P01-solaris.patch @@ -1,8 +1,8 @@ diff --git a/configure b/configure -index e87a326..5ccfc0f 100755 +index aa31ea0..773e6bf 100755 --- a/configure +++ b/configure -@@ -3156,7 +3156,7 @@ EOF +@@ -3167,7 +3167,7 @@ EOF check_cc <config.fate diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 85a8299fe..351b56df8 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -1,7 +1,7 @@ $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,YASM BZIP2 ZLIB)) $(eval $(call import.CONTRIB.defs,FFMPEG)) -FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v9.1.tar.bz2 +FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v9.2.tar.bz2 FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.env = diff --git a/contrib/x264/module.defs b/contrib/x264/module.defs index 7b4f62805..097f88d42 100644 --- a/contrib/x264/module.defs +++ b/contrib/x264/module.defs @@ -1,7 +1,7 @@ $(eval $(call import.MODULE.defs,X264,x264,YASM PTHREADW32)) $(eval $(call import.CONTRIB.defs,X264)) -X264.FETCH.url = http://download.handbrake.fr/handbrake/contrib/x264-r2245-bc13772.tar.gz +X264.FETCH.url = http://download.handbrake.fr/handbrake/contrib/x264-r2273-b3065e6.tar.gz X264.EXTRACT.tarbase = x264 X264.CONFIGURE.deps = diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index eb98553e3..6e494f26e 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -2826,15 +2826,21 @@ ghb_backend_events(signal_user_data_t *ud) } else { - status_str = g_strdup_printf ("Scanning title %d of %d...", + if (status.scan.preview_cur == 0) + status_str = g_strdup_printf("Scanning title %d of %d...", status.scan.title_cur, status.scan.title_count ); + else + status_str = g_strdup_printf( + "Scanning title %d of %d preview %d...", + status.scan.title_cur, status.scan.title_count, + status.scan.preview_cur); + } gtk_label_set_text (label, status_str); g_free(status_str); if (status.scan.title_count > 0) { - gtk_progress_bar_set_fraction (scan_prog, - (gdouble)status.scan.title_cur / status.scan.title_count); + gtk_progress_bar_set_fraction (scan_prog, status.scan.progress); } } else if (status.scan.state & GHB_STATE_SCANDONE) diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index bdd53c959..689c3b7e0 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3495,6 +3495,9 @@ ghb_backend_scan(const gchar *path, gint titleindex, gint preview_count, uint64_ // when computing progress hb_status.scan.title_count = 1; hb_status.scan.title_cur = 0; + hb_status.scan.preview_count = 1; + hb_status.scan.preview_cur = 0; + hb_status.scan.progress = 0; } void @@ -3563,6 +3566,9 @@ ghb_track_status() hb_status.scan.state |= GHB_STATE_SCANNING; hb_status.scan.title_count = p.title_count; hb_status.scan.title_cur = p.title_cur; + hb_status.scan.preview_count = p.preview_count; + hb_status.scan.preview_cur = p.preview_cur; + hb_status.scan.progress = p.progress; } break; #undef p @@ -3637,6 +3643,9 @@ ghb_track_status() hb_status.queue.state |= GHB_STATE_SCANNING; hb_status.queue.title_count = p.title_count; hb_status.queue.title_cur = p.title_cur; + hb_status.queue.preview_count = p.preview_count; + hb_status.queue.preview_cur = p.preview_cur; + hb_status.queue.progress = p.progress; } break; #undef p diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index e07bcb4cc..242a3e3b7 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -34,6 +34,8 @@ typedef struct // SCANNING gint title_count; gint title_cur; + gint preview_count; + gint preview_cur; // WORKING gint unique_id; diff --git a/gtk/src/main.c b/gtk/src/main.c index 9f3dc8b24..b990ec0c4 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -1082,7 +1082,7 @@ main(int argc, char *argv[]) g_idle_add((GSourceFunc)ghb_reload_queue, ud); // Start timer for monitoring libhb status, 500ms - g_timeout_add(500, ghb_timer_cb, (gpointer)ud); + g_timeout_add(200, ghb_timer_cb, (gpointer)ud); // Add dvd devices to File menu ghb_volname_cache_init(); diff --git a/libhb/common.h b/libhb/common.h index f8662271f..4d900ef0d 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -820,6 +820,9 @@ struct hb_state_s struct { /* HB_STATE_SCANNING */ + float progress; + int preview_cur; + int preview_count; int title_cur; int title_count; } scanning; diff --git a/libhb/scan.c b/libhb/scan.c index 49c092a1e..6d563f2d0 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -36,6 +36,9 @@ static void ScanFunc( void * ); static int DecodePreviews( hb_scan_t *, hb_title_t * title ); static void LookForAudio( hb_title_t * title, hb_buffer_t * b ); static int AllAudioOK( hb_title_t * title ); +static void UpdateState1(hb_scan_t *scan, int title); +static void UpdateState2(hb_scan_t *scan, int title); +static void UpdateState3(hb_scan_t *scan, int preview); static const char *aspect_to_string( double aspect ) { @@ -61,7 +64,7 @@ hb_thread_t * hb_scan_init( hb_handle_t * handle, volatile int * die, data->path = strdup( path ); data->title_index = title_index; data->title_set = title_set; - + data->preview_count = preview_count; data->store_previews = store_previews; data->min_title_duration = min_duration; @@ -97,6 +100,7 @@ static void ScanFunc( void * _data ) /* Scan all titles */ for( i = 0; i < hb_bd_title_count( data->bd ); i++ ) { + UpdateState1(data, i + 1); hb_list_add( data->title_set->list_title, hb_bd_title_scan( data->bd, i + 1, data->min_title_duration ) ); @@ -121,6 +125,7 @@ static void ScanFunc( void * _data ) /* Scan all titles */ for( i = 0; i < hb_dvd_title_count( data->dvd ); i++ ) { + UpdateState1(data, i + 1); hb_list_add( data->title_set->list_title, hb_dvd_title_scan( data->dvd, i + 1, data->min_title_duration ) ); @@ -147,6 +152,7 @@ static void ScanFunc( void * _data ) { hb_title_t * title; + UpdateState1(data, i + 1); title = hb_batch_title_scan( data->batch, i + 1 ); if ( title != NULL ) { @@ -157,7 +163,8 @@ static void ScanFunc( void * _data ) } else { - hb_title_t * title = hb_title_init( data->path, 0 ); + data->title_index = 1; + hb_title_t * title = hb_title_init( data->path, data->title_index ); if ( (data->stream = hb_stream_open( data->path, title, 1 ) ) != NULL ) { title = hb_stream_title_scan( data->stream, title ); @@ -175,7 +182,6 @@ static void ScanFunc( void * _data ) for( i = 0; i < hb_list_count( data->title_set->list_title ); ) { int j; - hb_state_t state; hb_audio_t * audio; if ( *data->die ) @@ -184,16 +190,7 @@ static void ScanFunc( void * _data ) } title = hb_list_item( data->title_set->list_title, i ); -#define p state.param.scanning - /* Update the UI */ - state.state = HB_STATE_SCANNING; - p.title_cur = title->index; - p.title_count = data->dvd ? hb_dvd_title_count( data->dvd ) : - data->bd ? hb_bd_title_count( data->bd ) : - data->batch ? hb_batch_title_count( data->batch ) : - hb_list_count(data->title_set->list_title); - hb_set_state( data->h, &state ); -#undef p + UpdateState2(data, i + 1); /* Decode previews */ /* this will also detect more AC3 / DTS information */ @@ -535,6 +532,8 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title ) { int j; + UpdateState3(data, i + 1); + if ( *data->die ) { free( info_list ); @@ -793,6 +792,8 @@ skip_preview: hb_buffer_close( &vid_buf ); } } + UpdateState3(data, i); + vid_decoder->close( vid_decoder ); free( vid_decoder ); @@ -1085,3 +1086,60 @@ static int AllAudioOK( hb_title_t * title ) } return 1; } + +static void UpdateState1(hb_scan_t *scan, int title) +{ + hb_state_t state; + +#define p state.param.scanning + /* Update the UI */ + state.state = HB_STATE_SCANNING; + p.title_cur = title; + p.title_count = scan->dvd ? hb_dvd_title_count( scan->dvd ) : + scan->bd ? hb_bd_title_count( scan->bd ) : + scan->batch ? hb_batch_title_count( scan->batch ) : + hb_list_count(scan->title_set->list_title); + p.preview_cur = 0; + p.preview_count = 1; + p.progress = 0.5 * ((float)p.title_cur + ((float)p.preview_cur / p.preview_count)) / p.title_count; +#undef p + + hb_set_state(scan->h, &state); +} + +static void UpdateState2(hb_scan_t *scan, int title) +{ + hb_state_t state; + +#define p state.param.scanning + /* Update the UI */ + state.state = HB_STATE_SCANNING; + p.title_cur = title; + p.title_count = hb_list_count( scan->title_set->list_title ); + p.preview_cur = 1; + p.preview_count = scan->preview_count; + if (scan->title_index) + p.progress = (float)p.title_cur / p.title_count; + else + p.progress = 0.5 + 0.5 * (float)p.title_cur / p.title_count; +#undef p + + hb_set_state(scan->h, &state); +} + +static void UpdateState3(hb_scan_t *scan, int preview) +{ + hb_state_t state; + + hb_get_state2(scan->h, &state); +#define p state.param.scanning + p.preview_cur = preview; + p.preview_count = scan->preview_count; + if (scan->title_index) + p.progress = ((float)p.title_cur - 1 + ((float)p.preview_cur / p.preview_count)) / p.title_count; + else + p.progress = 0.5 + 0.5 * ((float)p.title_cur - 1 + ((float)p.preview_cur / p.preview_count)) / p.title_count; +#undef p + + hb_set_state(scan->h, &state); +} diff --git a/macosx/Controller.m b/macosx/Controller.m index 61a77076c..9506bde0f 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -861,12 +861,22 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It #define p s.param.scanning case HB_STATE_SCANNING: { - [fSrcDVD2Field setStringValue: [NSString stringWithFormat: - NSLocalizedString( @"Scanning title %d of %d…", @"" ), - p.title_cur, p.title_count]]; + if( p.preview_cur ) + { + [fSrcDVD2Field setStringValue: [NSString stringWithFormat: + NSLocalizedString( @"Scanning title %d of %d, preview %d…", @"" ), + p.title_cur, p.title_count, + p.preview_cur]]; + } + else + { + [fSrcDVD2Field setStringValue: [NSString stringWithFormat: + NSLocalizedString( @"Scanning title %d of %d…", @"" ), + p.title_cur, p.title_count]]; + } [fScanIndicator setHidden: NO]; [fScanHorizontalLine setHidden: YES]; - [fScanIndicator setDoubleValue: 100.0 * ((double)( p.title_cur - 1 ) / p.title_count)]; + [fScanIndicator setDoubleValue: 100.0 * p.progress]; break; } #undef p @@ -935,14 +945,23 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It #define p s.param.scanning case HB_STATE_SCANNING: { - [fStatusField setStringValue: [NSString stringWithFormat: - NSLocalizedString( @"Queue Scanning title %d of %d…", @"" ), - p.title_cur, p.title_count]]; + NSString *scan_status; + if( p.preview_cur ) + { + scan_status = [NSString stringWithFormat: + NSLocalizedString( @"Queue Scanning title %d of %d, preview %d…", @"" ), + p.title_cur, p.title_count, p.preview_cur]; + } + else + { + scan_status = [NSString stringWithFormat: + NSLocalizedString( @"Queue Scanning title %d of %d…", @"" ), + p.title_cur, p.title_count]; + } + [fStatusField setStringValue: scan_status]; - /* Set the status string in fQueueController as well */ - [fQueueController setQueueStatusString: [NSString stringWithFormat: - NSLocalizedString( @"Queue Scanning title %d of %d…", @"" ), - p.title_cur, p.title_count]]; + /* Set the status string in fQueueController as well */ + [fQueueController setQueueStatusString: scan_status]; break; } #undef p @@ -968,14 +987,19 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It /* Update text field */ pass_desc = @""; - //string = [NSMutableString stringWithFormat: NSLocalizedString( @"Searching for start point: pass %d %@ of %d, %.2f %%", @"" ), p.job_cur, pass_desc, p.job_count, 100.0 * p.progress]; + //string = [NSMutableString stringWithFormat: + // NSLocalizedString( @"Searching for start point: pass %d %@ of %d, %.2f %%", @"" ), + // p.job_cur, pass_desc, p.job_count, 100.0 * p.progress]; /* For now, do not announce "pass x of x for the search phase */ - string = [NSMutableString stringWithFormat: NSLocalizedString( @"Searching for start point… : %.2f %%", @"" ), 100.0 * p.progress]; + string = [NSMutableString stringWithFormat: + NSLocalizedString( @"Searching for start point… : %.2f %%", @"" ), + 100.0 * p.progress]; - if( p.seconds > -1 ) + if( p.seconds > -1 ) { [string appendFormat: - NSLocalizedString( @" (ETA %02dh%02dm%02ds)", @"" ), p.hours, p.minutes, p.seconds]; + NSLocalizedString( @" (ETA %02dh%02dm%02ds)", @"" ), + p.hours, p.minutes, p.seconds]; } [fStatusField setStringValue: string]; @@ -1032,14 +1056,20 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It if ([pass_desc length]) { - string = [NSMutableString stringWithFormat: NSLocalizedString( @"Encoding: %@ \nPass %d %@ of %d, %.2f %%", @"" ), currentQueueEncodeNameString, p.job_cur, pass_desc, p.job_count, 100.0 * p.progress]; + string = [NSMutableString stringWithFormat: + NSLocalizedString( @"Encoding: %@ \nPass %d %@ of %d, %.2f %%", @"" ), + currentQueueEncodeNameString, + p.job_cur, pass_desc, p.job_count, 100.0 * p.progress]; } else { - string = [NSMutableString stringWithFormat: NSLocalizedString( @"Encoding: %@ \nPass %d of %d, %.2f %%", @"" ), currentQueueEncodeNameString, p.job_cur, p.job_count, 100.0 * p.progress]; + string = [NSMutableString stringWithFormat: + NSLocalizedString( @"Encoding: %@ \nPass %d of %d, %.2f %%", @"" ), + currentQueueEncodeNameString, + p.job_cur, p.job_count, 100.0 * p.progress]; } - if( p.seconds > -1 ) + if( p.seconds > -1 ) { if ( p.rate_cur > 0.0 ) { @@ -1947,7 +1977,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It if (status == NSAlertDefaultReturn) { /* User chose to go download vlc (as they rightfully should) so we send them to the vlc site */ - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://download.videolan.org/libdvdcss/last/macosx/"]]; + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://download.videolan.org/libdvdcss/1.2.12/macosx/"]]; } else if (status == NSAlertAlternateReturn) { diff --git a/test/test.c b/test/test.c index d13ec7b2f..60b1b8c47 100644 --- a/test/test.c +++ b/test/test.c @@ -600,10 +600,17 @@ static int HandleEvents( hb_handle_t * h ) #define p s.param.scanning case HB_STATE_SCANNING: /* Show what title is currently being scanned */ - fprintf( stderr, "Scanning title %d", p.title_cur ); - if( !titleindex || titlescan ) - fprintf( stderr, " of %d", p.title_count ); - fprintf( stderr, "...\n" ); + if (p.preview_cur) + { + fprintf(stdout, "\rScanning title %d of %d, preview %d, %.2f %%", + p.title_cur, p.title_count, p.preview_cur, 100 * p.progress); + } + else + { + fprintf(stdout, "\rScanning title %d of %d, %.2f %%", + p.title_cur, p.title_count, 100 * p.progress); + } + fflush(stdout); break; #undef p