コード例 #1
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
  void AFRA::setGlobalEntry(globalafraentry newEntry, uint32_t no) {
    int offset = 13 + 12 * getEntryCount() + 4;
    if (getLongOffsets()) {
      offset = 13 + 16 * getEntryCount() + 4;
    }
    int entrysize = 20;
    if (getLongIDs()) {
      entrysize += 4;
    }
    if (getLongOffsets()) {
      entrysize += 8;
    }

    setInt64(newEntry.time, offset + entrysize * no);
    if (getLongIDs()) {
      setInt32(newEntry.segment, offset + entrysize * no + 8);
      setInt32(newEntry.fragment, offset + entrysize * no + 12);
    } else {
      setInt16(newEntry.segment, offset + entrysize * no + 8);
      setInt16(newEntry.fragment, offset + entrysize * no + 10);
    }
    if (getLongOffsets()) {
      setInt64(newEntry.afraoffset, offset + entrysize * no + entrysize - 16);
      setInt64(newEntry.offsetfromafra, offset + entrysize * no + entrysize - 8);
    } else {
      setInt32(newEntry.afraoffset, offset + entrysize * no + entrysize - 8);
      setInt32(newEntry.offsetfromafra, offset + entrysize * no + entrysize - 4);
    }

    if (getInt32(offset - 4) < no + 1) {
      setInt32(no + 1, offset - 4);
    }
  }
コード例 #2
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);
   }
 }
コード例 #3
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void AFRA::setEntry(afraentry newEntry, uint32_t no) {
   int entrysize = 12;
   if (getLongOffsets()) {
     entrysize = 16;
   }
   setInt64(newEntry.time, 13 + entrysize * no);
   if (getLongOffsets()) {
     setInt64(newEntry.offset, 21 + entrysize * no);
   } else {
     setInt32(newEntry.offset, 21 + entrysize * no);
   }
   if (no + 1 > getEntryCount()) {
     setInt32(no + 1, 9);
   }
 }
コード例 #4
0
ファイル: mp4_ms.cpp プロジェクト: DDVTECH/mistserver
 void UUID_TFXD::setDuration(uint64_t newDuration) {
   if (getVersion() == 0) {
     setInt32(newDuration, 24);
   } else {
     setInt64(newDuration, 28);
   }
 }
コード例 #5
0
ファイル: mp4_ms.cpp プロジェクト: DDVTECH/mistserver
 void UUID_TFXD::setTime(uint64_t newTime) {
   if (getVersion() == 0) {
     setInt32(newTime, 20);
   } else {
     setInt64(newTime, 20);
   }
 }
コード例 #6
0
ファイル: mp4_ms.cpp プロジェクト: DDVTECH/mistserver
 void UUID_TrackFragmentReference::setDuration(size_t num, uint64_t newDuration) {
   if (getVersion() == 0) {
     setInt32(newDuration, 21 + (num * 8) + 4);
   } else {
     setInt64(newDuration, 21 + (num * 16) + 8);
   }
 }
コード例 #7
0
ファイル: mp4_ms.cpp プロジェクト: DDVTECH/mistserver
 void UUID_TrackFragmentReference::setTime(size_t num, uint64_t newTime) {
   if (getVersion() == 0) {
     setInt32(newTime, 21 + (num * 8));
   } else {
     setInt64(newTime, 21 + (num * 16));
   }
 }
コード例 #8
0
ファイル: mp4.cpp プロジェクト: solderzzc/mistserver
 /// Gets the 64 bits integer at the given index.
 /// Attempts to resize the data pointer if the index is out of range.
 /// Returns zero if resizing failed.
 uint64_t Box::getInt64(size_t index) {
   index += payloadOffset;
   if (index + 7 >= boxedSize()) {
     if (!reserve(index, 0, 8)) {
       return 0;
     }
     setInt64(0, index - payloadOffset);
   }
   uint64_t result = ntohl(((int *)(data + index))[0]);
   result <<= 32;
   result += ntohl(((int *)(data + index))[1]);
   return result;
 }
コード例 #9
0
ファイル: TestThreads.cpp プロジェクト: longshadian/estl
 void testInsert(int32_t v1, int64_t v2)
 {
     asyncSubmit([this, v1, v2] 
     {
         mysqlcpp::ConnectionGuard conn{ *m_db_pool };
         assert(conn);
         const char* sql = "INSERT INTO `test_threads` (`fint`, `fbigint`) "
             " VALUES (?, ?)";
         auto ps = conn->preparedStatement(sql);
         assert(ps);
         ps->setInt32(0, v1);
         ps->setInt64(1, v2);
         assert(ps->execute());
         std::ostringstream ostm{};
         ostm << "execute thread " << conn.get() << " " << std::this_thread::get_id() << "\n";
         std::cout << ostm.str();
         std::this_thread::sleep_for(std::chrono::milliseconds{ 10 });
     });
 }
