123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- #include "mp4common.h"
- MP4TextAtom::MP4TextAtom()
- : MP4Atom("text")
- {
-
-
-
-
-
- }
- void MP4TextAtom::AddPropertiesStsdType()
- {
- AddReserved("reserved1", 6);
- AddProperty(new MP4Integer16Property("dataReferenceIndex"));
- AddProperty(new MP4Integer32Property("displayFlags"));
- AddProperty(new MP4Integer32Property("textJustification"));
- AddProperty(new MP4Integer16Property("bgColorRed"));
- AddProperty(new MP4Integer16Property("bgColorGreen"));
- AddProperty(new MP4Integer16Property("bgColorBlue"));
- AddProperty(new MP4Integer16Property("defTextBoxTop"));
- AddProperty(new MP4Integer16Property("defTextBoxLeft"));
- AddProperty(new MP4Integer16Property("defTextBoxBottom"));
- AddProperty(new MP4Integer16Property("defTextBoxRight"));
- AddReserved("reserved2", 8);
- AddProperty(new MP4Integer16Property("fontNumber"));
- AddProperty(new MP4Integer16Property("fontFace"));
- AddReserved("reserved3", 1);
- AddReserved("reserved4", 2);
- AddProperty(new MP4Integer16Property("foreColorRed"));
- AddProperty(new MP4Integer16Property("foreColorGreen"));
- AddProperty(new MP4Integer16Property("foreColorBlue"));
- }
- void MP4TextAtom::AddPropertiesGmhdType()
- {
- AddProperty(new MP4BytesProperty("textData", 36));
- }
- void MP4TextAtom::Generate()
- {
- if (!strcmp(m_pParentAtom->GetType(), "stsd")) {
- AddPropertiesStsdType();
- GenerateStsdType();
- } else if (!strcmp(m_pParentAtom->GetType(), "gmhd")) {
- AddPropertiesGmhdType();
- GenerateGmhdType();
- } else {
- VERBOSE_WARNING(m_pFile->GetVerbosity(),
- printf("Warning: text atom in unexpected context, can not generate"));
- }
- }
- void MP4TextAtom::GenerateStsdType()
- {
-
- MP4Atom::Generate();
- ((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
- ((MP4Integer32Property*)m_pProperties[2])->SetValue(1);
- ((MP4Integer32Property*)m_pProperties[3])->SetValue(1);
- }
- void MP4TextAtom::GenerateGmhdType()
- {
- MP4Atom::Generate();
-
- static u_int8_t textData[36] = {
- 0x00, 0x01,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x01,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x00, 0x00,
- 0x40, 0x00,
- 0x00, 0x00,
- };
- ((MP4BytesProperty*)m_pProperties[0])->SetValue(textData, sizeof(textData));
-
- }
|