~ubuntu-wine/ubuntu/lucid/wine1.2/wine1.2+winepulse

« back to all changes in this revision

Viewing changes to dlls/avifil32/avifile.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-02-02 11:15:03 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100202111503-w4ayji21ei1ginjr
Tags: 1.1.37-0ubuntu1
* New upstream release
  - A number of fixes in AVI file support.
  - Several MSXML improvements.
  - A few MSI fixes.
  - Various bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1087
1087
    LONG block = start;
1088
1088
    LONG offset = 0;
1089
1089
 
 
1090
    if (!buffer)
 
1091
    {
 
1092
      if (bytesread)
 
1093
        *bytesread = samples*This->sInfo.dwSampleSize;
 
1094
      if (samplesread)
 
1095
        *samplesread = samples;
 
1096
      return AVIERR_OK;
 
1097
    }
 
1098
 
1090
1099
    /* convert start sample to block,offset pair */
1091
1100
    AVIFILE_SamplesToBlock(This, &block, &offset);
1092
1101
 
1094
1103
    samples *= This->sInfo.dwSampleSize;
1095
1104
 
1096
1105
    while (samples > 0 && buffersize > 0) {
 
1106
      LONG blocksize;
1097
1107
      if (block != This->dwCurrentFrame) {
1098
1108
        hr = AVIFILE_ReadBlock(This, block, NULL, 0);
1099
1109
        if (FAILED(hr))
1101
1111
      }
1102
1112
 
1103
1113
      size = min((DWORD)samples, (DWORD)buffersize);
1104
 
      size = min(size, This->cbBuffer - offset);
 
1114
      blocksize = This->lpBuffer[1];
 
1115
      TRACE("blocksize = %u\n",blocksize);
 
1116
      size = min(size, blocksize - offset);
1105
1117
      memcpy(buffer, ((BYTE*)&This->lpBuffer[2]) + offset, size);
1106
1118
 
1107
1119
      block++;
1655
1667
  This->fInfo.dwCaps                = AVIFILECAPS_CANREAD|AVIFILECAPS_CANWRITE;
1656
1668
  This->fInfo.dwLength              = MainAVIHdr.dwTotalFrames;
1657
1669
  This->fInfo.dwStreams             = MainAVIHdr.dwStreams;
1658
 
  This->fInfo.dwSuggestedBufferSize = MainAVIHdr.dwSuggestedBufferSize;
 
1670
  This->fInfo.dwSuggestedBufferSize = 0;
1659
1671
  This->fInfo.dwWidth               = MainAVIHdr.dwWidth;
1660
1672
  This->fInfo.dwHeight              = MainAVIHdr.dwHeight;
1661
1673
  LoadStringW(AVIFILE_hModule, IDS_AVIFILETYPE, This->fInfo.szFileType,
1757
1769
            pStream->sInfo.dwRate                = streamHdr.dwRate;
1758
1770
            pStream->sInfo.dwStart               = streamHdr.dwStart;
1759
1771
            pStream->sInfo.dwLength              = streamHdr.dwLength;
1760
 
            pStream->sInfo.dwSuggestedBufferSize =
1761
 
              streamHdr.dwSuggestedBufferSize;
 
1772
            pStream->sInfo.dwSuggestedBufferSize = 0;
1762
1773
            pStream->sInfo.dwQuality             = streamHdr.dwQuality;
1763
1774
            pStream->sInfo.dwSampleSize          = streamHdr.dwSampleSize;
1764
1775
            pStream->sInfo.rcFrame.left          = streamHdr.rcFrame.left;
1819
1830
          if (FAILED(hr))
1820
1831
            return hr;
1821
1832
        };
1822
 
 
 
1833
        if (pStream->lpFormat != NULL && pStream->sInfo.fccType == streamtypeAUDIO)
 
1834
        {
 
1835
          WAVEFORMATEX *wfx = pStream->lpFormat;          /* wfx->nBlockAlign = wfx->nChannels * wfx->wBitsPerSample / 8; could be added */
 
1836
          pStream->sInfo.dwSampleSize = wfx->nBlockAlign; /* to deal with corrupt wfx->nBlockAlign but Windows doesn't do this */
 
1837
          TRACE("Block size reset to %u, chan=%u bpp=%u\n", wfx->nBlockAlign, wfx->nChannels, wfx->wBitsPerSample);
 
1838
          pStream->sInfo.dwScale = 1;
 
1839
          pStream->sInfo.dwRate = wfx->nSamplesPerSec;
 
1840
        }
1823
1841
        if (mmioAscend(This->hmmio, &ck, 0) != S_OK)
1824
1842
          return AVIERR_FILEREAD;
1825
1843
      }
1900
1918
    }
1901
1919
  }
1902
1920
 
 
1921
  for (nStream = 0; nStream < This->fInfo.dwStreams; nStream++)
 
1922
  {
 
1923
    DWORD sugbuf =  This->ppStreams[nStream]->sInfo.dwSuggestedBufferSize;
 
1924
    if (This->fInfo.dwSuggestedBufferSize < sugbuf)
 
1925
      This->fInfo.dwSuggestedBufferSize = sugbuf;
 
1926
  }
 
1927
 
1903
1928
  /* find other chunks */
1904
1929
  FindChunkAndKeepExtras(&This->fileextra, This->hmmio, &ck, &ckRIFF, 0);
1905
1930