video_player.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. #include <cli/cli.h>
  3. #include <dialogs/dialogs.h>
  4. #include <furi.h>
  5. #include <gui/gui.h>
  6. #include <input/input.h>
  7. #include <notification/notification_messages.h>
  8. #include <stdio.h>
  9. #include <storage/storage.h>
  10. #include <toolbox/stream/file_stream.h>
  11. #include <gui/view_dispatcher.h>
  12. #define APPSDATA_FOLDER "/ext/apps_data"
  13. #define VIDEO_PLAYER_FOLDER "/ext/apps_data/video_player"
  14. //#define VIDEO_PLAYER_FOLDER STORAGE_APP_DATA_PATH_PREFIX
  15. #define FILE_NAME_LEN 64
  16. typedef enum {
  17. EventTypeInput,
  18. EventType1stHalf,
  19. EventType2ndHalf,
  20. } EventType;
  21. typedef struct {
  22. EventType type;
  23. InputEvent input;
  24. } VideoPlayerEvent;
  25. typedef enum {
  26. VIEW_PLAYER,
  27. } VideoPlayerViews;
  28. typedef struct {
  29. View* view;
  30. void* context;
  31. } PlayerView;
  32. typedef struct {
  33. NotificationApp* notification;
  34. FuriMessageQueue* event_queue;
  35. Gui* gui;
  36. PlayerView* player_view;
  37. ViewDispatcher* view_dispatcher;
  38. Storage* storage;
  39. Stream* stream;
  40. FuriString* filepath;
  41. DialogsApp* dialogs;
  42. FuriPubSub* input;
  43. FuriPubSubSubscription* input_subscription;
  44. Canvas* canvas;
  45. uint8_t* audio_buffer;
  46. uint8_t* image_buffer;
  47. uint8_t* buffer;
  48. uint32_t num_frames;
  49. uint16_t audio_chunk_size;
  50. uint16_t sample_rate;
  51. uint8_t height;
  52. uint8_t width;
  53. uint8_t version;
  54. uint8_t x_offset;
  55. uint16_t image_buffer_length;
  56. uint32_t frames_played;
  57. bool playing;
  58. bool quit;
  59. } VideoPlayerApp;
  60. typedef struct {
  61. VideoPlayerApp* player;
  62. } PlayerViewModel;
  63. void draw_callback(Canvas* canvas, void* ctx);
  64. bool input_callback(InputEvent* input_event, void* ctx);