jobjectArray read_track_info_internal(JNIEnv *env, jobject thiz, libvlc_media_t* p_m)
{
    /* get java class */
    jclass cls = (*env)->FindClass( env, "org/videolan/libvlc/TrackInfo" );
    if ( !cls )
    {
        LOGE("Failed to load class (org/videolan/libvlc/TrackInfo)" );
        return NULL;
    }

    /* get java class contructor */
    jmethodID clsCtor = (*env)->GetMethodID( env, cls, "<init>", "()V" );
    if ( !clsCtor )
    {
        LOGE("Failed to find class constructor (org/videolan/libvlc/TrackInfo)" );
        return NULL;
    }

    /* Get the tracks information of the media. */
    libvlc_media_track_t **p_tracks;

    int i_nbTracks = libvlc_media_tracks_get(p_m, &p_tracks);
    jobjectArray array = (*env)->NewObjectArray(env, i_nbTracks + 1, cls, NULL);

    unsigned i;
    if (array != NULL)
    {
        for (i = 0; i <= i_nbTracks; ++i)
        {
            jobject item = (*env)->NewObject(env, cls, clsCtor);
            if (item == NULL)
                continue;
            (*env)->SetObjectArrayElement(env, array, i, item);

            // use last track for metadata
            if (i == i_nbTracks)
            {
                setInt(env, item, "Type", 3 /* TYPE_META */);
                setLong(env, item, "Length", libvlc_media_get_duration(p_m));
                setString(env, item, "Title", libvlc_media_get_meta(p_m, libvlc_meta_Title));
                setString(env, item, "Artist", libvlc_media_get_meta(p_m, libvlc_meta_Artist));
                setString(env, item, "Album", libvlc_media_get_meta(p_m, libvlc_meta_Album));
                setString(env, item, "Genre", libvlc_media_get_meta(p_m, libvlc_meta_Genre));
                setString(env, item, "ArtworkURL", libvlc_media_get_meta(p_m, libvlc_meta_ArtworkURL));
                setString(env, item, "NowPlaying", libvlc_media_get_meta(p_m, libvlc_meta_NowPlaying));
                setString(env, item, "TrackNumber", libvlc_media_get_meta(p_m, libvlc_meta_TrackNumber));
                continue;
            }

            setInt(env, item, "Id", p_tracks[i]->i_id);
            setInt(env, item, "Type", p_tracks[i]->i_type);
            setString(env, item, "Codec", (const char*)vlc_fourcc_GetDescription(0,p_tracks[i]->i_codec));
            setString(env, item, "Language", p_tracks[i]->psz_language);
            setInt(env, item, "Bitrate", p_tracks[i]->i_bitrate);

            if (p_tracks[i]->i_type == libvlc_track_video)
            {
                setInt(env, item, "Height", p_tracks[i]->video->i_height);
                setInt(env, item, "Width", p_tracks[i]->video->i_width);
                setFloat(env, item, "Framerate", (float)p_tracks[i]->video->i_frame_rate_num / p_tracks[i]->video->i_frame_rate_den);
            }
            if (p_tracks[i]->i_type == libvlc_track_audio)
            {
                setInt(env, item, "Channels", p_tracks[i]->audio->i_channels);
                setInt(env, item, "Samplerate", p_tracks[i]->audio->i_rate);
            }
        }
    }

    libvlc_media_tracks_release(p_tracks, i_nbTracks);
    return array;
}
 bool ShadowCalculation_Impl::setMaximumFiguresInShadowOverlapCalculations(int maximumFiguresInShadowOverlapCalculations) {
   bool result = setInt(OS_ShadowCalculationFields::MaximumFiguresinShadowOverlapCalculations, maximumFiguresInShadowOverlapCalculations);
   return result;
 }
Exemple #3
0
 void RunPeriod_Impl::setEndMonth(int month)
 {
   setInt(OS_RunPeriodFields::EndMonth,month);
 }
Exemple #4
0
void ValueParameterDescriptor::useHostOverlayHandle(bool v) {
  setInt(kOfxParamPropUseHostOverlayHandle, 0, (v ? 1 : 0));
}
Exemple #5
0
void ParameterDescriptor::canUndo(bool yes) {
  setInt(kOfxParamPropCanUndo, 0, (yes ? 1 : 0));
}
Exemple #6
0
void ValueParameterDescriptor::animates(bool yes) {
  setInt(kOfxParamPropAnimates, 0, (yes ? 1 : 0));
}
Exemple #7
0
void ValueParameterDescriptor::evaluateOnChange(bool yes) {
  setInt(kOfxParamPropEvaluateOnChange, 0, (yes ? 1 : 0));
}
Exemple #8
0
/*
 * Save the values of the virtual registers to the
 * current thread structure.
 */
