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.

96 lines
2.2 KiB

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