pans
2016-12-15 87e3ee273b2f84081ac45926be9d8e5be3166eaa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/************************************************************************
 *        Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
 *        FileName                      :   audiotransfer.h
 *        Description                   :   audio transfer
 *        Modification History          :   none
 *        Version                       :   V1.0
 *        Time                          :   2009-11,12
 *        Author                        :   wanggongpu
 *        Descrp                        :   
*************************************************************************/
#ifndef AUDIOTRANSFER_H
#define AUDIOTRANSFER_H
 
#include <QtGui/QWidget>
#include "ui_audiotransfer.h"
#include <QList>
#include "DemoPublic.h"
#include "devicedata.h"
 
#include <stdio.h>
#include <stdlib.h>
#include <QDialog>
 
//ƽ̨²îÒì
#ifdef _WIN32
#elif  defined(__linux__)
#ifndef __stdcall
#define __stdcall
#endif
#endif
 
#define DebugPrint printf
typedef struct wave_info_struct
{
    FILE *soundfile;            // file handle Îļþ¾ä±ú
    short channels;                // 1 - mono . 2 - stereo. d'uh. Í¨µÀºÅ
    unsigned long num_samples;    // total number of samples/channel if available //×ܲÉÑùÊý
    short samplesize;            // 8 bit or 16bit. could probably just auto scale. but i think
                                // we'll just ignore 8bit sound. MFC May03 //bitÂÊ
    int samplerate;                // in Hz ²ÉÑùƵÂÊ
    int byteswap;                //½»»»×Ö½ÚÊý
}
wave_info_t; //¶àýÌåÎļþÓïÒô²ÎÊýÐÅÏ¢½á¹¹
 
typedef  struct wave_header
  {
    char riff[4];             /* "RIFF" */
    unsigned int  size;       /* length of rest of file = size of rest of header(36) + data length */
    char wave[4];             /* "WAVE" */
    char fmt[4];              /* "fmt " */
    unsigned int   fmt_len;    /* length of rest of fmt chunk = 16 */
    unsigned short tag;       /* MS PCM = 1 */
    unsigned short channels;  /* channels, mono = 1, stereo = 2 */
    unsigned int   samp_rate;  /* samples per second = 44100 */
    unsigned int   byte_rate;  /* bytes per second = samp_rate * byte_samp = 176400 */
    unsigned short byte_samp; /* block align (bytes per sample) = channels * bits_per_sample / 8 = 4 */
    unsigned short bit_samp;  /* bits per sample = 16 for MS PCM (format specific) */
    char data[4];             /* "data" */
    unsigned int  length;     /* data length (bytes) */
  } WaveFileHeader;//¶àýÌåÎļþ
 
 
wave_info_t *wave_init(char *inPath,WaveFileHeader *waveheader);//¸ø¶¨Îļþ»ñÈ¡Îļþ²ÎÊýÐÅÏ¢ ºÍ ÎļþÍ·
int wave_get_samples(wave_info_t *wave_info, short int pcm[], int num_samples); //ѹËõÎļþ
 
class AudioTransfer : public QDialog
{
    Q_OBJECT
 
public:
    friend void __stdcall fVoiceDataCallBack(int lVoiceComHandle,
                          char *pRecvDataBuffer, unsigned int dwBufSize,
                          unsigned char byAudioFlag,  void *pUser);
    AudioTransfer(QList<DeviceData> * tree, QDialog *parent = 0);
    ~AudioTransfer();
 
private slots:
    void on_pushButton_exit_clicked();
    void audioTransferDevice(QTreeWidgetItem * item, int  column);
    void on_pushButton_browse_clicked();
    void on_pushButton_talkmrsend_clicked();
 
 
    void on_pushButton_startmr_clicked();
    void on_pushButton_stopmr_clicked();
    
public:
    Ui::AudioTransferClass ui;
    QList<QTreeWidgetItem *> items;
    QList<DeviceData> *m_qlistdevicetree;
    int m_atuserid[256];
    //²¼·À³··À±ê¼Ç
    int m_atuseridflag[256];
    //Ñ¡ÖÐË÷ÒýÖµ
    int m_atindex;
 
    int m_talkmrhandle;
    void * m_encodehandle;
};
 
#endif // AUDIOTRANSFER_H