int connect(std::string const & uri) { websocketpp::lib::error_code ec; client::connection_ptr con = m_endpoint.get_connection(uri, ec); if (ec) { std::cout << "> Connect initialization error: " << ec.message() << std::endl; return -1; } int new_id = m_next_id++; connection_metadata::ptr metadata_ptr(new connection_metadata(new_id, con->get_handle(), uri)); m_connection_list[new_id] = metadata_ptr; con->set_open_handler(websocketpp::lib::bind( &connection_metadata::on_open, metadata_ptr, &m_endpoint, websocketpp::lib::placeholders::_1 )); con->set_fail_handler(websocketpp::lib::bind( &connection_metadata::on_fail, metadata_ptr, &m_endpoint, websocketpp::lib::placeholders::_1 )); m_endpoint.connect(con); return new_id; }
ff_stream_info_impl::ff_stream_info_impl(const AVStream * _AVStream) { DT_ASSERT(NULL != _AVStream); if (NULL == _AVStream) BOOST_THROW_EXCEPTION(errors::invalid_pointer()); m_index = _AVStream->index; m_id = _AVStream->id; m_frame_rate = FF2DTType(_AVStream->r_frame_rate); m_first_dts = _AVStream->first_dts; m_time_base = FF2DTType(_AVStream->time_base); m_start_time = _AVStream->start_time; m_duration = _AVStream->duration; m_language = /*_AVStream->language*/""; // remove from ffmpeg 0.8 m_frames_count = _AVStream->nb_frames; m_sample_aspect_ratio = FF2DTType(_AVStream->sample_aspect_ratio); m_metadata = metadata_ptr(/*new ff_metadata(_AVStream->metadata)*/); m_avg_frame_rate = FF2DTType(_AVStream->avg_frame_rate); m_decoder_info = create_ff_decoder_info(_AVStream->codec); }
ff_stream_info_impl::ff_stream_info_impl(const AVFormatContext * avFormatContext, const AVStream * _AVStream) { DT_ASSERT(NULL != _AVStream); if (NULL == _AVStream) BOOST_THROW_EXCEPTION(errors::invalid_pointer()); m_index = _AVStream->index; m_id = _AVStream->id; m_frame_rate = FF2DTType(_AVStream->r_frame_rate); m_first_dts = _AVStream->first_dts; m_time_base = FF2DTType(_AVStream->time_base); m_start_time = _AVStream->start_time; const AVRational tb = {1, AV_TIME_BASE}; m_duration = (_AVStream->duration != AV_NOPTS_VALUE) ? _AVStream->duration : convertDuration(avFormatContext->duration, tb, _AVStream->time_base);; m_language = /*_AVStream->language*/""; // remove from ffmpeg 0.8 m_frames_count = _AVStream->nb_frames; m_sample_aspect_ratio = FF2DTType(_AVStream->sample_aspect_ratio); m_metadata = metadata_ptr(/*new ff_metadata(_AVStream->metadata)*/); m_avg_frame_rate = FF2DTType(_AVStream->avg_frame_rate); m_decoder_info = create_ff_decoder_info(_AVStream->codec); }