void saveRegisters() {
    setInt(frame, FRAME_PC, pc);
    int sp = (char*) stack - (char*) frame;
    setInt(frame, FRAME_SP, sp);
}
Exemple #9
0
void Reader::IoSmartCardGetAttribute(IWDFIoRequest* pRequest,SIZE_T inBufSize,SIZE_T outBufSize) {
	UNREFERENCED_PARAMETER(inBufSize);

	wchar_t log[300]=L"";
	char temp[300];

	DWORD code=getInt(pRequest);
	swprintf(log,L"[BixVReader][GATT]  - code %0X",code);
	OutputDebugString(log);

	switch(code) {
		case SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA009):
			// custom attribute; RPC_TYPE
			OutputDebugString(L"[BixVReader][GATT]RPC_TYPE");
			setInt(device,pRequest,rpcType);
			return;
		case SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA00a):
			// custom attribute; PipeName
			if (rpcType==0) {
				PipeReader *pipe=(PipeReader *)this;
				OutputDebugString(L"[BixVReader][GATT]PIPE_NAME");
				sprintf(temp,"%S",pipe->pipeName);
				setString(device,pRequest,(char*)temp,(int)outBufSize);
			}
			else {
				SectionLocker lock(device->m_RequestLock);
				pRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), 0);
			}
			return;
		case SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA00b):
			// custom attribute; EventPipeName
			if (rpcType==0) {
				PipeReader *pipe=(PipeReader *)this;
				OutputDebugString(L"[BixVReader][GATT]EVENT_PIPE_NAME");
				sprintf(temp,"%S",pipe->pipeEventName);
				setString(device,pRequest,(char*)temp,(int)outBufSize);
			}
			else {
				SectionLocker lock(device->m_RequestLock);
				pRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), 0);
			}
			return;
		case SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA00c):
			// custom attribute; TCP port
			if (rpcType==1) {
				TcpIpReader *tcpIp=(TcpIpReader *)this;
				OutputDebugString(L"[BixVReader][GATT]PORT");
				setInt(device,pRequest,tcpIp->port);
			}
			else {
				SectionLocker lock(device->m_RequestLock);
				pRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), 0);
			}
			return;
		case SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA00d):
			// custom attribute; TCP event port
			if (rpcType==1) {
				TcpIpReader *tcpIp=(TcpIpReader *)this;
				OutputDebugString(L"[BixVReader][GATT]EVENT_PORT");
				setInt(device,pRequest,tcpIp->eventPort);
			}
			else {
				SectionLocker lock(device->m_RequestLock);
				pRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), 0);
			}
			return;
		case SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED, 0xA00e):
			// custom attribute; TCP base port
			if (rpcType==1) {
				TcpIpReader *tcpIp=(TcpIpReader *)this;
				OutputDebugString(L"[BixVReader][GATT]BASE_PORT");
				setInt(device,pRequest,tcpIp->portBase);
				tcpIp;
			}
			else {
				SectionLocker lock(device->m_RequestLock);
				pRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), 0);
			}
			return;
		case SCARD_ATTR_CHARACTERISTICS:
			// 0x00000000 No special characteristics
			OutputDebugString(L"[BixVReader][GATT]SCARD_ATTR_CHARACTERISTICS");
			setInt(device,pRequest,0);
			return;
		case SCARD_ATTR_VENDOR_NAME:
			OutputDebugString(L"[BixVReader][GATT]SCARD_ATTR_VENDOR_NAME");
			setString(device,pRequest,vendorName,(int)outBufSize);
			return;
		case SCARD_ATTR_VENDOR_IFD_TYPE:
			OutputDebugString(L"[BixVReader][GATT]SCARD_ATTR_VENDOR_IFD_TYPE");
			setString(device,pRequest,vendorIfdType,(int)outBufSize);
			return;
		case SCARD_ATTR_DEVICE_UNIT:
			OutputDebugString(L"[BixVReader][GATT]SCARD_ATTR_DEVICE_UNIT");
			setInt(device,pRequest,deviceUnit);
			return;
		case SCARD_ATTR_ATR_STRING:
			OutputDebugString(L"[BixVReader][GATT]SCARD_ATTR_ATR_STRING");
			BYTE ATR[100];
			DWORD ATRsize;
			if (!QueryATR(ATR,&ATRsize))
			{
				SectionLocker lock(device->m_RequestLock);
				pRequest->CompleteWithInformation(STATUS_NO_MEDIA, 0);
				return;
			}
			setBuffer(device,pRequest,ATR,ATRsize);
			return;
		case SCARD_ATTR_CURRENT_PROTOCOL_TYPE:
			OutputDebugString(L"[BixVReader][GATT]SCARD_ATTR_CURRENT_PROTOCOL_TYPE");
			setInt(device,pRequest,protocol); // T=0 or T=1
			return;
		default: {
			swprintf(log,L"[BixVReader][GATT]ERROR_NOT_SUPPORTED:%08X",code);
			OutputDebugString(log);
			SectionLocker lock(device->m_RequestLock);
	        pRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), 0);
		}
	}
}
Exemple #10
0
void   RhoSettings::setBool(const char* szName, bool bVal, boolean bSaveToFile){
    setInt(szName, bVal?1:0);

    if ( bSaveToFile )
        saveToFile();
}
Exemple #11
0
void   RhoSettings::setBool(const char* szName, bool bVal){
    setInt(szName, bVal?1:0);
}
Exemple #12
0
BOOL RegistryInt::store()
    {
     return setInt(id, value, root);
    }
