当前位置: 首页>>代码示例>>C++>>正文


C++ Media类代码示例

本文整理汇总了C++中Media的典型用法代码示例。如果您正苦于以下问题:C++ Media类的具体用法?C++ Media怎么用?C++ Media使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Media类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: callEditFn

void callEditFn(vector<Media*> *medias, unsigned idx, bool del)
{
	if (del)
	{
		try
		{
			Media* item = medias->at(idx);
			medias->erase(medias->begin() + idx);
			cout << endl;
			cout << "Item Deleted" << endl << item->toString() << endl;
			delete item;
		}
		catch (out_of_range e) 
		{
			cout << endl << "Item not Found! Nothing Deleted" << endl;
		}
	}
	else
	{
		try
		{
			if (Book* b = dynamic_cast<Book*>(medias->at(idx)))
				editBook(b);
			if(Music* a = dynamic_cast<Music*>(medias->at(idx)))
				editAudioTrack(a);
			if(Movie* m = dynamic_cast<Movie*>(medias->at(idx)))
				editMovie(m);
		}
		catch (out_of_range e)
		{
			cout << endl << "Item not Found! Nothing Edited" << endl;
		}
	}
}
开发者ID:squadguy,项目名称:cis230,代码行数:34,代码来源:cw_tpms1.cpp

示例2: qDebug

System::EngineResponse System::validateEntry (WebUpload::Entry * entry) {

    System::EngineResponse res = System::ENGINE_RESPONSE_OK;

    qDebug() << __FUNCTION__ << ": called";

    // Ok here's the problem: the target dir can be different for each medium
    // in the entry, but will it ever in real life be other than .share?
    // We need to have enough space for preprocessing all media before trying
    // to upload anything. Further checks are done later anyway, so let's just
    // assume everything goes under ~/MyDocs/.share. Bying checking available
    // space now we make sure the engine doesn't hang up and doesn't leave
    // garbage xml files.
    QDir targetDir = QDir::homePath() + "/MyDocs/.share/";
    bool enoughDiskSpace = checkDiskSpace(targetDir, entry);

    if (!enoughDiskSpace) {
        return System::ENGINE_RESPONSE_NO_DISKSPACE;
    }

    QVectorIterator<Media *> mediaIter = entry->media();
    while (mediaIter.hasNext ()) {
        Media * media = mediaIter.next ();
        QString filePath = media->srcFilePath ();
        qDebug() << "SYSTEM::" << __FUNCTION__ << filePath;
        if ((!filePath.isEmpty ()) && (!QFile::exists (filePath))) {
            return System::ENGINE_RESPONSE_FILES_MISSING;
        }
    }

    return res;
}
开发者ID:nemomobile-graveyard,项目名称:webupload-engine,代码行数:32,代码来源:system.cpp

示例3: Q_ASSERT

void
MediaLibrary::dropEvent( QDropEvent *event )
{
    const QList<QUrl>         &fileList = event->mimeData()->urls();

    if ( fileList.isEmpty() )
    {
        event->ignore();
        return;
    }

    Q_ASSERT( Library::getInstance() != NULL );

    foreach ( const QUrl &url, fileList )
    {
        const QString       &fileName = url.toLocalFile();

        if ( fileName.isEmpty() )
            continue;

        Media       *media = Library::getInstance()->addMedia( fileName );

        if ( media != NULL )
        {
            Clip*       clip = new Clip( media );
            media->setBaseClip( clip );
            Library::getInstance()->addClip( clip );
            event->accept();
        }
        else
            qCritical() << "Clip already present in library or an error occurred while loading media:" << fileName;
    }
    event->accept();
}
开发者ID:Giladx,项目名称:vlmc,代码行数:34,代码来源:MediaLibrary.cpp

示例4:

std::shared_ptr<ShowEpisode> Show::addEpisode( Media& media, unsigned int episodeNumber)
{
    auto episode = ShowEpisode::create( m_ml, media.id(), episodeNumber, m_id );
    media.setShowEpisode( episode );
    media.save();
    return episode;
}
开发者ID:chouquette,项目名称:medialibrary,代码行数:7,代码来源:Show.cpp

