Logo Search packages:      
Sourcecode: libtheora version File versions  Download package

ogg_int64_t theora_granule_frame ( theora_state th,
ogg_int64_t  granulepos 

Convert a granulepos to an absolute frame number. The granulepos is interpreted in the context of a given theora_state handle.

th A previously initialized theora_state handle (encode or decode)
granulepos The granulepos to convert.
The frame number corresponding to granulepos.
Return values:
-1 The given granulepos is undefined (i.e. negative)
Thus function was added in the 1.0alpha4 release.

Definition at line 450 of file toplevel.c.

References theora_state::internal_decode, theora_state::internal_encode, PB_INSTANCE::keyframe_granule_shift, and theora_granule_frame().

Referenced by theora_granule_frame().

  CP_INSTANCE *cpi=(CP_INSTANCE *)(th->internal_encode);
  PB_INSTANCE *pbi=(PB_INSTANCE *)(th->internal_decode);


    ogg_int64_t iframe=granulepos>>pbi->keyframe_granule_shift;
    ogg_int64_t pframe=granulepos-(iframe<<pbi->keyframe_granule_shift);

    return (iframe+pframe);


Generated by  Doxygen 1.6.0   Back to index