Exemple #13
0
 bool Timestep_Impl::setNumberOfTimestepsPerHour(int numberOfTimestepsPerHour) {
   bool result = setInt(OS_TimestepFields::NumberofTimestepsperHour, numberOfTimestepsPerHour);
   return result;
 }
Exemple #14
0
 void RunPeriod_Impl::setNumTimePeriodRepeats(int numRepeats)
 {
   setInt(OS_RunPeriodFields::NumberofTimesRunperiodtobeRepeated,numRepeats);
 }
Exemple #15
0
void ParameterDescriptor::enabled(bool yes) {
  setInt(kOfxParamPropEnabled, 0, (yes ? 1 : 0));
}
 bool ScheduleVariableInterval_Impl::setStartDay(int startDay, bool driverMethod) {
   bool result = setInt(OS_Schedule_VariableIntervalFields::StartDay, startDay, driverMethod);
   return result;
 }
Exemple #17
0
void ValueParameterDescriptor::interactPreferedSize(int w, int h) {
  setInt(kOfxParamPropInteractPreferedSize, 0, w);
  setInt(kOfxParamPropInteractPreferedSize, 1, h);
}
Exemple #18
0
void PvObject::setInt(int value)
{
    std::string key = PyPvDataUtility::getValueOrSingleFieldName(pvStructurePtr);
    setInt(key, value);
}
Exemple #19
0
void ValueParameterDescriptor::persistant(bool yes) {
  setInt(kOfxParamPropPersistant, 0, (yes ? 1 : 0));
}
Exemple #20
0
void Sound::setOffsetBytes(int offset)
{
  setInt(offset, AL_BYTE_OFFSET);
}
Exemple #21
0
void ValueParameterDescriptor::pluginMayWrite(bool yes) {
  setInt(kOfxParamPropPluginMayWrite, 0, (yes ? 1 : 0));
}
bool RegistrySettingsManager::setBoolean(const TCHAR *name, bool value)
{
  return setInt(name, value ? 1 : 0);
}
Exemple #23
0
void ParameterDescriptor::secret(bool yes) {
  setInt(kOfxParamPropSecret, 0, (yes ? 1 : 0));
}
bool RegistrySettingsManager::setUINT(const TCHAR *name, UINT value)
{
  return setInt(name, (int)value);
}
 bool ShadowCalculation_Impl::setCalculationFrequency(int calculationFrequency) {
   bool result = setInt(OS_ShadowCalculationFields::CalculationFrequency, calculationFrequency);
   return result;
 }
bool RegistrySettingsManager::setByte(const TCHAR *name, char value)
{
  return setInt(name, (int)value);
}
Exemple #27
0
 void RunPeriod_Impl::setBeginMonth(int month)
 {
   setInt(OS_RunPeriodFields::BeginMonth,month);
 }
