Ticket #3355: restore_dvd_speed_seeking.diff

File restore_dvd_speed_seeking.diff, 3.3 KB (added by skamithi, 14 years ago)

set dvd speed to the highest during sticky rew/ffw.

  • DVDRingBuffer.h

     
    100100    uint8_t GetNumAudioChannels(int id);
    101101    void JumpToTitle(bool change) { jumptotitle = change; }
    102102    void SeekCellStart(void);
    103     void SetDVDSpeed(const char *device, int speed);
     103    void SetDVDSpeed(void);
     104    void SetDVDSpeed(int speed);
    104105
    105106    void SetParent(NuppelVideoPlayer *p) { parent = p; }
    106107
  • DVDRingBuffer.cpp

     
    7272{
    7373    if (dvdnav)
    7474    {
    75         SetDVDSpeed(dvdFilename, -1);
     75        SetDVDSpeed(-1);
    7676        dvdnav_close(dvdnav);
    7777        dvdnav = NULL;
    7878    }           
     
    135135bool DVDRingBufferPriv::OpenFile(const QString &filename)
    136136{
    137137    dvdFilename = filename.ascii();
    138     int dvdDriveSpeed = gContext->GetNumSetting("DVDDriveSpeed", 2);
    139138    dvdnav_status_t dvdRet = dvdnav_open(&dvdnav, filename.local8Bit());
    140139    if (dvdRet == DVDNAV_STATUS_ERR)
    141140    {
     
    189188        dvdnav_get_serial_number(dvdnav, &serialnum);
    190189        dvdname = QString(name);
    191190        serialnumber = QString(serialnum);
    192    
    193         SetDVDSpeed(dvdFilename, dvdDriveSpeed);
    194 
     191        SetDVDSpeed();
    195192        return true;
    196193    }
    197194}
    198195
    199 /** \fn DVDRingBufferPriv::GetReadPosition()
    200  *  \brief returns current position in the PGC.
     196/** \brief returns current position in the PGC.
    201197 */
    202198long long DVDRingBufferPriv::GetReadPosition(void)
    203199{
     
    11501191    Seek(cellStart);
    11511192}
    11521193
    1153 /*
    1154  * \brief obtained from the mplayer project
     1194/** \brief set dvd speed. uses the DVDDriveSpeed Setting from the settings
     1195 * table
    11551196 */
    1156 void DVDRingBufferPriv::SetDVDSpeed(const char *device, int speed)
     1197void DVDRingBufferPriv::SetDVDSpeed(void)
    11571198{
     1199    int dvdDriveSpeed = gContext->GetNumSetting("DVDDriveSpeed", 12);
     1200    SetDVDSpeed(dvdDriveSpeed);
     1201}
     1202
     1203/** \brief set dvd speed.
     1204 *  \param dvd drive speed. example if speed is 1, then function sets dvd speed to 2048kb/s
     1205 */
     1206void DVDRingBufferPriv::SetDVDSpeed(int speed)
     1207{
    11581208#if defined(__linux__) && defined(SG_IO) && defined(GPCMD_SET_STREAMING)
    11591209    int fd;
    11601210    unsigned char buffer[28];
     
    11631213    struct sg_io_hdr sghdr;
    11641214    struct stat st;
    11651215
     1216    const char *device = dvdFilename;
    11661217    memset(&sghdr, 0, sizeof(sghdr));
    11671218    memset(buffer, 0, sizeof(buffer));
    11681219    memset(sense, 0, sizeof(sense));
    11691220    memset(cmd, 0, sizeof(cmd));
    11701221    memset(&st, 0, sizeof(st));
    11711222
     1223    QMutexLocker lock(&seekLock);
     1224   
    11721225    if (stat(device, &st) == -1 )
    11731226    {
    11741227        VERBOSE(VB_PLAYBACK, LOC_ERR +
  • NuppelVideoPlayer.cpp

     
    37943794{
    37953795    bool skip_changed;
    37963796
     3797    if (ringBuffer->isDVD())
     3798    {
     3799        if (GetDecoder())
     3800            GetDecoder()->UpdateDVDFramesPlayed();
     3801        if (play_speed != normal_speed)
     3802            ringBuffer->DVD()->SetDVDSpeed(-1);
     3803        else
     3804            ringBuffer->DVD()->SetDVDSpeed();
     3805    }
     3806
    37973807    if (play_speed > 0.0f && play_speed <= 3.0f)
    37983808    {
    37993809        skip_changed = (ffrew_skip != 1);