Difference between revisions of "Truxton file create exif"

From truxwiki.com
Jump to navigation Jump to search
 
Line 21: Line 21:
 
=Sample=
 
=Sample=
 
<source lang="C" highlight="5">
 
<source lang="C" highlight="5">
void process_file(uint64_t truxton)
+
void process_file( uint64_t truxton )
 
{
 
{
   uint64_t file = truxton_file_open_md5(truxton, "9ec8fb6095c35eff2b236863b7caaf10");
+
   uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" );
  
   uint64_t exif = truxton_file_create_exif(file);
+
   uint64_t exif = truxton_file_create_exif( file );
  
   truxton_exif_set_make(exif, "Ford");
+
   truxton_exif_set_make( exif, "Ford" );
   truxton_exif_set_model(exif, "Mustang");
+
   truxton_exif_set_model( exif, "Mustang" );
   truxton_exif_set_device_time(exif, truxton_file_get_modified( file ) );
+
   truxton_exif_set_device_time( exif, truxton_file_get_modified( file ) );
   truxton_exif_set_latitude(exif, 27.94999);
+
   truxton_exif_set_latitude( exif, 27.94999 );
   truxton_exif_set_longitude(exif, -82.354748);
+
   truxton_exif_set_longitude( exif, -82.354748 );
   truxton_exif_save(exif);
+
   truxton_exif_save( exif );
   truxton_exif_destroy(exif);
+
   truxton_exif_destroy( exif );
  
   truxton_file_free(file);
+
   truxton_file_free( file );
 
}
 
}
 
</source>
 
</source>

Latest revision as of 04:56, 13 February 2021

This creates an EXIF object sourced from this file that you can use in the EXIF API. An EXIF object is how you add records to the [EXIF] table. The resulting EXIF object will automatically be associated with the file it was created from and with the media the file belongs to.

Note: Not all camera information comes from EXIF sections. Camera information can be exploited from anywhere in the file but the meta data will be stored in the [EXIF] table. XMP is an example of this.

Syntax

uint64_t truxton_file_create_exif( uint64_t file_handle );

Parameters

file_handle

The handle created by the truxton_file_open_id or truxton_file_open_md5 call.

Return value

A handle to an EXIF object.

Sample

void process_file( uint64_t truxton )
{
   uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" );

   uint64_t exif = truxton_file_create_exif( file );

   truxton_exif_set_make( exif, "Ford" );
   truxton_exif_set_model( exif, "Mustang" );
   truxton_exif_set_device_time( exif, truxton_file_get_modified( file ) );
   truxton_exif_set_latitude( exif, 27.94999 );
   truxton_exif_set_longitude( exif, -82.354748 );
   truxton_exif_save( exif );
   truxton_exif_destroy( exif );

   truxton_file_free( file );
}