コード例 #1
0
IOMedia *
IODVDBlockStorageDriver::instantiateDesiredMediaObject(void)
{
    if (getMediaType() < kDVDMediaTypeMin || getMediaType() > kDVDMediaTypeMax) {
        return super::instantiateDesiredMediaObject();
    }

    return(new IODVDMedia);
}
コード例 #2
0
ファイル: llparcel.cpp プロジェクト: ArminW/imprudence
// Assumes we are in a block "ParcelData"
void LLParcel::packMessage(LLSD& msg)
{
	msg["local_id"] = getLocalID();
	msg["parcel_flags"] = ll_sd_from_U32(getParcelFlags());
	msg["sale_price"] = getSalePrice();
	msg["name"] = getName();
	msg["description"] = getDesc();
	msg["music_url"] = getMusicURL();
	msg["media_url"] = getMediaURL();
	msg["media_desc"] = getMediaDesc();
	msg["media_type"] = getMediaType();
	msg["media_width"] = getMediaWidth();
	msg["media_height"] = getMediaHeight();
	msg["auto_scale"] = getMediaAutoScale();
	msg["media_loop"] = getMediaLoop();
	msg["obscure_media"] = getObscureMedia();
	msg["obscure_music"] = getObscureMusic();
	msg["media_id"] = getMediaID();
	msg["group_id"] = getGroupID();
	msg["pass_price"] = mPassPrice;
	msg["pass_hours"] = mPassHours;
	msg["category"] = (U8)mCategory;
	msg["auth_buyer_id"] = mAuthBuyerID;
	msg["snapshot_id"] = mSnapshotID;
	msg["snapshot_id"] = mSnapshotID;
	msg["user_location"] = ll_sd_from_vector3(mUserLocation);
	msg["user_look_at"] = ll_sd_from_vector3(mUserLookAt);
	msg["landing_type"] = (U8)mLandingType;

}
コード例 #3
0
//从本地添加items
int PlaylistWindow::addItemFromLocal(const QStringList &addList,bool playNow)
{

    int mediaType;
    bool flag=true;
    for(int i=0;i<addList.length();i++) {

        QString label = addList.at(i);
        QFileInfo fileInfo(label);
        if(fileInfo.exists()) {
            QStringList list = label.split("/");
            QListWidgetItem *item = new QListWidgetItem(list.last(),listWidget);
            int row = listWidget->row(item);

            //添加索引字符
            QString index = "";
            if(row<9) {
                index.append("0").append(QString::number(row+1,10).append(". "));
            } else {
                  index = QString::number(row+1,10).append(". ");
            }
            item->setText(index.append(item->text()));
            //设置item高度
            item->setSizeHint(QSize(100,30));
            item->setToolTip(label);
            //设置media的类型
            int type = getMediaType(label);

            if(type != -1){
                if(type == MEDIA_TYPE_MUSIC){
                    item->setIcon(QIcon(":/image/music.gif"));
                }
                else{
                    item->setIcon(QIcon(":/image/video.ico"));
                }
                item->setStatusTip(QString::number(type,10));
            }
            this->setItemNormalView(item);
            //添加到playlist 并将第一条设置为当前播放item
			qDebug() << playlist->mediaCount();
            playlist->addMedia(QUrl::fromLocalFile(label));
            if(flag){
                flag=false;
                mediaType = type;
                if(playNow){
                    //this->setItemPlay(row);
					playlist->setCurrentIndex(row);

                }else{
                    listWidget->setCurrentItem(item);
                }
            }
        } else {
            continue;
        }
    }

	return mediaType;
}
コード例 #4
0
std::string
MediaSinkImpl::getPadName ()
{
  if (getMediaType()->getValue() == MediaType::AUDIO) {
    return "audio_sink";
  } else {
    return "video_sink";
  }
}
コード例 #5
0
// Assumes we are in a block "ParcelData"
void LLParcel::packMessage(LLSD& msg)
{
	// used in the viewer, the sim uses it's own packer
	msg["local_id"] = getLocalID();
	msg["parcel_flags"] = ll_sd_from_U32(getParcelFlags());
	msg["sale_price"] = getSalePrice();
	msg["name"] = getName();
	msg["description"] = getDesc();
	msg["music_url"] = getMusicURL();
	msg["media_url"] = getMediaURL();
	msg["media_desc"] = getMediaDesc();
	msg["media_type"] = getMediaType();
	msg["media_width"] = getMediaWidth();
	msg["media_height"] = getMediaHeight();
	msg["auto_scale"] = getMediaAutoScale();
	msg["media_loop"] = getMediaLoop();
	msg["media_current_url"] = getMediaCurrentURL();
	msg["obscure_media"] = false; // OBSOLETE - no longer used
	msg["obscure_music"] = false; // OBSOLETE - no longer used
	msg["media_id"] = getMediaID();
	msg["media_allow_navigate"] = getMediaAllowNavigate();
	msg["media_prevent_camera_zoom"] = getMediaPreventCameraZoom();
	msg["media_url_timeout"] = getMediaURLTimeout();
	msg["media_url_filter_enable"] = getMediaURLFilterEnable();
	msg["media_url_filter_list"] = getMediaURLFilterList();
	msg["group_id"] = getGroupID();
	msg["pass_price"] = mPassPrice;
	msg["pass_hours"] = mPassHours;
	msg["category"] = (U8)mCategory;
	msg["auth_buyer_id"] = mAuthBuyerID;
	msg["snapshot_id"] = mSnapshotID;
	msg["user_location"] = ll_sd_from_vector3(mUserLocation);
	msg["user_look_at"] = ll_sd_from_vector3(mUserLookAt);
	msg["landing_type"] = (U8)mLandingType;
	msg["see_avs"] = (LLSD::Boolean) getSeeAVs();
	msg["group_av_sounds"] = (LLSD::Boolean) getAllowGroupAVSounds();
	msg["any_av_sounds"] = (LLSD::Boolean) getAllowAnyAVSounds();
}
コード例 #6
0
/* Accept a new piece of media, doing whatever's necessary to make it
 * show up properly to the system.
 */
