Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#33 Encoder C API: Non-obvious need to reset enc_buf

v1.0 (example)
closed-fixed
3
2006-06-13
2005-09-15
Matt Hammond
No

When using the C API for the encoder, the enc_buf structure in the
encoder handle needs to be set prior to every call to
dirac_encoder_output, even if the previous call to
dirac_encoder_output didn't return encoded data (eg. it returns
ENC_STATE_BUFFER)

Although the API docs mention that the enc_buf structure should be
set up prior to such calls, the above requirement is not explicit. The
reasoning given in the docs can be read to imply that you only need
to set it up once, until the next time ENC_STATE_AVAIL is returned.

Either the docs could be more explicit, or the API could be changed
to not corrupt enc_buf if ENC_STATE_BUFFER is returned.

Discussion

  • Matt Hammond
    Matt Hammond
    2005-09-15

    • priority: 5 --> 3
     
    • assigned_to: nobody --> asuraparaju
     
  • Logged In: YES
    user_id=692051

    The enc_buf remains unchanged when a status other than
    ENC_STATE_AVAIL is returned. So the enc_buf needs to be set
    up before the first call to dirac_encoder_output and
    subsequently after every time the function returns
    ENC_STATE_AVAIL. Need to modify the docs to make this obvious.

     
  • Matt Hammond
    Matt Hammond
    2005-09-27

    Logged In: YES
    user_id=1181777

    The observed behaviour did not seem to match this behaviour: if a state
    other than ENC_STATE_AVAIL is returned, then enc_buf->size did seem to
    get corrupted.

    dirac_encoder.cpp, lines 872-880 implies this observed behaviour: it looks
    possible for compressor->getEncodedData() to set enc_buf.size to zero. In
    which case ENC_STATE_AVAIL is not set, and yet enc_buf.size has been
    altered.

     
  • Logged In: YES
    user_id=692051

    Your observations are true for the dirac_encoder.cpp v1.8
    and v1.9. I based my comments on dirac_encoder.cpp v1.10
    which fixed bug #1291478. I tested it for resetting the
    enc_buf only after processing ENC_STATE_AVAIL and it works.
    I guess I should have mentioned this in the comment.

    Modified Files:
    libdirac_encoder/dirac_encoder.cpp
    old version: 1.9 new version: 1.10

     
  • Logged In: YES
    user_id=692051

    Fixed in release 0.5.4

     
    • status: open --> closed-fixed