MP4(3)

πŸ“¦ version 2.1.0, in fedora 43, fedora 44

πŸ’– MP4(3) β€” the MP4 File Format Library era πŸ’–

okay so bestie, we're in the <mp4.h> cinematic universe, and this page is literally just about ONE little function that's lowkey carrying the whole edit list timeline situation. no cap. let's get into it πŸŽ€


✨ NAME ✨

MP4GetSampleIdFromEditTime β€” gets u the sample id of a specified time in the edit list timeline. that's it. that's the whole job. and she does it flawlessly πŸ’…


🌸 SYNTAX 🌸

#include <mp4.h>

MP4SampleId MP4GetSampleIdFromEditTime(
     MP4FileHandle hFile,
     MP4TrackId trackId,
     MP4Timestamp when,
     MP4Timestamp* pStartTime = NULL,
     MP4Duration* pDuration = NULL
);

look at those default args, NULL and NULL, so polite, so optional, so demure 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • hFile β€” specifies the mp4 file to which the operation applies. basically which file are we doing this to, bestie, bc we can't just be doing this to a random one 😭
  • trackId β€” specifies the track to which the operation applies. which track, babes. be specific.
  • when β€” specifies the time in the track time scale that is desired. this is the moment you're asking about ⭐
  • pStartTime β€” if non-NULL, pointer to variable that will receive the starting timestamp for this sample. ⚠️ caveat, and she's important: the timestamp is in the track edit list timescale. not the regular one. the edit list one. noted. πŸ’€
  • pDuration β€” if non-NULL, pointer to variable that will receive the duration for this sample in the edit list timeline. ⚠️ caveat the second: the duration is in the track timescale units. yeah, the units are different between these two. iconic of them, honestly.

πŸ‘‘ RETURN VALUES πŸ‘‘

  • upon success: the sample id that occurs at the specified time. slay.
  • upon an error: MP4_INVALID_SAMPLE_ID. it's giving "we don't know her" πŸ™ˆ

🌈 DESCRIPTION 🌈

MP4GetSampleIdFromEditTime returns the sample id of the track sample in which the specified time occurs in the edit list timeline. like, u hand her a time, she hands u back which sample lives there. that's the vibe check and she passes βœ…

the specified time should be in the track time scale. and if ur sitting there like "bestie how do i even get a time value into this time scale" β€” go look at MP4ConvertToTrackTimestamp() for how to map a time value to this time scale. she'll do the conversion for u 🧚

now, the important part, and i need u to actually read this one: since the edit list can cause the sample start time and duration to be different that it in the standard track timeline, it is strongly advised that the caller retrieve the new sample start time and duration via this function. like. strongly advised. that's not a suggestion, that's a "girl please pass in pStartTime and pDuration" moment. the edit list rearranges things and if u don't grab the new values from here ur gonna be confused later. periodt πŸ’–


πŸ”₯ SEE ALSO πŸ”₯

  • MP4(3)
  • MP4GetSampleIdFromTime(3)

Cisco Systems Inc. Β· Version 0.9 Β· and the manual page signature is just MP4(3) bc we're classy like that πŸŽ€

okay bye bestie, go get ur sample ids, drink water, and remember: the edit list timescale is NOT the same as the track timescale and that's on purpose πŸ’œβœ¨

πŸ“¦ where this page comes from