png img proxy fixes, speed zoom segv fix, colapse ins 1frm silence undo, repair rende...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / devicempeginput.C
index 168244b0c875fe485cc44cedcfeb20c3d427d53f..056da30ac357d3f89085bf3f940889b867f3462f 100644 (file)
@@ -2,21 +2,21 @@
 /*
  * CINELERRA
  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- * 
+ *
  */
 
 
@@ -48,8 +48,9 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+#ifdef HAVE_VIDEO4LINUX2
 #include <linux/videodev2.h>
-
+#endif
 
 Condition DeviceMPEGInput::in_mpeg_lock(1,"DeviceMPEGInput::in_mpeg_lock");
 DeviceMPEGList DeviceMPEGInput::in_mpeg;
@@ -414,36 +415,40 @@ int DeviceMPEGInput::set_channel(Channel *channel)
 
 void DeviceMPEGInput::set_captioning(int strk)
 {
-       mLock holds(decoder_lock);
+       decoder_lock->lock("DeviceMPEGInput::set_captioning");
        captioning = strk;
        if( src && video_stream >= 0 )
                src->show_subtitle(video_stream, strk);
+       decoder_lock->unlock();
 }
 
 int DeviceMPEGInput::drop_frames(int frames)
 {
-       mLock holds(decoder_lock);
+       decoder_lock->lock("DeviceMPEGInput::drop_frames");
        double result = -1.;
        if( src && video_stream >= 0 )
                result = src->drop_frames(frames,video_stream);
+       decoder_lock->unlock();
        return result;
 }
 
 double DeviceMPEGInput::audio_timestamp()
 {
-       mLock holds(decoder_lock);
+       decoder_lock->lock("DeviceMPEGInput::audio_timestamp");
        double result = -1.;
        if( src && audio_stream >= 0 )
                result = src->get_audio_time(audio_stream);
+       decoder_lock->unlock();
        return result;
 }
 
 double DeviceMPEGInput::video_timestamp()
 {
-       mLock holds(decoder_lock);
+       decoder_lock->lock("DeviceMPEGInput::video_timestamp");
        double ret = -1.;
        if( src && video_stream >= 0 )
                ret = src->get_video_time(video_stream);
+       decoder_lock->unlock();
        return ret;
 }
 
@@ -484,35 +489,51 @@ int DeviceMPEGInput::stop_record()
 
 int DeviceMPEGInput::subchannel_count()
 {
+#ifdef HAVE_DVB
        return src ? src->dvb.channel_count() : 0;
+#else
+       return 0;
+#endif
 }
 
 int DeviceMPEGInput::subchannel_definition(int subchan, char *name,
        int &major, int &minor, int &total_astreams, int &total_vstreams)
 {
+#ifdef HAVE_DVB
        int result = src != 0 ? 0 : -1;
        if( !result ) result = src->dvb.get_channel(subchan, major, minor);
        if( !result ) result = src->dvb.get_station_id(subchan, &name[0]);
        if( !result ) result = src->dvb.total_astreams(subchan, total_astreams);
        if( !result ) result = src->dvb.total_vstreams(subchan, total_vstreams);
        return result;
+#else
+       return -1;
+#endif
 }
 
 int DeviceMPEGInput::subchannel_video_stream(int subchan, int vstream)
 {
+#ifdef HAVE_DVB
        int result = src != 0 ? 0 : -1;
        if( !result && src->dvb.vstream_number(subchan, vstream, result) )
                result = -1;
        return result;
+#else
+       return -1;
+#endif
 }
 
 int DeviceMPEGInput::subchannel_audio_stream(int subchan, int astream, char *enc)
 {
+#ifdef HAVE_DVB
        int result = src != 0 ? 0 : -1;
        if( src && src->dvb.astream_number(subchan, astream, result, enc) ) {
                enc[0] = 0; result = -1;
        }
        return result;
+#else
+       return -1;
+#endif
 }
 
 int DeviceMPEGInput::get_video_pid(int track)
@@ -523,7 +544,7 @@ int DeviceMPEGInput::get_video_pid(int track)
 int DeviceMPEGInput::get_video_info(int track, int &pid, double &framerate,
                 int &width, int &height, char *title)
 {
-       //mLock holds(decoder_lock);  caller of callback holds lock
+       //caller of callback holds decoder_lock;
        if( !src ) return 1;
        pid = src->video_pid(track);
        framerate = src->frame_rate(track);