You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASICMEDIAINPUT_H_INCL__
  2. #define __BASICMEDIAINPUT_H_INCL__
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <sys/stat.h>
  7. #include <sys/types.h>
  8. #ifdef __linux__
  9. #include <linux/ioctl.h>
  10. #include <linux/types.h>
  11. #include <linux/videodev2.h>
  12. #include <pthread.h>
  13. #include <sys/ioctl.h>
  14. #include <sys/mman.h>
  15. #include <sys/time.h>
  16. #include <unistd.h>
  17. #endif
  18. #include "basicLIBAV.h"
  19. #include "basicThread.h"
  20. #define _VIN_DefaultWidth 640
  21. #define _VIN_DefaultHeight 480
  22. #define ARM_BR_NOW 0
  23. #define _VIN_DefaultQueueSize 15
  24. #define _VIN_DefaultFPS 15
  25. typedef enum _VI_SAVE_MODE
  26. {
  27. VI_NO_SAVE_MODE = 0,
  28. VI_IMAGE_SEQUENCE = 1,
  29. VI_MJPEG_FILE = 2,
  30. VI_MPEG1_FILE = 3,
  31. VI_MPEG2_FILE = 4,
  32. VI_MP4_FILE = 5
  33. } _VI_SAVE_MODE;
  34. typedef enum _THREAD_STATUS
  35. {
  36. VI_CREATED = 0,
  37. VI_INIT_OK = 1,
  38. VI_DEVICE_OK = 2,
  39. VI_SETTINGS_OK = 3,
  40. VI_MEMORY_OK = 4,
  41. VI_STREAM_OK = 5,
  42. VI_WORKING_OK = 6,
  43. VI_STOPED = 7,
  44. VI_RESTARTING = 8
  45. } _THREAD_STATUS;
  46. #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
  47. #define VIDEO_PICTURE_QUEUE_SIZE 30
  48. #define BUFFER_ALIGN 32
  49. typedef enum _MediaTypes
  50. {
  51. MT_UNDEFINED = 0,
  52. MT_VIDEO = 1,
  53. MT_AUDIO = 2,
  54. MT_DEVICE = 4,
  55. MT_FILE = 8,
  56. MT_NETWORK = 16
  57. } _MediaTypes;
  58. /**
  59. * basicMediaInput - parent to all (Audio/Video) media input
  60. * pins
  61. *
  62. * @author gagua
  63. */
  64. class basicMediaInput : public basicThread
  65. {
  66. protected:
  67. uint8_t m_eType;
  68. // int m_nBitRate;
  69. // char m_pInputName[MAX_PATH_LEN];
  70. VideoState m_sMediaState;
  71. public:
  72. // Constructor
  73. basicMediaInput();
  74. basicMediaInput(_MediaTypes mediaType);
  75. basicMediaInput(CSTR InputName, _MediaTypes mediaType = MT_UNDEFINED);
  76. // Destructor
  77. virtual ~basicMediaInput();
  78. bool create(CSTR URI, _MediaTypes mediaType = MT_UNDEFINED);
  79. // Copy constructor
  80. // TODO: Uncomment the copy constructor when you need it.
  81. // basicMediaInput(const basicMediaInput& src);
  82. // Assignment operator
  83. // TODO: Uncomment the assignment operator when you need it.
  84. // basicMediaInput& operator=(const basicMediaInput& src);
  85. };
  86. #endif // __BASICMEDIAINPUT_H_INCL__