Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Akin Ocal

@Akin Ocal
About
Posts
74
Topics
57
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Media Decoder Application
    A Akin Ocal

    Hello I want to make a decoding operation using sample grabber or my custom filter due to a custom encoding algorithm. If I build a graph like : file source->decoder->file writer , is this approriate for decoder application by means of time ? Best Regards, Akin Ocal

    C / C++ / MFC algorithms data-structures question

  • Image\Video Compression for Video Streaming
    A Akin Ocal

    Hello I am looking for a image\video compression\decompression library to serve video over TCP\IP. I get frames from my web cam in 320*240 resolution and RGB24 format so each frame is 320*240*3 = 230400 byte = 225 kbyte. I am using Directshow to get streams from files or capture devices in server side. But I don't want use it also in client side. I am building my client in pure WinAPI. So I am looking for ANSI or only Win32 dependent open or closed free libraries for C\C++. Can you suggest any ? Best Regards, Akin Ocal

    C / C++ / MFC c++ sysadmin question

  • Audio Signal Processing using Directshow(ISampleGrabber) - 2
    A Akin Ocal

    Hello , I wanted to re-ask my previos question , since I made some progress. And I want to clear some stuff in my head. 1. BUFFERING "STEREO" STREAMS : I use the code below . Generally 8000 bytes passed to callback function. Since my each sampleis 16bit , that is about 4000 samples for each call. So I defined CHANNEL_SIZE as 2048 which is approriatefor total sample count. I made it 2048 as power of 2 because I will implement FFT . What do you think about that buffering approach ? ................................................. #define CHANNEL_SIZE 2048 double leftChannel[CHANNEL_SIZE] ; double rightChannel[CHANNEL_SIZE] ; .................................................................. STDMETHODIMP BufferCB( double SampleTime, BYTE * pBuffer, long BufferSize ) { unsigned int nSampleCount = BufferSize/2 ; short* pStream = (short *) pBuffer ; for( i = 0;i<nSampleCount/2 ; i++) { leftChannel[i] = ((double)(*pStream)) ; pStream++ ; rightChannel[i] = ((double)(*pStream)) ; pStream++ ; } } 2. MULTITHREADING : Can you compare using sample grabber and creating threads for signal processing for performance (especially CPU usage ) ? In my first approach , I created thread for FFT since my FFT task didnt include changing samples , it was just about spectral analysis. 3. DATA FORMATS, CONVERSIONS : I get my each sample as 16 bit. When I looked some DXSDK9 audio samples , they declare "signed" shorts for samples. So I am confused about declaring sample variables as signed , since they can store negative values. Also I have question marks about getting double or float values from shorts , and replacing shorts with new floats or doubles after making some signal processing. I can understand dividing short values by 32768(2^16 / 2 ). But what about "vice-versa" ? Thank you very much for reading, BEST REGARDS, Akin Ocal

    C / C++ / MFC question performance discussion

  • Changing Parameters of a DMO which added as filter in Directshow
    A Akin Ocal

    I added MS ParamEqu filter ( which is a DMO ) into my graph using IDMOWrapper interface. I want to manipulate parameters of it ( gain,bandwidth,center freq) programatically in my code. When I searched for this , I found IMediaParams Interface ( http://msdn2.microsoft.com/en-us/library/ms785964(VS.85).aspx) But I am not sure that it will solve my problem. If you experienced changing parameters of a DMO fitler programatically , can you give me advices about that ? For example I didnt understand "envelope" concept. Also sample code for using that interface would be very good. Best Regards

    C / C++ / MFC visual-studio com data-structures help tutorial

  • Audio Equalizer With and Without DirectSound(ParamEq DMO)
    A Akin Ocal

    Hello I want to build a multiband (from 60 Hz to 3 kHZ ) audio equalizer using Directshow and sample grabber. 1. I guess I must build band-pass filters ( I will work with FIR filters) to equalize sound. Is there any sample or advice for that task ? For ex. what should number of taps in my filter be ? 2. Let's assume that I added ParamEq DMO to my graph. How can I change parameters for this filter ? Regards, Akin

    C / C++ / MFC question data-structures

  • Audio Processing Questions (2)
    A Akin Ocal

    Hi , sorry for a new thread. I needed to open it since I made some progress. By the way , I implemented my callback function without buffering as below. So can you check it ? Especially I am not sure about getting floats from BYTEs and , replacing new floats back after making some signal processing. STDMETHODIMP BufferCB( double SampleTime, BYTE * pBuffer, long BufferSize ) { unsigned int i,j ; short nCurrentSampleValue = 0 ,temp = 0; float fCurrentSampleValue = 0,fNewSampleValue =0 ; long nSampleCount ; short nRatioOfDataTypes ; nRatioOfDataTypes = sizeof(short)/sizeof(BYTE) ; nSampleCount = BufferSize / nRatioOfDataTypes; for(i=0;i<nSampleCount;i++) { nCurrentSampleValue = 0 ; fCurrentSampleValue = 0 ; for(j=0;j<nRatioOfDataTypes ;j++) { temp = 0x0000 ; temp = ((short)pBuffer[i*nRatioOfDataTypes+j]) ; temp = temp << (8*(nRatioOfDataTypes-j-1)) ; nCurrentSampleValue |= temp ; fCurrentSampleValue = ((float)nCurrentSampleValue) / 32768 ; } fNewSampleValue = MAKE_SOME_SIGNAL_PROCESS(fCurrentSampleValue); //////////////////////////////////////////// temp = (short) (fNewSampleValue*32768); pBuffer[i*nRatioOfDataTypes] = (BYTE) (temp & 0xFF00) ; pBuffer[i*nRatioOfDataTypes+1] = (BYTE) (temp & 0x00FF) ; //////////////////////////////////////////// } } Finally can you send me any sample code for buffering or make any suggestion about that ? Thank you very much... Best Regards

    C / C++ / MFC question

  • Audio Signal Processing using Directshow(ISampleGrabber)
    A Akin Ocal

    Thank you very much for your answers. But I have some questions again : 1. I can succesfully get AM_MEDIA_TYPE from output pin of my source filter (I use audio files as sources in my case ) But unfotunately I cannot get pbFormat even formattype of AM_MEDIA_TYPE (pbFormat -> bad pointer, formattype-> GUID_NULL ) I use the code below to get AM_MEDIA_TYPE , I can get other parameters succesfully :( BOOL MyClass::GetMediaTypeOfConnectedPin (IBaseFilter* pFilter,PIN_DIRECTION pDir,AM_MEDIA_TYPE* pMediaType,int index) { HRESULT hr ; IPin* fPin ; hr = this->GetPin(pFilter,pDir,index,&fPin); if(hr != S_OK ) return FALSE ; if ( (fPin->ConnectionMediaType(pMediaType)) != S_OK) return FALSE ; if ( pMediaType->formattype == FORMAT_WaveFormatEx) { WAVEFORMATEX* temp = (WAVEFORMATEX*) malloc(sizeof(WAVEFORMATEX)); temp = ( WAVEFORMATEX *)pMediaType->pbFormat; ... free(temp); } return TRUE ; } 2. What is the order of samples if there are 2 channels. For example is it something like : Left Channel -> pBuffer[0] ... pBuffer[n/2] Right Channel -> pBuffer[n/2+1] .... pBuffer[n] or Left Channel-> pBuffer[even_indexes] Right Channel -> pBuffer[odd_indexes] 3. After I get my samples as WORDs(unsigned shorts) , what should I do to get floats from them ? Thank you very much Regards

    C / C++ / MFC question algorithms data-structures help tutorial

  • Audio Signal Processing using Directshow(ISampleGrabber)
    A Akin Ocal

    Thank you very much indeed...

    C / C++ / MFC question algorithms data-structures help tutorial

  • Audio Signal Processing using Directshow(ISampleGrabber)
    A Akin Ocal

    Hello I want to build an audio processing application using ISampleGrabber interface. 1. How can I learn sampling rates of audio streams ? Its callback function gives me "SampleTime"s and size of buffers. I guess I can get sampling rate as kbps. By the way after I get sampling rate as kbps how can I express in Hz\kHz ? 2. I know that your buffer size must be power of 2 to implement FFT algorithm ( at least Radix2 , I'm new on that area). So size of buffers ISamplegrabber gives are not always (almost never) powers of 2. So how should I handle this problem ? 3.Callback function gives a buffer of samples as BYTE* (array of unsigned chars). So to make an audio process , how should I get double or float values instead of unsigned chars ? For example should it be like this ? : double realSampleValue -> pBuffer[0].......pBuffer[7] ( Here I mean to make this programtically using bit operators) Thank you very much...

    C / C++ / MFC question algorithms data-structures help tutorial

  • Vista SDK Build Problem
    A Akin Ocal

    I am using VS2005. When I want to build a project using Vista SDK libraries ( Media Foundation) I receive errors below : 1>c:\program files\microsoft sdks\windows\v6.0\include\propsys.h(896) : error C2061: syntax error : identifier '__RPC__out' 1>c:\program files\microsoft sdks\windows\v6.0\include\propsys.h(900) : error C2061: syntax error : identifier '__RPC__in' 1>c:\program files\microsoft sdks\windows\v6.0\include\propsys.h(905) : error C2061: syntax error : identifier '__RPC__in_opt' 1>c:\program files\microsoft sdks\windows\v6.0\include\propsys.h(1305) : error C2061: syntax error : identifier '__RPC__out' 1>c:\program files\microsoft sdks\windows\v6.0\include\propsys.h(1308) : error C2061: syntax error : identifier '__RPC__deref_out_opt' I am getting some errors also for structuredquery.h. In Tools->Options->vc++ Projects , my includes file directories order is : $(VCInstallDir)PlatformSDK\include $(VCInstallDir)include C:\Program Files\Microsoft SDKs\Windows\v6.0\Include $(VCInstallDir)atlmfc\include $(FrameworkSDKDir)include How can I resolve this issue ? Thanks

    C / C++ / MFC help question c++ tools

  • Video Files to VCD\DVD Conversion
    A Akin Ocal

    Hello I want to write a simple application which converts a video file to a vcd\dvd file, so my VCD Player or DVD Player must play it directly ,after burning a disc with converted file. How can I convert videos to VCD\DVD formats ? Thank you very much.

    C / C++ / MFC question

  • Getting objects in ROT
    A Akin Ocal

    http://www.alexfedotov.com/samples/enumrot.asp I can enumerate objects in ROT using the code in the link. How can I get objects exposed by these running objects ? Will I use IMoniker::BindToObject for the rest ? Regards...

    C / C++ / MFC question com json

  • Dynamic Graph UI System
    A Akin Ocal

    Hi, I want to draw a graph like MS Visio and want to allow users to modify nodes and connections like GraphEdit of DXSDK. I am browsing opensource UML tools like UMLPad,StarUML.... It would be very good for me if people experienced in this help me about design of classes for this project. Regards , Akin Öcal

    IT & Infrastructure design data-structures tools help

  • Cluster Detection
    A Akin Ocal

    I want my application to detect whether it runs on a cluster or not. How can i do this using Cluster API ? BEST REGARDS

    C / C++ / MFC question json

  • Cant get SACL
    A Akin Ocal

    I cant get SACL of an existing file on my system with this code. GetNamedSecurityInfo returns 0 (ERROR_SUCCESS) , which means there is no error in execution of it but pSACL still becomes 0x00000000 and IsValidAcl(pSACL) returns FALSE . #include #include unsigned long enable_privilege(const char *priv) { HANDLE token = INVALID_HANDLE_VALUE; u status = OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token ); if( !status ) { return GetLastError(); } unsigned char buf[sizeof(TOKEN_PRIVILEGES) + sizeof(LUID_AND_ATTRIBUTES)]; TOKEN_PRIVILEGES *privs = (TOKEN_PRIVILEGES*)buf; status = LookupPrivilegeValue( NULL, priv, &privs->Privileges->Luid ); if( !status ) { u err = GetLastError(); CloseHandle(token); return err; } privs->PrivilegeCount = 1; privs->Privileges->Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges( token, FALSE, // do not disable all privs, 0, // zero buffer for prev state NULL, // prev state don't care NULL // no sink for returned prev state size ); status = GetLastError(); CloseHandle(token); return status; } int _tmain(int argc, _TCHAR* argv[]) { PACL pSACL = NULL; PSECURITY_DESCRIPTOR pSD = NULL; unsigned long returnValue ; enable_privilege(SE_SECURITY_NAME ); returnValue = GetNamedSecurityInfo( "D:\\aa.txt", // object name SE_FILE_OBJECT, // object type SACL_SECURITY_INFORMATION, // information type NULL, // owner SID NULL, // primary group SID NULL, // DACL &pSACL, // SACL &pSD); // SD if(!IsValidAcl(pSACL)) printf("FAILED , ERROR CODE : %d\n\n",returnValue); LocalFree(pSD); return 0 ; }

    C / C++ / MFC help

  • Changing stream resolution
    A Akin Ocal

    How can i change video resolution using sample grabber ? Does VMR9 renderer supply a ready method for this operation ? Thank you very much

    C / C++ / MFC question

  • Getting SACL & Privilege Problem
    A Akin Ocal

    I cant get SACL structure of a file , however i call a function : Privilege(SE_SECURITY_NAME,TRUE); How can i get sacl ?? BOOL Privilege(LPTSTR pszPrivilege, BOOL bEnable) { HANDLE hToken; TOKEN_PRIVILEGES tp; // // obtain the token, first check the thread and then the process // if (!OpenThreadToken(GetCurrentThread(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, TRUE, &hToken)){ if (GetLastError() == ERROR_NO_TOKEN){ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) return FALSE; } else return FALSE; } // // get the luid for the privilege // if (!LookupPrivilegeValue(NULL, pszPrivilege, &tp.Privileges[0].Luid)) return FALSE; tp.PrivilegeCount = 1; if (bEnable) tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; else tp.Privileges[0].Attributes = 0; // // enable or disable the privilege // if (!AdjustTokenPrivileges(hToken, FALSE, &tp, 0, (PTOKEN_PRIVILEGES)NULL, 0)) return FALSE; if (!CloseHandle(hToken)) return FALSE; return TRUE; }

    C / C++ / MFC help question

  • PSID Leakage Problem , please check the code
    A Akin Ocal

    I am doing everything for allocating and freeing sid structure but it always gives leakages please check the code : BOOL GetAll (char* sFileOrFolderName ) { DWORD dwRtnCode = 0; PSID ownerSid = NULL; HANDLE hFile; hFile = CreateFile( sFileOrFolderName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { return FALSE; } dwRtnCode = GetSecurityInfo( hFile, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION, (&ownerSid), NULL, NULL, NULL, NULL); if( !ownerSid ) { CloseHandle(hFile); return FALSE; } LocalFree((HLOCAL)ownerSid); CloseHandle(hFile); return TRUE ; } int _tmain(int argc, _TCHAR* argv[]) { while(1) { if(!GetAll("d:\\aa.txt")) { printf("\nFailed"); } Sleep(1000); } return 0; }

    C / C++ / MFC help

  • VMR9 & SampleGrabber at the same time , how ?
    A Akin Ocal

    Thanks but what about audio streams ? And what about processing imag , will it only give image or can it give chance of processing image buffer just in sample-grabber ?

    C / C++ / MFC question com announcement

  • VMR9 & SampleGrabber at the same time , how ?
    A Akin Ocal

    http://msdn2.microsoft.com/en-us/library/ms786690.aspx It says : Include Qedit.h. This header file is not compatible with Microsoft® Direct3D® headers later than version 7. My application must do both VMR9 rendering and sample grabbing. But there are many problems when i include d3d9.h+vmr9.h with qedit.h at the same time , it gives lots of errors when trying to build how can i use vmr9 filter and samplegrabber filter at the same time ?

    C / C++ / MFC question com announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups