~ubuntu-branches/ubuntu/precise/mp3diags/precise

« back to all changes in this revision

Viewing changes to src/MpegStream.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-09-05 10:48:57 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090905104857-48aob98yoibqarh0
Tags: 0.99.05.033-0ubuntu1
New upstream release (FFe granted LP: #423812).

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
        MP3_NOTE (m_pos, "Stream uses CRC.");
186
186
    }*/
187
187
 
188
 
    if (MpegFrame::MPEG1 != m_firstFrame.getVersion() || MpegFrame::LAYER3 != m_firstFrame.getLayer())
 
188
    if (
 
189
        !(MpegFrame::MPEG1 == m_firstFrame.getVersion() && MpegFrame::LAYER3 == m_firstFrame.getLayer()) &&
 
190
        !(MpegFrame::MPEG2 == m_firstFrame.getVersion() && MpegFrame::LAYER3 == m_firstFrame.getLayer()))
189
191
    {
190
192
        MP3_NOTE (m_pos, untestedEncoding);
191
193
    }
196
198
}
197
199
 
198
200
 
 
201
 
199
202
// this can only be called once; the second call will throw (it's harder and quite pointless to allow more than one call)
200
203
void MpegStream::removeLastFrame()
201
204
{
202
 
    CB_ASSERT (!m_bRemoveLastFrameCalled);
 
205
    STRM_ASSERT (!m_bRemoveLastFrameCalled);
203
206
    m_bRemoveLastFrameCalled = true;
204
207
    m_nSize -= m_lastFrame.getSize();
205
208
    m_nTotalBps -= m_lastFrame.getBitrate();
206
 
    CB_ASSERT(m_nFrameCount >= 10);
 
209
    STRM_ASSERT (m_nFrameCount >= 10);
207
210
    --m_nFrameCount;
208
211
    m_nBitrate = int(m_nTotalBps / m_nFrameCount);
209
212
}
318
321
 
319
322
    int nBfrSize (MpegFrame::MPEG_FRAME_HDR_SIZE + nSideInfoSize + XING_LABEL_SIZE);
320
323
    streamsize nRead (read(in, bfr, nBfrSize));
321
 
    CB_ASSERT (nBfrSize == nRead); // this was supposed to be a valid frame to begin with (otherwise the base class would have thrown)
 
324
    STRM_ASSERT (nBfrSize == nRead); // this was supposed to be a valid frame to begin with (otherwise the base class would have thrown)
322
325
 
323
326
    char* pLabel (bfr + MpegFrame::MPEG_FRAME_HDR_SIZE + nSideInfoSize);
324
327
    MP3_CHECK_T (0 == strncmp("Xing", pLabel, XING_LABEL_SIZE) || 0 == strncmp("Info", pLabel, XING_LABEL_SIZE), m_pos, "Not a Xing stream. Header not found.", NotXingStream());
432
435
    char bfr [BFR_SIZE];
433
436
 
434
437
    streamsize nRead (read(in, bfr, BFR_SIZE));
435
 
    CB_ASSERT (BFR_SIZE == nRead); // this was supposed to be a valid frame to begin with (otherwise the base class would have thrown)
 
438
    STRM_ASSERT (BFR_SIZE == nRead); // this was supposed to be a valid frame to begin with (otherwise the base class would have thrown)
436
439
 
437
440
    MP3_CHECK_T (0 == strncmp("LAME", bfr + LAME_OFFS, LAME_LABEL_SIZE), m_pos, "Not a LAME stream. Header not found.", NotLameStream());
438
441
 
466
469
    char bfr [BFR_SIZE];
467
470
 
468
471
    streamsize nRead (read(in, bfr, BFR_SIZE));
469
 
    CB_ASSERT (BFR_SIZE == nRead); // this was supposed to be a valid frame to begin with (otherwise the base class would have thrown)
 
472
    STRM_ASSERT (BFR_SIZE == nRead); // this was supposed to be a valid frame to begin with (otherwise the base class would have thrown) // ttt0 was reported as triggered at https://sourceforge.net/apps/mantisbt/mp3diags/view.php?id=8
470
473
 
471
474
    char* pLabel (bfr + MpegFrame::MPEG_FRAME_HDR_SIZE + 32);
472
475
    MP3_CHECK_T (0 == strncmp("VBRI", pLabel, VBRI_LABEL_SIZE), m_pos, "Not a VBRI stream. Header not found.", NotVbriStream());
609
612
    case V11: strRes = "ID3V1.1"; break;
610
613
    case V11b: strRes = "ID3V1.1b"; break;
611
614
    default:
612
 
        CB_ASSERT (false);
 
615
        STRM_ASSERT (false);
613
616
    }
614
617
    strRes += getSpacedStr(getTitle(0)) + getSpacedStr(getArtist(0)) + getSpacedStr(getAlbumName(0)) + getSpacedStr(getGenre(0));
615
618
    return strRes;