Ticket #6547: mythvideodefaultplayer-trunk.patch

File mythvideodefaultplayer-trunk.patch, 5.1 KB (added by anonymous, 15 years ago)

Patch for trunk (20545)

  • mythplugins/mythvideo/mythvideo/videodlg.h

     
    5858    void SetCurrentNode(MythGenericTree *);
    5959
    6060    void playVideo();
     61    void playVideoDefault();
    6162    void playVideoWithTrailers();
    6263    void playTrailer();
    6364
  • mythplugins/mythvideo/mythvideo/videodlg.cpp

     
    840840    }
    841841
    842842    void PlayVideo(const QString &filename,
    843             const MetadataListManager &video_list)
     843            const MetadataListManager &video_list, bool defaultplayer = false)
    844844    {
    845845        const int WATCHED_WATERMARK = 10000; // Less than this and the chain of
    846846                                             // videos will not be followed when
     
    856856        {
    857857            playing_time.start();
    858858
    859             VideoPlayerCommand::PlayerFor(item.get()).Play();
     859            VideoPlayerCommand::PlayerFor(item.get(), defaultplayer).Play();
    860860
    861861            if (item->GetChildID() > 0)
    862862                item = video_list.byID(item->GetChildID());
     
    21862186            }
    21872187        }
    21882188
     2189        m_menuPopup->AddButton(tr("Watch This Video (default player)"), SLOT(playVideoDefault()));
    21892190        m_menuPopup->AddButton(tr("Video Info"), SLOT(InfoMenu()), true);
    21902191        m_menuPopup->AddButton(tr("Manage Video"), SLOT(ManageMenu()), true);
    21912192    }
     
    24342435        PlayVideo(metadata->GetFilename(), m_d->m_videoList->getListCache());
    24352436}
    24362437
     2438void VideoDialog::playVideoDefault()
     2439{
     2440    Metadata *metadata = GetMetadata(GetItemCurrent());
     2441    if (metadata)
     2442        PlayVideo(metadata->GetFilename(), m_d->m_videoList->getListCache(), true);
     2443}
     2444
    24372445namespace
    24382446{
    24392447    struct SimpleCollect : public DirectoryHandler
  • mythplugins/mythvideo/mythvideo/playercommand.h

     
    44class VideoPlayerCommand
    55{
    66  public:
    7     static VideoPlayerCommand PlayerFor(const class Metadata *item);
     7    static VideoPlayerCommand PlayerFor(const class Metadata *item, bool defaultplayer = false);
    88    static VideoPlayerCommand PlayerFor(const QString &filename);
    99
    1010  public:
  • mythplugins/mythvideo/mythvideo/playercommand.cpp

     
    184184        ClearPlayerList();
    185185    }
    186186
    187     void PlayerFor(const Metadata *item)
     187    void PlayerFor(const Metadata *item, bool defaultplayer = false)
    188188    {
    189189        if (item)
    190190        {
     
    197197            else
    198198                filename = item->GetFilename();
    199199
    200             if (play_command.length())
     200            if (!defaultplayer && play_command.length())
    201201            {
    202202                AddPlayer(play_command, filename, item->GetPlot(),
    203203                        item->GetTitle(), item->GetDirector(),
     
    206206            }
    207207            else
    208208            {
    209                 PlayerFor(filename, item);
     209              PlayerFor(filename, item, defaultplayer);
    210210            }
    211211        }
    212212    }
    213213
    214     void PlayerFor(const QString &filename, const Metadata *extraData = 0)
     214  void PlayerFor(const QString &filename, const Metadata *extraData = 0, bool defaultplayer = false)
    215215    {
    216216        QString extension = filename.section(".", -1, -1);
    217217        QDir dir_test(QString("%1/VIDEO_TS").arg(filename));
     
    222222
    223223        const FileAssociations::association_list fa_list =
    224224                FileAssociations::getFileAssociation().getList();
    225         for (FileAssociations::association_list::const_iterator p =
     225        if (!defaultplayer)
     226            for (FileAssociations::association_list::const_iterator p =
    226227                fa_list.begin(); p != fa_list.end(); ++p)
    227         {
    228             if (p->extension.toLower() == extension.toLower() &&
    229                     !p->use_default)
    230228            {
    231                 play_command = p->playcommand;
    232                 break;
     229                if (p->extension.toLower() == extension.toLower() &&
     230                        !p->use_default)
     231                {
     232                    play_command = p->playcommand;
     233                    break;
     234                }
    233235            }
    234         }
    235236
    236237        if (play_command.trimmed().isEmpty())
    237238            play_command = "Internal";
     
    297298
    298299////////////////////////////////////////////////////////////////////////
    299300
    300 VideoPlayerCommand VideoPlayerCommand::PlayerFor(const Metadata *item)
     301VideoPlayerCommand VideoPlayerCommand::PlayerFor(const Metadata *item, bool defaultplayer)
    301302{
    302303    VideoPlayerCommand ret;
    303     ret.m_d->PlayerFor(item);
     304    ret.m_d->PlayerFor(item, defaultplayer);
    304305    return ret;
    305306}
    306307