IOReturn
IODVDBlockStorageDriver::acceptNewMedia(void)
{
    IOReturn result;

    if (getMediaType() < kDVDMediaTypeMin || getMediaType() > kDVDMediaTypeMax) {
        return super::acceptNewMedia();
    }

    /* Obtain disc status: */

    switch (getMediaType()) {
        case kDVDMediaTypeR:
        case kDVDMediaTypeRW: {
            bool checkIsWritable = false;
            DVDDiscInfo discInfo;
            DVDRZoneInfo rzoneInfo;

            result = reportDiscInfo(&discInfo);
            if (result != kIOReturnSuccess) {
                break;
            }

            switch (discInfo.discStatus) {
                case 0x01: /* is disc incomplete? */
                    checkIsWritable = true;
                    break;
                case 0x02: /* is disc complete? */
                    checkIsWritable = discInfo.erasable ? true : false;
                    break;
            }

            /* Obtain rzone status: */

            if (checkIsWritable) {
                UInt16 rzoneLast = (discInfo.lastRZoneNumberInLastBorderMSB << 8) |
                                    discInfo.lastRZoneNumberInLastBorderLSB;

                result = reportRZoneInfo(rzoneLast,&rzoneInfo);
                if (result != kIOReturnSuccess) {
                    break;
                }

                if (discInfo.discStatus == 0x01) { /* is disc incomplete? */
                    _maxBlockNumber = max( _maxBlockNumber,
                                           max( OSSwapBigToHostInt32(rzoneInfo.rzoneStartAddress) +
                                                OSSwapBigToHostInt32(rzoneInfo.rzoneSize), 1 ) - 1 );
                }

                if (rzoneInfo.incremental) { /* is rzone incremental? */
                    _writeProtected = false;
                    break;
                }

                if (discInfo.discStatus == 0x01) { /* is disc incomplete? */
                    if (rzoneInfo.blank) { /* is rzone invisible? */
                        UInt16 rzoneFirst = (discInfo.firstRZoneNumberInLastBorderMSB << 8) |
                                             discInfo.firstRZoneNumberInLastBorderLSB;

                        if (rzoneFirst < rzoneLast) {
                            result = reportRZoneInfo(rzoneLast - 1,&rzoneInfo);
                            if (result != kIOReturnSuccess) {
                                break;
                            }

                            if (rzoneInfo.incremental) { /* is rzone incremental? */
                                _writeProtected = false;
                                break;
                            }
                        }
                    }
                }
            }

            break;
        }
        case kDVDMediaTypePlusR:
        case kDVDMediaTypeHDR: {
            DVDDiscInfo discInfo;
            DVDRZoneInfo rzoneInfo;
            IOReturn result;

            result = reportDiscInfo(&discInfo);
            if (result != kIOReturnSuccess) {
                break;
            }

            /* Obtain rzone status: */

            if (discInfo.discStatus == 0x01) { /* is disc incomplete? */
                UInt16 rzoneLast = (discInfo.lastRZoneNumberInLastBorderMSB << 8) |
                                    discInfo.lastRZoneNumberInLastBorderLSB;

                _writeProtected = false;

                result = reportRZoneInfo(rzoneLast,&rzoneInfo);
                if (result != kIOReturnSuccess) {
                    break;
                }

                _maxBlockNumber = max( _maxBlockNumber,
                                       max( OSSwapBigToHostInt32(rzoneInfo.rzoneStartAddress) +
                                            OSSwapBigToHostInt32(rzoneInfo.rzoneSize), 1 ) - 1 );
            }

            break;
        }
    }

    return IOBlockStorageDriver::acceptNewMedia();
}
コード例 #7
0
IOMedia *
IODVDBlockStorageDriver::instantiateMediaObject(UInt64 base,UInt64 byteSize,
                                        UInt32 blockSize,char *mediaName)
{
    IOMedia *media = NULL;

    if (getMediaType() < kDVDMediaTypeMin || getMediaType() > kDVDMediaTypeMax) {
        return super::instantiateMediaObject(base,byteSize,blockSize,mediaName);
    }

    media = IOBlockStorageDriver::instantiateMediaObject(
                                             base,byteSize,blockSize,mediaName);

    if (media) {
        const char *description = NULL;
        const char *picture = NULL;

        switch (getMediaType()) {
            case kDVDMediaTypeROM:
                description = kIODVDMediaTypeROM;
                picture = "DVD.icns";
                break;
            case kDVDMediaTypeRAM:
                description = kIODVDMediaTypeRAM;
                picture = "DVD-RAM.icns";
                break;
            case kDVDMediaTypeR:
                description = kIODVDMediaTypeR;
                picture = "DVD-R.icns";
                break;
            case kDVDMediaTypeRW:
                description = kIODVDMediaTypeRW;
                picture = "DVD-RW.icns";
                break;
            case kDVDMediaTypePlusR:
                description = kIODVDMediaTypePlusR;
                picture = "DVD+R.icns";
                break;
            case kDVDMediaTypePlusRW:
                description = kIODVDMediaTypePlusRW;
                picture = "DVD+RW.icns";
                break;
            case kDVDMediaTypeHDROM:
                description = kIODVDMediaTypeHDROM;
                picture = "DVD.icns";
                break;
            case kDVDMediaTypeHDRAM:
                description = kIODVDMediaTypeHDRAM;
                picture = "DVD-RAM.icns";
                break;
            case kDVDMediaTypeHDR:
                description = kIODVDMediaTypeHDR;
                picture = "DVD-R.icns";
                break;
            case kDVDMediaTypeHDRW:
                description = kIODVDMediaTypeHDRW;
                picture = "DVD-RW.icns";
                break;
        }

        if (description) {
            media->setProperty(kIODVDMediaTypeKey, description);
        }

        if (picture) {
            OSDictionary *dictionary = OSDictionary::withCapacity(2);
            OSString *identifier = OSString::withCString("com.apple.iokit.IODVDStorageFamily");
            OSString *resourceFile = OSString::withCString(picture);

            if (dictionary && identifier && resourceFile) {
                dictionary->setObject("CFBundleIdentifier", identifier);
                dictionary->setObject("IOBundleResourceFile", resourceFile);
            }

            media->setProperty(kIOMediaIconKey, dictionary);

            if (resourceFile) {
                resourceFile->release();
            }
            if (identifier) {
                identifier->release();
            }
            if (dictionary) {
                dictionary->release();
            }
        }
    }

    return media;
}
コード例 #8
0
/* Accept a new piece of media, doing whatever's necessary to make it
 * show up properly to the system. The arbitration lock is assumed to
 * be held during the call.
 */
IOReturn
IOCDBlockStorageDriver::acceptNewMedia(void)
{
    IOReturn result;
    int i;
    int nentries;
    int nAudioTracks;

    /* First, we cache information about the tracks on the disc: */

    result = cacheTocInfo();
    if (result != kIOReturnSuccess) {
        assert(_toc == NULL);
    }

    /* Scan thru the track list, counting up the number of Data and Audio tracks. */

    nAudioTracks = 0;

    _minBlockNumberAudio = 0xFFFFFFFF;
    _maxBlockNumberAudio = 0xFFFFFFFF;

    if (_toc) {
        nentries = CDTOCGetDescriptorCount(_toc);

        for (i = 0; i < nentries; i++) {
            UInt32 lba = CDConvertMSFToClippedLBA(_toc->descriptors[i].p);
            /* tracks 1-99, not leadout or skip intervals */
            if (_toc->descriptors[i].point <= 99 && _toc->descriptors[i].adr == 1) {
                if ((_toc->descriptors[i].control & 0x04)) {
                    /* it's a data track */
                    _maxBlockNumberAudio = min(_maxBlockNumberAudio, lba ? (lba - 1) : 0);
                } else {
                    nAudioTracks++;
                    _minBlockNumberAudio = min(_minBlockNumberAudio, lba);
                }
                /* leadout */
            } else if (_toc->descriptors[i].point == 0xA2 && _toc->descriptors[i].adr == 1) {
                _maxBlockNumber = max(_maxBlockNumber, lba ? (lba - 1) : 0);
                _maxBlockNumberAudio = min(_maxBlockNumberAudio, lba ? (lba - 1) : 0);
            }
        }

        if (_maxBlockNumberAudio < _minBlockNumberAudio) {
            _maxBlockNumberAudio = 0xFFFFFFFF;

            /* find first data track or leadout after the audio tracks */
            for (i = 0; i < nentries; i++) {
                UInt32 lba = CDConvertMSFToClippedLBA(_toc->descriptors[i].p);
                /* tracks 1-99, not leadout or skip intervals */
                if (_toc->descriptors[i].point <= 99 && _toc->descriptors[i].adr == 1) {
                    if ((_toc->descriptors[i].control & 0x04)) {
                        /* it's a data track */
                        if (lba > _minBlockNumberAudio) {
                            _maxBlockNumberAudio = min(_maxBlockNumberAudio, lba - 1);
                        }
                    }
                    /* leadout */
                } else if (_toc->descriptors[i].point == 0xA2 && _toc->descriptors[i].adr == 1) {
                    if (lba > _minBlockNumberAudio) {
                        _maxBlockNumberAudio = min(_maxBlockNumberAudio, lba - 1);
                    }
                }
            }
        }
    }

    /* Obtain disc status: */

    switch (getMediaType()) {
    case kCDMediaTypeR:
    case kCDMediaTypeRW: {
        bool checkIsWritable = false;
        CDDiscInfo discInfo;
        CDTrackInfo trackInfo;

        result = reportDiscInfo(&discInfo);
        if (result != kIOReturnSuccess) {
            break;
        }

        switch (discInfo.discStatus) {
        case 0x01: /* is disc incomplete? */
            checkIsWritable = true;
            break;
        case 0x02: /* is disc complete? */
            checkIsWritable = discInfo.erasable ? true : false;
            break;
        }

        /* Obtain track status: */

        if (checkIsWritable) {
            UInt16 trackLast = discInfo.lastTrackNumberInLastSessionLSB;

            result = reportTrackInfo(trackLast,&trackInfo);
            if (result != kIOReturnSuccess) {
                break;
            }

            if (discInfo.discStatus == 0x01) { /* is disc incomplete? */
                _maxBlockNumber = CDConvertMSFToClippedLBA(discInfo.lastPossibleStartTimeOfLeadOut);
            }

            if (trackInfo.packet) { /* is track incremental? */
                _writeProtected = false;
                break;
            }

            if (discInfo.discStatus == 0x01) { /* is disc incomplete? */
                if (trackInfo.blank) { /* is track invisible? */
                    UInt16 trackFirst = discInfo.firstTrackNumberInLastSessionLSB;

                    if (trackFirst < trackLast) {
                        result = reportTrackInfo(trackLast - 1,&trackInfo);
                        if (result != kIOReturnSuccess) {
                            break;
                        }

                        if (trackInfo.packet) { /* is track incremental? */
                            _writeProtected = false;
                            break;
                        }
                    }
                }
            }
        }

        break;
    }
    }

    /* Instantiate a media object and attach it to ourselves. */

    result = super::acceptNewMedia();
    if (result != kIOReturnSuccess) {
        return(result);			/* give up now */
    }

    return(result);
}