示例5: ending

void ending(int& sceen){
    
    Texture message = Texture("res/mese-ji.png");
    Texture jijii = Texture("res/jijii.png");
    Texture con = Texture("res/kongura.png");
    Font font = ("res/meiryo.ttc");
    std::string text1 = "いい人生じゃった最後までやってくれて";
    std::string text2 = "本当にありがとうございました";
    Media clear = Media ("res/se/clear.wav");
    
    clear.play();
    while (sceen == 3)
    {
    if (!env.isOpen()) exit(0);
        env.begin();
        env.bgColor(Color::black);

        if (env.isPushKey(GLFW_KEY_ENTER)){
            sceen = 0;
        }
        drawTextureBox(-1024, -312, 2048, 1024, 0, 0, 2048, 1024, jijii);
        drawTextureBox(-1024, -512, 2048, 1024, 0, 0, 2048, 1024, message);
        drawTextureBox(-1024, 0, 2048-400, 256-50, 0, 0, 2048, 256, con);
        font.size(100);
        font.draw(text1, Vec2f(-900, -300), Color::white);
        font.draw(text2, Vec2f(-900, -400), Color::white);
        font.size(30);
        

    env.end();
    }
}
开发者ID:peperontino39,项目名称:test,代码行数:32,代码来源:story.cpp

示例6: setResizable

LatestCommentsDialog::LatestCommentsDialog(Session* session, MediaCollection *mediaCollection, WObject* parent): WDialog{parent}
{
  setResizable(true);
  setWindowTitle(wtr("menu.latest.comments"));
  setClosable(true);
  setTransient(true);
  setMaximumSize(700, WLength::Auto);
  Dbo::Transaction t(*session);
  Dbo::collection<CommentPtr> latestComments = session->find<Comment>().orderBy("last_updated desc").limit(5);
  if(!latestComments.size())
    contents()->addWidget(new WText{wtr("comments.empty")});
  for(CommentPtr comment: latestComments) {
    WContainerWidget* commentWidget = new WContainerWidget;
    Media media = mediaCollection->media(comment->mediaId());
      
    WContainerWidget *header = WW<WContainerWidget>();
    header->setContentAlignment(AlignCenter);
    
    WAnchor *videoLink = WW<WAnchor>("", media.title(t)).css("link-hand label label-info comment-box-element");
    header->addWidget(videoLink);
    Dbo::ptr<AuthInfo> authInfo = session->find<AuthInfo>().where("user_id = ?").bind(comment->user().id());
    header->addWidget(WW<WText>(WString("{1} ({2})").arg(authInfo->identity("loginname")).arg(comment->lastUpdated().toString()))
    .css("label label-success comment-box-element"));
    commentWidget->addWidget(header);
    videoLink->clicked().connect([=](WMouseEvent){
      _mediaClicked.emit(media);
      accept();
    });
    commentWidget->addWidget(WW<WText>(WString::fromUTF8(comment->content())).css("well comment-text comment-box-element").setInline(false));
    contents()->addWidget(WW<WContainerWidget>().css("comment-text").add(commentWidget));
  }
}
开发者ID:GuLinux,项目名称:Pandorica,代码行数:32,代码来源:latestcommentsdialog.cpp

示例7: fileScan

void LibraryManagerPrivate::fileScan(QString file)
{
    if ( mustClean ) {
        DataBase::instance()->clean();
    }

    Media *m = Media::specializedObjectForFile(file);

    if ( totalFiles != 0 ) {
        currentFile++;
        emit processingFile(file, currentFile, totalFiles);
    }

    if ( m ) {
        if ( m->isValid() ) {
            QStringList paths = LibraryManager::searchPaths();
            QString     shortestPath;

            for ( QString dpath : paths ) {
                dpath = QDir(dpath).canonicalPath();

                if ( file.startsWith(dpath) && ( ( dpath.size() < shortestPath.size() ) || shortestPath.isEmpty() ) ) {
                    shortestPath = dpath;
                }
            }

            DataBase::instance()->save(m, shortestPath);
        } else {
            m->deleteLater();
        }
    }
}
开发者ID:acristoffers,项目名称:SimplePlayer,代码行数:32,代码来源:librarymanagerprivate.cpp

