#define NESTEGG_TRACK_VIDEO 0/**< Track is of type video. */ #define NESTEGG_TRACK_AUDIO 1/**< Track is of type audio. */ #define NESTEGG_TRACK_UNKNOWN INT_MAX /**< Track is of type unknown. */
#define NESTEGG_SEEK_SET 0/**< Seek offset relative to beginning of stream. */ #define NESTEGG_SEEK_CUR 1/**< Seek offset relative to current position in stream. */ #define NESTEGG_SEEK_END 2/**< Seek offset relative to end of stream. */
#define NESTEGG_ENCODING_COMPRESSION 0/**< Content encoding type is compression. */ #define NESTEGG_ENCODING_ENCRYPTION 1/**< Content encoding type is encryption. */
#define NESTEGG_PACKET_HAS_SIGNAL_BYTE_FALSE 0/**< Packet does not have signal byte */ #define NESTEGG_PACKET_HAS_SIGNAL_BYTE_UNENCRYPTED 1/**< Packet has signal byte and is unencrypted */ #define NESTEGG_PACKET_HAS_SIGNAL_BYTE_ENCRYPTED 2/**< Packet has signal byte and is encrypted */ #define NESTEGG_PACKET_HAS_SIGNAL_BYTE_PARTITIONED 4/**< Packet has signal byte and is partitioned */
#define NESTEGG_PACKET_HAS_KEYFRAME_FALSE 0/**< Packet contains only keyframes. */ #define NESTEGG_PACKET_HAS_KEYFRAME_TRUE 1/**< Packet does not contain any keyframes */ #define NESTEGG_PACKET_HAS_KEYFRAME_UNKNOWN 2/**< Packet may or may not contain keyframes */
typedefstruct nestegg nestegg; /**< Opaque handle referencing the stream state. */ typedefstruct nestegg_packet nestegg_packet; /**< Opaque handle referencing a packet of data. */
/** User supplied pointer to be passed to the IO callbacks. */ void * userdata;
} nestegg_io;
/** Parameters specific to a video track. */ typedefstruct { unsignedint stereo_mode; /**< Video mode. One of #NESTEGG_VIDEO_MONO, #NESTEGG_VIDEO_STEREO_LEFT_RIGHT, #NESTEGG_VIDEO_STEREO_BOTTOM_TOP,or
#NESTEGG_VIDEO_STEREO_TOP_BOTTOM. */ unsignedint width; /**< Width of the video frame in pixels. */ unsignedint height; /**< Height of the video frame in pixels. */ unsignedint display_width; /**< Display width of the video frame in pixels. */ unsignedint display_height; /**< Display height of the video frame in pixels. */ unsignedint crop_bottom; /**< Pixels to crop from the bottom of the frame. */ unsignedint crop_top; /**< Pixels to crop from the top of the frame. */ unsignedint crop_left; /**< Pixels to crop from the left of the frame. */ unsignedint crop_right; /**< Pixels to crop from the right of the frame. */ unsignedint alpha_mode; /**< 1 if an additional opacity stream is available, otherwise 0. */ unsignedint matrix_coefficients; /**< See Table 4 of ISO/IEC 23001-8:2016. */ unsignedint range; /**< Clipping of color ranges. */ unsignedint transfer_characteristics; /**< See Table 3 of ISO/IEC 23091-4. */ unsignedint primaries; /**< See Table 2 of ISO/IEC 23091-4. */ double primary_r_chromacity_x; /**< Red X chromaticity coordinate per CIE 1931.
NaN means element not present. */ double primary_r_chromacity_y; /**< Red Y chromaticity coordinate per CIE 1931.
NaN means element not present. */ double primary_g_chromacity_x; /**< Green X chromaticity coordinate per CIE 1931.
NaN means element not present. */ double primary_g_chromacity_y; /**< Green Y chromaticity coordinate per CIE 1931.
NaN means element not present. */ double primary_b_chromacity_x; /**< Blue X chromaticity coordinate per CIE 1931.
NaN means element not present. */ double primary_b_chromacity_y; /**< Blue Y chromaticity coordinate per CIE 1931.
NaN means element not present. */ double white_point_chromaticity_x; /**< White X chromaticity coordinate per CIE 1931.
NaN means element not present. */ double white_point_chromaticity_y; /**< White Y chromaticity coordinate per CIE 1931.
NaN means element not present. */ double luminance_max; /**< Maximum luminance in cd/m2.
NaN means element not present. */ double luminance_min; /**< Minimum luminance in cd/m2.
NaN means element not present. */ unsignedint max_cll; /**< Maximum Content Light Level in cd/m2.
0 means element not present. */ unsignedint max_fall; /**< Maximum Frame-Average Light Level in cd/m2.
0 means element not present. */ unsignedint projection_type; /**< Projection type. One of #NESTEGG_VIDEO_PROJECTION_RECTANGULAR, #NESTEGG_VIDEO_PROJECTION_EQUIRECTANGULAR, #NESTEGG_VIDEO_PROJECTION_CUBEMAP,or
#NESTEGG_VIDEO_PROJECTION_MESH. */ double projection_pose_yaw; /**< Specifies a yaw rotation to the projection.
Value represents a clockwise rotation, in degrees, around the up vector. */ double projection_pose_pitch; /**< Specifies a pitch rotation to the projection.
Value represents a counter-clockwise rotation, in degrees, around the right vector. */ double projection_pose_roll; /**< Specifies a roll rotation to the projection.
Value represents a counter-clockwise rotation, in degrees, around the forward vector. */
} nestegg_video_params;
/** Parameters specific to an audio track. */ typedefstruct { double rate; /**< Sampling rate in Hz. */ unsignedint channels; /**< Number of audio channels. */ unsignedint depth; /**< Bits per sample. */
uint64_t codec_delay; /**< Nanoseconds that must be discarded from the start. */
uint64_t seek_preroll;/**< Nanoseconds that must be discarded after a seek. */
} nestegg_audio_params;
/** Logging callback function pointer. */ typedefvoid (* nestegg_log)(nestegg * context, unsignedint severity, charconst * format, ...);
/** Initialize a nestegg context. During initialization the parser will readforwardinthestreamprocessingallelementsuntilthefirst blockofmediaisreached.Alltrackmetadatahasbeenprocessedatthispoint. @paramcontextStorageforthenewnesteggcontext.@seenestegg_destroy @paramioUsersuppliedIOcontext. @paramcallbackOptionalloggingcallbackfunctionpointer.MaybeNULL. @parammax_offsetOptionalmaximumoffsettoberead.Set-1toignore. @retval0Success.
@retval -1 Error. */ int nestegg_init(nestegg ** context, nestegg_io io, nestegg_log callback, int64_t max_offset);
/** Destroy a nestegg context and free associated memory.
@param context #nestegg context to be freed. @see nestegg_init */ void nestegg_destroy(nestegg * context);
/** Query the duration of the media stream in nanoseconds. @paramcontextStreamcontextinitializedby#nestegg_init. @paramdurationStorageforthequeriedduration. @retval0Success.
@retval -1 Error. */ int nestegg_duration(nestegg * context, uint64_t * duration);
/** Query the tstamp scale of the media stream in nanoseconds. @noteTimestampspresentedbynestegghavebeenscaledbythisvalue beforepresentationtothecaller. @paramcontextStreamcontextinitializedby#nestegg_init. @paramscaleStorageforthequeriedscalefactor. @retval0Success.
@retval -1 Error. */ int nestegg_tstamp_scale(nestegg * context, uint64_t * scale);
/** Query the number of tracks in the media stream. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtracksStorageforthequeriedtrackcount. @retval0Success.
@retval -1 Error. */ int nestegg_track_count(nestegg * context, unsignedint * tracks);
/** Query the start and end offset for a particular cluster. @paramcontextStreamcontextinitializedby#nestegg_init. @paramcluster_numZero-basedclusternumber;ordertheyappearincues. @parammax_offsetOptionalmaximumoffsettoberead.Set-1toignore. @paramstart_posStartingoffsetofthecluster.-1meansnon-existant. @paramend_posStartingoffsetofthecluster.-1meansnon-existantor finalcluster. @paramtstampStartingtimestampofthecluster. @retval0Success.
@retval -1 Error. */ int nestegg_get_cue_point(nestegg * context, unsignedint cluster_num,
int64_t max_offset, int64_t * start_pos,
int64_t * end_pos, uint64_t * tstamp);
/** Seek to @a offset. Stream will seek directly to offset. Mustbeusedtoseektothestartofacluster;theparserwillnotbe abletounderstandotheroffsets. @paramcontextStreamcontextinitializedby#nestegg_init. @paramoffsetAbsoluteoffsetinbytes. @retval0Success.
@retval -1 Error. */ int nestegg_offset_seek(nestegg * context, uint64_t offset);
/** Seek @a track to @a tstamp. Stream seek will terminate at the earliest keypointinthestreamatorbefore@atstamp.Othertracksinthe streamwilloutputpacketswithunspecifiedbutnearbytimestamps. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @paramtstampAbsolutetimestampinnanoseconds. @retval0Success.
@retval -1 Error. */ int nestegg_track_seek(nestegg * context, unsignedint track, uint64_t tstamp);
/** Query the type specified by @a track. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @retval#NESTEGG_TRACK_VIDEOTracktypeisvideo. @retval#NESTEGG_TRACK_AUDIOTracktypeisaudio. @retval#NESTEGG_TRACK_UNKNOWNTracktypeisunknown.
@retval -1 Error. */ int nestegg_track_type(nestegg * context, unsignedint track);
/** Query the codec ID specified by @a track. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @retval#NESTEGG_CODEC_VP8TrackcodecisVP8. @retval#NESTEGG_CODEC_VP9TrackcodecisVP9. @retval#NESTEGG_CODEC_AV1TrackcodecisAV1. @retval#NESTEGG_CODEC_VORBISTrackcodecisVorbis. @retval#NESTEGG_CODEC_OPUSTrackcodecisOpus. @retval#NESTEGG_CODEC_UNKNOWNTrackcodecisunknown.
@retval -1 Error. */ int nestegg_track_codec_id(nestegg * context, unsignedint track);
/** Query the number of codec initialization chunks for @a track. Each chunkofdatashouldbepassedtothecodecinitializationfunctionsin theorderreturned. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @paramcountStorageforthequeriedchunkcount. @retval0Success.
@retval -1 Error. */ int nestegg_track_codec_data_count(nestegg * context, unsignedint track, unsignedint * count);
/** Get a pointer to chunk number @a item of codec initialization data for @atrack. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @paramitemZerobasedchunkitemnumber. @paramdataStorageforthequerieddatapointer. Thedataisownedbythe#nesteggcontext. @paramlengthStorageforthequerieddatasize. @retval0Success.
@retval -1 Error. */ int nestegg_track_codec_data(nestegg * context, unsignedint track, unsignedint item, unsignedchar ** data, size_t * length);
/** Query the video parameters specified by @a track. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @paramparamsStorageforthequeriedvideoparameters. @retval0Success.
@retval -1 Error. */ int nestegg_track_video_params(nestegg * context, unsignedint track,
nestegg_video_params * params);
/** Query the audio parameters specified by @a track. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @paramparamsStorageforthequeriedaudioparameters. @retval0Success.
@retval -1 Error. */ int nestegg_track_audio_params(nestegg * context, unsignedint track,
nestegg_audio_params * params);
/** Query the encoding status for @a track. If a track has multiple encodings thefirstwillbereturned. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @retval#NESTEGG_ENCODING_COMPRESSIONThetrackiscompressed,butnotencrypted. @retval#NESTEGG_ENCODING_ENCRYPTIONThetrackisencryptedandcompressed.
@retval -1 Error. */ int nestegg_track_encoding(nestegg * context, unsignedint track);
/** Query the ContentEncKeyId for @a track. Will return an error if the track innotencrypted,orisnotrecognized. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @paramcontent_enc_key_idStorageforqueriedid.Thecontentencryptionkeyused. Ownedbynesteggandwillbefreedseparately. @paramcontent_enc_key_id_lengthLengthofthequeriedContentEncKeyIdinbytes. @retval0Success.
@retval -1 Error. */ int nestegg_track_content_enc_key_id(nestegg * context, unsignedint track, unsignedcharconst ** content_enc_key_id,
size_t * content_enc_key_id_length);
/** Query the default frame duration for @a track. For a video track, this istypicallytheinverseofthevideoframerate. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @paramdurationStorageforthedefaultdurationinnanoseconds. @retval0Success.
@retval -1 Error. */ int nestegg_track_default_duration(nestegg * context, unsignedint track,
uint64_t * duration);
/** Reset parser state to the last valid state before nestegg_read_packet failed. @paramcontextStreamcontextinitializedby#nestegg_init. @retval0Success.
@retval -1 Error. */ int nestegg_read_reset(nestegg * context);
/** Read a packet of media data. A packet consists of one or more chunks of dataassociatedwithasingletrack.nestegg_read_packetshouldbe calledinaloopwhilethereturnvalueis1todrivethestreamparser forward.@seenestegg_free_packet @paramcontextContextreturnedby#nestegg_init. @parampacketStorageforthereturnednestegg_packet. @retval1Additionalpacketsmaybereadinsubsequentcalls. @retval0Endofstream.
@retval -1 Error. */ int nestegg_read_packet(nestegg * context, nestegg_packet ** packet);
/** Read the last packet for a track without affecting current parser state. @paramcontextStreamcontextinitializedby#nestegg_init. @paramtrackZerobasedtracknumber. @parampacketStorageforthereturnednestegg_packet. @retval0Success.
@retval -1 Error. */ int nestegg_read_last_packet(nestegg * context, unsignedint track,
nestegg_packet ** packet);
/** Read total frame count for a track without affecting current parser state.\ ThisMUSTbecalledbeforeanycalltonestegg_read_packet! @paramcontextStreamcontextinitializedby#nestegg_init. @paramframes_outStorageforthereturnedtotalframescount. @retval0Success.
@retval -1 Error. */ int nestegg_read_total_frames_count(nestegg * context, uint64_t * frames_out);
/** Destroy a nestegg_packet and free associated memory.
@param packet #nestegg_packet to be freed. @see nestegg_read_packet */ void nestegg_free_packet(nestegg_packet * packet);
/** Query the keyframe status for a given packet. @parampacketPacketinitializedby#nestegg_read_packet. @retval#NESTEGG_PACKET_HAS_KEYFRAME_FALSEPacketcontainsnokeyframes. @retval#NESTEGG_PACKET_HAS_KEYFRAME_TRUEPacketcontainskeyframes. @retval#NESTEGG_PACKET_HAS_KEYFRAME_UNKNOWNUnknownpacketkeyframecontent.
@retval -1 Error. */ int nestegg_packet_has_keyframe(nestegg_packet * packet);
/** Query the track number of @a packet. @parampacketPacketinitializedby#nestegg_read_packet. @paramtrackStorageforthequeriedzerobasedtrackindex. @retval0Success.
@retval -1 Error. */ int nestegg_packet_track(nestegg_packet * packet, unsignedint * track);
/** Query the timestamp in nanoseconds of @a packet. @parampacketPacketinitializedby#nestegg_read_packet. @paramtstampStorageforthequeriedtimestampinnanoseconds. @retval0Success.
@retval -1 Error. */ int nestegg_packet_tstamp(nestegg_packet * packet, uint64_t * tstamp);
/** Query the duration in nanoseconds of @a packet. @parampacketPacketinitializedby#nestegg_read_packet. @paramdurationStorageforthequerieddurationinnanoseconds. @retval0Success.
@retval -1 Error. */ int nestegg_packet_duration(nestegg_packet * packet, uint64_t * duration);
/** Query the number of data chunks contained in @a packet. @parampacketPacketinitializedby#nestegg_read_packet. @paramcountStorageforthequeriedchunkcount. @retval0Success.
@retval -1 Error. */ int nestegg_packet_count(nestegg_packet * packet, unsignedint * count);
/** Get a pointer to chunk number @a item of packet data. @parampacketPacketinitializedby#nestegg_read_packet. @paramitemZerobasedchunkitemnumber. @paramdataStorageforthequerieddatapointer. Thedataisownedbythe#nestegg_packetpacket. @paramlengthStorageforthequerieddatasize. @retval0Success.
@retval -1 Error. */ int nestegg_packet_data(nestegg_packet * packet, unsignedint item, unsignedchar ** data, size_t * length);
/** Get a pointer to additional data with identifier @a id of additional packet data.If@aidisn'tpresentinthepacket,returns-1. @parampacketPacketinitializedby#nestegg_read_packet. @paramidCodecspecificidentifer.ForVP8,use1togetaVP8encoded framecontaininganalphachannelinitsYplane. @paramdataStorageforthequerieddatapointer. Thedataisownedbythe#nestegg_packetpacket. @paramlengthStorageforthequerieddatasize. @retval0Success.
@retval -1 Error. */ int nestegg_packet_additional_data(nestegg_packet * packet, unsignedint id, unsignedchar ** data, size_t * length);
/** Returns discard_padding for given packet @parampacketPacketinitializedby#nestegg_read_packet. @paramdiscard_paddingpointertostorediscardpaddingin. @retval0Success.
@retval -1 Error. */ int nestegg_packet_discard_padding(nestegg_packet * packet,
int64_t * discard_padding);
/** Query if a packet is encrypted. @parampacketPacketinitializedby#nestegg_read_packet. @retval#NESTEGG_PACKET_HAS_SIGNAL_BYTE_FALSENosignalbyte,encryption informationnotreadfrompacket. @retval#NESTEGG_PACKET_HAS_SIGNAL_BYTE_UNENCRYPTEDEncryptedbitnot set,encryptioninformationnotreadfrompacket. @retval#NESTEGG_PACKET_HAS_SIGNAL_BYTE_ENCRYPTEDEncryptedbitset, encryptioninfomationreadfrompacket. @retval#NESTEGG_PACKET_HAS_SIGNAL_BYTE_PARTITIONEDPartitionedbitset, encryptionandparitioninformationreadfrompacket.
@retval -1 Error.*/ int nestegg_packet_encryption(nestegg_packet * packet);
/** Query the IV for an encrypted packet. Expects a packet from an encrypted track,andwillreturnerrorifgivenapacketthathasnosignalbtye. @parampacketPacketinitializedby#nestegg_read_packet. @paramivStorageforqueriediv. @paramlengthLengthofreturnediv,maybe0. Thedataisownedbythe#nestegg_packetpacket. @retval0Success. @retval-1Error.
*/ int nestegg_packet_iv(nestegg_packet * packet, unsignedcharconst ** iv,
size_t * length);
/** Query the packet for offsets. @parampacketPacketinitializedby#nestegg_read_packet. @parampartition_offsetsStorageforqueriedoffsets. @paramnum_offsetsLengthofreturnedoffsets,maybe0. Thedataisownedbythe#nestegg_packetpacket. @retval0Success. @retval-1Error.
*/ int nestegg_packet_offsets(nestegg_packet * packet,
uint32_t const ** partition_offsets,
uint8_t * num_offsets);
/** Returns reference_block given packet @parampacketPacketinitializedby#nestegg_read_packet. @paramreference_blockpointertostorereferenceblockin. @retval0Success.
@retval -1 Error. */ int nestegg_packet_reference_block(nestegg_packet * packet,
int64_t * reference_block);
/** Query the logical stream position after a packet has been fully read. ForSimpleBlockpacketsthisistheendoftheblock;forBlockGroup packetsthisistheendoftheentiregroupincludingany BlockDuration,ReferenceBlock,andBlockAdditionselements. @parampacketPacketinitializedby#nestegg_read_packet. @paramend_offsetStorageforthequeriedoffset. @retval0Success.
@retval -1 Error. */ int nestegg_packet_end_offset(nestegg_packet * packet, int64_t * end_offset);
/** Query the presence of cues. @paramcontextStreamcontextinitializedby#nestegg_init. @retval0Themediahasnocues.
@retval 1 The media has cues. */ int nestegg_has_cues(nestegg * context);
/** Try to determine if the buffer looks like the beginning of a WebM file. @parambufferAbuffercontainingthebeginningofamediafile. @paramlengthThesizeofthebuffer. @retval0ThefileisnotaWebMfile.
@retval 1 The file is a WebM file. */ int nestegg_sniff_webm(unsignedcharconst* buffer, size_t length);
/** Try to determine if the buffer looks like the beginning of a Mkv file. @parambufferAbuffercontainingthebeginningofamediafile. @paramlengthThesizeofthebuffer. @retval0ThefileisnotaMkvfile.
@retval 1 The file is a Mkv Mkv. */ int nestegg_sniff_mkv(unsignedcharconst * buffer, size_t length);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.