Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to seek to specific frame #2

@dodoma

Description

@dodoma

I need to achieve drag to some position to play.
So, I've tried to use fseek(input, 14954847 + 429832, SEEK_SET) to jump to specific frame in basic-decoder-mfalc.c
(14954847 is the sample offset of seekpoint 60, 429832 is the metadata header length.)
and then called mfalc_sync(m).

[seekpoint 60]
sample number: 5202944
sample offset: 14954847
samples: 1024

following is the basic-decoder-mflac output

metadata block: type: 4, is_last: 0, length: 197
[vorbis_comment]
  vendor string=[32]reference libFLAC 1.3.2 20170101
  comment[0]=[43]ALBUM=For Your Entertainment (Tour Edition)
  comment[1]=[19]ARTIST=Adam Lambert
  comment[2]=[36]COMMENT=Create by taurusxin/ncmdump.
  comment[3]=[26]TITLE=Whataya Want from Me
  comment[4]=[13]TRACKNUMBER=3
metadata block: type: 6, is_last: 0, length: 423423
[picture]
  type=3
  mime string=[10]image/jpeg
  description string=[0]
  width=0
  height=0
  colordepth=0
  totalcolors=0
  data=[423381 bytes]
metadata block: type: 1, is_last: 1, length: 4096
decoded 8 frames
result: -3
miniflac (536 bytes):
  state: MINIFLAC_FRAME
  bitreader (40 bytes):
    val: 0x00000000
    bits: 0
    crc8: 139
    crc16: 31069
    pos: 153
    len: 16384
  ogg (80 bytes):
    state: MINIFLAC_OGG_CAPTUREPATTERN_O
    bitreader (40 bytes):
      val: 0x00000000
      bits: 0
      crc8: 0
      crc16: 0
      pos: 0
      len: 0
    version: 0
    headertype: 0
      continuation: 0
      b_o_s: 0
      e_o_s: 0
    granulepos: 0
    serialno: 0
    pageno: 0
    segments: 0
    curseg: 0
    length: 0
    pos: 0
  header (4 bytes):
    state: MINIFLAC_OGGHEADER_PACKETTYPE
  streammarker (4 bytes):
    state: MINIFLAC_STREAMMARKER_F
  metadata (116 bytes):
    state: MINIFLAC_METADATA_HEADER
    pos: 0
    header (16 bytes):
      is_last: 1
      type_raw: 1
      type: MINIFLAC_METADATA_PADDING 
      length: 4096
    streaminfo: (16 bytes)
      state: MINIFLAC_STREAMINFO_MD5_1
      pos: 16
      sample_rate: 44100
      bps: 16
    vorbis_comment (20 bytes):
      state: MINIFLAC_VORBISCOMMENT_COMMENT_LENGTH
      len: 13
      pos: 13
      tot: 5
      cur: 5
    picture (12 bytes):
      state: MINIFLAC_PICTURE_PICTURE_DATA
      len: 423381
      pos: 423381
    cuesheet (12 bytes):
      state: MINIFLAC_CUESHEET_CATALOG
      pos: 0
      track: 0
      tracks: 0
      point: 0
      points: 0
    seektable (12 bytes):
      state: MINIFLAC_SEEKTABLE_SAMPLE_NUMBER
      len: 114
      pos: 114
    application (12 bytes):
      state: MINIFLAC_APPLICATION_ID
      len: 0
      pos: 0
  frame (272 bytes):
    state: MINIFLAC_FRAME_FOOTER
    cur_subframe: 2
    crc16: 52128
    frame_header (40 bytes):
      state: MINIFLAC_FRAME_HEADER_SYNC
      block_size_raw: 10
      sample_rate_raw: 9
      channel_assignment_raw: 9
      blocking_strategy: 0
      block_size: 1024
      sample_rate: 44100
      channel_assignment: MINIFLAC_CHASSGN_RIGHT_SIDE
      channels: 2
      bps: 16
      sample_number: 9
      frame_number: 9
      crc8: 142
    subframe (216 bytes):
      state: MINIFLAC_SUBFRAME_HEADER
      bps: 0
      subframe_header (12 bytes):
        state: MINIFLAC_SUBFRAME_HEADER_RESERVEBIT1
        type: MINIFLAC_SUBFRAME_TYPE_UNKNOWN
        order: 0
        wasted_bits: 0
        type_raw: 0
      subframe_constant (4 bytes):
        state: MINIFLAC_SUBFRAME_CONSTANT_DECODE
      subframe_verbatim (8 bytes):
        state: MINIFLAC_SUBFRAME_VERBATIM_DECODE
        pos: 0
      subframe_fixed (8 bytes):
        state: MINIFLAC_SUBFRAME_FIXED_DECODE
        pos: 0
      subframe_lpc (140 bytes):
        state: MINIFLAC_SUBFRAME_LPC_PRECISION
        pos: 0
        precision: 0
        shift: 0
        coefficients:
         coefficients[0]: 0
         coefficients[1]: 0
         coefficients[2]: 0
         coefficients[3]: 0
         coefficients[4]: 0
         coefficients[5]: 0
         coefficients[6]: 0
         coefficients[7]: 0
         coefficients[8]: 0
         coefficients[9]: 0
         coefficients[10]: 0
         coefficients[11]: 0
         coefficients[12]: 0
         coefficients[13]: 0
         coefficients[14]: 0
         coefficients[15]: 0
         coefficients[16]: 0
         coefficients[17]: 0
         coefficients[18]: 0
         coefficients[19]: 0
         coefficients[20]: 0
         coefficients[21]: 0
         coefficients[22]: 0
         coefficients[23]: 0
         coefficients[24]: 0
         coefficients[25]: 0
         coefficients[26]: 0
         coefficients[27]: 0
         coefficients[28]: 0
         coefficients[29]: 0
         coefficients[30]: 0
         coefficients[31]: 0
      residual (36 bytes):
        state: MINIFLAC_RESIDUAL_CODING_METHOD
        coding_method: 0
        partition_order: 0
        rice_parameter: 0
        rice_size: 0
        msb: 0
        rice_parameter_size: 0
        value: 0
        partition: 0
        partition_total: 0
        residual: 0
        residual_total: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions