MergePlaylist.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #pragma once
  2. #include "../playlist/ifc_playlist.h"
  3. #include <vector>
  4. #include <windows.h> // for MAX_PATH
  5. #include <bfc/multipatch.h>
  6. #include "../playlist/ifc_playlistloadercallback.h"
  7. class merge_pl_entry
  8. {
  9. public:
  10. merge_pl_entry() {}
  11. merge_pl_entry( const wchar_t *p_filename, const wchar_t *p_title, int p_length_ms );
  12. ~merge_pl_entry();
  13. size_t GetFilename( wchar_t *p_filename, size_t filenameCch );
  14. size_t GetTitle( wchar_t *p_title, size_t titleCch );
  15. int GetLengthInMilliseconds();
  16. size_t GetExtendedInfo( const wchar_t *metadata, wchar_t *info, size_t infoCch );
  17. void SetFilename( const wchar_t *p_filename );
  18. void SetTitle( const wchar_t *p_title );
  19. void SetLengthMilliseconds( int p_length_ms );
  20. wchar_t *filename = 0;
  21. wchar_t *filetitle = 0;
  22. int length = -1;
  23. bool cached = false;
  24. };
  25. enum { patch_playlist, patch_playlistloadercallback };
  26. class MergePlaylist : public MultiPatch<patch_playlist, ifc_playlist>, public MultiPatch<patch_playlistloadercallback, ifc_playlistloadercallback>
  27. {
  28. public:
  29. MergePlaylist();
  30. ~MergePlaylist();
  31. void Clear();
  32. void OnFile( const wchar_t *p_filename, const wchar_t *p_title, int lengthInMS, ifc_plentryinfo *info );
  33. void AppendWithInfo( const wchar_t *p_filename, const wchar_t *p_title, int lengthInMS );
  34. size_t GetNumItems();
  35. size_t GetItem( size_t item, wchar_t *p_filename, size_t filenameCch );
  36. size_t GetItemTitle( size_t item, wchar_t *p_title, size_t titleCch );
  37. const wchar_t *ItemTitle( size_t item );
  38. const wchar_t *ItemName( size_t item );
  39. int GetItemLengthMilliseconds( size_t item );
  40. size_t GetItemExtendedInfo( size_t item, const wchar_t *metadata, wchar_t *info, size_t infoCch );
  41. void SetItemFilename( size_t item, const wchar_t *p_filename );
  42. void SetItemTitle( size_t item, const wchar_t *p_title );
  43. void SetItemLengthMilliseconds( size_t item, int p_length_ms );
  44. void AppendPlaylist( MergePlaylist &copy );
  45. bool HasFilename( const wchar_t *p_filename );
  46. uint64_t total_time;
  47. protected:
  48. RECVS_MULTIPATCH;
  49. public:
  50. //private:
  51. typedef std::vector<merge_pl_entry *> PlaylistEntries;
  52. PlaylistEntries entries;
  53. };