~jaromil/freej/master

« back to all changes in this revision

Viewing changes to qt/Sound.cpp

  • Committer: fred
  • Date: 2011-01-25 17:32:31 UTC
  • Revision ID: git-v1:6126f899abcd96f6bab887cb2f840caf272b2c6b
Little modif in qt to test sound and streaming + various modif in freej

in qfreej : adding automatic call to ::openSoundDevice() when opening a
video.
Layer replaced by VideoLayer.
Added streaming config in ::Sound()
Changed from 10 to 1ms.

TODO file created (instead of the comments in the main)

in freej :
JackClient::Process() -> now writing jack outputs in a ring buffer.
commented out the RunCallback call.
OggTheoraEncoder:: -> a 30 sec recording to a file
from the JackClient ring buffer in wav PCM format added.

In theorautils.cpp -> work in progress :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    m_enc = NULL;
16
16
 
17
17
    // le jack output port que l'on veut enregistrer
18
 
    m_audio = new AudioCollector("metro:120_bpm", 1024, 48000);
 
18
    m_audio = new AudioCollector("metro:120_bpm", 1024, 48000); //
 
19
    //m_audio = new AudioCollector("", 1024, 48000);
19
20
//    m_audio = new AudioCollector("MPlayer [13728]:out_0", 1024, 48000);
20
21
//    m_audio = new AudioCollector("system:capture_1", 1024, 48000);
21
 
    //m_audio = new AudioCollector("freej:Out0", 1024, 48000);
22
 
 
23
 
    m_freej->screen->add_audio(m_audio->Jack);
24
 
 
25
 
    if (m_audio)
26
 
    {
 
22
 
 
23
    m_freej->screen->add_audio(m_audio->Jack); //
 
24
 
 
25
    if (m_audio) //
 
26
    { //
27
27
        m_enc = new OggTheoraEncoder();
28
28
        if (m_enc)
29
29
        {
30
 
            m_enc->video_quality = 14;
31
 
            m_enc->video_bitrate = 1000000;
32
 
            m_enc->audio_quality = 6;
33
 
 
34
 
            m_enc->use_audio = true;
35
 
            m_enc->audio = m_audio;
36
 
 
 
30
            m_enc->video_quality = 10;
 
31
            m_enc->video_bitrate = 100000;
 
32
            m_enc->audio_quality = 1;
 
33
            m_enc->audio_bitrate = 48000;
 
34
 
 
35
            m_enc->use_audio = true; //
 
36
//             m_enc->use_audio = false;
 
37
            m_enc->audio = m_audio; //
 
38
 
 
39
 
 
40
 
 
41
            //if(shout_set_host(m_enc->ice, "skimeuzac.com"))
 
42
                        //qDebug() << "shout_set_host: " << shout_get_error(m_enc->ice);
 
43
 
 
44
            if(shout_set_host(m_enc->ice, "localhost"))
 
45
                        qDebug() << "shout_set_host: " << shout_get_error(m_enc->ice);
 
46
 
 
47
            if(shout_set_port(m_enc->ice, 8000))
 
48
                        qDebug() << "shout_set_port: " << shout_get_error(m_enc->ice);
 
49
 
 
50
            if(shout_set_name(m_enc->ice, "qfreej streaming test"))
 
51
                        qDebug() << "shout_set_title: " << shout_get_error(m_enc->ice);
 
52
 
 
53
            if(shout_set_user(m_enc->ice, "source"))
 
54
                        qDebug() << "shout_set_user: " << shout_get_error(m_enc->ice);
 
55
 
 
56
            if(shout_set_password(m_enc->ice, "test!"))
 
57
                        qDebug() << "shout_set_pass: " << shout_get_error(m_enc->ice);
 
58
 
 
59
            if(shout_set_mount(m_enc->ice, "freejcpp.ogg"))
 
60
                        qDebug() << "shout_set_mount: " << shout_get_error(m_enc->ice);
37
61
 
38
62
            m_freej->add_encoder(m_enc);
39
 
            m_enc->set_filedump("Video/dump.ogg");
 
63
 
 
64
            if( shout_open(m_enc->ice) == SHOUTERR_SUCCESS ) {
 
65
 
 
66
                qDebug() << "streaming on url: http://" << shout_get_host(m_enc->ice) << ":" \
 
67
                         << shout_get_port(m_enc->ice) <<  shout_get_mount(m_enc->ice);
 
68
 
 
69
                m_enc->write_to_stream = true;
 
70
            } else {
 
71
 
 
72
                qDebug() << "error connecting to server " << shout_get_host(m_enc->ice) << ":" \
 
73
                                << shout_get_error(m_enc->ice);
 
74
 
 
75
                m_enc->write_to_stream = false;
 
76
            }
 
77
 
 
78
 
 
79
            m_enc->set_filedump("Video/dump.ogg");
40
80
            qDebug() << "fps :" << m_freej->fps.get();
41
81
        }
42
 
    }
 
82
    } //
43
83
}
44
84
 
45
85
Sound::~Sound()