1 /*****************************************************************************
2 * open.cpp : Panels for the open dialogs
3 ****************************************************************************
4 * Copyright (C) 2006-2009 the VideoLAN team
5 * Copyright (C) 2007 Société des arts technologiques
6 * Copyright (C) 2007 Savoir-faire Linux
10 * Authors: Clément Stenac <zorglub@videolan.org>
11 * Jean-Baptiste Kempf <jb@videolan.org>
12 * Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27 *****************************************************************************/
34 #include "components/open_panels.hpp"
35 #include "dialogs/open.hpp"
36 #include "dialogs_provider.hpp" /* Open Subtitle file */
37 #include "util/qt_dirs.hpp"
39 #include <QFileDialog>
40 #include <QDialogButtonBox>
42 #include <QStackedLayout>
46 #include <QScrollArea>
48 #include <QStringListModel>
50 #define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory")
52 static const char *psz_devModule[] = { "v4l", "v4l2", "pvr", "dvb", "bda",
53 "dshow", "screen", "jack" };
55 /**************************************************************************
56 * Open Files and subtitles *
57 **************************************************************************/
58 FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
59 OpenPanel( _parent, _p_intf ), dialogBox( NULL )
61 /* Classic UI Setup */
64 /* Set Filters for file selection */
65 /* QString fileTypes = "";
66 ADD_FILTER_MEDIA( fileTypes );
67 ADD_FILTER_VIDEO( fileTypes );
68 ADD_FILTER_AUDIO( fileTypes );
69 ADD_FILTER_PLAYLIST( fileTypes );
70 ADD_FILTER_ALL( fileTypes );
71 fileTypes.replace( QString(";*"), QString(" *")); */
74 /* lineFileEdit = ui.fileEdit;
75 //TODO later: fill the fileCompleteList with previous items played.
76 QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
77 fileCompleter->setModel( new QDirModel( fileCompleter ) );
78 lineFileEdit->setCompleter( fileCompleter );*/
79 if( config_GetInt( p_intf, "qt-embedded-open" ) )
81 ui.tempWidget->hide();
86 /* Deactivate the subtitles control by default. */
87 ui.subFrame->setEnabled( false );
88 /* Build the subs size combo box */
89 setfillVLCConfigCombo( "freetype-rel-fontsize" , p_intf,
91 /* Build the subs align combo box */
92 setfillVLCConfigCombo( "subsdec-align", p_intf, ui.alignSubComboBox );
95 BUTTONACT( ui.fileBrowseButton, browseFile() );
96 BUTTONACT( ui.removeFileButton, removeFile() );
98 BUTTONACT( ui.subBrowseButton, browseFileSub() );
99 CONNECT( ui.subCheckBox, toggled( bool ), this, toggleSubtitleFrame( bool ) );
101 CONNECT( ui.fileListWidg, itemChanged( QListWidgetItem * ), this, updateMRL() );
102 CONNECT( ui.subInput, textChanged( const QString& ), this, updateMRL() );
103 CONNECT( ui.alignSubComboBox, currentIndexChanged( int ), this, updateMRL() );
104 CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
108 inline void FileOpenPanel::BuildOldPanel()
110 /** BEGIN QFileDialog tweaking **/
111 /* Use a QFileDialog and customize it because we don't want to
112 rewrite it all. Be careful to your eyes cause there are a few hacks.
113 Be very careful and test correctly when you modify this. */
115 /* Make this QFileDialog a child of tempWidget from the ui. */
116 dialogBox = new FileOpenBox( ui.tempWidget, NULL,
117 p_intf->p_sys->filepath, "" );
119 dialogBox->setFileMode( QFileDialog::ExistingFiles );
120 dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
121 dialogBox->restoreState(
122 getSettings()->value( "file-dialog-state" ).toByteArray() );
124 /* We don't want to see a grip in the middle of the window, do we? */
125 dialogBox->setSizeGripEnabled( false );
128 dialogBox->setToolTip( qtr( "Select one or multiple files" ) );
129 dialogBox->setMinimumHeight( 250 );
131 // But hide the two OK/Cancel buttons. Enable them for debug.
132 QDialogButtonBox *fileDialogAcceptBox =
133 dialogBox->findChildren<QDialogButtonBox*>()[0];
134 fileDialogAcceptBox->hide();
136 /* Ugly hacks to get the good Widget */
137 //This lineEdit is the normal line in the fileDialog.
138 QLineEdit *lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
139 /* Make a list of QLabel inside the QFileDialog to access the good ones */
140 QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
142 /* Hide the FileNames one. Enable it for debug */
143 listLabel[1]->setText( qtr( "File names:" ) );
144 /* Change the text that was uncool in the usual box */
145 listLabel[2]->setText( qtr( "Filter:" ) );
147 dialogBox->layout()->setMargin( 0 );
148 dialogBox->layout()->setSizeConstraint( QLayout::SetNoConstraint );
150 /** END of QFileDialog tweaking **/
152 // Add the DialogBox to the layout
153 ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
155 CONNECT( lineFileEdit, textChanged( const QString& ), this, updateMRL() );
156 dialogBox->installEventFilter( this );
159 FileOpenPanel::~FileOpenPanel()
162 getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
165 void FileOpenPanel::browseFile()
167 QStringList files = QFileDialog::getOpenFileNames( this, qtr( "Select one or multiple files" ), p_intf->p_sys->filepath) ;
168 foreach( const QString &file, files )
170 QListWidgetItem *item =
171 new QListWidgetItem( toNativeSeparators( file ), ui.fileListWidg );
172 item->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled );
173 ui.fileListWidg->addItem( item );
174 savedirpathFromFile( file );
180 void FileOpenPanel::removeFile()
182 int i = ui.fileListWidg->currentRow();
185 QListWidgetItem *temp = ui.fileListWidg->takeItem( i );
193 /* Show a fileBrowser to select a subtitle */
194 void FileOpenPanel::browseFileSub()
196 // TODO Handle selection of more than one subtitles file
197 QStringList files = THEDP->showSimpleOpen( qtr("Open subtitles file"),
198 EXT_FILTER_SUBTITLE, p_intf->p_sys->filepath );
200 if( files.isEmpty() ) return;
201 ui.subInput->setText( toNativeSeparators( files.join(" ") ) );
205 void FileOpenPanel::toggleSubtitleFrame( bool b )
207 ui.subFrame->setEnabled( b );
214 /* Update the current MRL */
215 void FileOpenPanel::updateMRL()
217 QStringList fileList;
221 if( dialogBox == NULL )
222 for( int i = 0; i < ui.fileListWidg->count(); i++ )
224 if( !ui.fileListWidg->item( i )->text().isEmpty() )
225 fileList << ui.fileListWidg->item( i )->text();
228 fileList = dialogBox->selectedFiles();
231 if( ui.subCheckBox->isChecked() && !ui.subInput->text().isEmpty() ) {
232 mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
233 int align = ui.alignSubComboBox->itemData(
234 ui.alignSubComboBox->currentIndex() ).toInt();
235 mrl.append( " :subsdec-align=" + QString().setNum( align ) );
236 int size = ui.sizeSubComboBox->itemData(
237 ui.sizeSubComboBox->currentIndex() ).toInt();
238 mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
241 emit mrlUpdated( fileList, mrl );
242 emit methodChanged( "file-caching" );
245 /* Function called by Open Dialog when clicke on Play/Enqueue */
246 void FileOpenPanel::accept()
249 p_intf->p_sys->filepath = dialogBox->directory().absolutePath();
250 ui.fileListWidg->clear();
253 /* Function called by Open Dialog when clicked on cancel */
254 void FileOpenPanel::clear()
256 ui.fileListWidg->clear();
257 ui.subInput->clear();
260 /* Update buttons depending on current selection */
261 void FileOpenPanel::updateButtons()
263 bool b_has_files = ( ui.fileListWidg->count() > 0 );
264 ui.removeFileButton->setEnabled( b_has_files );
265 ui.subCheckBox->setEnabled( b_has_files );
268 /**************************************************************************
269 * Open Discs ( DVD, CD, VCD and similar devices ) *
270 **************************************************************************/
271 DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
272 OpenPanel( _parent, _p_intf )
276 /* Get the default configuration path for the devices */
277 psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
278 psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
279 psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
281 /* State to avoid overwritting the users changes with the configuration */
286 ui.browseDiscButton->setToolTip( qtr( I_DEVICE_TOOLTIP ));
287 ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) );
289 #ifdef WIN32 /* Disc drives probing for Windows */
292 if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) )
294 char *drive = szDrives;
295 UINT oldMode = SetErrorMode( SEM_FAILCRITICALERRORS );
298 if( GetDriveTypeA(drive) == DRIVE_CDROM )
299 ui.deviceCombo->addItem( drive );
301 /* go to next drive */
304 SetErrorMode(oldMode);
306 #else /* Use a Completer under Linux */
307 QCompleter *discCompleter = new QCompleter( this );
308 discCompleter->setModel( new QDirModel( discCompleter ) );
309 ui.deviceCombo->setCompleter( discCompleter );
313 BUTTONACT( ui.dvdRadioButton, updateButtons() );
314 BUTTONACT( ui.vcdRadioButton, updateButtons() );
315 BUTTONACT( ui.audioCDRadioButton, updateButtons() );
316 BUTTONACT( ui.dvdsimple, updateButtons() );
317 BUTTONACT( ui.browseDiscButton, browseDevice() );
318 BUTTON_SET_ACT_I( ui.ejectButton, "", toolbar/eject, qtr( "Eject the disc" ),
321 CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL());
322 CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL());
323 CONNECT( ui.chapterSpin, valueChanged( int ), this, updateMRL());
324 CONNECT( ui.audioSpin, valueChanged( int ), this, updateMRL());
325 CONNECT( ui.subtitlesSpin, valueChanged( int ), this, updateMRL());
327 /* Run once the updateButtons function in order to fill correctly the comboBoxes */
331 DiscOpenPanel::~DiscOpenPanel()
333 free( psz_dvddiscpath );
334 free( psz_vcddiscpath );
335 free( psz_cddadiscpath );
338 void DiscOpenPanel::clear()
340 ui.titleSpin->setValue( 0 );
341 ui.chapterSpin->setValue( 0 );
342 ui.subtitlesSpin->setValue( -1 );
343 ui.audioSpin->setValue( -1 );
350 #define setDrive( psz_name ) {\
351 int index = ui.deviceCombo->findText( qfu( psz_name ) ); \
352 if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );}
354 #define setDrive( psz_name ) {\
355 ui.deviceCombo->setEditText( qfu( psz_name ) ); }
358 /* update the buttons according the type of device */
359 void DiscOpenPanel::updateButtons()
361 if ( ui.dvdRadioButton->isChecked() )
365 setDrive( psz_dvddiscpath );
368 ui.titleLabel->setText( qtr("Title") );
369 ui.chapterLabel->show();
370 ui.chapterSpin->show();
371 ui.diskOptionBox_2->show();
372 ui.dvdsimple->setEnabled( true );
374 else if ( ui.vcdRadioButton->isChecked() )
378 setDrive( psz_vcddiscpath );
381 ui.titleLabel->setText( qtr("Entry") );
382 ui.chapterLabel->hide();
383 ui.chapterSpin->hide();
384 ui.diskOptionBox_2->show();
385 ui.dvdsimple->setEnabled( false );
391 setDrive( psz_cddadiscpath );
394 ui.titleLabel->setText( qtr("Track") );
395 ui.chapterLabel->hide();
396 ui.chapterSpin->hide();
397 ui.diskOptionBox_2->hide();
398 ui.dvdsimple->setEnabled( false );
406 /* Update the current MRL */
407 void DiscOpenPanel::updateMRL()
410 QStringList fileList;
412 /* CDDAX and VCDX not implemented. TODO ? No. */
414 if( ui.dvdRadioButton->isChecked() ) {
415 if( !ui.dvdsimple->isChecked() )
418 mrl = "dvdsimple://";
419 mrl += ui.deviceCombo->currentText();
420 emit methodChanged( "dvdnav-caching" );
422 if ( ui.titleSpin->value() > 0 ) {
423 mrl += QString("@%1").arg( ui.titleSpin->value() );
424 if ( ui.chapterSpin->value() > 0 ) {
425 mrl+= QString(":%1").arg( ui.chapterSpin->value() );
430 } else if ( ui.vcdRadioButton->isChecked() ) {
431 mrl = "vcd://" + ui.deviceCombo->currentText();
432 emit methodChanged( "vcd-caching" );
434 if( ui.titleSpin->value() > 0 ) {
435 mrl += QString("@E%1").arg( ui.titleSpin->value() );
440 mrl = "cdda://" + ui.deviceCombo->currentText();
441 emit methodChanged( "cdda-caching" );
444 fileList << mrl; mrl = "";
446 if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
448 if ( ui.audioSpin->value() >= 0 ) {
449 mrl += " :audio-track=" +
450 QString("%1").arg( ui.audioSpin->value() );
452 if ( ui.subtitlesSpin->value() >= 0 ) {
453 mrl += " :sub-track=" +
454 QString("%1").arg( ui.subtitlesSpin->value() );
459 if( ui.titleSpin->value() > 0 )
460 mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
462 emit mrlUpdated( fileList, mrl );
465 void DiscOpenPanel::browseDevice()
467 QString dir = QFileDialog::getExistingDirectory( this,
468 qtr( I_DEVICE_TOOLTIP ) );
470 ui.deviceCombo->setEditText( toNativeSepNoSlash( dir ) );
475 void DiscOpenPanel::eject()
477 intf_Eject( p_intf, qtu( ui.deviceCombo->currentText() ) );
480 void DiscOpenPanel::accept()
483 /**************************************************************************
484 * Open Network streams and URL pages *
485 **************************************************************************/
486 NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
487 OpenPanel( _parent, _p_intf )
492 CONNECT( ui.protocolCombo, activated( int ),
493 this, updateProtocol( int ) );
494 CONNECT( ui.portSpin, valueChanged( int ), this, updateMRL() );
495 CONNECT( ui.addressText, textChanged( const QString& ), this, updateMRL());
497 ui.protocolCombo->addItem( "" );
498 ui.protocolCombo->addItem("HTTP", QVariant("http"));
499 ui.protocolCombo->addItem("HTTPS", QVariant("https"));
500 ui.protocolCombo->addItem("MMS", QVariant("mms"));
501 ui.protocolCombo->addItem("FTP", QVariant("ftp"));
502 ui.protocolCombo->addItem("RTSP", QVariant("rtsp"));
503 ui.protocolCombo->addItem("RTP", QVariant("rtp"));
504 ui.protocolCombo->addItem("UDP", QVariant("udp"));
505 ui.protocolCombo->addItem("RTMP", QVariant("rtmp"));
507 updateProtocol( ui.protocolCombo->currentIndex() );
509 if( config_GetInt( p_intf, "qt-recentplay" ) )
511 mrlList = new QStringListModel(
512 getSettings()->value( "Open/netMRL" ).toStringList() );
513 QCompleter *completer = new QCompleter( mrlList, this );
514 ui.addressText->setCompleter( completer );
516 CONNECT( ui.addressText, editingFinished(), this, updateCompleter() );
522 NetOpenPanel::~NetOpenPanel()
524 if( !mrlList ) return;
526 QStringList tempL = mrlList->stringList();
527 while( tempL.size() > 8 ) tempL.removeFirst();
529 getSettings()->setValue( "Open/netMRL", tempL );
534 void NetOpenPanel::clear()
537 /* update the widgets according the type of protocol */
538 void NetOpenPanel::updateProtocol( int idx_proto ) {
539 QString addr = ui.addressText->text();
540 QString proto = ui.protocolCombo->itemData( idx_proto ).toString();
542 ui.portSpin->setEnabled( idx_proto == UDP_PROTO ||
543 idx_proto == RTP_PROTO );
545 if( idx_proto == NO_PROTO ) return;
547 /* If we already have a protocol in the address, replace it */
548 if( addr.contains( "://"))
550 if( idx_proto != UDP_PROTO && idx_proto != RTP_PROTO )
551 addr.replace( QRegExp("^.*://@*"), proto + "://");
552 else if ( ( addr.contains(QRegExp("://((22[4-9])|(23\\d)|(\\[?[fF]{2}[0-9a-fA-F]{2}:))"))) ||
553 ( !addr.contains(QRegExp("^\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}")) &&
554 !addr.contains(QRegExp(":[a-fA-F0-9]{1,4}:")) ) )
555 addr.replace( QRegExp("^.*://"), proto + "://@");
557 addr.replace( QRegExp("^.*://"), proto + "://");
558 addr.replace( QRegExp("@+"), "@");
559 ui.addressText->setText( addr );
564 void NetOpenPanel::updateMRL() {
566 QString addr = ui.addressText->text();
567 int idx_proto = ui.protocolCombo->currentIndex();
568 if( addr.contains( "://"))
570 /* Match the correct item in the comboBox */
571 ui.protocolCombo->setCurrentIndex(
572 ui.protocolCombo->findData( addr.section( ':', 0, 0 ) ) );
577 switch( idx_proto ) {
579 mrl = "http://" + addr;
580 emit methodChanged("http-caching");
583 mrl = "https://" + addr;
584 emit methodChanged("http-caching");
587 mrl = "mms://" + addr;
588 emit methodChanged("mms-caching");
591 mrl = "ftp://" + addr;
592 emit methodChanged("ftp-caching");
595 mrl = "rtsp://" + addr;
596 emit methodChanged("rtsp-caching");
600 mrl = qfu(((idx_proto == RTP_PROTO) ? "rtp" : "udp"));
602 if( addr[0] == ':' ) /* Port number without address */
607 switch( addr.count( ":" ) )
609 case 0: /* DNS or IPv4 literal, no port number */
611 mrl += QString(":%1").arg( ui.portSpin->value() );
613 case 1: /* DNS or IPv4 literal plus port number */
616 default: /* IPv6 literal */
617 if( !addr.contains( "]:" ) )
619 if( addr[0] != '[' ) /* Missing brackets */
620 mrl += qfu( "[" ) + addr + qfu( "]" );
623 mrl += QString(":%1").arg( ui.portSpin->value() );
625 else /* Brackets present, port present */
630 emit methodChanged(idx_proto == RTP_PROTO
631 ? "rtp-caching" : "udp-caching");
634 mrl = "rtmp://" + addr;
635 emit methodChanged("rtmp-caching");
640 QStringList qsl; qsl<< mrl;
641 emit mrlUpdated( qsl, "" );
644 void NetOpenPanel::updateCompleter()
647 QStringList tempL = mrlList->stringList();
648 if( !tempL.contains( ui.addressText->text() ) )
649 tempL.append( ui.addressText->text() );
650 mrlList->setStringList( tempL );
653 /**************************************************************************
654 * Open Capture device ( DVB, PVR, V4L, and similar ) *
655 **************************************************************************/
656 CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
657 OpenPanel( _parent, _p_intf )
659 isInitialized = false;
662 void CaptureOpenPanel::initialize()
664 if( isInitialized ) return;
666 msg_Dbg( p_intf, "Initialization of Capture device panel" );
667 isInitialized = true;
671 BUTTONACT( ui.advancedButton, advancedDialog() );
673 /* Create two stacked layouts in the main comboBoxes */
674 QStackedLayout *stackedDevLayout = new QStackedLayout;
675 ui.cardBox->setLayout( stackedDevLayout );
677 QStackedLayout *stackedPropLayout = new QStackedLayout;
678 ui.optionsBox->setLayout( stackedPropLayout );
680 /* Creation and connections of the WIdgets in the stacked layout */
681 #define addModuleAndLayouts( number, name, label, layout ) \
682 QWidget * name ## DevPage = new QWidget( this ); \
683 QWidget * name ## PropPage = new QWidget( this ); \
684 stackedDevLayout->addWidget( name ## DevPage ); \
685 stackedPropLayout->addWidget( name ## PropPage ); \
686 layout * name ## DevLayout = new layout; \
687 layout * name ## PropLayout = new layout; \
688 name ## DevPage->setLayout( name ## DevLayout ); \
689 name ## PropPage->setLayout( name ## PropLayout ); \
690 ui.deviceCombo->addItem( qtr( label ), QVariant( number ) );
692 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
695 /*********************
696 * DirectShow Stuffs *
697 *********************/
698 if( module_exists( "dshow" ) ){
699 addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow", QGridLayout );
703 module_config_t *p_config =
704 config_FindConfig( VLC_OBJECT(p_intf), "dshow-vdev" );
705 vdevDshowW = new StringListConfigControl(
706 VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
709 p_config = config_FindConfig( VLC_OBJECT(p_intf), "dshow-adev" );
710 adevDshowW = new StringListConfigControl(
711 VLC_OBJECT(p_intf), p_config, this, false, dshowDevLayout, line );
714 /* dshow Properties */
715 QLabel *dshowVSizeLabel = new QLabel( qtr( "Video size" ) );
716 dshowPropLayout->addWidget( dshowVSizeLabel, 0, 0 );
718 dshowVSizeLine = new QLineEdit;
719 dshowPropLayout->addWidget( dshowVSizeLine, 0, 1);
720 dshowPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
724 CuMRL( vdevDshowW->combo, currentIndexChanged ( int ) );
725 CuMRL( adevDshowW->combo, currentIndexChanged ( int ) );
726 CuMRL( dshowVSizeLine, textChanged( const QString& ) );
732 if( module_exists( "bda" ) ){
733 addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow", QGridLayout );
736 QLabel *bdaTypeLabel = new QLabel( qtr( "DVB Type:" ) );
738 bdas = new QRadioButton( "DVB-S" );
739 bdas->setChecked( true );
740 bdac = new QRadioButton( "DVB-C" );
741 bdat = new QRadioButton( "DVB-T" );
742 bdaa = new QRadioButton( "ATSC" );
744 bdaDevLayout->addWidget( bdaTypeLabel, 0, 0 );
745 bdaDevLayout->addWidget( bdas, 0, 1 );
746 bdaDevLayout->addWidget( bdac, 0, 2 );
747 bdaDevLayout->addWidget( bdat, 0, 3 );
748 bdaDevLayout->addWidget( bdaa, 0, 4 );
751 QLabel *bdaFreqLabel =
752 new QLabel( qtr( "Transponder/multiplex frequency" ) );
753 bdaPropLayout->addWidget( bdaFreqLabel, 0, 0 );
755 bdaFreq = new QSpinBox;
756 bdaFreq->setAlignment( Qt::AlignRight );
757 bdaFreq->setSuffix(" kHz");
758 bdaFreq->setSingleStep( 1000 );
759 setSpinBoxFreq( bdaFreq )
760 bdaPropLayout->addWidget( bdaFreq, 0, 1 );
762 bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
763 bdaPropLayout->addWidget( bdaSrateLabel, 1, 0 );
765 bdaSrate = new QSpinBox;
766 bdaSrate->setAlignment( Qt::AlignRight );
767 bdaSrate->setSuffix(" kHz");
768 setSpinBoxFreq( bdaSrate );
769 bdaPropLayout->addWidget( bdaSrate, 1, 1 );
771 bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
772 bdaPropLayout->addWidget( bdaBandLabel, 2, 0 );
774 bdaBandBox = new QComboBox;
775 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
776 bdaPropLayout->addWidget( bdaBandBox, 2, 1 );
778 bdaBandLabel->hide();
780 bdaPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
784 CuMRL( bdaFreq, valueChanged ( int ) );
785 CuMRL( bdaSrate, valueChanged ( int ) );
786 CuMRL( bdaBandBox, currentIndexChanged ( int ) );
787 BUTTONACT( bdas, updateButtons() );
788 BUTTONACT( bdat, updateButtons() );
789 BUTTONACT( bdac, updateButtons() );
790 BUTTONACT( bdaa, updateButtons() );
791 BUTTONACT( bdas, updateMRL() );
792 BUTTONACT( bdat, updateMRL() );
793 BUTTONACT( bdac, updateMRL() );
794 BUTTONACT( bdaa, updateMRL() );
801 if( module_exists( "v4l2" ) ){
802 addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2", QGridLayout );
805 QLabel *v4l2VideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
806 v4l2DevLayout->addWidget( v4l2VideoDeviceLabel, 0, 0 );
808 v4l2VideoDevice = new QLineEdit;
809 v4l2DevLayout->addWidget( v4l2VideoDevice, 0, 1 );
811 QLabel *v4l2AudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
812 v4l2DevLayout->addWidget( v4l2AudioDeviceLabel, 1, 0 );
814 v4l2AudioDevice = new QLineEdit;
815 v4l2DevLayout->addWidget( v4l2AudioDevice, 1, 1 );
817 /* v4l2 Props panel */
818 QLabel *v4l2StdLabel = new QLabel( qtr( "Standard" ) );
819 v4l2PropLayout->addWidget( v4l2StdLabel, 0 , 0 );
821 v4l2StdBox = new QComboBox;
822 setfillVLCConfigCombo( "v4l2-standard", p_intf, v4l2StdBox );
823 v4l2PropLayout->addWidget( v4l2StdBox, 0 , 1 );
824 v4l2PropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
828 CuMRL( v4l2VideoDevice, textChanged( const QString& ) );
829 CuMRL( v4l2AudioDevice, textChanged( const QString& ) );
830 CuMRL( v4l2StdBox, currentIndexChanged ( int ) );
836 if( module_exists( "v4l" ) ){
837 addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux", QGridLayout );
840 QLabel *v4lVideoDeviceLabel = new QLabel( qtr( "Video device name" ) );
841 v4lDevLayout->addWidget( v4lVideoDeviceLabel, 0, 0 );
843 v4lVideoDevice = new QLineEdit;
844 v4lDevLayout->addWidget( v4lVideoDevice, 0, 1 );
846 QLabel *v4lAudioDeviceLabel = new QLabel( qtr( "Audio device name" ) );
847 v4lDevLayout->addWidget( v4lAudioDeviceLabel, 1, 0 );
849 v4lAudioDevice = new QLineEdit;
850 v4lDevLayout->addWidget( v4lAudioDevice, 1, 1 );
852 /* V4l Props panel */
853 QLabel *v4lNormLabel = new QLabel( qtr( "Norm" ) );
854 v4lPropLayout->addWidget( v4lNormLabel, 0 , 0 );
856 v4lNormBox = new QComboBox;
857 setfillVLCConfigCombo( "v4l-norm", p_intf, v4lNormBox );
858 v4lPropLayout->addWidget( v4lNormBox, 0 , 1 );
860 QLabel *v4lFreqLabel = new QLabel( qtr( "Frequency" ) );
861 v4lPropLayout->addWidget( v4lFreqLabel, 1 , 0 );
863 v4lFreq = new QSpinBox;
864 v4lFreq->setAlignment( Qt::AlignRight );
865 v4lFreq->setSuffix(" kHz");
866 setSpinBoxFreq( v4lFreq );
867 v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
868 v4lPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
872 CuMRL( v4lVideoDevice, textChanged( const QString& ) );
873 CuMRL( v4lAudioDevice, textChanged( const QString& ) );
874 CuMRL( v4lFreq, valueChanged ( int ) );
875 CuMRL( v4lNormBox, currentIndexChanged ( int ) );
881 if( module_exists( "jack" ) ){
882 addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit",
885 /* Jack Main panel */
887 QLabel *jackChannelsLabel = new QLabel( qtr( "Channels:" ) );
888 jackDevLayout->addWidget( jackChannelsLabel, 1, 0 );
890 jackChannels = new QSpinBox;
891 setSpinBoxFreq( jackChannels );
892 jackChannels->setMaximum(255);
893 jackChannels->setValue(2);
894 jackChannels->setAlignment( Qt::AlignRight );
895 jackDevLayout->addWidget( jackChannels, 1, 1 );
898 QLabel *jackPortsLabel = new QLabel( qtr( "Selected ports:" ) );
899 jackDevLayout->addWidget( jackPortsLabel, 0 , 0 );
901 jackPortsSelected = new QLineEdit( qtr( ".*") );
902 jackPortsSelected->setAlignment( Qt::AlignRight );
903 jackDevLayout->addWidget( jackPortsSelected, 0, 1 );
905 /* Jack Props panel */
908 QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) );
909 jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
910 jackCaching = new QSpinBox;
911 setSpinBoxFreq( jackCaching );
912 jackCaching->setSuffix( " ms" );
913 jackCaching->setValue(1000);
914 jackCaching->setAlignment( Qt::AlignRight );
915 jackPropLayout->addWidget( jackCaching, 1 , 2 );
918 jackPace = new QCheckBox(qtr( "Use VLC pace" ));
919 jackPropLayout->addWidget( jackPace, 2, 1 );
922 jackConnect = new QCheckBox( qtr( "Auto connnection" ));
923 jackPropLayout->addWidget( jackConnect, 2, 2 );
926 CuMRL( jackChannels, valueChanged( int ) );
927 CuMRL( jackCaching, valueChanged( int ) );
928 CuMRL( jackPace, stateChanged( int ) );
929 CuMRL( jackConnect, stateChanged( int ) );
930 CuMRL( jackPortsSelected, textChanged( const QString& ) );
936 if( module_exists( "pvr" ) ){
937 addModuleAndLayouts( PVR_DEVICE, pvr, "PVR", QGridLayout );
940 QLabel *pvrDeviceLabel = new QLabel( qtr( "Device name" ) );
941 pvrDevLayout->addWidget( pvrDeviceLabel, 0, 0 );
943 pvrDevice = new QLineEdit;
944 pvrDevLayout->addWidget( pvrDevice, 0, 1 );
946 QLabel *pvrRadioDeviceLabel = new QLabel( qtr( "Radio device name" ) );
947 pvrDevLayout->addWidget( pvrRadioDeviceLabel, 1, 0 );
949 pvrRadioDevice = new QLineEdit;
950 pvrDevLayout->addWidget( pvrRadioDevice, 1, 1 );
952 /* PVR props panel */
953 QLabel *pvrNormLabel = new QLabel( qtr( "Norm" ) );
954 pvrPropLayout->addWidget( pvrNormLabel, 0, 0 );
956 pvrNormBox = new QComboBox;
957 setfillVLCConfigCombo( "pvr-norm", p_intf, pvrNormBox );
958 pvrPropLayout->addWidget( pvrNormBox, 0, 1 );
960 QLabel *pvrFreqLabel = new QLabel( qtr( "Frequency" ) );
961 pvrPropLayout->addWidget( pvrFreqLabel, 1, 0 );
963 pvrFreq = new QSpinBox;
964 pvrFreq->setAlignment( Qt::AlignRight );
965 pvrFreq->setSuffix(" kHz");
966 setSpinBoxFreq( pvrFreq );
967 pvrPropLayout->addWidget( pvrFreq, 1, 1 );
969 QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
970 pvrPropLayout->addWidget( pvrBitrLabel, 2, 0 );
972 pvrBitr = new QSpinBox;
973 pvrBitr->setAlignment( Qt::AlignRight );
974 pvrBitr->setSuffix(" kHz");
975 setSpinBoxFreq( pvrBitr );
976 pvrPropLayout->addWidget( pvrBitr, 2, 1 );
977 pvrPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
981 CuMRL( pvrDevice, textChanged( const QString& ) );
982 CuMRL( pvrRadioDevice, textChanged( const QString& ) );
984 CuMRL( pvrFreq, valueChanged ( int ) );
985 CuMRL( pvrBitr, valueChanged ( int ) );
986 CuMRL( pvrNormBox, currentIndexChanged ( int ) );
992 if( module_exists( "dvb" ) ){
993 addModuleAndLayouts( DVB_DEVICE, dvb, "DVB", QGridLayout );
996 QLabel *dvbDeviceLabel = new QLabel( qtr( "Adapter card to tune" ) );
997 QLabel *dvbTypeLabel = new QLabel( qtr( "DVB Type:" ) );
999 dvbCard = new QSpinBox;
1000 dvbCard->setAlignment( Qt::AlignRight );
1001 dvbCard->setPrefix( "/dev/dvb/adapter" );
1003 dvbDevLayout->addWidget( dvbDeviceLabel, 0, 0 );
1004 dvbDevLayout->addWidget( dvbCard, 0, 2, 1, 2 );
1006 dvbs = new QRadioButton( "DVB-S" );
1007 dvbs->setChecked( true );
1008 dvbc = new QRadioButton( "DVB-C" );
1009 dvbt = new QRadioButton( "DVB-T" );
1011 dvbDevLayout->addWidget( dvbTypeLabel, 1, 0 );
1012 dvbDevLayout->addWidget( dvbs, 1, 1 );
1013 dvbDevLayout->addWidget( dvbc, 1, 2 );
1014 dvbDevLayout->addWidget( dvbt, 1, 3 );
1016 /* DVB Props panel */
1017 QLabel *dvbFreqLabel =
1018 new QLabel( qtr( "Transponder/multiplex frequency" ) );
1019 dvbPropLayout->addWidget( dvbFreqLabel, 0, 0 );
1021 dvbFreq = new QSpinBox;
1022 dvbFreq->setAlignment( Qt::AlignRight );
1023 dvbFreq->setSuffix(" kHz");
1024 dvbFreq->setSingleStep( 1000 );
1025 setSpinBoxFreq( dvbFreq );
1026 dvbPropLayout->addWidget( dvbFreq, 0, 1 );
1028 dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
1029 dvbPropLayout->addWidget( dvbSrateLabel, 1, 0 );
1031 dvbSrate = new QSpinBox;
1032 dvbSrate->setAlignment( Qt::AlignRight );
1033 dvbSrate->setSuffix(" kHz");
1034 setSpinBoxFreq( dvbSrate );
1035 dvbPropLayout->addWidget( dvbSrate, 1, 1 );
1037 dvbBandLabel = new QLabel( qtr( "Bandwidth" ) );
1038 dvbPropLayout->addWidget( dvbBandLabel, 2, 0 );
1040 dvbBandBox = new QComboBox;
1041 /* This doesn't work since dvb-bandwidth doesn't seem to be a
1043 setfillVLCConfigCombo( "dvb-bandwidth", p_intf, bdaBandBox );
1045 dvbBandBox->addItem( qtr( "Auto" ), 0 );
1046 dvbBandBox->addItem( qtr( "6 MHz" ), 6 );
1047 dvbBandBox->addItem( qtr( "7 MHz" ), 7 );
1048 dvbBandBox->addItem( qtr( "8 MHz" ), 8 );
1049 dvbPropLayout->addWidget( dvbBandBox, 2, 1 );
1051 dvbBandLabel->hide();
1054 dvbPropLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ),
1058 CuMRL( dvbCard, valueChanged ( int ) );
1059 CuMRL( dvbFreq, valueChanged ( int ) );
1060 CuMRL( dvbSrate, valueChanged ( int ) );
1061 CuMRL( dvbBandBox, currentIndexChanged ( int ) );
1063 BUTTONACT( dvbs, updateButtons() );
1064 BUTTONACT( dvbt, updateButtons() );
1065 BUTTONACT( dvbc, updateButtons() );
1066 BUTTONACT( dvbs, updateMRL() );
1067 BUTTONACT( dvbt, updateMRL() );
1068 BUTTONACT( dvbc, updateMRL() );
1077 addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop", QGridLayout );
1078 QLabel *screenLabel = new QLabel( qtr( "Your display will be "
1079 "opened and played in order to stream or save it." ) );
1080 screenLabel->setWordWrap( true );
1081 screenDevLayout->addWidget( screenLabel, 0, 0 );
1083 QLabel *screenFPSLabel = new QLabel(
1084 qtr( "Desired frame rate for the capture." ) );
1085 screenPropLayout->addWidget( screenFPSLabel, 0, 0 );
1087 screenFPS = new QSpinBox;
1088 screenFPS->setValue( 1 );
1089 screenFPS->setAlignment( Qt::AlignRight );
1090 screenPropLayout->addWidget( screenFPS, 0, 1 );
1092 /* Screen connect */
1093 CuMRL( screenFPS, valueChanged( int ) );
1095 /* General connects */
1096 CONNECT( ui.deviceCombo, activated( int ) ,
1097 stackedDevLayout, setCurrentIndex( int ) );
1098 CONNECT( ui.deviceCombo, activated( int ),
1099 stackedPropLayout, setCurrentIndex( int ) );
1100 CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
1101 CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
1104 #undef addModuleAndLayouts
1107 CaptureOpenPanel::~CaptureOpenPanel()
1111 void CaptureOpenPanel::clear()
1116 void CaptureOpenPanel::updateMRL()
1119 QStringList fileList;
1120 int i_devicetype = ui.deviceCombo->itemData(
1121 ui.deviceCombo->currentIndex() ).toInt();
1122 switch( i_devicetype )
1126 if( bdas->isChecked() ) mrl = "dvb-s://";
1127 else if( bdat->isChecked() ) mrl = "dvb-t://";
1128 else if( bdac->isChecked() ) mrl = "dvb-c://";
1129 else if( bdaa->isChecked() ) mrl = "atsc://";
1131 mrl += "frequency=" + QString::number( bdaFreq->value() );
1132 if( bdac->isChecked() || bdat->isChecked() || bdaa->isChecked() )
1134 fileList << mrl; mrl = "";
1136 if( bdas->isChecked() || bdac->isChecked() )
1137 mrl += " :dvb-srate=" + QString::number( bdaSrate->value() );
1138 else if( bdat->isChecked() || bdaa->isChecked() )
1139 mrl += " :dvb-bandwidth=" +
1140 QString::number( bdaBandBox->itemData(
1141 bdaBandBox->currentIndex() ).toInt() );
1144 fileList << "dshow://";
1145 mrl+= " :dshow-vdev=" +
1146 colon_escape( QString("%1").arg( vdevDshowW->getValue() ) );
1147 mrl+= " :dshow-adev=" +
1148 colon_escape( QString("%1").arg( adevDshowW->getValue() ) );
1149 if( dshowVSizeLine->isModified() )
1150 mrl += " :dshow-size=" + dshowVSizeLine->text();
1154 fileList << "v4l://";
1155 mrl += " :v4l-vdev=" + v4lVideoDevice->text();
1156 mrl += " :input-slave=alsa://" + v4lAudioDevice->text();
1157 mrl += " :v4l-norm=" + QString::number( v4lNormBox->currentIndex() );
1158 mrl += " :v4l-frequency=" + QString::number( v4lFreq->value() );
1161 fileList << "v4l2://" + v4l2VideoDevice->text();
1162 mrl += " :input-slave=alsa://" + v4l2AudioDevice->text();
1163 mrl += " :v4l2-standard=" + QString::number( v4l2StdBox->currentIndex() );
1167 mrl += "channels=" + QString::number( jackChannels->value() );
1168 mrl += ":ports=" + jackPortsSelected->text();
1169 fileList << mrl; mrl = "";
1171 mrl += " :jack-input-caching=" + QString::number( jackCaching->value() );
1172 if ( jackPace->isChecked() )
1174 mrl += " :jack-input-use-vlc-pace";
1176 if ( jackConnect->isChecked() )
1178 mrl += " :jack-input-auto-connect";
1182 fileList << "pvr://";
1183 mrl += " :pvr-device=" + pvrDevice->text();
1184 mrl += " :pvr-radio-device=" + pvrRadioDevice->text();
1185 mrl += " :pvr-norm=" + QString::number( pvrNormBox->currentIndex() );
1186 if( pvrFreq->value() )
1187 mrl += " :pvr-frequency=" + QString::number( pvrFreq->value() );
1188 if( pvrBitr->value() )
1189 mrl += " :pvr-bitrate=" + QString::number( pvrBitr->value() );
1193 mrl += "frequency=" + QString::number( dvbFreq->value() );
1194 if( dvbc->isChecked() || dvbt->isChecked() )
1196 fileList << mrl; mrl= "";
1198 mrl += " :dvb-adapter=" + QString::number( dvbCard->value() );
1199 if( dvbs->isChecked() || dvbc->isChecked() )
1200 mrl += " :dvb-srate=" + QString::number( dvbSrate->value() );
1201 else if( dvbt->isChecked() )
1202 mrl += " :dvb-bandwidth=" +
1203 QString::number( dvbBandBox->itemData(
1204 dvbBandBox->currentIndex() ).toInt() );
1209 fileList << "screen://";
1210 mrl = " :screen-fps=" + QString::number( screenFPS->value() );
1215 if( !advMRL.isEmpty() ) mrl += advMRL;
1217 emit mrlUpdated( fileList, mrl );
1221 * Update the Buttons (show/hide) for the GUI as all device type don't
1222 * use the same ui. elements.
1224 void CaptureOpenPanel::updateButtons()
1226 /* Be sure to display the ui Elements in case they were hidden by
1227 * some Device Type (like Screen://) */
1228 ui.optionsBox->show();
1229 ui.advancedButton->show();
1230 /* Get the current Device Number */
1231 int i_devicetype = ui.deviceCombo->itemData(
1232 ui.deviceCombo->currentIndex() ).toInt();
1233 switch( i_devicetype )
1237 if( bdas->isChecked() || bdac->isChecked() )
1240 bdaSrateLabel->show();
1242 bdaBandLabel->hide();
1244 else if( bdat->isChecked() || bdaa->isChecked() )
1247 bdaSrateLabel->hide();
1249 bdaBandLabel->show();
1254 if( dvbs->isChecked() || dvbc->isChecked() )
1257 dvbSrateLabel->show();
1259 dvbBandLabel->hide();
1261 else if( dvbt->isChecked() )
1264 dvbSrateLabel->hide();
1266 dvbBandLabel->show();
1271 //ui.optionsBox->hide();
1272 ui.advancedButton->hide();
1279 void CaptureOpenPanel::advancedDialog()
1281 /* Get selected device type */
1282 int i_devicetype = ui.deviceCombo->itemData(
1283 ui.deviceCombo->currentIndex() ).toInt();
1285 /* Get the corresponding module */
1286 module_t *p_module =
1287 module_find( psz_devModule[i_devicetype] );
1288 if( NULL == p_module ) return;
1291 QList<ConfigControl *> controls;
1293 /* Get the confsize */
1294 unsigned int i_confsize;
1295 module_config_t *p_config;
1296 p_config = module_config_get( p_module, &i_confsize );
1298 /* New Adv Prop dialog */
1299 adv = new QDialog( this );
1300 adv->setWindowTitle( qtr( "Advanced Options" ) );
1302 /* A main Layout with a Frame */
1303 QVBoxLayout *mainLayout = new QVBoxLayout( adv );
1304 QScrollArea *scroll = new QScrollArea;
1305 mainLayout->addWidget( scroll );
1307 QFrame *advFrame = new QFrame;
1308 /* GridLayout inside the Frame */
1309 QGridLayout *gLayout = new QGridLayout( advFrame );
1311 scroll->setWidgetResizable( true );
1312 scroll->setWidget( advFrame );
1314 /* Create the options inside the FrameLayout */
1315 for( int n = 0; n < (int)i_confsize; n++ )
1317 module_config_t *p_item = p_config + n;
1318 ConfigControl *config = ConfigControl::createControl(
1319 VLC_OBJECT( p_intf ), p_item, advFrame, gLayout, n );
1321 controls.append( config );
1325 QDialogButtonBox *advButtonBox = new QDialogButtonBox( adv );
1326 QPushButton *closeButton = new QPushButton( qtr( "OK" ) );
1327 QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ) );
1329 CONNECT( closeButton, clicked(), adv, accept() );
1330 CONNECT( cancelButton, clicked(), adv, reject() );
1332 advButtonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
1333 advButtonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );
1335 mainLayout->addWidget( advButtonBox );
1337 /* Creation of the MRL */
1340 QString tempMRL = "";
1341 for( int i = 0; i < controls.size(); i++ )
1343 ConfigControl *control = controls[i];
1345 tempMRL += (i ? " :" : ":");
1347 if( control->getType() == CONFIG_ITEM_BOOL )
1348 if( !(qobject_cast<VIntConfigControl *>(control)->getValue() ) )
1351 tempMRL += control->getName();
1353 switch( control->getType() )
1355 case CONFIG_ITEM_STRING:
1356 case CONFIG_ITEM_FILE:
1357 case CONFIG_ITEM_DIRECTORY:
1358 case CONFIG_ITEM_MODULE:
1359 tempMRL += colon_escape( QString("=%1").arg( qobject_cast<VStringConfigControl *>(control)->getValue() ) );
1361 case CONFIG_ITEM_INTEGER:
1362 tempMRL += QString("=%1").arg( qobject_cast<VIntConfigControl *>(control)->getValue() );
1364 case CONFIG_ITEM_FLOAT:
1365 tempMRL += QString("=%1").arg( qobject_cast<VFloatConfigControl *>(control)->getValue() );
1371 msg_Dbg( p_intf, "%s", qtu( advMRL ) );
1373 for( int i = 0; i < controls.size(); i++ )
1375 ConfigControl *control = controls[i];
1379 module_config_free( p_config );
1380 module_release (p_module);