コード例 #1
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void ABST::setQualityEntry(std::string & newEntry, uint32_t no) {
   int countLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     countLoc += getStringLen(countLoc) + 1;
   }
   int tempLoc = countLoc + 1;
   //attempt to reach the wanted position
   unsigned int i;
   for (i = 0; i < getInt8(countLoc) && i < no; ++i) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   //we are now either at the end, or at the right position
   //let's reserve any unreserved space...
   if (no + 1 > getInt8(countLoc)) {
     int amount = no + 1 - getInt8(countLoc);
     if (!reserve(payloadOffset + tempLoc, 0, amount)) {
       return;
     };
     memset(data + payloadOffset + tempLoc, 0, amount);
     setInt8(no + 1, countLoc); //set new qualityEntryCount
     tempLoc += no - i;
   }
   //now, tempLoc is at position for string number no, and we have at least 1 byte reserved.
   setString(newEntry, tempLoc);
 }
コード例 #2
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 uint32_t ABST::getQualityEntryCount() {
   int countLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     countLoc += getStringLen(countLoc) + 1;
   }
   return getInt8(countLoc);
 }
コード例 #3
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void ABST::setSegmentRunTable(ASRT & newSegment, uint32_t no) {
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += getStringLen(tempLoc) + 1; //DrmData
   tempLoc += getStringLen(tempLoc) + 1; //MetaData
   int countLoc = tempLoc;
   tempLoc++; //skip segmentRuntableCount
   //attempt to reach the wanted position
   unsigned int i;
   for (i = 0; i < getInt8(countLoc) && i < no; ++i) {
     tempLoc += getBoxLen(tempLoc);
   }
   //we are now either at the end, or at the right position
   //let's reserve any unreserved space...
   if (no + 1 > getInt8(countLoc)) {
     int amount = no + 1 - getInt8(countLoc);
     if (!reserve(payloadOffset + tempLoc, 0, amount * 8)) {
       return;
     };
     //set empty erro boxes as contents
     for (int j = 0; j < amount; ++j) {
       memcpy(data + payloadOffset + tempLoc + j * 8, "\000\000\000\010erro", 8);
     }
     setInt8(no + 1, countLoc); //set new count
     tempLoc += (no - i) * 8;
   }
   //now, tempLoc is at position for string number no, and we have at least an erro box reserved.
   setBox(newSegment, tempLoc);
 }
コード例 #4
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 AFRT & ABST::getFragmentRunTable(uint32_t no) {
   static Box result;
   if (no >= getFragmentRunTableCount()) {
     static Box res;
     return (AFRT &)res;
   }
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += getStringLen(tempLoc) + 1; //DrmData
   tempLoc += getStringLen(tempLoc) + 1; //MetaData
   for (unsigned int i = getInt8(tempLoc++); i != 0; --i) {
     tempLoc += getBoxLen(tempLoc);
   }
   tempLoc++;
   for (unsigned int i = 0; i < no; i++) {
     tempLoc += getBoxLen(tempLoc);
   }
   return (AFRT &)getBox(tempLoc);
 }
