avi_decoder.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "avi_decoder.h"
  2. #include "avi_tscc_decoder.h"
  3. #include "avi_rle_decoder.h"
  4. #include "avi_yuv_decoder.h"
  5. #include "avi_rgb_decoder.h"
  6. int AVIDecoderCreator::CreateVideoDecoder(const nsavi::AVIH *avi_header, const nsavi::STRH *stream_header, const nsavi::STRF *stream_format, const nsavi::STRD *stream_data, ifc_avivideodecoder **decoder)
  7. {
  8. nsavi::video_format *format = (nsavi::video_format *)stream_format;
  9. if (format)
  10. {
  11. if (format->compression == 'ccst') // tscc
  12. {
  13. *decoder = AVITSCC::CreateDecoder(format);
  14. if (*decoder)
  15. return CREATEDECODER_SUCCESS;
  16. else
  17. return CREATEDECODER_FAILURE;
  18. }
  19. else if (format->compression == nsavi::video_format_rle8) // 8bit RLE
  20. {
  21. *decoder = AVIRLE::CreateDecoder(format);
  22. if (*decoder)
  23. return CREATEDECODER_SUCCESS;
  24. else
  25. return CREATEDECODER_FAILURE;
  26. }
  27. else if (format->compression == 'YVYU') // YUV
  28. {
  29. *decoder = AVIYUV::CreateDecoder(format);
  30. if (*decoder)
  31. return CREATEDECODER_SUCCESS;
  32. else
  33. return CREATEDECODER_FAILURE;
  34. }
  35. else if (format->compression == nsavi::video_format_rgb)
  36. {
  37. *decoder = AVIRGB::CreateDecoder(format);
  38. if (*decoder)
  39. return CREATEDECODER_SUCCESS;
  40. else
  41. return CREATEDECODER_FAILURE;
  42. }
  43. }
  44. return CREATEDECODER_NOT_MINE;
  45. }
  46. #define CBCLASS AVIDecoderCreator
  47. START_DISPATCH;
  48. CB(CREATE_VIDEO_DECODER, CreateVideoDecoder)
  49. END_DISPATCH;
  50. #undef CBCLASS