Exemplo n.º 1
0
//----------------------------------------------------------------------------
// Function:   DisplayLocalApplicationInfo
// Purpose:    Prints out locally registered applications
// Parameters:
//   pApplication : [in] pointer to PEER_APPLICATION_REGISTRATION_INFO object
//
void DisplayLocalApplicationInfo(__in PCPEER_APPLICATION_REGISTRATION_INFO pApplication)
{
    wprintf(L"Application:\n");

    wprintf(L"\tId: ");
    PrintGUID(&pApplication->application.id);

    if (pApplication->application.pwzDescription != NULL)
    {
        wprintf(L"\tDescription: %s\n", pApplication->application.pwzDescription);
    }

    if (pApplication->pwzApplicationToLaunch != NULL)
    {
        wprintf(L"\tApplication Path: %s\n", pApplication->pwzApplicationToLaunch);
    }

    if (pApplication->pwzApplicationArguments != NULL)
    {
        wprintf(L"\tApplication Arguments: %s\n", pApplication->pwzApplicationArguments);
    }

    wprintf(L"\tPublication Scope: %s\n", PublicationScope(pApplication->dwPublicationScope));

    
}
Exemplo n.º 2
0
Arquivo: asf.c Projeto: 5sw/stuff
void ParseData()
{
	currentObjects = calloc( sizeof (MediaObject), streamCount );
	printf( "Data begins...\n" );
	printf( "File ID:       " ); PrintGUID();
	printf( "Total packets: %llu\n", ReadQWord() );
	cursor += 2; // Skip reserved field
	while (cursor < end) {
		uint8_t *tmp = cursor;
		ParsePacket();
		cursor = tmp + packetSize;
	}
}
Exemplo n.º 3
0
Arquivo: asf.c Projeto: 5sw/stuff
void ParseFileProperties()
{
	printf( "\t\tFile ID:       " ); PrintGUID();
	printf( "\t\tFile size:     %llu\n", ReadQWord() );
	printf( "\t\tCreation date: %llu\n", ReadQWord() );
	printf( "\t\tPacket count:  %llu\n", ReadQWord() );
	printf( "\t\tPlay duration: %llu\n", ReadQWord() );
	printf( "\t\tSend duration: %llu\n", ReadQWord() );
	printf( "\t\tPreroll:       %llu\n", ReadQWord() );
	printf( "\t\tFlags:         %u\n", ReadDWord() );
	packetSize = ReadDWord() ;
	printf( "\t\tMin Pack. size %u\n", packetSize );
	uint32_t maxPacketSize = ReadDWord();
	printf( "\t\tMax Pack. size %u\n", maxPacketSize  );
	printf( "\t\tMax bitrate    %u\n", ReadDWord() );
	printf( "\tend file properties\n" );
}
Exemplo n.º 4
0
int main(int argc, char **argv)
{
	const unsigned int	width = 16, height = 16;
	const unsigned int	mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2};
	const unsigned int	subpic_width = 16, subpic_height = 16;

	Display			*display;
	XvPortID		port_num;
	int			surface_type_id;
	unsigned int		is_overlay, intra_unsigned;
	int			colorkey;
	XvMCContext		context;
	XvImageFormatValues	*subpics;
	int			num_subpics;
	XvMCSubpicture		subpicture = {0};
	int			i;

	display = XOpenDisplay(NULL);

	if (!GetPort
	(
		display,
		width,
		height,
		XVMC_CHROMA_FORMAT_420,
		mc_types,
		2,
		&port_num,
		&surface_type_id,
		&is_overlay,
		&intra_unsigned
	))
	{
		XCloseDisplay(display);
		fprintf(stderr, "Error, unable to find a good port.\n");
		exit(1);
	}

	if (is_overlay)
	{
		Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0);
		XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey);
	}

	assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success);

	subpics = XvMCListSubpictureTypes(display, port_num, surface_type_id, &num_subpics);
	assert((subpics && num_subpics) > 0 || (!subpics && num_subpics == 0));

	for (i = 0; i < num_subpics; ++i)
	{
		printf("Subpicture %d:\n", i);
		printf("\tid: 0x%08x\n", subpics[i].id);
		printf("\ttype: %s\n", subpics[i].type == XvRGB ? "XvRGB" : (subpics[i].type == XvYUV ? "XvYUV" : "Unknown"));
		printf("\tbyte_order: %s\n", subpics[i].byte_order == LSBFirst ? "LSB First" : (subpics[i].byte_order == MSBFirst ? "MSB First" : "Unknown"));
		PrintGUID(subpics[i].guid);
		printf("\tbpp: %u\n", subpics[i].bits_per_pixel);
		printf("\tformat: %s\n", subpics[i].format == XvPacked ? "XvPacked" : (subpics[i].format == XvPlanar ? "XvPlanar" : "Unknown"));
		printf("\tnum_planes: %u\n", subpics[i].num_planes);

		if (subpics[i].type == XvRGB)
		{
			printf("\tdepth: %u\n", subpics[i].depth);
			printf("\tred_mask: 0x%08x\n", subpics[i].red_mask);
			printf("\tgreen_mask: 0x%08x\n", subpics[i].green_mask);
			printf("\tblue_mask: 0x%08x\n", subpics[i].blue_mask);
		}
		else if (subpics[i].type == XvYUV)
		{
			printf("\ty_sample_bits: %u\n", subpics[i].y_sample_bits);
			printf("\tu_sample_bits: %u\n", subpics[i].u_sample_bits);
			printf("\tv_sample_bits: %u\n", subpics[i].v_sample_bits);
			printf("\thorz_y_period: %u\n", subpics[i].horz_y_period);
			printf("\thorz_u_period: %u\n", subpics[i].horz_u_period);
			printf("\thorz_v_period: %u\n", subpics[i].horz_v_period);
			printf("\tvert_y_period: %u\n", subpics[i].vert_y_period);
			printf("\tvert_u_period: %u\n", subpics[i].vert_u_period);
			printf("\tvert_v_period: %u\n", subpics[i].vert_v_period);
		}
		PrintComponentOrder(subpics[i].component_order);
		printf("\tscanline_order: %s\n", subpics[i].scanline_order == XvTopToBottom ? "XvTopToBottom" : (subpics[i].scanline_order == XvBottomToTop ? "XvBottomToTop" : "Unknown"));
	}

	if (num_subpics == 0)
	{
		printf("Subpictures not supported, nothing to test.\n");
		return 0;
	}

	/* Test NULL context */
	assert(XvMCCreateSubpicture(display, NULL, &subpicture, subpic_width, subpic_height, subpics[0].id) == XvMCBadContext);
	/* Test NULL subpicture */
	assert(XvMCCreateSubpicture(display, &context, NULL, subpic_width, subpic_height, subpics[0].id) == XvMCBadSubpicture);
	/* Test invalid subpicture */
	assert(XvMCCreateSubpicture(display, &context, &subpicture, subpic_width, subpic_height, -1) == BadMatch);
	/* Test huge width */
	assert(XvMCCreateSubpicture(display, &context, &subpicture, 16384, subpic_height, subpics[0].id) == BadValue);
	/* Test huge height */
	assert(XvMCCreateSubpicture(display, &context, &subpicture, subpic_width, 16384, subpics[0].id) == BadValue);
	/* Test huge width & height */
	assert(XvMCCreateSubpicture(display, &context, &subpicture, 16384, 16384, subpics[0].id) == BadValue);
	for (i = 0; i < num_subpics; ++i)
	{
		/* Test valid params */
		assert(XvMCCreateSubpicture(display, &context, &subpicture, subpic_width, subpic_height, subpics[i].id) == Success);
		/* Test subpicture id assigned */
		assert(subpicture.subpicture_id != 0);
		/* Test context id assigned and correct */
		assert(subpicture.context_id == context.context_id);
		/* Test subpicture type id assigned and correct */
		assert(subpicture.xvimage_id == subpics[i].id);
		/* Test width & height assigned and correct */
		assert(subpicture.width == width && subpicture.height == height);
		if (subpics[i].type == XvRGB)
			/* Test no palette support */
			assert(subpicture.num_palette_entries == 0 && subpicture.entry_bytes == 0);
		else
			/* Test palette support */
			assert(subpicture.num_palette_entries == 16 && subpicture.entry_bytes == 4);
		/* Test valid params */
		assert(XvMCDestroySubpicture(display, &subpicture) == Success);
	}
	/* Test NULL surface */
	assert(XvMCDestroySubpicture(display, NULL) == XvMCBadSubpicture);

	assert(XvMCDestroyContext(display, &context) == Success);

	free(subpics);
	XvUngrabPort(display, port_num, CurrentTime);
	XCloseDisplay(display);

	return 0;
}
Exemplo n.º 5
0
// Gets new location data from the user, and prints the report data.
// The location data includes fields for both a civic address report 
// and a latitude/longitude report.
// The error radius, altitude, and altitude error fields are not
// displayed in the Default Location Control Panel, but they are 
// available from the Location API.
HRESULT EnterLocation(CLocationReport * pLocationReport)
{
    WCHAR address1[ADDRESS_FIELD_LENGTH];
    WCHAR address2[ADDRESS_FIELD_LENGTH]; 
    WCHAR city[ADDRESS_FIELD_LENGTH];
    WCHAR stateprovince[ADDRESS_FIELD_LENGTH];
    WCHAR zipcode[ADDRESS_FIELD_LENGTH];
    WCHAR countryregion[COUNTRYREGION_FIELD_LENGTH]; // ISO-3166 2-digit or 3-digit code
    DOUBLE latitude = 0;
    DOUBLE longitude = 0;
    DOUBLE errorradius = 0;
    DOUBLE altitude = 0;
    DOUBLE altitudeerror = 0;
    int numberfieldsread = 0; // number of fields successfully read by wscanf_s

    // Interface for civic address report
    CComPtr<ICivicAddressReport> spCivicAddressReport; 
    // Interface for latitude/longitude report
    CComPtr<ILatLongReport> spLatLongReport; 

    // prompt user to enter line 1 of the street address.
    wprintf(PROMPT_ADDRESS1);
    SafeGetws(address1, ARRAYSIZE(address1));
    fflush(stdin);
    // Set line 1 of the street address in the new report
    CComBSTR bstrAddress1(address1);
    HRESULT hr = pLocationReport->SetAddressLine1(bstrAddress1);    
    
    if (SUCCEEDED(hr))
    {
        // prompt user to enter line 2 of the street address.
        wprintf(PROMPT_ADDRESS2);
        SafeGetws(address2, ARRAYSIZE(address2));
        fflush(stdin);
        // Set line 2 of the street address in the new report
        CComBSTR bstrAddress2(address2);
        hr = pLocationReport->SetAddressLine2(bstrAddress2);
    }
    if (SUCCEEDED(hr))
    {
        // prompt user to enter the city.
        wprintf(PROMPT_CITY);
        SafeGetws(city, ARRAYSIZE(city));
        fflush(stdin);
        // Set the city in the new report
        CComBSTR bstrCity(city);
        hr = pLocationReport->SetCity(bstrCity);
    }
    if (SUCCEEDED(hr))
    {
        // prompt user to enter the state/province.
        wprintf(PROMPT_STATEPROVINCE);
        SafeGetws(stateprovince, ARRAYSIZE(city));
        fflush(stdin);
        // Set the state/province in the new report
        CComBSTR bstrStateProvince(stateprovince);
        hr = pLocationReport->SetStateProvince(bstrStateProvince);
    }
    if (SUCCEEDED(hr))
    {
        // prompt user to enter the postal code.
        wprintf(PROMPT_POSTALCODE);
        SafeGetws(zipcode, ARRAYSIZE(zipcode));
        fflush(stdin);
        // Set the postal code in the new report
        CComBSTR bstrZipCode(zipcode);
        hr = pLocationReport->SetPostalCode(bstrZipCode);    
    }
    if (SUCCEEDED(hr))
    {
        // prompt user to enter the country code.
        wprintf(PROMPT_COUNTRYREGION);
        SafeGetws(countryregion, ARRAYSIZE(countryregion));
        fflush(stdin);
        // Set the country/region in the new report
        CComBSTR bstrCountryRegion(countryregion);
        hr = pLocationReport->SetCountryRegion(bstrCountryRegion);
    }
    if (SUCCEEDED(hr))
    {
        // prompt the user to enter latitude
        wprintf(PROMPT_LATITUDE);
        numberfieldsread = wscanf_s(L"%lf", &latitude);
        fflush(stdin);
        if (0 == numberfieldsread) 
        {
            wprintf(L"Error reading input. The report field will be set to zero.\n");
        }
        else 
        {
            // Set the latitude
            hr = pLocationReport->SetLatitude(latitude);
        }
    }
    if (SUCCEEDED(hr))
    {
        // prompt the user to enter longitude
        wprintf(PROMPT_LONGITUDE);
        numberfieldsread = wscanf_s(L"%lf", &longitude);
        fflush(stdin);
        if (0 == numberfieldsread) 
        {
            wprintf(L"Error reading input. The report field will be set to zero.\n");
        }
        else 
        {
            // Set the longitude
            hr = pLocationReport->SetLongitude(longitude);
        }
    }
    if (SUCCEEDED(hr))
    {
        // prompt the user to enter the error radius for the latitude/longitude 
        wprintf(PROMPT_ERRORRADIUS);
        numberfieldsread = wscanf_s(L"%lf", &errorradius);
        fflush(stdin);
        if (0 == numberfieldsread) 
        {
            wprintf(L"Error reading input. The report field will be set to a default value.\n");
        }
        else 
        {
            // Set the error radius
            hr = pLocationReport->SetErrorRadius(errorradius);
        }
    }
    if (SUCCEEDED(hr))
    {
        // prompt the user to enter altitude
        wprintf(PROMPT_ALTITUDE);
        numberfieldsread = wscanf_s(L"%lf", &altitude);
        fflush(stdin);
        if (0 == numberfieldsread) 
        {
            wprintf(L"Error reading input. The report field will be set to zero.\n");
        }
        else 
        {
            // Set the altitude
            hr = pLocationReport->SetAltitude(altitude);
        }
    }
    if (SUCCEEDED(hr))
    {
        // prompt the user to enter altitude error
        wprintf(PROMPT_ALTITUDEERROR);
        numberfieldsread = wscanf_s(L"%lf", &altitudeerror);
        fflush(stdin);
        if (0 == numberfieldsread) 
        {
            wprintf(L"Error reading input. The report field will be set to zero.\n");
        }
        else
        {
            // Set the altitude error
            hr = pLocationReport->SetAltitudeError(altitudeerror);
        }
    }
    if (SUCCEEDED(hr))
    {
        // Print the GUID 
        SENSOR_ID SensorID;
        hr = pLocationReport->GetSensorID(&SensorID);
        PrintGUID(SensorID);
    }
    if (SUCCEEDED(hr))
    {
        // Print the timestamp
        SYSTEMTIME systime;
        hr = pLocationReport->GetTimestamp(&systime); 
        PrintTime(systime);
    }
    if (SUCCEEDED(hr))
    {
        hr = pLocationReport->QueryInterface(IID_PPV_ARGS(&spCivicAddressReport));
    }
    if (SUCCEEDED(hr))
    {
        PrintCivicAddress(spCivicAddressReport);
    }
    if (SUCCEEDED(hr))
    {
        hr = pLocationReport->QueryInterface(IID_PPV_ARGS(&spLatLongReport));
    }
    if (SUCCEEDED(hr))
    {
        PrintLatLong(spLatLongReport);
    }
    return hr;
}