]> git.sesse.net Git - mlt/commitdiff
Merge branch 'master' of dennedy.org:git/mltframework.org/mlt
authorDan Dennedy <dan@dennedy.org>
Mon, 15 Feb 2010 04:18:43 +0000 (20:18 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 15 Feb 2010 04:18:43 +0000 (20:18 -0800)
1  2 
src/framework/mlt_frame.c

index 56efe98b932970258c392ae02751c6b155a4c891,976cecf0e7d37a1903b617a72ae1a2a9f6582a49..6ca882428dd844247da123458961f8613756aa79
@@@ -387,11 -387,19 +387,19 @@@ int mlt_frame_get_image( mlt_frame this
        {
                mlt_properties_set_int( properties, "image_count", mlt_properties_get_int( properties, "image_count" ) - 1 );
                error = get_image( this, buffer, format, width, height, writable );
-               mlt_properties_set_int( properties, "width", *width );
-               mlt_properties_set_int( properties, "height", *height );
-               mlt_properties_set_int( properties, "format", *format );
-               if ( this->convert_image )
-                       this->convert_image( this, buffer, format, requested_format );
+               if ( !error )
+               {
+                       mlt_properties_set_int( properties, "width", *width );
+                       mlt_properties_set_int( properties, "height", *height );
+                       mlt_properties_set_int( properties, "format", *format );
+                       if ( this->convert_image )
+                               this->convert_image( this, buffer, format, requested_format );
+               }
+               else
+               {
+                       // Cause the image to be loaded from test card or fallback (white) below.
+                       mlt_frame_get_image( this, buffer, format, width, height, writable );
+               }
        }
        else if ( mlt_properties_get_data( properties, "image", NULL ) )
        {
@@@ -783,15 -791,28 +791,15 @@@ void mlt_frame_close( mlt_frame this 
  
  int mlt_sample_calculator( float fps, int frequency, int64_t position )
  {
 -      int samples = 0;
 -
 -      if ( fps )
 -      {
 -              /* Compute the cumulative number of samples until the start of this frame and the
 -              cumulative number of samples until the start of the next frame. Round each to the
 -              nearest integer and take the difference to determine the number of samples in
 -              this frame.
 -
 -              This approach should prevent rounding errors that can accumulate over a large number
 -              of frames causing A/V sync problems. */
 -
 -              int64_t samples_at_this =
 -                      (int64_t)( (double) position * (double) frequency / (double) fps +
 -                      ( position < 0 ? -0.5 : 0.5 ) );
 -              int64_t samples_at_next =
 -                      (int64_t)( (double) (position + 1) * (double) frequency / (double) fps +
 -                      ( position < 0 ? -0.5 : 0.5 ) );
 -              samples = (int)( samples_at_next - samples_at_this );
 -      }
 -
 -      return samples;
 +      /* Compute the cumulative number of samples until the start of this frame and the
 +      cumulative number of samples until the start of the next frame. Round each to the
 +      nearest integer and take the difference to determine the number of samples in
 +      this frame.
 +
 +      This approach should prevent rounding errors that can accumulate over a large number
 +      of frames causing A/V sync problems. */
 +      return mlt_sample_calculator_to_now( fps, frequency, position )
 +               - mlt_sample_calculator_to_now( fps, frequency, position + 1 );
  }
  
  /** Determine the number of samples that belong before a time position.
   * \bug Will this break when mlt_position is converted to double?
   */
  
 -int64_t mlt_sample_calculator_to_now( float fps, int frequency, int64_t position )
 +inline int64_t mlt_sample_calculator_to_now( float fps, int frequency, int64_t position )
  {
        int64_t samples = 0;