hr = pSrcAud->SetInput(bsInputFile) and hr = pEncoder->PrepareToEncode(VARIANT_TRUE); are not working
-
both return handle fail. what does it mean? I am using the encoder 9 sdk. I have pick the sample application which comes with sdk . Now when i use the inbuitl sample . it encode the file but when i use that one for changing the following things it gets return handle fail. Look at the change: In sample application ---------------------
if ( SUCCEEDED( hr ) )
{
hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.mpg")); //this is a standard file
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcVid->SetInput(CComBSTR("C:\\InputFile.mpg"));
}my change ---------------
WCHAR * pwszOutFile = NULL;
WCHAR * pwszInFile = NULL;//input file and output file come from console
for(int i=0;i= argc )
{
break;
}hr = ConvertTCharToWChar( argv\[i\], &pwszInFile ); if( FAILED( hr ) ) { break; } } else if ( 0 == \_tcsicmp( argv\[i\], \_T( "-o" ) ) ) { i++; if( i >= argc ) { break; } hr = ConvertTCharToWChar( argv\[i\], &pwszOutFile ); if( FAILED( hr ) ) { break; } } }
CComBSTR bsInputFile;
bsInputFile.Attach ( W2BSTR(pwszInFile ) );
if ( SUCCEEDED( hr ) )
{
hr = pSrcAud->SetInput(bsInputFile); //Handle return hr=-2147012890
}I had try to find so many times in the google, but unable to find the solution. the preparetoEncodemethod works for console but when i am using the same thing for the window. it give me the E_UNEXPECTED result in the hr.
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
both return handle fail. what does it mean? I am using the encoder 9 sdk. I have pick the sample application which comes with sdk . Now when i use the inbuitl sample . it encode the file but when i use that one for changing the following things it gets return handle fail. Look at the change: In sample application ---------------------
if ( SUCCEEDED( hr ) )
{
hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.mpg")); //this is a standard file
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcVid->SetInput(CComBSTR("C:\\InputFile.mpg"));
}my change ---------------
WCHAR * pwszOutFile = NULL;
WCHAR * pwszInFile = NULL;//input file and output file come from console
for(int i=0;i= argc )
{
break;
}hr = ConvertTCharToWChar( argv\[i\], &pwszInFile ); if( FAILED( hr ) ) { break; } } else if ( 0 == \_tcsicmp( argv\[i\], \_T( "-o" ) ) ) { i++; if( i >= argc ) { break; } hr = ConvertTCharToWChar( argv\[i\], &pwszOutFile ); if( FAILED( hr ) ) { break; } } }
CComBSTR bsInputFile;
bsInputFile.Attach ( W2BSTR(pwszInFile ) );
if ( SUCCEEDED( hr ) )
{
hr = pSrcAud->SetInput(bsInputFile); //Handle return hr=-2147012890
}I had try to find so many times in the google, but unable to find the solution. the preparetoEncodemethod works for console but when i am using the same thing for the window. it give me the E_UNEXPECTED result in the hr.
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
What is ConvertTCharToWChar? Have you looked at bsInputFile in the debugger to see if it's valid?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
What is ConvertTCharToWChar? Have you looked at bsInputFile in the debugger to see if it's valid?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Mark Salsbery wrote:
What is ConvertTCharToWChar?
HRESULT ConvertTCharToWChar( TCHAR * ptszInput, WCHAR ** pwszOutput ) { int cchOutput = 0; if( NULL == ptszInput || NULL == pwszOutput ) { return( E_INVALIDARG ); } // // Get output buffer size // #ifdef UNICODE cchOutput = wcslen( ptszInput ) + 1; #else //UNICODE cchOutput = MultiByteToWideChar( CP_ACP, 0, ptszInput, -1, NULL, 0 ); if( 0 == cchOutput ) { return( HRESULT_FROM_WIN32( GetLastError() ) ); } #endif // UNICODE *pwszOutput = new WCHAR[ cchOutput ]; if( NULL == *pwszOutput) { return( E_OUTOFMEMORY ); } #ifdef UNICODE wcsncpy( *pwszOutput, ptszInput, cchOutput ); #else //UNICODE if( 0 == MultiByteToWideChar( CP_ACP, 0, ptszInput, -1, *pwszOutput, cchOutput ) ) { SAFE_ARRAYDELETE( *pwszOutput ); return( HRESULT_FROM_WIN32( GetLastError() ) ); } #endif // UNICODE return( S_OK ); }
Have you looked at bsInputFile in the debugger to see if it's valid?
yes , The value comes valid.
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Mark Salsbery wrote:
What is ConvertTCharToWChar?
HRESULT ConvertTCharToWChar( TCHAR * ptszInput, WCHAR ** pwszOutput ) { int cchOutput = 0; if( NULL == ptszInput || NULL == pwszOutput ) { return( E_INVALIDARG ); } // // Get output buffer size // #ifdef UNICODE cchOutput = wcslen( ptszInput ) + 1; #else //UNICODE cchOutput = MultiByteToWideChar( CP_ACP, 0, ptszInput, -1, NULL, 0 ); if( 0 == cchOutput ) { return( HRESULT_FROM_WIN32( GetLastError() ) ); } #endif // UNICODE *pwszOutput = new WCHAR[ cchOutput ]; if( NULL == *pwszOutput) { return( E_OUTOFMEMORY ); } #ifdef UNICODE wcsncpy( *pwszOutput, ptszInput, cchOutput ); #else //UNICODE if( 0 == MultiByteToWideChar( CP_ACP, 0, ptszInput, -1, *pwszOutput, cchOutput ) ) { SAFE_ARRAYDELETE( *pwszOutput ); return( HRESULT_FROM_WIN32( GetLastError() ) ); } #endif // UNICODE return( S_OK ); }
Have you looked at bsInputFile in the debugger to see if it's valid?
yes , The value comes valid.
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
Well if the string is valid at the time of the call, and it's exactly the same as when you use the sample code, then it should work. It's impossible for us to debug - you have to do it :)
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Well if the string is valid at the time of the call, and it's exactly the same as when you use the sample code, then it should work. It's impossible for us to debug - you have to do it :)
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Thanks for you nice smile :). but I really need your help can you give the proper time so can we seat together? for solving the problem?
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Thanks for you nice smile :). but I really need your help can you give the proper time so can we seat together? for solving the problem?
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
If that's really the only change you made from the sample code, and the sample code worked, then you should be able to debug it fairly easily. I would start at the line you marked in red and comment it out and add the line from the working code, like this: //hr = pSrcAud->SetInput(bsInputFile); //Handle return hr=-2147012890 hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.mpg")); //this is a standard file If it doesn't work, then something is broken somewhere else. If it works, then switch the code to your new code: hr = pSrcAud->SetInput(bsInputFile); //Handle return hr=-2147012890 //hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.mpg")); //this is a standard file Put a breakpoint here and check bsInputFile in the debugger. It should be the EXACT string that worked in the sample code ("C:\InputFile.mpg" in your posted code). If the project is fairly small and you have a complete buildable solution for VS 2003 or below, I can look at the code if you want to send it. Email me. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
If that's really the only change you made from the sample code, and the sample code worked, then you should be able to debug it fairly easily. I would start at the line you marked in red and comment it out and add the line from the working code, like this: //hr = pSrcAud->SetInput(bsInputFile); //Handle return hr=-2147012890 hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.mpg")); //this is a standard file If it doesn't work, then something is broken somewhere else. If it works, then switch the code to your new code: hr = pSrcAud->SetInput(bsInputFile); //Handle return hr=-2147012890 //hr = pSrcAud->SetInput(CComBSTR("C:\\InputFile.mpg")); //this is a standard file Put a breakpoint here and check bsInputFile in the debugger. It should be the EXACT string that worked in the sample code ("C:\InputFile.mpg" in your posted code). If the project is fairly small and you have a complete buildable solution for VS 2003 or below, I can look at the code if you want to send it. Email me. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Thank you very much for this guideline. and support. :rose: :rose: if this will not run then I will email you. Thank you once again
Dear Mark
."Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India