| 690 | } |
| 691 | |
| 692 | void GstPlayer::load( const std::string& path ) |
| 693 | { |
| 694 | // If we are already using a custom pipeline we have to reset for now. |
| 695 | if( mUsingCustomPipeline ) { |
| 696 | resetCustomPipeline(); |
| 697 | } |
| 698 | |
| 699 | // Construct and link the elements of our pipeline if this is our first run.. |
| 700 | if( ! mGstData.pipeline ) { |
| 701 | constructPipeline(); |
| 702 | } |
| 703 | |
| 704 | // Prepare for (re)loading.... |
| 705 | setPipelineState( GST_STATE_READY ); |
| 706 | |
| 707 | // Reset the buffers after we have reached GST_STATE_READY. |
| 708 | resetVideoBuffers(); |
| 709 | |
| 710 | std::string uriPath; |
| 711 | if( path.find( "://", 0 ) == std::string::npos ) { |
| 712 | GError* err = nullptr; |
| 713 | gchar* uri = gst_filename_to_uri( path.c_str(), &err ); |
| 714 | uriPath = std::string( static_cast<const char*>( uri ) ); |
| 715 | g_free( uri ); |
| 716 | if( err ) { |
| 717 | g_free( err ); |
| 718 | } |
| 719 | mGstData.isStream = false; |
| 720 | } |
| 721 | else { |
| 722 | mGstData.isStream = true; |
| 723 | } |
| 724 | |
| 725 | // set the new movie path |
| 726 | const gchar* uri = ( ! uriPath.empty() ) ? uriPath.c_str() : path.c_str(); |
| 727 | g_object_set( G_OBJECT ( mGstData.pipeline ), "uri", uri, nullptr ); |
| 728 | |
| 729 | // and preroll. |
| 730 | setPipelineState( GST_STATE_PAUSED ); |
| 731 | } |
| 732 | |
| 733 | void GstPlayer::play() |
| 734 | { |
no test coverage detected