~ubuntu-branches/ubuntu/precise/me-tv/precise-proposed

« back to all changes in this revision

Viewing changes to src/stream_thread.cc

  • Committer: Bazaar Package Importer
  • Author(s): Scott Evans
  • Date: 2009-06-27 00:46:22 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627004622-q0zvsie6ioa60vh3
Tags: 0.9.4-0ubuntu1
* New upstream release (LP: #379706)
  - Fix to stop EPG update crashing the application
    after faulty save (LP: #72872)
  - Fixed spin buttons from GtkBuilder conversion (LP: #382197) 
  - Fixed icon on application popup menu (LP: #379685)
  - Fixed compiling of me-tv-0.8.12 fails on Fedora 11 (LP: #377020)
  - Fixed Failed to lock to channel at boot (LP: #377050)
  - Increased timeout to 5 seconds again (LP: #371165)
  - Fixed me-tv unusually slow, often freezes (LP: #351510)
  - Fixed channel persistence (LP: #361514)
  - Fix for forward slashes in description (LP: #359710)
  - Fixed Must create .me-tv directory manually (LP: #353796)
  - Fixed audio stream can't be changed (LP: #350402)
* debian/control:
  - Removed dependency libxine1-ffmpeg, libxine1-x
  - Removed libglademm-2.4-dev Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
StreamThread::StreamThread(const Channel& active_channel) :
50
50
        Thread("Stream"),
51
51
        channel(active_channel),
52
 
        frontend(get_application().get_device_manager().get_frontend())
 
52
        frontend(get_application().device_manager.get_frontend())
53
53
{
54
54
        g_debug("Creating StreamThread");
55
55
        g_static_rec_mutex_init(mutex.gobj());
81
81
                throw Exception(Glib::ustring::compose(_("Failed to create FIFO '%1'"), fifo_path));
82
82
        }
83
83
 
84
 
        // Fudge the channel open
 
84
        // Fudge the channel open.  Allows Glib::IO_FLAG_NONBLOCK
85
85
        int fd = open(fifo_path.c_str(), O_RDONLY | O_NONBLOCK);
86
86
        if (fd == -1)
87
87
        {
111
111
{
112
112
        setup_dvb();
113
113
        g_debug("Starting stream thread");
114
 
        Thread::start();        
 
114
        Thread::start();
115
115
        start_epg_thread();
116
116
}
117
117
 
194
194
                write(buffer, bytes_read);
195
195
        }
196
196
        THREAD_CATCH
 
197
                
197
198
        g_debug("StreamThread loop exited");
198
199
        
199
200
        Lock lock(mutex, "StreamThread::run() - exit");
502
503
        
503
504
        remove_all_demuxers();
504
505
        
505
 
        frontend.tune_to(channel.frontend_parameters);
 
506
        frontend.tune_to(channel.transponder);
506
507
        
507
508
        Dvb::Demuxer demuxer_pat(demux_path);
508
509
        demuxer_pat.set_filter(PAT_PID, PAT_ID);
520
521
        for (guint i = 0; i < length; i++)
521
522
        {
522
523
                Dvb::SI::ProgramAssociation program_association = pas.program_associations[i];
523
 
                
 
524
 
 
525
                g_debug("%d: Service ID: %d, PMT ID: %d", i,
 
526
                        program_association.program_number,
 
527
                        program_association.program_map_pid);
524
528
                if (program_association.program_number == channel.service_id)
525
529
                {
526
530
                        pmt_pid = program_association.program_map_pid;
527
 
                        g_debug("%d: PMT ID: %d", i, pmt_pid);
 
531
                        g_debug("PMT ID found");
528
532
                }
529
533
        }
530
534
        
574
578
 
575
579
void StreamThread::start_epg_thread()
576
580
{
577
 
        Lock lock(mutex, "StreamThread::start_epg_thread()");
 
581
        if (!disable_epg_thread)
 
582
        {
 
583
                Lock lock(mutex, "StreamThread::start_epg_thread()");
578
584
 
579
 
        stop_epg_thread();
580
 
        epg_thread = new EpgThread();
581
 
        epg_thread->start();
582
 
        g_debug("EPG thread started");
 
585
                stop_epg_thread();
 
586
                epg_thread = new EpgThread();
 
587
                epg_thread->start();
 
588
                g_debug("EPG thread started");
 
589
        }
583
590
}
584
591
 
585
592
void StreamThread::stop_epg_thread()
586
593
{
587
 
        Lock lock(mutex, "StreamThread::stop_epg_thread()");
588
 
 
589
 
        if (epg_thread != NULL)
 
594
        if (!disable_epg_thread)
590
595
        {
591
 
                g_debug("Stopping EPG thread");
592
 
                delete epg_thread;
593
 
                epg_thread = NULL;
594
 
                g_debug("EPG thread stopped");
 
596
                Lock lock(mutex, "StreamThread::stop_epg_thread()");
 
597
 
 
598
                if (epg_thread != NULL)
 
599
                {
 
600
                        g_debug("Stopping EPG thread");
 
601
                        delete epg_thread;
 
602
                        epg_thread = NULL;
 
603
                        g_debug("EPG thread stopped");
 
604
                }
595
605
        }
596
606
}
597
607
 
667
677
                g_debug("Broadcasting stopped");
668
678
        }
669
679
}
 
680
 
 
681
guint StreamThread::get_last_epg_update_time()
 
682
{
 
683
        guint result = 0;
 
684
 
 
685
        Lock lock(mutex, "StreamThread::get_epg_last_update_time()");
 
686
        if (epg_thread != NULL)
 
687
        {
 
688
                result = epg_thread->get_last_epg_update_time();
 
689
        }
 
690
        
 
691
        return result;
 
692
}