[Hdrflow-svn] SF.net SVN: hdrflow: [297] trunk/lib/extras/src/raw
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-09-06 22:34:33
|
Revision: 297
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=297&view=rev
Author: glslang
Date: 2007-09-06 15:34:31 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
+ writes output to temp
Modified Paths:
--------------
trunk/lib/extras/src/raw/dcraw.c
trunk/lib/extras/src/raw/raw.cpp
Modified: trunk/lib/extras/src/raw/dcraw.c
===================================================================
--- trunk/lib/extras/src/raw/dcraw.c 2007-09-05 22:20:13 UTC (rev 296)
+++ trunk/lib/extras/src/raw/dcraw.c 2007-09-06 22:34:31 UTC (rev 297)
@@ -7407,9 +7407,7 @@
#ifndef NO_LCMS
char *cam_profile=0, *out_profile=0;
#endif
- char tempdir[ BUFSIZ ];
- DWORD dw;
-
+
#ifndef LOCALTIME
putenv ("TZ=UTC");
#endif
@@ -7457,7 +7455,7 @@
puts("");
return 1;
}
- argv[argc] = "";
+ //argv[argc] = "";
for (arg=1; argv[arg][0] == '-'; ) {
opt = argv[arg++][1];
if ((cp = strchr (sp="nbrktqsHA", opt)))
@@ -7503,6 +7501,7 @@
case 'm': output_color = 0; break;
case 'T': output_tiff = 1; break;
case '4': output_bps = 16; break;
+ case 'Z': ofname = argv[arg++]; break;
default:
fprintf (stderr,_("Unknown option \"-%c\".\n"), opt);
return 1;
@@ -7528,7 +7527,7 @@
status = 1;
image = 0;
oprof = 0;
- meta_data = ofname = 0;
+ meta_data = 0;
if (setjmp (failure)) {
if (fileno(ifp) > 2) fclose(ifp);
if (fileno(ofp) > 2) fclose(ofp);
@@ -7696,24 +7695,15 @@
write_ext = ".tiff";
else
write_ext = ".pgm\0.ppm\0.ppm\0.pam" + colors*5-5;
-#ifdef WIN32
- dw = GetTempPath(BUFSIZ, tempdir);
- if( dw > BUFSIZ || dw == 0 )
- return 2;
-#else
- tempdir = "/var/tmp";
-#endif
- ofname = (char *) malloc (strlen(ifname) + strlen(tempdir)+ 16);
- merror (ofname, "main()");
if (write_to_stdout)
strcpy (ofname,_("standard output"));
else {
- strcpy (ofname, tempdir);
- strcat (ofname, ifname);
- if ((cp = strrchr (ofname, '.'))) *cp = 0;
- if (thumbnail_only)
- strcat (ofname, ".thumb");
- strcat (ofname, write_ext);
+// strcpy (ofname, tempdir);
+// strcat (ofname, ifname);
+// if ((cp = strrchr (ofname, '.'))) *cp = 0;
+// if (thumbnail_only)
+// strcat (ofname, ".thumb");
+// strcat (ofname, write_ext);
ofp = fopen (ofname, "wb");
if (!ofp) {
status = 1;
@@ -7728,7 +7718,7 @@
if (ofp != stdout) fclose(ofp);
cleanup:
if (meta_data) free (meta_data);
- if (ofname) free (ofname);
+ //if (ofname) free (ofname);
if (oprof) free (oprof);
if (image) free (image);
}
Modified: trunk/lib/extras/src/raw/raw.cpp
===================================================================
--- trunk/lib/extras/src/raw/raw.cpp 2007-09-05 22:20:13 UTC (rev 296)
+++ trunk/lib/extras/src/raw/raw.cpp 2007-09-06 22:34:31 UTC (rev 297)
@@ -52,33 +52,22 @@
pl::string linear_output = properties.get_property_with_key( pcos::key::from_string( "linear_output" ) ).value<pl::string>( );
pl::string tiff = properties.get_property_with_key( pcos::key::from_string( "tiff_output" ) ).value<pl::string>( );
pl::string path = properties.get_property_with_key( pcos::key::from_string( "path" ) ).value<pl::string>( );
+ pl::string output_path = properties.get_property_with_key( pcos::key::from_string( "output_path" ) ).value<pl::string>( );
std::vector<const char*> args;
args.push_back( "dcraw" );
args.push_back( linear_output.c_str( ) );
args.push_back( tiff.c_str( ) );
+ args.push_back( "-Z" );
+ args.push_back( output_path.c_str( ) );
args.push_back( path.c_str( ) );
if( dcraw_( static_cast<int>( args.size( ) ), const_cast<char**>( &args[ 0 ] ) ) )
return il::image_type_ptr( );
- pl::string tempdir;
-#ifdef WIN32
- TCHAR wtempdir[ BUFSIZ ];
- DWORD dw = GetTempPath(BUFSIZ, wtempdir);
- if( dw > BUFSIZ || dw == 0 )
- return il::image_type_ptr( );
- tempdir = pl::to_string( wtempdir );
-#else
- tempdir = "/var/tmp";
-#endif
-
- pl::string pathname( path.begin( ), path.begin( ) + path.find_last_of( "." ) );
- pathname = pl::string( tempdir ) + pathname + ".tiff";
+ typedef pl::discovery<query_traits> discovery;
- typedef pl::discovery<query_traits> discovery;
-
- discovery plugins( query_traits( pl::to_wstring( pathname ) ) );
+ discovery plugins( query_traits( pl::to_wstring( output_path ) ) );
if( plugins.empty( ) )
return il::image_type_ptr( );
@@ -86,7 +75,7 @@
{
il::openimagelib_plugin_ptr plug = boost::shared_dynamic_cast<il::openimagelib_plugin>( i->create_plugin( "" ) );
if( plug )
- return plug->load( pl::make_stream( pathname, std::ios::in ) );
+ return plug->load( pl::make_stream( output_path, std::ios::in ) );
}
return il::image_type_ptr( );
@@ -118,6 +107,7 @@
, linear_output_( pcos::key::from_string( "linear_output" ) )
, tiff_output_( pcos::key::from_string( "tiff_output" ) )
, path_( pcos::key::from_string( "path" ) )
+ , output_path_( pcos::key::from_string( "output_path" ) )
{
set_raw_properties( );
}
@@ -155,6 +145,18 @@
raw_props_.append( linear_output_ = pl::string( "-4" ) );
raw_props_.append( tiff_output_ = pl::string( "-T" ) );
raw_props_.append( path_ = pl::string( "" ) );
+
+ pl::string tempdir;
+#ifdef WIN32
+ TCHAR wtempdir[ BUFSIZ ];
+ DWORD dw = GetTempPath(BUFSIZ, wtempdir);
+ if( !( dw > BUFSIZ || dw == 0 ) )
+ tempdir = pl::to_string( wtempdir );
+#else
+ tempdir = "/var/tmp/";
+#endif
+
+ raw_props_.append( output_path_ = tempdir + pl::string( "hdrflow_extras_raw_.tiff" ) );
}
private:
@@ -180,6 +182,7 @@
pcos::property linear_output_;
pcos::property tiff_output_;
pcos::property path_;
+ pcos::property output_path_;
};
} } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|