Exemple #1
0
static int VarsCommand (vlc_object_t *obj, char const *cmd,
                        vlc_value_t oldval, vlc_value_t newval, void *data)
{
    void *p;

    (void) cmd; (void) oldval; (void) data;

    if (sscanf (newval.psz_string, "%p", &p) == 1)
    {
        p = ObjectExists (obj, p);
        if (p == NULL)
        {
            msg_Err (obj, "no such object: %s", newval.psz_string);
            return VLC_ENOOBJ;
        }
        obj = p;
    }
    else
        vlc_object_hold (obj);

    PrintObject (obj, "");
    DumpVariables (obj);
    vlc_object_release (obj);

    return VLC_SUCCESS;
}
Exemple #2
0
static vlc_object_t *ObjectExists (vlc_object_t *root, void *obj)
{
    if (root == obj)
        return vlc_object_hold (root);

    vlc_object_internals_t *priv = vlc_internals(root);
    vlc_object_t *ret = NULL;

    /* NOTE: nested locking here (due to recursive call) */
    vlc_mutex_lock (&vlc_internals(root)->tree_lock);

    for (priv = priv->first; priv != NULL && ret == NULL; priv = priv->next)
        ret = ObjectExists (vlc_externals (priv), obj);

    vlc_mutex_unlock (&vlc_internals(root)->tree_lock);
    return ret;
}
Exemple #3
0
bool CWizDatabase::UpdateDeletedGUID(const WIZDELETEDGUIDDATA& data)
{
    bool bRet = false;

    CString strType = WIZOBJECTDATA::ObjectTypeToTypeString(data.eType);
    bool bExists = false;
    ObjectExists(data.strGUID, strType, bExists);
    if (!bExists)
        return true;

    bRet = DeleteObject(data.strGUID, strType, false);

    if (!bRet) {
        Q_EMIT updateError("Failed to delete object: " + data.strGUID + " type: " + strType);
    }

    return bRet;
}
Exemple #4
0
//-*****************************************************************************
void
ReadPropertyHeader( H5Node & iParent,
                    const std::string & iPropName,
                    AbcA::PropertyHeader & oHeader,
                    bool & oIsScalarLike,
                    uint32_t & oNumSamples,
                    uint32_t & oFirstChangedIndex,
                    uint32_t & oLastChangedIndex,
                    uint32_t & oTimeSamplingIndex )
{
    uint32_t info[5] = {0, 0, 0, 0, 0};
    size_t numFields = 0;
    size_t fieldsUsed = 1;

    // 0000 0000 0000 0000 0000 0000 0000 0011
    static const uint32_t ptypeMask = 0x0003;

    // 0000 0000 0000 0000 0000 0000 0011 1100
    static const uint32_t podMask = 0x003c;

    // 0000 0000 0000 0000 0000 0000 0100 0000
    static const uint32_t hasTsidxMask = 0x0040;

    // 0000 0000 0000 0000 0000 0000 1000 0000
    static const uint32_t noRepeatsMask = 0x0080;

    // 0000 0000 0000 0000 1111 1111 0000 0000
    static const uint32_t extentMask = 0xff00;

    ReadSmallArray(iParent.getObject(), iPropName + ".info", H5T_STD_U32LE,
                   H5T_NATIVE_UINT32, 5, numFields, (void *) info );

    AbcA::MetaData metaData;
    ReadMetaData( iParent, iPropName + ".meta", metaData );

    if ( numFields == 1 && info[0] == 0 )
    {
        oHeader = AbcA::PropertyHeader( iPropName, metaData );
    }
    else
    {
        // low two bits are the property type
        char ipt = info[0] & ptypeMask;

        // first bit is either scalar, or scalar like
        oIsScalarLike = ipt & 1;

        // is scalar like is set for this array attribute
        if (ipt == 3)
        {
            oHeader.setPropertyType( AbcA::kArrayProperty );
        }
        else
        {
            oHeader.setPropertyType( ( AbcA::PropertyType )ipt );
        }

        // Read the pod type out of bits 2-5
        char podt = ( char )( ( info[0] & podMask ) >> 2 );
        if ( podt != ( char )kBooleanPOD &&

             podt != ( char )kUint8POD &&
             podt != ( char )kInt8POD &&

             podt != ( char )kUint16POD &&
             podt != ( char )kInt16POD &&

             podt != ( char )kUint32POD &&
             podt != ( char )kInt32POD &&

             podt != ( char )kUint64POD &&
             podt != ( char )kInt64POD &&

             podt != ( char )kFloat16POD &&
             podt != ( char )kFloat32POD &&
             podt != ( char )kFloat64POD &&

             podt != ( char )kStringPOD &&
             podt != ( char )kWstringPOD )
        {
            ABCA_THROW( "Read invalid POD type: " << ( int )podt );
        }

        // bit 6 is the hint about whether time sampling index was written
        // at the end
        bool hasTsidx = ( (info[0] & hasTsidxMask ) >> 6 ) == 1;
        oTimeSamplingIndex = 0;

        if ( hasTsidx && numFields > 1 )
        {
            oTimeSamplingIndex = info[numFields - 1];
            fieldsUsed ++;
        }

        // bit 7 is a hint about whether first and last changed index
        // are intrinsically 1, and numSamples - 1
        // (no repeated data from the start or the end)
        bool noRepeats = ( (info[0] & noRepeatsMask ) >> 7 ) == 1;

        // Time Sampling Index could be written, but the number of samples
        // may not be.
        if ( numFields > fieldsUsed )
        {
            oNumSamples = info[1];

            if ( numFields >= 4 )
            {
                oFirstChangedIndex = info[2];
                oLastChangedIndex = info[3];
            }
            else if ( noRepeats )
            {
                oFirstChangedIndex = 1;
                oLastChangedIndex = oNumSamples - 1;
            }
            else
            {
                oFirstChangedIndex = 0;
                oLastChangedIndex = 0;
            }
        }
        else
        {
            oNumSamples = 0;
            oFirstChangedIndex = 0;
            oLastChangedIndex = 0;

            // if smp0 exists then we have 1 sample
            std::string smpName = iPropName + ".smp0";
            if ( oHeader.getPropertyType() == AbcA::kArrayProperty &&
                 ObjectExists( iParent, smpName ) )
            {
                oNumSamples = 1;
            }
            else if ( oHeader.getPropertyType() == AbcA::kScalarProperty &&
                      AttrExists( iParent, smpName ) )
            {
                oNumSamples = 1;
            }
        }

        // Read the extent out of bits 8-15
        uint8_t extent = ( uint8_t )( ( info[0] & extentMask ) >> 8 );
        if ( extent == 0 )
        {
            ABCA_THROW( "Degenerate extent 0" );
        }

        // bits 16-31 are currently not being used

        // the time sampling will be set on oHeader by the calling function
        // since we don't have access to the archive here.
        oHeader.setName( iPropName );
        oHeader.setMetaData( metaData );
        oHeader.setDataType(
            AbcA::DataType( ( Util::PlainOldDataType ) podt, extent ) );
    }
}