OSDN Git Service

added HB_STATE_MUXING to hb_state_s and corresponding structure.
authorjohnallen <johnallen@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 7 Jan 2007 15:34:07 +0000 (15:34 +0000)
committerjohnallen <johnallen@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 7 Jan 2007 15:34:07 +0000 (15:34 +0000)
this state indicates the transition from the end of HB_STATE_WORKING to the beginning of HB_STATE_WORKDONE.
This state can take as long a 10 minutes on a long conversion.
The associated working structure contains a progress float.
Once we determine how to get a proper progress from the call to av_write_trailer in libavformat, we can update this progress.
HB, IHB, and HBTest are now using using HB_STATE_MUXING to provided feedback to the user.

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

libhb/common.h
libhb/muxcommon.c
macosx/Controller.mm
macosx/ExpressController.m
test/test.c

index eba152f..0e53dde 100644 (file)
@@ -289,6 +289,7 @@ struct hb_state_s
 #define HB_STATE_WORKING  8
 #define HB_STATE_PAUSED   16
 #define HB_STATE_WORKDONE 32
+#define HB_STATE_MUXING   64
     int state;
 
     union
@@ -322,6 +323,11 @@ struct hb_state_s
             int error;
         } workdone;
 
+        struct
+        {
+            /* HB_STATE_MUXING */
+            float progress;
+        } muxing;
     } param;
 };
 
index 93fa773..f1723cc 100644 (file)
@@ -158,6 +158,13 @@ static void MuxerFunc( void * _mux )
         struct stat sb;
         uint64_t bytes_total, frames_total;
 
+#define p state.param.muxing
+        /* Update the UI */
+        hb_state_t state;
+        state.state   = HB_STATE_MUXING;
+               p.progress = 0;
+        hb_set_state( job->h, &state );
+#undef p
         m->end( m );
 
         if( !stat( job->file, &sb ) )
index a38d0d0..a2e872a 100644 (file)
@@ -350,6 +350,31 @@ static int FormatSettings[3][4] =
         }
 #undef p
 
+#define p s.param.muxing
+        case HB_STATE_MUXING:
+        {
+            float progress_total;
+            NSMutableString * string;
+                       
+            /* Update text field */
+            string = [NSMutableString stringWithFormat:
+                _( @"Muxing: %.2f %%" ), 100.0 * p.progress];
+            [fStatusField setStringValue: string];
+                       
+            /* Update slider */
+            [fRipIndicator setDoubleValue: 100.0 * p.progress];
+                       
+            /* Update dock icon */
+            [self UpdateDockIcon: 100.0 * p.progress];
+                       
+            [fPauseButton setEnabled: YES];
+            [fPauseButton setTitle: _( @"Pause" )];
+            [fRipButton setEnabled: YES];
+            [fRipButton setTitle: _( @"Cancel" )];
+            break;
+        }
+#undef p
+                       
         case HB_STATE_PAUSED:
             [fStatusField setStringValue: _( @"Paused" )];
             [fPauseButton setEnabled: YES];
index ec2ce5d..d5d1744 100644 (file)
             }
             [fConvertInfoString setStringValue: string];
             [fConvertIndicator setIndeterminate: NO];
+            [fConvertIndicator setDoubleValue: 100.0 * progress_total];
+            break;
+        }
+#undef p
+
+#define p s.param.muxing
+        case HB_STATE_MUXING:
+        {
+            NSMutableString * string = [NSMutableString
+                stringWithFormat: @"Muxing: %.1f %%",
+                100.0 * p.progress];
+            [fConvertInfoString setStringValue: string];
+            [fConvertIndicator setIndeterminate: NO];
             [fConvertIndicator setDoubleValue: 100.0 * p.progress];
             break;
         }
index 9d65430..33fec15 100644 (file)
@@ -447,6 +447,14 @@ static int HandleEvents( hb_handle_t * h )
             break;
 #undef p
 
+#define p s.param.muxing
+        case HB_STATE_MUXING:
+        {
+            fprintf( stderr, "\rMuxing: %.2f %%", 100.0 * p.progress );
+            break;
+        }
+#undef p
+
 #define p s.param.workdone
         case HB_STATE_WORKDONE:
             /* Print error if any, then exit */