lib.cpp 639 B

123456789101112131415161718192021222324252627
  1. #include "Decoder.h"
  2. #include "lib.h"
  3. void *F263_CreateDecoder()
  4. {
  5. return new Decoder;
  6. }
  7. int F263_DecodeFrame(void *context, void *frameData, size_t frameSize, YV12_PLANES *yv12, int *width, int *height, int *keyframe)
  8. {
  9. if (frameSize > 0x1FFFFFFF)
  10. return F263_ERROR_TOO_MUCH_DATA;
  11. if (!frameData)
  12. return F263_ERROR_NO_DATA;
  13. Decoder *decoder = (Decoder *)context;
  14. decoder->buffer.data = (uint8_t *)frameData;
  15. decoder->buffer.numBits = (uint32_t)(frameSize*8);
  16. return decoder->DecodeFrame(yv12, width, height, keyframe);
  17. }
  18. void F263_DestroyDecoder(void *context)
  19. {
  20. Decoder *decoder = (Decoder *)context;
  21. delete decoder;
  22. }