コード例 #10
0
int32_t MediaAnalyticsItem::readFromParcel(const Parcel& data) {
    // into 'this' object
    // .. we make a copy of the string to put away.
    mKey = data.readCString();
    mSessionID = data.readInt64();
    mFinalized = data.readInt32();
    mTimestamp = data.readInt64();

    int count = data.readInt32();
    for (int i = 0; i < count ; i++) {
            MediaAnalyticsItem::Attr attr = data.readCString();
            int32_t ztype = data.readInt32();
                switch (ztype) {
                    case MediaAnalyticsItem::kTypeInt32:
                            setInt32(attr, data.readInt32());
                            break;
                    case MediaAnalyticsItem::kTypeInt64:
                            setInt64(attr, data.readInt64());
                            break;
                    case MediaAnalyticsItem::kTypeDouble:
                            setDouble(attr, data.readDouble());
                            break;
                    case MediaAnalyticsItem::kTypeCString:
                            setCString(attr, data.readCString());
                            break;
                    case MediaAnalyticsItem::kTypeRate:
                            {
                                int64_t count = data.readInt64();
                                int64_t duration = data.readInt64();
                                setRate(attr, count, duration);
                            }
                            break;
                    default:
                            ALOGE("reading bad item type: %d, idx %d",
                                  ztype, i);
                            return -1;
                }
    }

    return 0;
}
コード例 #11
0
ファイル: efc_variant.cpp プロジェクト: vilkov/efc
size_t Variant::deserialize(const unsigned char *buffer, size_t size)
{
    if (buffer != NULL && size > 0)
    {
        Variant::Type type = static_cast<Variant::Type>(*buffer);
        ++buffer;

        switch (type)
        {
            case UINT8:
            {
                typedef uint8_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setUint8(static_cast<Type>(*buffer));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case INT8:
            {
                typedef uint8_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setInt8(static_cast<Type>(*buffer));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case UINT16:
            {
                typedef uint16_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setUint16(ntohs(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case INT16:
            {
                typedef int16_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setInt16(ntohs(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case UINT32:
            {
                typedef uint32_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setUint32(ntohl(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case INT32:
            {
                typedef int32_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setInt32(ntohl(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case UINT64:
            {
                typedef uint64_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setUint64(ntohll(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case INT64:
            {
                typedef int64_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setInt64(ntohll(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case FLOAT:
            {
                typedef uint32_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setFloat(ntohf(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case DOUBLE:
            {
                typedef uint64_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setDouble(ntohd(*reinterpret_cast<const Type *>(buffer)));
                    size = sizeof(Type) + 1;
                }
                break;
            }

            case BOOL:
            {
                typedef bool Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setBool(*reinterpret_cast<const Type *>(buffer));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case CHAR:
            {
                typedef char Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    setChar(*reinterpret_cast<const Type *>(buffer));
                    size = sizeof(Type) + 1;
                }

                break;
            }

            case STRING:
            {
                typedef uint32_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    Type len = ntohl(*reinterpret_cast<const Type *>(buffer));

                    if (len > 0 && len <= ((size - 1) - sizeof(Type)))
                        setString(reinterpret_cast<const char *>(buffer + sizeof(Type)), len);

                    size = sizeof(Type) + 1 + len;
                }

                break;
            }

            case BINARY:
            {
                typedef uint32_t Type;

                if ((size - 1) < sizeof(Type))
                    return 0;
                else
                {
                    Type len = ntohl(*reinterpret_cast<const Type *>(buffer));

                    if (len > 0 && len <= ((size - 1) - sizeof(Type)))
                        setBinary(reinterpret_cast<const unsigned char *>(buffer + sizeof(Type)), len);

                    size = sizeof(Type) + 1 + len;
                }

                break;
            }
        }

        return size;
    }

    return 0;
}
コード例 #12
0
ファイル: nbcd.hpp プロジェクト: AttilaVamos/HPCC-Platform
 inline Decimal(__int64 value)                           { setInt64(value); }
コード例 #13
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void ABST::setSmpteTimeCodeOffset(uint64_t newTime) {
   setInt64(newTime, 21);
 }
コード例 #14
0
ファイル: mp4_adobe.cpp プロジェクト: DDVTECH/mistserver
 void ABST::setCurrentMediaTime(uint64_t newTime) {
   setInt64(newTime, 13);
 }
コード例 #15
0
ファイル: mp4_ms.cpp プロジェクト: DDVTECH/mistserver
 UUID::UUID() {
   memcpy(data + 4, "uuid", 4);
   setInt64(0, 0);
   setInt64(0, 8);
 }
コード例 #16
0
void CConfigFile::setInt64(const char * const key, const int64_t val)
{
	setInt64(std::string(key), val);
}
コード例 #17
0
ファイル: nbcd.hpp プロジェクト: AttilaVamos/HPCC-Platform
 inline Decimal & operator = (__int64 value)             { setInt64(value); return *this; }