---------------------------------------------------------------------- | AP4_DataAtom::LoadString +---------------------------------------------------------------------*/
| 1541 | | AP4_DataAtom::LoadString |
| 1542 | +---------------------------------------------------------------------*/ |
| 1543 | AP4_Result |
| 1544 | AP4_DataAtom::LoadString(AP4_String*& string) |
| 1545 | { |
| 1546 | if (m_Source == NULL) { |
| 1547 | string = new AP4_String(); |
| 1548 | return AP4_SUCCESS; |
| 1549 | } else { |
| 1550 | // create a string with enough capactiy for the data |
| 1551 | AP4_LargeSize size = 0; |
| 1552 | m_Source->GetSize(size); |
| 1553 | if (size > AP4_DATA_ATOM_MAX_SIZE) return AP4_ERROR_OUT_OF_RANGE; |
| 1554 | string = new AP4_String((AP4_Size)size); |
| 1555 | |
| 1556 | // read from the start of the stream |
| 1557 | m_Source->Seek(0); |
| 1558 | AP4_Result result = m_Source->Read(string->UseChars(), (AP4_Size)size); |
| 1559 | if (AP4_FAILED(result)) { |
| 1560 | delete string; |
| 1561 | string = NULL; |
| 1562 | } |
| 1563 | |
| 1564 | return result; |
| 1565 | } |
| 1566 | } |
| 1567 | |
| 1568 | /*---------------------------------------------------------------------- |
| 1569 | | AP4_DataAtom::LoadBytes |