@@ -1648,7 +1648,7 @@ bool load_images_from_dir(const std::string dir,
16481648 return true ;
16491649}
16501650
1651- const char * preview_path;
1651+ std::string preview_path;
16521652float preview_fps;
16531653
16541654void step_callback (int step, int frame_count, sd_image_t * image, bool is_noisy) {
@@ -1657,16 +1657,16 @@ void step_callback(int step, int frame_count, sd_image_t* image, bool is_noisy)
16571657 // is_noisy is set to true if the preview corresponds to noisy latents, false if it's denoised latents
16581658 // unused in this app, it will either be always noisy or always denoised here
16591659 if (frame_count == 1 ) {
1660- stbi_write_png (preview_path, image->width , image->height , image->channel , image->data , 0 );
1660+ stbi_write_png (preview_path. c_str () , image->width , image->height , image->channel , image->data , 0 );
16611661 } else {
1662- create_mjpg_avi_from_sd_images (preview_path, image, frame_count, preview_fps);
1662+ create_mjpg_avi_from_sd_images (preview_path. c_str () , image, frame_count, preview_fps);
16631663 }
16641664}
16651665
16661666int main (int argc, const char * argv[]) {
16671667 SDParams params;
16681668 parse_args (argc, argv, params);
1669- preview_path = params.preview_path . c_str () ;
1669+ preview_path = params.preview_path ;
16701670 if (params.video_frames > 4 ) {
16711671 size_t last_dot_pos = params.preview_path .find_last_of (" ." );
16721672 std::string base_path = params.preview_path ;
@@ -1677,8 +1677,7 @@ int main(int argc, const char* argv[]) {
16771677 std::transform (file_ext.begin (), file_ext.end (), file_ext.begin (), ::tolower);
16781678 }
16791679 if (file_ext == " .png" ) {
1680- base_path = base_path + " .avi" ;
1681- preview_path = base_path.c_str ();
1680+ preview_path = base_path + " .avi" ;
16821681 }
16831682 }
16841683 preview_fps = params.fps ;
0 commit comments