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
L

liur17

@liur17
About
Posts
21
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • help: no audio in directshow DES
    L liur17

    I wrote a program to trim a segment mpeg file to avi file, the video in the avi file is ok, but I can't output the audio into it. when I try to find out the output pin of the audio group, it returns error code:"the group does not has output pin", should I exract audio from mpeg file to a new file then add it to Timeline? please give any suggestion. my code is following: //Video hr = pTL->CreateEmptyNode(&pVideoGroupObj, TIMELINE_MAJOR_TYPE_GROUP); hr = pVideoGroupObj->QueryInterface(IID_IAMTimelineGroup, (void **)&pVideoGroup); AM_MEDIA_TYPE mtVideo; ZeroMemory(&mtVideo, sizeof(AM_MEDIA_TYPE)); mtVideo.majortype = MEDIATYPE_Video; mtVideo.subtype = MEDIASUBTYPE_RGB555; mtVideo.pbFormat = (BYTE*)CoTaskMemAlloc(sizeof(VIDEOINFOHEADER)); VIDEOINFOHEADER *pVideoHeader = (VIDEOINFOHEADER*)mtVideo.pbFormat; ZeroMemory(pVideoHeader, sizeof(VIDEOINFOHEADER)); //the m_mtSrcVideo is AM_MEDIA_TYPE info. gotten from mpeg file. VIDEOINFOHEADER *pVideoHeader0 = (VIDEOINFOHEADER*)m_mtSrcVideo.pbFormat; pVideoHeader->bmiHeader.biBitCount = pVideoHeader0->bmiHeader.biBitCount; pVideoHeader->bmiHeader.biWidth = pVideoHeader0->bmiHeader.biWidth; pVideoHeader->bmiHeader.biHeight = pVideoHeader0->bmiHeader.biHeight; pVideoHeader->bmiHeader.biPlanes = pVideoHeader0->bmiHeader.biPlanes; pVideoHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pVideoHeader->bmiHeader.biSizeImage = DIBSIZE(pVideoHeader->bmiHeader); mtVideo.formattype = FORMAT_VideoInfo; mtVideo.cbFormat = sizeof(VIDEOINFOHEADER); mtVideo.bFixedSizeSamples = TRUE; mtVideo.lSampleSize = DIBSIZE(pVideoHeader->bmiHeader); hr = pVideoGroup->SetMediaType(&mtVideo); hr = pTL->AddGroup(pVideoGroupObj); hr = pTL->CreateEmptyNode(&pVideoTrackObj, TIMELINE_MAJOR_TYPE_TRACK); hr = pVideoGroup->QueryInterface(IID_IAMTimelineComp, (void **)&pVideoComp); hr = pVideoComp->VTrackInsBefore(pVideoTrackObj, 0); hr = pVideoTrackObj->QueryInterface(IID_IAMTimelineTrack, (void **)&pVideoTrack); hr = pTL->CreateEmptyNode(&pVideoSourceObj, TIMELINE_MAJOR_TYPE_SOURCE); hr = pVideoSourceObj->QueryInterface(IID_IAMTimelineSrc, (void **)&pVideoSource); //Audio hr = pTL->CreateEmptyNode(&pAudioGroupObj, TIMELINE_MAJOR_TYPE_GROUP); hr = pAudioGroupObj->QueryInterface(IID_IAMTimelineGroup, (void **)&pAudioGroup); AM_MEDIA_TYPE mtAudio; ZeroMemory(&mtAudio, sizeof(AM_MEDIA_TYPE)); mtVideo.majortype = MEDIATYPE_Audio; mtAudio.subtype = MEDIASUBTYPE_PCM; mtAudio.bFixedSizeSamples = m_mtSrcAudio.bFixedSizeSamples; //the m_mtSrcAudio is AM_MEDIA_TYP

    C / C++ / MFC help question

  • IAMStreamControl StartAt() doesn't work [modified]
    L liur17

    I want to control the avi write action by query the IAMStreamControl interface of input pin in pAviMux, see below: IAMStreamControl *pSC = NULL; hr = pMuxPin01->QueryInterface(IID_IAMStreamControl, (void **)&pSC); hr = pSC->StartAt(&rtStart, 0); //rtStart = 3 seconds hr = pSC->StopAt(&rtStop, FALSE, 0); //rtStop = 9 seconds hr = pMediaControl->Run(); when I set the parameter of StartAt() as NULL, it works OK, the pMuxAvi stop the writing at rtStop time. however, when I give a rtStart parameter to StartAt() function, the pMuxAvi write a corrupt avi file which is only 127kb in size. what's wrong with the StartAt() function? please help. -- modified at 6:02 Saturday 14th July, 2007

    C / C++ / MFC database help question

  • I am getting 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
    L liur17

    I wrote below function in VC6 one year ago, maybe it can give you some hints. BOOL CMyClass::CaptureImage(LPCSTR szFileName) { if (pVMRWindowlessControl== NULL) return FALSE; BYTE* lpImage = NULL; if (pVMRWindowlessControl->GetCurrentImage(&lpImage) == S_OK) { BITMAPFILEHEADER hdr; DWORD dwSize, dwWritten; LPBITMAPINFOHEADER pDib = (LPBITMAPINFOHEADER)lpImage; //创建文件供写入 HANDLE hFile = CreateFile(szFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) return FALSE; //初始化BITMAP文件头 dwSize = DibSizeImage(pDib); hdr.bfType = BFT_BITMAP; hdr.bfSize = dwSize + sizeof(BITMAPFILEHEADER); hdr.bfReserved1 = 0; hdr.bfReserved2 = 0; hdr.bfOffBits = (DWORD)sizeof(BITMAPFILEHEADER) + pDib->biSize + DibPaletteSize(pDib); //写入文件头及内容 WriteFile(hFile, (LPCVOID)&hdr, sizeof(BITMAPFILEHEADER), &dwWritten, 0); WriteFile(hFile, (LPCVOID)pDib, dwSize, &dwWritten, 0); CloseHandle(hFile); CoTaskMemFree(lpImage); } return TRUE; }

    C / C++ / MFC help csharp visual-studio graphics game-dev

  • I am getting 'ICaptureGraphBuilder2' : missing storage-class or type specifiers
    L liur17

    the Class ICaptureGraphBuilder2 is defined in strmif.h; and the CLSID_CaptureGraphBuilder2 is defined in uuids.h

    C / C++ / MFC help csharp visual-studio graphics game-dev

  • can't get pin category property
    L liur17

    I can't get the pin category property in my directshow program, I try all pins in all filters(pSrcFilter, pMux, pMpeg2Splitter, pDecoder, etc), but every pin can't query the IKsPropertySet, it alawys return fail, so i can't know that the pin category is PIN_CATEGORY_CAPTURE or PIN_CATEGORY_PREVIEW, why? please give me some suggestion. IKsPropertySet *pKs; hr = pPin->QueryInterface(IID_IKsPropertySet, (void **)&pKs); if (FAILED(hr)) { return FALSE; }

    C / C++ / MFC database question

  • Help: Media seek in directshow
    L liur17

    Thank you very much. I checked my mailbox and not found your mail.(maybe the antivirus software ate it:(,), however after I follow your instruction to read the "Seeking the Filter Graph" in MSDN, I still can't find out the answer, It only tell me how to seek the media for rendering the media on screen, I also use pMediaSeeking->GetCapabilities(...) to check if it supports seeking, it return S_OK.

    C / C++ / MFC database help question workspace

  • fatal error C1083: Cannot open include file: 'dshow.h': No such file or directory
    L liur17

    go to menu Tools->options, click "Directories" tab in option dialog, input "c:\dxsdk\include" (your directx installation directory), then move it to top.

    C / C++ / MFC help graphics game-dev

  • Help: Media seek in directshow
    L liur17

    I wrote a program to convert mpeg file to avi in directshow, now the conversion is OK, but I can't find out a method to seek the source media, I want to seek to a given point in source media before the conversion begin. In other words, I want to convert a segment of mpeg file to avi file. The structure of my program is following: 1. Read source mpeg file by using pGraph->AddSourceFilter(...); 2. Init IMediaSeeking, IMediaControl, etc by query pGraph; 3. Setup output avi file and init pMux by using pBuilder->SetOutputFileName(...); 4. Create Mpeg splitter and Mpeg Decoder then add them to pGraph; 5. Connect all filters by using pBuilder->RenderStream(....); 6. Start conversion by using pMediaControl->run(). now the conversion of whole mpeg file is OK, but I can't seek the source media, the pMediaSeeking->SetPositions(...) and GetDuration() function always return fail. I also tried to seek media by pMux but failed. someone can give me instruction to resolve it? thanks in advance.

    C / C++ / MFC database help question workspace

  • convert mpg to avi in directshow
    L liur17

    I got it. Thank you for your kind reply.

    C / C++ / MFC question learning

  • convert mpg to avi in directshow
    L liur17

    Thanks you very much! I get the root of problem by using graphedit.exe: the input mpg file is a mpeg-1 file, so the file source filer outputs mpeg1-stream, but mpeg2demultiplexer requires mpeg2-stream, when it's running, it popup many DCDSPFilter.ax window and show a error message: These filters cannot agree on a connection, verify type compatibility of input pin and output pin. after I change the mpeg2demultiplexer to mpeg1streamsplitter and add the mpeg1 decoder, it runs OK. But this remains a problem: how can I get the type of mpeg file? I have to identify the file type(mpeg1 or mpeg2) programmly so that I can add the according filter. ???

    C / C++ / MFC question learning

  • convert mpg to avi in directshow
    L liur17

    Recently I try to convert mpg file to avi programmly, but it doesn't work , i am a beginner:) ,the code list below, anyone can give me suggestion? thanks. hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph); IBaseFilter *pSrcFilter = NULL; hr = pGraph->AddSourceFilter(lpMpgFile, L"Source Filter", &pSrcFilter); hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC, IID_ICaptureGraphBuilder2, (void **)&pBuilder); pBuilder->SetFiltergraph(pGraph); hr = pBuilder->SetOutputFileName(&MEDIASUBTYPE_Avi, lpOutputAviFile, &pMux, NULL); hr = pGraph->AddFilter(pMux, L"Mux Filter"); IBaseFilter *pMpeg2Splitter= NULL; hr = CoCreateInstance(CLSID_MPEG2Demultiplexer, 0, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void **)&pMpeg2Splitter); hr = pGraph->AddFilter(pMpeg2Splitter, L"Mpeg2 Splitter"); IMpeg2Demultiplexer *pDemux = NULL; hr = pMpeg2Splitter->QueryInterface(IID_IMpeg2Demultiplexer, (void**)&pDemux); AM_MEDIA_TYPE pMediaType; memset(&pMediaType, 0x0, sizeof(pMediaType)); pMediaType.majortype = MEDIATYPE_Video; pMediaType.subtype = MEDIASUBTYPE_MPEG2_VIDEO; pMediaType.formattype = FORMAT_MPEG2Video; pMediaType.bFixedSizeSamples = FALSE; pMediaType.bTemporalCompression = TRUE; pMediaType.lSampleSize = 0; MPEG2VIDEOINFO video_info; memset(&video_info, 0x0, sizeof(MPEG2VIDEOINFO)); pMediaType.cbFormat = sizeof(MPEG2VIDEOINFO); pMediaType.pbFormat = (BYTE *)&video_info; AM_MEDIA_TYPE pMediaAudioType; memset(&pMediaAudioType, 0x0, sizeof(pMediaAudioType)); pMediaAudioType.majortype = MEDIATYPE_Audio; pMediaAudioType.subtype = MEDIASUBTYPE_MPEG1Payload; pMediaAudioType.formattype = FORMAT_WaveFormatEx; pMediaAudioType.bFixedSizeSamples = FALSE; pMediaAudioType.bTemporalCompression = FALSE; pMediaAudioType.lSampleSize = 0; MPEG1WAVEFORMAT audio_info; memset(&audio_info, 0x0, sizeof(MPEG1WAVEFORMAT)); pMediaAudioType.cbFormat = sizeof(MPEG1WAVEFORMAT); pMediaAudioType.pbFormat = (BYTE *)&audio_info; IPin *pPin0 = NULL; hr = pDemux->CreateOutputPin(&pMediaType, L"Video Output", &pPin0); IMPEG2StreamIdMap *pStreamIdMap = NULL; hr = pPin0->QueryInterface(IID_IMPEG2StreamIdMap, (void **)&pStreamIdMap); hr = pStreamIdMap->MapStreamId(0xC0, MPEG2_PROGRAM_ELEMENTARY_STREAM, 0, 0); IPin *pPin1 = NULL; hr = pDemux->CreateOutputPin(&pMediaAudioType, L"Audio Output", &pPin1); IMPEG2StreamIdMap *pStreamIdMap1 = NULL; hr = pPin1->QueryInterface(IID_IMPEG2StreamIdMap, (void **)&pStreamIdMap1); hr = pStreamIdMap1->MapStre

    C / C++ / MFC question learning

  • True DBGrid in VC++
    L liur17

    Thanks for your reply. I use True OLE DataGrid 7, using bound mode. Looking forward to your instruction, Thank you in advance.

    C / C++ / MFC c++ database tutorial question

  • True DBGrid in VC++
    L liur17

    Hi, I try to translate text to text in True DBGrid control, but it seems not work in VC++, my code list below: .... CValueItems oValueItems; oValueItems = m_CtrlTDBG.GetColumns().GetItem(&index).GetValueItems(); CValueItemDisp* pValueItemDisp = new CValueItemDisp(); pValueItemDisp->SetValue(old_value); pValueItemDisp->SetDisplayValue(new_value); oValueItems.Add((LPDISPATCH)pValueItemDisp); oValueItems.SetTranslate(TRUE); .... I don't know how to use the function CValueItems.Add(LPDISPATCH vItem), someone can give me any suggestion? Thanks!

    C / C++ / MFC c++ database tutorial question

  • Retrieving VARCHAR out of MSSQL with ADO
    L liur17

    Hi, It's very strange, i use mssql2000+sp4 and not found this trouble. why didn't you using strValue.trimRight() to trim the space off?

    Database database c++ sql-server json help

  • Retrieving VARCHAR out of MSSQL with ADO
    L liur17

    Hi, I use _variant_t to get the value _variant_t tValue = pRS->GetFields()->GetItem(_T("YouFieldName"))->GetValue(); it works well, if you want to get CString type data, then: tValue.ChangeType(VT_BSTR);CString strValue = tValue.bstrVal;

    Database database c++ sql-server json help

  • How to SetEvenRowStyle in truedbgrid control in run time?
    L liur17

    Hi, I use truedbgrid control to show the table in vc++, but i don't know how to use the function SetEvenRowStyle(LPDISPATCH) and SetOddRowStyle(LPDISPATCH), anyone can tell me how to pass the LPDISPATCH parameter? Thanks!

    C / C++ / MFC c++ tutorial question

  • Look for a powerful datagrid control for VC++
    L liur17

    TrueDB is a good grid control, Thanks.

    C / C++ / MFC c++ question

  • Look for a powerful datagrid control for VC++
    L liur17

    Hi, is there a free powerful datagrid control for VC++? its color could be changed, and also can add droplist in its field. Thanks.

    C / C++ / MFC c++ question

  • How to put a dll to remote XP and run it?
    L liur17

    Thanks, my mean is how to put the dll into remote XP and loading it by rundll32 command. could you give me any suggestion? liur

    C / C++ / MFC question tutorial

  • How to connect toan ORACLE DB Using VC++6?
    L liur17

    to access oracle db using vc++, you can use ADO: #define INITGUID #import "c:\program files\common files\system\ado\msado15.dll" rename_namespace("ADO_RWXLS") rename("EOF","EndOfFile") using namespace ADO_RWXLS; #include "icrsint.h" _ConnectionPtr pConn; ::CoInitialize(NULL); pConn.CreateInstance(__uuidof(Connection)); CString strConn; strConn.Format(_T("Provider=MSDAORA.1;Data Source=%s;Database=%s;User ID=yourname;Password=yourpasswd"),strServerName,strServerName); pConn->Open(str_Connection, "", "", adOpenUnspecified); liur -- modified at 2:22 Sunday 14th January, 2007

    C / C++ / MFC c++ database oracle tools tutorial
  • Login

  • Don't have an account? Register

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