示例8: render

void Display::render(Media & media, Player & player, std::vector<Enemy>& enemies, std::vector<Laser>& playerLasers, std::vector<Laser>& enemyLasers)
{
	SDL_RenderClear(m_renderer);
	SDL_SetRenderDrawColor(m_renderer, 255, 255, 255, 0);

	//Render player
	SDL_RenderCopy(m_renderer, media.getPlayerTexture(), nullptr, &player.getPosition());

	//Render enemies
	for (auto &i : enemies)
	{
		SDL_RenderCopy(m_renderer, media.getEnemyTexture(), nullptr, &i.m_pos);
	}

	//Render Player Lasers
	for (auto &i : playerLasers)
	{
		SDL_RenderCopy(m_renderer, media.getLaserTexture(), nullptr, &i.m_pos);
	}

	for (auto &i : enemyLasers)
	{
		SDL_RenderCopy(m_renderer, media.getLaserTexture(), nullptr, &i.m_pos);
	}

	SDL_RenderPresent(m_renderer);
}
开发者ID:RyanSwann1,项目名称:SDL2-Space-Invaders-V1,代码行数:27,代码来源:Display.cpp

示例9: main

int
main(int, char**)
{
	Media app;
	if (app.InitCheck() == B_OK)
		app.Run();

	return 0;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:9,代码来源:Media.cpp

示例10: rate

void User::rate(Wt::Dbo::ptr< User > userPtr, const Media& media, int rating, Wt::Dbo::Transaction& transaction) {
  MediaRatingPtr previousRating = transaction.session().find<MediaRating>()
    .where("user_id = ?").bind(userPtr.id())
    .where("media_id = ?").bind(media.uid());
  if(!previousRating) {
    transaction.session().add(new MediaRating{userPtr, media.uid(), rating});
    return;
  }
  previousRating.modify()->setRating(rating);
}
开发者ID:geolffrey,项目名称:Pandorica,代码行数:10,代码来源:user.cpp

示例11: autoplay

bool Settings::autoplay(const Media& media)
{
  string autoplay = value(Settings::mediaAutoplay);
  if(autoplay == "autoplay_always")
    return true;
  if(autoplay == "autoplay_audio_only")
    return media.mimetype().find("audio") != string::npos;
  if(autoplay == "autoplay_video_only")
    return media.mimetype().find("video") != string::npos;
  return false;
}
开发者ID:GuLinux,项目名称:Pandorica,代码行数:11,代码来源:settings.cpp

示例12: Dialog

TextureDialog::TextureDialog(EditorState *pstate, Node *pnode, CubeSide pface):
    Dialog(pstate),
    node(pnode),
    face(pface),
    lb(NULL),
    the_image(NULL),
    context(NULL)
{
    IVideoDriver *driver = state->device->getVideoDriver();
    IGUIEnvironment *guienv = state->device->getGUIEnvironment();

    // Window and basic items
    win = guienv->addWindow(rect<s32>(340, 50, 340 + 74 * 3 + 10, 50 + 74 * 3 + 10), true,
                            narrow_to_wide(std::string(getCubeSideName(face)) + " texture").c_str());
    guienv->addButton(rect<s32>(155, 30, 74*3, 55), win, ETD_GUI_ID_APPLY,   L"Apply",  L"Apply this texture selection to the node face");
    guienv->addButton(rect<s32>(155, 60, 74*3, 85), win, ETD_GUI_ID_IMPORT,  L"Import", L"Import images from files");
    guienv->addButton(rect<s32>(84,  60, 150,  85), win, ETD_GUI_ID_ACTIONS, L"Actions");

    // Fill out listbox
    lb = guienv->addListBox(rect<s32>(10, 104, 74 * 3, 74 * 3), win, 502);
    Media *media = &state->project->media;
    std::map<std::string, Media::Image*>& images = media->getList();
    int count = 1;
    lb->addItem(L"");
    lb->setSelected(0);
    for (std::map<std::string, Media::Image*>::const_iterator it = images.begin();
            it != images.end();
            ++it) {
        if (!it->second) {
            continue;
        }
        if (it->second->name == "default") {
            lb->addItem(L"");
        } else {
            lb->addItem(narrow_to_wide(it->second->name + " [used " +
                                       num_to_str(it->second->getHolders()) + " times]").c_str());
        }
        if (it->second == node->getTexture(face))
            lb->setSelected(count);
        count++;
    }

    Media::Image *image = node->getTexture(face);
    if (image) {
        the_image = driver->addTexture("tmpicon.png", image->get());
    }

    // Context menu
    context = guienv->addContextMenu(rect<s32>(84, 85, 150, 180), win, ETD_GUI_ID_ACTIONS_CM);
    context->addItem(L"Export", ETD_GUI_ID_EXPORT);
    context->setCloseHandling(ECMC_HIDE);
    context->setVisible(false);
    context->setEventParent(win);
}
开发者ID:asl97,项目名称:NodeBoxEditor,代码行数:54,代码来源:TextureDialog.cpp

示例13: VALUES

bool Artist::addMedia( Media& media )
{
    static const std::string req = "INSERT INTO MediaArtistRelation VALUES(?, ?)";
    // If track's ID is 0, the request will fail due to table constraints
    sqlite::ForeignKey artistForeignKey( m_id );
    return sqlite::Tools::executeInsert( m_ml->getConn(), req, media.id(), artistForeignKey ) != 0;
}
开发者ID:chouquette,项目名称:medialibrary,代码行数:7,代码来源:Artist.cpp

示例14: RTMEDIA_Flush

/**
 * \brief Wrapper for the Media Flush function.
 * This wrapper protects from simultanoeous access to the same media
 * \param  pRtMedia    Pointer to a RtMedia instance
 * \return Operation result code
 */
unsigned char RTMEDIA_Flush( RtMedia       *pRtMedia)
{
  unsigned char result;
  Media *pMedia = &(pRtMedia->media);
  
  /* Take the mutex */
  xSemaphoreTake( pRtMedia->mutex, ( portTickType ) 0 );
  
  /* Invoke the Media Write function */
  result = pMedia->flush(pMedia);
 
  /* Release the mutex */ 
  xSemaphoreGive( pRtMedia->mutex );
  
  return result;
}
开发者ID:yonathan,项目名称:sam3demo,代码行数:22,代码来源:rtmedia.c

示例15: main

int main(int argc, char **argv)
{
    SDL_Event *event = av_mallocz(sizeof(SDL_Event));
    Content *content = av_mallocz(sizeof(Content));
    Media *video = av_mallocz(sizeof(Media));
    Media *audio = av_mallocz(sizeof(Media));
    State *state = av_mallocz(sizeof(State));
    SDL_Thread *video_decode_tid1;
    SDL_Thread *video_decode_tid2;
    SDL_Thread *read_pkt_tid;
    SDL_Thread *refresh_tid;
//    InitPool(2);
    state->content = content;
    state->video = video;
    state->audio = audio;
    init_video(video);
    if(argc < 2) {
	LOGE("Usage : play <content>");
	exit(1);
    }
    av_register_all();
    if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) {
	LOGE("fail to initialize SDL");
	exit(1);
    }
    av_strlcpy(content->name, argv[1], sizeof(content->name));
    LOGE("addr : %x", video->frame_buf);
    get_content_info(content);
    LOGI("finding streams");
    find_av_streams(content, video, audio);
    LOGI("finding decoder");
    find_decoder(video);
    video->get_info(video);
    LOGI("creating reading thread...");
    read_pkt_tid = SDL_CreateThread(queue_av_pkt, "read", state);
    LOGI("initing screen");
    init_screen(video);
//    LOGI("alloc frame");
    alloc_frame(video);
    LOGI("alloc all the frame");
//    alloc_all_frame(video);
    LOGI("creating decode thread1...");
    video_decode_tid1 = SDL_CreateThread(decode_video, "decode1", video);    
    refresh(state, 50);
    event_handle(event);
    return 0;
}
开发者ID:aichunyu,项目名称:TVplayer,代码行数:47,代码来源:TVplayer.c


注:本文中的Media类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。