Exemple #28
0
void DIALOG_PLOT::applyPlotSettings()
{
    REPORTER&   reporter = m_messagesPanel->Reporter();

    PCB_PLOT_PARAMS tempOptions;

    tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
    tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
    tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
    tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() );
    tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
    tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
    tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
    tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
    tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
    tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>
                                   ( m_drillShapeOpt->GetSelection() ) );
    tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
    tempOptions.SetPlotMode( m_plotModeOpt->GetSelection() == 1 ? SKETCH : FILLED );
    tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );

    // Update settings from text fields. Rewrite values back to the fields,
    // since the values may have been constrained by the setters.

    // read HPLG pen size (this param is stored in mils)
    wxString    msg = m_HPGLPenSizeOpt->GetValue();
    int         tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS;

    if( !tempOptions.SetHPGLPenDiameter( tmp ) )
    {
        msg = StringFromValue( g_UserUnit, tempOptions.GetHPGLPenDiameter() * IU_PER_MILS );
        m_HPGLPenSizeOpt->SetValue( msg );
        msg.Printf( _( "HPGL pen size constrained." ) );
        reporter.Report( msg, REPORTER::RPT_INFO );
    }

    // Read HPGL pen overlay (this param is stored in mils)
    msg = m_HPGLPenOverlayOpt->GetValue();
    tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS;

    if( !tempOptions.SetHPGLPenOverlay( tmp ) )
    {
        msg = StringFromValue( g_UserUnit,
                                     tempOptions.GetHPGLPenOverlay() * IU_PER_MILS );
        m_HPGLPenOverlayOpt->SetValue( msg );
        msg.Printf( _( "HPGL pen overlay constrained." ) );
        reporter.Report( msg, REPORTER::RPT_INFO );
    }

    // Default linewidth
    msg = m_linesWidth->GetValue();
    tmp = ValueFromString( g_UserUnit, msg );

    if( !tempOptions.SetLineWidth( tmp ) )
    {
        msg = StringFromValue( g_UserUnit, tempOptions.GetLineWidth() );
        m_linesWidth->SetValue( msg );
        msg.Printf( _( "Default line width constrained." ) );
        reporter.Report( msg, REPORTER::RPT_INFO );
    }

    // X scale
    double tmpDouble;
    msg = m_fineAdjustXscaleOpt->GetValue();
    msg.ToDouble( &tmpDouble );

    if( !setDouble( &m_XScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
    {
        msg.Printf( wxT( "%f" ), m_XScaleAdjust );
        m_fineAdjustXscaleOpt->SetValue( msg );
        msg.Printf( _( "X scale constrained." ) );
        reporter.Report( msg, REPORTER::RPT_INFO );
    }

    ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust );

    // Y scale
    msg = m_fineAdjustYscaleOpt->GetValue();
    msg.ToDouble( &tmpDouble );

    if( !setDouble( &m_YScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
    {
        msg.Printf( wxT( "%f" ), m_YScaleAdjust );
        m_fineAdjustYscaleOpt->SetValue( msg );
        msg.Printf( _( "Y scale constrained." ) );
        reporter.Report( msg, REPORTER::RPT_INFO );
    }

    ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust );

    // PS Width correction
    msg = m_PSFineAdjustWidthOpt->GetValue();
    int itmp = ValueFromString( g_UserUnit, msg );

    if( !setInt( &m_PSWidthAdjust, itmp, m_widthAdjustMinValue, m_widthAdjustMaxValue ) )
    {
        msg = StringFromValue( g_UserUnit, m_PSWidthAdjust );
        m_PSFineAdjustWidthOpt->SetValue( msg );
        msg.Printf( _( "Width correction constrained. "
                       "The reasonable width correction value must be in a range of "
                       " [%+f; %+f] (%s) for current design rules. " ),
                    To_User_Unit( g_UserUnit, m_widthAdjustMinValue ),
                    To_User_Unit( g_UserUnit, m_widthAdjustMaxValue ),
                    ( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) );
        reporter.Report( msg, REPORTER::RPT_WARNING );
    }

    // Store m_PSWidthAdjust in mm in user config
    ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ,
                           (double)m_PSWidthAdjust / IU_PER_MM );

    tempOptions.SetFormat( getPlotFormat() );

    tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
    tempOptions.SetUseGerberAttributes( m_useGerberAttributes->GetValue() );
    tempOptions.SetGerberPrecision( m_rbGerberFormat->GetSelection() == 0 ? 5 : 6 );

    LSET selectedLayers;

    for( unsigned i = 0; i < m_layerList.size(); i++ )
    {
        if( m_layerCheckListBox->IsChecked( i ) )
            selectedLayers.set( m_layerList[i] );
    }

    tempOptions.SetLayerSelection( selectedLayers );
    tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
    tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );

    // Set output directory and replace backslashes with forward ones
    wxString dirStr;
    dirStr = m_outputDirectoryName->GetValue();
    dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
    tempOptions.SetOutputDirectory( dirStr );

    if( m_plotOpts != tempOptions )
    {
        m_parent->SetPlotSettings( tempOptions );
        m_plotOpts = tempOptions;
        m_parent->OnModify();
    }
}
Exemple #29
0
 void RunPeriod_Impl::setEndDayOfMonth(int day)
 {
   setInt(OS_RunPeriodFields::EndDayofMonth,day);
 }
Exemple #30
0
void IntParameterDescriptor::displayMax(int v) {
  setInt(kOfxParamPropDisplayMax, 0, v);
}