1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #include "mp4common.h"
- class MP4HalfSizeTableProperty : public MP4TableProperty
- {
- public:
- MP4HalfSizeTableProperty(char *name, MP4IntegerProperty *pCountProperty) :
- MP4TableProperty(name, pCountProperty) {};
-
- u_int32_t GetCount() {
- return (m_pCountProperty->GetValue() + 1)/ 2;
- };
- void SetCount(u_int32_t count) {
- m_pCountProperty->SetValue(count * 2);
- };
- };
- MP4Stz2Atom::MP4Stz2Atom()
- : MP4Atom("stz2")
- {
- AddVersionAndFlags();
- AddReserved("reserved", 3);
- AddProperty(
- new MP4Integer8Property("fieldSize"));
- MP4Integer32Property* pCount =
- new MP4Integer32Property("sampleCount");
- AddProperty(pCount);
- }
- void MP4Stz2Atom::Read()
- {
- ReadProperties(0, 4);
- uint8_t fieldSize =
- ((MP4Integer8Property *)m_pProperties[3])->GetValue();
-
- MP4Integer32Property* pCount =
- (MP4Integer32Property *)m_pProperties[4];
- MP4TableProperty *pTable;
- if (fieldSize != 4) {
- pTable = new MP4TableProperty("entries", pCount);
- } else {
-
- pTable = new MP4HalfSizeTableProperty("entries", pCount);
- }
- AddProperty(pTable);
- if (fieldSize == 16) {
- pTable->AddProperty(
- new MP4Integer16Property("entrySize"));
- } else {
- pTable->AddProperty(
- new MP4Integer8Property("entrySize"));
- }
-
- ReadProperties(4);
- Skip();
- }
|