FileControl.mm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // FileControl.m
  3. // FunSDKDemo
  4. //
  5. // Created by XM on 2018/11/30.
  6. // Copyright © 2018年 XM. All rights reserved.
  7. //
  8. #import "FileControl.h"
  9. #import "Header.h"
  10. @implementation FileControl
  11. - (NSMutableArray *)getLocalImage {
  12. NSString *path = [NSString getPhotoPath];
  13. NSMutableArray *imageList = (NSMutableArray*)[[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
  14. if (!imageList) {
  15. return [NSMutableArray array];
  16. }
  17. for (int i =(int)imageList.count-1; i>=0; i--) {
  18. NSString *imagePath = [imageList objectAtIndex:i];
  19. if (![imagePath containsString:@"jpg"]) {
  20. [imageList removeObjectAtIndex:i];
  21. }else{
  22. [imageList replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%@/%@",path,imagePath]];
  23. }
  24. }
  25. return imageList;
  26. }
  27. - (NSMutableArray *)getLocalVideo {
  28. NSString *path = [NSString getVideoPath];
  29. NSMutableArray *videoList = (NSMutableArray*)[[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
  30. if (!videoList) {
  31. return [NSMutableArray array];
  32. }
  33. for (int i =(int)videoList.count-1; i>=0; i--) {
  34. NSString *videoPath = [videoList objectAtIndex:i];
  35. if ((![videoPath containsString:@"mp4"]) && (![videoPath containsString:@"fvideo"])) {
  36. [videoList removeObjectAtIndex:i];
  37. }else{
  38. [videoList replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%@/%@",path,videoPath]];
  39. }
  40. }
  41. return videoList;
  42. }
  43. //判断录像文件类型是不是H265
  44. - (BOOL)getVideoTypeH265:(NSString*)path {
  45. int videoType = 0;//FUN_MediaGetCodecType([path UTF8String]); //目前版本的底层库暂时不支持,后续版本可能会支持,如果有需要可以直接联系我们
  46. if (videoType == 3) {
  47. return YES;
  48. }
  49. return NO;
  50. }
  51. //判断录像文件类型是不是鱼眼视频
  52. - (BOOL)getVideoTypeFish:(NSString*)path {
  53. if ([path containsString:@".fvideo"]) {
  54. return YES;
  55. }
  56. return NO;
  57. }
  58. @end