Difference between revisions of "Truxton media destroy"

From truxwiki.com
Jump to navigation Jump to search
Line 3: Line 3:
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
void truxton_media_destroy(uint64_t media);
+
void truxton_media_destroy( uint64_t media );
</syntaxhighlight>
+
</source >
  
 
=Parameters=
 
=Parameters=
Line 13: Line 13:
  
 
=Sample=
 
=Sample=
<syntaxhighlight lang="C" highlight="25">
+
<source lang="C" highlight="25">
void create_media(void)
+
void create_media( void )
 
{
 
{
 
   uint64_t truxton = truxton_create();
 
   uint64_t truxton = truxton_create();
  
   uint64_t media = truxton_media_create(truxton);
+
   uint64_t media = truxton_media_create( truxton );
  
 
   truxton_media_set_name( media, "Ducky Momo Server" );
 
   truxton_media_set_name( media, "Ducky Momo Server" );
Line 38: Line 38:
 
   printf( "Media ID is %s\n", id );
 
   printf( "Media ID is %s\n", id );
  
   truxton_media_destroy(media);
+
   truxton_media_destroy( media );
   truxton_destroy(truxton);
+
   truxton_destroy( truxton );
 
}
 
}
</syntaxhighlight>
+
</source >
  
 
=Remarks=
 
=Remarks=
 
By default, when this API is called the identifier for the media will be generated, the created and last updated timestamps will be set to the current time, the expiration date set to 99 years from now, the percent complete set to 100 and the status set to [[Media Status | loaded]].
 
By default, when this API is called the identifier for the media will be generated, the created and last updated timestamps will be set to the current time, the expiration date set to 99 years from now, the percent complete set to 100 and the status set to [[Media Status | loaded]].

Revision as of 23:38, 9 February 2021

This frees any resources allocated to this media object. You can use this to add to the [Media] table in the database.

Syntax

void truxton_media_destroy( uint64_t media );

Parameters

media

The Truxton instance this file type will belong. This handle comes from calling truxton_create().

Sample

void create_media( void )
{
   uint64_t truxton = truxton_create();

   uint64_t media = truxton_media_create( truxton );

   truxton_media_set_name( media, "Ducky Momo Server" );
   truxton_media_set_description( media, "Original plans for I Hate People plate" );
   truxton_media_set_case_number( media, "PNF-S02E30");
   truxton_media_set_originator( media, "Provenmire and Marsh" );
   truxton_media_set_evidence_bag( media, "EVINC-20100709" );
   truxton_media_set_type( media, MEDIA_TYPE_HARD_DISK_IMAGE );
   truxton_media_set_size( media, 100 * ONE_GIGABYTE );
   truxton_media_set_latitude( media, -17.60978782 );
   truxton_media_set_longitude( media, 177.0342855299 );
   truxton_media_save( media );
   truxton_media_tag( media, "Too Young", "Yes, yes I am", 1 );

   char id[ 65 ];

   truxton_media_get_id( media, id, sizeof( id ) );

   printf( "Media ID is %s\n", id );

   truxton_media_destroy( media );
   truxton_destroy( truxton );
}

Remarks

By default, when this API is called the identifier for the media will be generated, the created and last updated timestamps will be set to the current time, the expiration date set to 99 years from now, the percent complete set to 100 and the status set to loaded.