A problem with VLC API called playlist_AddExt

This forum is about all development around libVLC.
MathxH
New Cone
New Cone
Posts: 3
Joined: 27 Aug 2015 08:34

A problem with VLC API called playlist_AddExt

Postby MathxH » 27 Aug 2015 08:42

Hi EveryOne:

Hi,I am programmer from China, rencently, I just have a problem with VLC API usage in VLC SDK. I cannot found anything useful information in the Document.

I have Requirement in my software as follows:
Implement the feature of recording RTSP stream into Video file like .avi , .mp4 file and so forth.


I cannot find any Demo about this in VLC SDK. So, I just go and read/track the VLC Media Player source this Bigger Project, the UI of this software wrote in Qt, and some features wrote in a set of VLC APIs. I found the feature of converting A RTSP stream into video file just implemented by calling A function named playlist_AddExt(It is a VLC API in SDK) in "modules\gui\qt4\recents.cpp" as follows:

Code: Select all

int Open::openMRLwithOptions( intf_thread_t* p_intf, const QString &mrl, QStringList *options, bool b_start, bool b_playlist, const char *title) { /* Options */ const char **ppsz_options = NULL; int i_options = 0; if( options != NULL && options->count() > 0 ) { ppsz_options = new const char *[options->count()]; for( int j = 0; j < options->count(); j++ ) { QString option = colon_unescape( options->at(j) ); if( !option.isEmpty() ) { ppsz_options[i_options] = strdup(qtu(option)); i_options++; } } } /* Add to playlist */ int i_ret = playlist_AddExt( THEPL, qtu(mrl), title, PLAYLIST_APPEND | (b_start ? PLAYLIST_GO : PLAYLIST_PREPARSE), PLAYLIST_END, -1, i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED, b_playlist, pl_Unlocked ); /* Add to recent items, only if played */ if( i_ret == VLC_SUCCESS && b_start && b_playlist ) RecentsMRL::getInstance( p_intf )->addRecent( mrl ); /* Free options */ if ( ppsz_options != NULL ) { for ( int i = 0; i < i_options; ++i ) free( (char*)ppsz_options[i] ); delete[] ppsz_options; } return i_ret; }

And This is My code referred to above code as follows:

Code: Select all

intf_thread_t * p_this = (intf_thread_t *)GetWindowLongPtr((HWND)this->winId(), GWLP_HINSTANCE); QString transcode = "sout=#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128,deinterlace}"; QString outFile = "std{access=file{overwrite},mux=avi,dst=D:/--please stay polite--.avi}"; QStringList optionList; optionList.append(transcode); optionList.append(outFile); int i_options = 0; const char** ppsz_options = NULL; if (!optionList.isEmpty() && optionList.count() > 0) { ppsz_options = new const char *[optionList.count()]; for (int j = 0; j < optionList.count(); j++) { QString option = optionList.at(j); ppsz_options[i_options] = strdup(option.toStdString().c_str()); i_options++; } } playlist_t *p_playlist = pl_Get(p_this); int i_ret = playlist_AddExt(p_playlist, m_url.toStdString().c_str(), m_url.toStdString().c_str(), PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, -1, i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked); if (i_ret == VLC_SUCCESS) { ui->record->setText("Recording"); m_isRecording = true; }
so the problem comes to show, I cannot precisely figure it out , I cannot use it precisely. the first agrument of this function playlist_t* created by what function? intf_thread_t* this varirable created by what function. I cannot find anything in VLC Media Player source (Maybe I am just a newbie for C/C++).

Could You Tell Me something Wrong in My code ? Or if you have some Demos of this , you can tell me where I can find? Or If you have better solution(use other APIs) to implement my requirement of converting(recording) RTSP stream into a video file? And How Can I stop the recording? just simply called this Stop function like this?

Code: Select all

void VLCPlayer::Stop() { if (m_vlcPlayer) { libvlc_media_player_stop(m_vlcPlayer); libvlc_media_player_release(m_vlcPlayer); ui->play->setText("Play"); } m_vlcPlayer = NULL; }

------------------

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests