Difference between revisions of "Truxton media destroy"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This frees any resources allocated to this media object. You can use this to add to the <code>Media</code> table in the database. =Syntax= <syntaxhighlight lang="C"> uint64_t...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This frees any resources allocated to this media object.
 
This frees any resources allocated to this media object.
You can use this to add to the <code>Media</code> table in the database.
+
You can use this to add to the <code><nowiki>[</nowiki>[[Media Table|Media]]<nowiki>]</nowiki></code> table in the database.
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
uint64_t truxton_media_destroy(uint64_t truxton_handle);
+
void truxton_media_destroy( uint64_t media );
</syntaxhighlight>
+
</source >
  
 
=Parameters=
 
=Parameters=
==<code>truxton_handle</code>==
+
==<code>media</code>==
 
The Truxton instance this file type will belong.
 
The Truxton instance this file type will belong.
 
This handle comes from calling <code>[[truxton_create]]()</code>.
 
This handle comes from calling <code>[[truxton_create]]()</code>.
 
=Return value=
 
A handle to a media object.
 
  
 
=Sample=
 
=Sample=
<syntaxhighlight lang="C" highlight="5">
+
<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 41: 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]].

Latest revision as of 07:37, 3 February 2024

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.