Ticket #9854: remotedvd.diff

File remotedvd.diff, 3.7 KB (added by markk, 14 years ago)
  • mythtv/libs/libmythtv/fileringbuffer.cpp

    diff --git a/mythtv/libs/libmythtv/fileringbuffer.cpp b/mythtv/libs/libmythtv/fileringbuffer.cpp
    index 22f42ae..02d3a4f 100644
    a b static int posix_fadvise(int, off_t, off_t, int) { return 0; }  
    4242#define LOC_ERR  QString("FileRingBuf(%1) Error: ").arg(filename)
    4343
    4444FileRingBuffer::FileRingBuffer(const QString &lfilename,
    45                                bool write, bool readahead, int timeout_ms)
    46   : RingBuffer(kRingBuffer_File)
     45                               bool write, bool readahead, int timeout_ms,
     46                               RingBufferType rbtype)
     47  : RingBuffer(rbtype)
    4748{
    4849    startreadahead = readahead;
    4950    safefilename = lfilename;
  • mythtv/libs/libmythtv/fileringbuffer.h

    diff --git a/mythtv/libs/libmythtv/fileringbuffer.h b/mythtv/libs/libmythtv/fileringbuffer.h
    index 93fee9f..b2b97dd 100644
    a b class MTV_PUBLIC FileRingBuffer : public RingBuffer  
    1818
    1919  protected:
    2020    FileRingBuffer(const QString &lfilename,
    21                    bool write, bool readahead, int timeout_ms);
     21                   bool write, bool readahead, int timeout_ms,
     22                   RingBufferType rbtype = kRingBuffer_File);
    2223
    2324    virtual int safe_read(void *data, uint sz)
    2425    {
  • mythtv/libs/libmythtv/ringbuffer.cpp

    diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
    index 253c58b..5124848 100644
    a b RingBuffer *RingBuffer::Create(  
    138138            bddir  = true;
    139139    }
    140140
    141     if (!stream_only && (dvdurl || dvddir || dvdext))
     141    bool isdvd = dvdurl || dvddir || dvdext;
     142
     143    if (!stream_only && isdvd)
    142144    {
    143145        if (lfilename.left(6) == "dvd://")     // 'Play DVD' sends "dvd:/" + dev
    144146            lfilename.remove(0,5);             // e.g. "dvd://dev/sda"
    RingBuffer *RingBuffer::Create(  
    169171        return new BDRingBuffer(lfilename);
    170172    }
    171173
     174
     175    RingBufferType type = kRingBuffer_File;
     176    if (stream_only && isdvd)
     177        type = kRingBuffer_RemoteDVD;
     178
    172179    return new FileRingBuffer(
    173         lfilename, write, usereadahead, timeout_ms);
     180        lfilename, write, usereadahead, timeout_ms, type);
    174181}
    175182
    176183RingBuffer::RingBuffer(RingBufferType rbtype) :
    void RingBuffer::CalcReadAheadThresh(void)  
    366373    // make this a multiple of ffmpeg block size..
    367374    fill_min        = ((fill_min / KB32) + 1) * KB32;
    368375
     376    if (type == kRingBuffer_RemoteDVD)
     377    {
     378        fill_min = CHUNK;
     379        readblocksize = CHUNK;
     380    }
     381
    369382    VERBOSE(VB_FILE, LOC +
    370383            QString("CalcReadAheadThresh(%1 Kb)\n\t\t\t -> "
    371384                    "threshhold(%2 KB) min read(%3 KB) blk size(%4 KB)")
    void RingBuffer::run(void)  
    772785                    (now.tv_usec - lastread.tv_usec) / 1000;
    773786                readtimeavg = (readtimeavg * 9 + readinterval) / 10;
    774787
    775                 if (readtimeavg < 150 && (uint)readblocksize < (BUFFER_SIZE_MINIMUM >>2))
     788                if (readtimeavg < 150 &&
     789                    (uint)readblocksize < (BUFFER_SIZE_MINIMUM >>2) &&
     790                     type != kRingBuffer_RemoteDVD)
    776791                {
    777792                    int old_block_size = readblocksize;
    778793                    readblocksize = 3 * readblocksize / 2;
  • mythtv/libs/libmythtv/ringbuffer.h

    diff --git a/mythtv/libs/libmythtv/ringbuffer.h b/mythtv/libs/libmythtv/ringbuffer.h
    index 6073c56..29bcad5 100644
    a b enum RingBufferType  
    3838    kRingBuffer_DVD,
    3939    kRingBuffer_BD,
    4040    kRingBuffer_HTTP,
     41    kRingBuffer_RemoteDVD,
     42    kRingBuffer_RemoteBD,
    4143};
    4244
    4345class MTV_PUBLIC RingBuffer : protected QThread