コード例 #5
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 ///\return Empty string if no > serverEntryCount(), serverEntry[no] otherwise.
 const char * ABST::getServerEntry(uint32_t no) {
   if (no + 1 > getServerEntryCount()) {
     return "";
   }
   int tempLoc = 29 + getStringLen(29) + 1 + 1; //position of first entry
   for (unsigned int i = 0; i < no; i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   return getString(tempLoc);
 }
コード例 #6
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 char * ABST::getDrmData() {
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   return getString(tempLoc);
 }
コード例 #7
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void ABST::setDrmData(std::string newDrm) {
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   setString(newDrm, tempLoc);
 }
コード例 #8
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 uint32_t ABST::getSegmentRunTableCount() {
   uint32_t tempLoc = 29 + getStringLen(29) + 1 + 1;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc++;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += getStringLen(tempLoc) + 1; //DrmData
   tempLoc += getStringLen(tempLoc) + 1; //MetaData
   return getInt8(tempLoc);
 }
コード例 #9
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 const char * ABST::getQualityEntry(uint32_t no) {
   if (no > getQualityEntryCount()) {
     return "";
   }
   int tempLoc = 29 + getStringLen(29) + 1 + 1; //position of serverentries;
   for (unsigned int i = 0; i < getServerEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += 1; //first qualityentry
   for (unsigned int i = 0; i < no; i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   return getString(tempLoc);
 }
コード例 #10
0
ファイル: mp4.cpp プロジェクト: solderzzc/mistserver
 /// Sets the NULL-terminated string at the given index.
 /// Will attempt to resize if the string doesn't fit.
 /// Fails silently if resizing failed.
 void Box::setString(char * newData, size_t size, size_t index) {
   index += payloadOffset;
   if (index >= boxedSize()) {
     if (!reserve(index, 0, 1)) {
       return;
     }
     data[index] = 0;
   }
   if (getStringLen(index) != size) {
     if (!reserve(index, getStringLen(index) + 1, size + 1)) {
       return;
     }
   }
   memcpy(data + index, newData, size + 1);
 }
コード例 #11
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 uint32_t ASRT::getSegmentRunEntryCount() {
   int tempLoc = 5; //position of qualityentry count;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   return getInt32(tempLoc);
 }
コード例 #12
0
ファイル: string.cpp プロジェクト: duyanning/ropevm
char *String2Utf8(Object *string) {
    int len = getStringLen(string);
    unsigned short *unicode = getStringChars(string);
    char *utf8 = (char*)sysMalloc(utf8CharLen(unicode, len) + 1);

    return unicode2Utf8(unicode, len, utf8);
}
コード例 #13
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 afrt_runtable AFRT::getFragmentRun(uint32_t no) {
   afrt_runtable res;
   if (no > getFragmentRunCount()) {
     return res;
   }
   int tempLoc = 9;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += 4;
   for (unsigned int i = 0; i < no; i++) {
     if (getInt32(tempLoc + 12) == 0) {
       tempLoc += 17;
     } else {
       tempLoc += 16;
     }
   }
   res.firstFragment = getInt32(tempLoc);
   res.firstTimestamp = getInt64(tempLoc + 4);
   res.duration = getInt32(tempLoc + 12);
   if (res.duration) {
     res.discontinuity = getInt8(tempLoc + 16);
   } else {
     res.discontinuity = 0;
   }
   return res;
 }
コード例 #14
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void AFRT::setFragmentRun(afrt_runtable newRun, uint32_t no) {
   int tempLoc = 9;
   for (unsigned int i = 0; i < getQualityEntryCount(); ++i) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   int countLoc = tempLoc;
   unsigned int count = getInt32(countLoc);
   tempLoc += 4;
   for (unsigned int i = 0; i < no; i++) {
     if (i + 1 > count) {
       setInt32(0, tempLoc);
       setInt64(0, tempLoc + 4);
       setInt32(1, tempLoc + 12);
     }
     if (getInt32(tempLoc + 12) == 0) {
       tempLoc += 17;
     } else {
       tempLoc += 16;
     }
   }
   setInt32(newRun.firstFragment, tempLoc);
   setInt64(newRun.firstTimestamp, tempLoc + 4);
   setInt32(newRun.duration, tempLoc + 12);
   if (newRun.duration == 0) {
     setInt8(newRun.discontinuity, tempLoc + 16);
   }
   if (count < no + 1) {
     setInt32(no + 1, countLoc);
   }
 }
コード例 #15
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 uint32_t AFRT::getFragmentRunCount() {
   int tempLoc = 9;
   for (unsigned int i = 0; i < getQualityEntryCount(); ++i) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   return getInt32(tempLoc);
 }
コード例 #16
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 const char * ASRT::getQualityEntry(uint32_t no) {
   if (no > getQualityEntryCount()) {
     return "";
   }
   int tempLoc = 5; //position of qualityentry count;
   for (unsigned int i = 0; i < no; i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   return getString(tempLoc);
 }
コード例 #17
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void ASRT::setSegmentRun(uint32_t firstSegment, uint32_t fragmentsPerSegment, uint32_t no) {
   int tempLoc = 5; //position of qualityentry count;
   for (unsigned int i = 0; i < getQualityEntryCount(); i++) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   int countLoc = tempLoc;
   tempLoc += 4 + no * 8;
   if (no + 1 > getInt32(countLoc)) {
     setInt32(no + 1, countLoc); //set new qualityEntryCount
   }
   setInt32(firstSegment, tempLoc);
   setInt32(fragmentsPerSegment, tempLoc + 4);
 }
コード例 #18
0
void refactorString(struct bucketString *pStr) {
    struct bucket *pResult;
    struct bucket *pBkt;
    int i, j;

    /* Exit if string is empty, or only one bucket exists */
    if (pStr == NULL) return;
    if (pStr->pBkt == NULL) {
        pStr->pLast = NULL;
        return;
    }
    if (pStr->pBkt->pNext == NULL) {
        if (isBucketNonEmpty(pStr->pBkt)==0) {
            /* Dump bucket */
            clearString(pStr);
            return;

        } else {
            /* Already have only one valid bucket */
            pStr->pLast = pStr->pBkt;
            return;
        }
    }

    /* Attempt to create new bucket */
    pResult = newBucket(getStringLen(pStr));

    if (pResult == NULL) {
        /* Failed to create bucket. Clear string (probably empty) */
        clearString(pStr);
        return;
    }

    /* Copy over data from existing buckets */
    i = 0;
    for (pBkt = pStr->pBkt; pBkt != NULL; pBkt = pBkt->pNext) {
        /* Skip empty buckets */
        if (isBucketNonEmpty(pBkt) == 0) continue;

        /* Copy buffers. i accumulates continuously */
        for (j = 0; j < pBkt->size; i++, j++) {
            pResult->pBuf[i] = pBkt->pBuf[j];
        }
    }

    /* Remove old buckets and reassign to new bucket */
    clearString(pStr);
    pStr->pBkt = pResult;
    pStr->pLast = pResult;
}
コード例 #19
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 asrt_runtable ASRT::getSegmentRun(uint32_t no) {
   asrt_runtable res;
   if (no >= getSegmentRunEntryCount()) {
     return res;
   }
   int tempLoc = 5; //position of qualityentry count;
   for (unsigned int i = 0; i < getQualityEntryCount(); ++i) {
     tempLoc += getStringLen(tempLoc) + 1;
   }
   tempLoc += 4 + 8 * no;
   res.firstSegment = getInt32(tempLoc);
   res.fragmentsPerSegment = getInt32(tempLoc + 4);
   return res;
 }
コード例 #20
0
ファイル: string.cpp プロジェクト: duyanning/ropevm
int getStringUtf8Len(Object *string) {
    return utf8CharLen(getStringChars(string), getStringLen(string));
}
コード例 #21
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 uint32_t ABST::getServerEntryCount() {
   int countLoc = 29 + getStringLen(29) + 1;
   return getInt8(countLoc);
 }