You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(32) |
Oct
(26) |
Nov
(8) |
Dec
(17) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
(5) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: libvidcap c. m. <lib...@li...> - 2007-09-07 21:21:28
|
Revision: 6
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=6&view=rev
Author: bcholew
Date: 2007-09-07 14:21:27 -0700 (Fri, 07 Sep 2007)
Log Message:
-----------
Adjust for DirectShow sapi.
Modified Paths:
--------------
trunk/src/conv.h
Modified: trunk/src/conv.h
===================================================================
--- trunk/src/conv.h 2007-09-07 21:19:26 UTC (rev 5)
+++ trunk/src/conv.h 2007-09-07 21:21:27 UTC (rev 6)
@@ -40,11 +40,19 @@
typedef int (*conv_func)(int width, int height,
const char * src, char * dst, int dst_size);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
conv_func
conv_conversion_func_get(int src_fourcc, int dst_fourcc);
int
conv_fmt_size_get(int width, int height, int fourcc);
+#ifdef __cplusplus
+}
#endif
+#endif
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: libvidcap c. m. <lib...@li...> - 2007-09-07 21:19:30
|
Revision: 5
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=5&view=rev
Author: bcholew
Date: 2007-09-07 14:19:26 -0700 (Fri, 07 Sep 2007)
Log Message:
-----------
Implement DirectShow-specific format-validating functionality used at acquisition and bind times. At bind time, we now hold on to the media type for use at capture start time.
Modified Paths:
--------------
trunk/src/directshow/DirectShowSource.cpp
trunk/src/directshow/DirectShowSource.h
Modified: trunk/src/directshow/DirectShowSource.cpp
===================================================================
--- trunk/src/directshow/DirectShowSource.cpp 2007-09-06 15:39:40 UTC (rev 4)
+++ trunk/src/directshow/DirectShowSource.cpp 2007-09-07 21:19:26 UTC (rev 5)
@@ -50,6 +50,7 @@
pSampleGrabberIF_(0),
pNullRenderer_(0),
pMediaControlIF_(0),
+ nativeMediaType_(0),
pIntermediateFilter_(0),
intermediateMediaType_(0),
stoppingCapture_(false)
@@ -193,6 +194,9 @@
dshowMgr_->unregisterSrcGraph(pMediaEventIF_);
+ if ( nativeMediaType_ )
+ dshowMgr_->freeMediaType(*nativeMediaType_);
+
// These below were initialized in constructor
pMediaEventIF_->Release();
@@ -574,7 +578,7 @@
}
// Get the appropriate source media type
- AM_MEDIA_TYPE * pAmMediaType = getMediaType(pSourceOutPin_);
+ AM_MEDIA_TYPE * pAmMediaType = nativeMediaType_;
if ( !pAmMediaType )
{
log_error("failed to match media type\n");
@@ -584,9 +588,13 @@
// set the frame rate
VIDEOINFOHEADER * vih = (VIDEOINFOHEADER *) pAmMediaType->pbFormat;
vih->AvgTimePerFrame = 10000000 *
- sourceContext_->fmt_nominal.fps_denominator /
- sourceContext_->fmt_nominal.fps_numerator;
+ sourceContext_->fmt_native.fps_denominator /
+ sourceContext_->fmt_native.fps_numerator;
+ // set the dimensions
+ vih->bmiHeader.biWidth = sourceContext_->fmt_native.width;
+ vih->bmiHeader.biHeight = sourceContext_->fmt_native.height;
+
// set the stream's media type
hr = pStreamConfig_->SetFormat(pAmMediaType);
if ( FAILED(hr) )
@@ -606,6 +614,7 @@
}
else
{
+ //FIXME: do at bind time
hr = pSampleGrabberIF_->SetMediaType(pAmMediaType);
}
if ( FAILED(hr) )
@@ -745,7 +754,8 @@
pNullRenderer_->Release();
pNullRenderer_ = 0;
bail_4:
- dshowMgr_->freeMediaType(*pAmMediaType);
+ // free this at next bind time, and in destructor
+ //dshowMgr_->freeMediaType(*pAmMediaType);
bail_3:
pSampleGrabberIF_->Release();
pSampleGrabberIF_ = 0;
@@ -804,8 +814,174 @@
}
int
-DirectShowSource::bindFormat(const vidcap_fmt_info * fmtInfo)
+DirectShowSource::bindFormat(const vidcap_fmt_info * fmtNominal)
{
+ // If we've already got one, free it
+ if ( nativeMediaType_ )
+ dshowMgr_->freeMediaType(*nativeMediaType_);
+
+ bool needsFpsEnforcement = false;
+ bool needsFmtConv = false;
+
+ int iCount = 0, iSize = 0;
+ HRESULT hr = pStreamConfig_->GetNumberOfCapabilities(&iCount, &iSize);
+
+ // Check the size to make sure we pass in the correct structure.
+ if (iSize != sizeof(VIDEO_STREAM_CONFIG_CAPS) )
+ {
+ log_error("capabilities struct is wrong size (%d not %d)\n",
+ iSize, sizeof(VIDEO_STREAM_CONFIG_CAPS));
+ return 1;
+ }
+
+ struct formatProperties
+ {
+ bool isSufficient;
+ bool needsFmtConversion;
+ bool needsFpsEnforcement;
+ AM_MEDIA_TYPE *mediaFormat;
+ };
+
+ struct formatProperties * candidateFmtProps =
+ new struct formatProperties [iCount];
+
+ // these will be filled-in by checkFormat()
+ vidcap_fmt_info * fmtNative = new vidcap_fmt_info [iCount];
+
+ // enumerate each NATIVE source format
+ bool itCanWork = false;
+ for (int iFormat = 0; iFormat < iCount; ++iFormat )
+ {
+ candidateFmtProps[iFormat].isSufficient = false;
+ candidateFmtProps[iFormat].needsFmtConversion = false;
+ candidateFmtProps[iFormat].needsFpsEnforcement = false;
+ candidateFmtProps[iFormat].mediaFormat = 0;
+
+ // evaluate each native source format
+ if ( checkFormat(fmtNominal, &fmtNative[iFormat], iFormat,
+ &(candidateFmtProps[iFormat].needsFmtConversion),
+ &(candidateFmtProps[iFormat].needsFpsEnforcement),
+ &(candidateFmtProps[iFormat].mediaFormat)) )
+ {
+ candidateFmtProps[iFormat].isSufficient = true;
+ itCanWork = true;
+ }
+ }
+
+ // NOTE: Will need to free unselected mediaFormats
+ // before returning, but hold onto the best
+ // (if any) candidate format
+
+ // Can ANY of this source's native formats
+ // satisfy the requested format (to be bound)?
+ if ( !itCanWork )
+ {
+ goto freeThenReturn;
+ }
+
+ // evaluate the possibilities
+
+ int bestFmtNum = -1;
+
+ // any that work without mods?
+ for ( int iFmt = 0; iFmt < iCount; ++iFmt )
+ {
+ if ( candidateFmtProps[iFmt].isSufficient &&
+ !candidateFmtProps[iFmt].needsFmtConversion &&
+ !candidateFmtProps[iFmt].needsFpsEnforcement )
+ {
+ // found a perfect match!
+ log_info("bindFormat: found a 'perfect' match (fmt #%d)\n", iFmt);
+
+ bestFmtNum = iFmt;
+ goto freeThenReturn;
+ }
+ }
+
+ // any that work without format conversion? but with framerate conversion?
+ for ( int iFmt = 0; iFmt < iCount; ++iFmt )
+ {
+ if ( candidateFmtProps[iFmt].isSufficient &&
+ !candidateFmtProps[iFmt].needsFmtConversion &&
+ candidateFmtProps[iFmt].needsFpsEnforcement )
+ {
+ // found an okay match
+ log_info("bindFormat: found an 'okay' match (fmt #%d)\n", iFmt);
+
+ bestFmtNum = iFmt;
+ goto freeThenReturn;
+ }
+ }
+
+ // any that work with format conversion? but without framerate conversion?
+ for ( int iFmt = 0; iFmt < iCount; ++iFmt )
+ {
+ if ( candidateFmtProps[iFmt].isSufficient &&
+ candidateFmtProps[iFmt].needsFmtConversion &&
+ !candidateFmtProps[iFmt].needsFpsEnforcement )
+ {
+ // found a so-so match
+ log_info("bindFormat: found a 'so-so' match (fmt #%d)\n", iFmt);
+
+ bestFmtNum = iFmt;
+ goto freeThenReturn;
+ }
+ }
+
+ // any that work with both caveats?
+ for ( int iFmt = 0; iFmt < iCount; ++iFmt )
+ {
+ if ( candidateFmtProps[iFmt].isSufficient &&
+ candidateFmtProps[iFmt].needsFmtConversion &&
+ candidateFmtProps[iFmt].needsFpsEnforcement )
+ {
+ // found a poor match
+ log_info("bindFormat: found a poor match (fmt #%d)\n", iFmt);
+
+ bestFmtNum = iFmt;
+ goto freeThenReturn;
+ }
+ }
+
+ log_error("bindFormat: coding ERROR\n");
+ itCanWork = false;
+
+freeThenReturn:
+
+ // Free all sufficient candidates (unless it's the the CHOSEN one)
+ for ( int iFmt = 0; iFmt < iCount; ++iFmt )
+ {
+ if ( candidateFmtProps[iFmt].isSufficient )
+ {
+ // NOT the chosen one?
+ if ( !itCanWork || iFmt != bestFmtNum )
+ dshowMgr_->freeMediaType(*candidateFmtProps[iFmt].mediaFormat);
+ }
+ }
+
+ // Can bind succeed?
+ if ( itCanWork )
+ {
+ // take note of native media type, fps, dimensions
+ nativeMediaType_ = candidateFmtProps[bestFmtNum].mediaFormat;
+ sourceContext_->fmt_native.fps_numerator =
+ fmtNative[bestFmtNum].fps_numerator;
+ sourceContext_->fmt_native.fps_denominator =
+ fmtNative[bestFmtNum].fps_denominator;
+ sourceContext_->fmt_native.width = fmtNative[bestFmtNum].width;
+ sourceContext_->fmt_native.height = fmtNative[bestFmtNum].height;
+ sourceContext_->fmt_native.fourcc = fmtNative[bestFmtNum].fourcc;
+
+ //FIXME: use these values NOW, instead of waiting for
+ // capture to start()
+ }
+
+ delete [] candidateFmtProps;
+ delete [] fmtNative;
+
+ if ( !itCanWork )
+ return 1;
+
return 0;
}
@@ -813,12 +989,173 @@
DirectShowSource::validateFormat(const vidcap_fmt_info * fmtNominal,
vidcap_fmt_info * fmtNative) const
{
- // TODO: actually validate
+ bool needsFpsEnforcement = false;
+ bool needsFmtConv = false;
- return false;
+ int iCount = 0, iSize = 0;
+ HRESULT hr = pStreamConfig_->GetNumberOfCapabilities(&iCount, &iSize);
+
+ // Check the size to make sure we pass in the correct structure.
+ if (iSize != sizeof(VIDEO_STREAM_CONFIG_CAPS) )
+ {
+ log_error("capabilities struct is wrong size (%d not %d)\n",
+ iSize, sizeof(VIDEO_STREAM_CONFIG_CAPS));
+ return 0;
+ }
+
+ // enumerate each NATIVE format for this source
+ bool itWorks = false;
+ for (int iFormat = 0; iFormat < iCount; iFormat++)
+ {
+ AM_MEDIA_TYPE *mediaFormat = 0;
+
+ itWorks = checkFormat(fmtNominal, fmtNative, iFormat,
+ &needsFpsEnforcement, &needsFmtConv,
+ &mediaFormat);
+
+ if ( itWorks )
+ {
+ dshowMgr_->freeMediaType(*mediaFormat);
+ return 1;
+ }
+ }
+
+ return 0;
}
-//FIXME: should this be generic?
+// Evaluate one of perhaps several native formats for
+// suitability for providing the nominal format.
+// Fill-in output parameter 'mediaFormat'.
+bool
+DirectShowSource::checkFormat(const vidcap_fmt_info * fmtNominal,
+ vidcap_fmt_info * fmtNative,
+ int formatNum,
+ bool *needsFramerateEnforcing, bool *needsFormatConversion,
+ AM_MEDIA_TYPE **mediaFormat) const
+{
+ // get video stream capabilities structure #(formatNum)
+ VIDEO_STREAM_CONFIG_CAPS scc;
+ AM_MEDIA_TYPE *pMediaType;
+ HRESULT hr = pStreamConfig_->GetStreamCaps(formatNum, &pMediaType,
+ (BYTE*)&scc);
+
+ if (FAILED(hr))
+ {
+ log_warn("checkFormat: failed getting stream capabilities [%d] (%d)\n",
+ formatNum + 1, hr);
+ return false;
+ }
+
+ // check resolution
+ if ( fmtNominal->width < scc.MinOutputSize.cx ||
+ fmtNominal->height < scc.MinOutputSize.cy ||
+ fmtNominal->width > scc.MaxOutputSize.cx ||
+ fmtNominal->height > scc.MaxOutputSize.cy )
+ {
+ dshowMgr_->freeMediaType(*pMediaType);
+ return false;
+ }
+
+ bool matchesWidth = false;
+ for (int width = scc.MinOutputSize.cx; width <= scc.MaxOutputSize.cx;
+ width += scc.OutputGranularityX)
+ {
+ if ( width == fmtNominal->width )
+ matchesWidth = true;
+ }
+
+ bool matchesHeight = false;
+ for (int height = scc.MinOutputSize.cy; height <= scc.MaxOutputSize.cy;
+ height += scc.OutputGranularityY)
+ {
+ if ( height == fmtNominal->height )
+ matchesHeight = true;
+ }
+
+ if ( !matchesWidth || !matchesHeight )
+ {
+ dshowMgr_->freeMediaType(*pMediaType);
+ return false;
+ }
+
+ // calculate range of supported frame rates
+ double fpsMin = static_cast<double>( 1000000000 / scc.MaxFrameInterval)
+ / 100.0;
+ double fpsMax = static_cast<double>( 1000000000 / scc.MinFrameInterval)
+ / 100.0;
+
+ double fps = static_cast<double>(fmtNominal->fps_numerator) /
+ static_cast<double>(fmtNominal->fps_denominator);
+
+ // check framerate
+ if ( fps > fpsMax )
+ {
+ dshowMgr_->freeMediaType(*pMediaType);
+ return false;
+ }
+
+ if ( fps < fpsMin )
+ *needsFramerateEnforcing = true;
+
+ // check media type
+
+ int nativeFourcc = 0;
+ if ( mapDirectShowMediaTypeToVidcapFourcc(
+ pMediaType->subtype.Data1, nativeFourcc) )
+ {
+ dshowMgr_->freeMediaType(*pMediaType);
+ return false;
+ }
+
+ *needsFormatConversion = ( nativeFourcc != fmtNominal->fourcc );
+
+ if ( *needsFormatConversion &&
+ (conv_conversion_func_get(nativeFourcc, fmtNominal->fourcc) == 0) )
+ {
+ dshowMgr_->freeMediaType(*pMediaType);
+ return false;
+ }
+
+ // it's suitable. fill-in the native format values
+
+ fmtNative->width = fmtNominal->width;
+ fmtNative->height = fmtNominal->height;
+
+ if ( *needsFormatConversion )
+ fmtNative->fourcc = nativeFourcc;
+ else
+ fmtNative->fourcc = fmtNominal->fourcc;
+
+ if ( *needsFramerateEnforcing )
+ {
+ //FIXME: Use float. Drop numerator/denominator business.
+ fmtNative->fps_numerator = (int)fpsMax;
+ fmtNative->fps_denominator = 1;
+ }
+ else
+ {
+ fmtNative->fps_numerator = fmtNominal->fps_numerator;
+ fmtNative->fps_denominator = fmtNominal->fps_denominator;
+ }
+
+ /*
+ log_info("cf: can be satisfied with NATIVE format #%d: "
+ "'%s' %dx%d %d/%d fps\n",
+ formatNum,
+ vidcap_fourcc_string_get(fmtNative->fourcc),
+ fmtNative->width, fmtNative->height,
+ fmtNative->fps_numerator,
+ fmtNative->fps_denominator);
+ */
+
+ // return this suitable media type
+ *mediaFormat = pMediaType;
+
+ //FIXME: adjust framerate and dimensions now - not at capture start time
+
+ return true;
+}
+
void
DirectShowSource::cancelCallbacks()
{
@@ -838,11 +1175,7 @@
LeaveCriticalSection(&captureMutex_);
- log_info("cancelled source's capture callbacks\n");
-
stop();
-
- log_info("cancelled source's capture callbacks and stopped capture\n");
}
// Fake out interface queries
@@ -969,7 +1302,7 @@
{
switch ( data )
{
- case 0xe436eb7e: // MEDIASUBTYPE_RGB32.Data1
+ case 0xe436eb7e:
fourcc = VIDCAP_FOURCC_RGB32;
break;
case 0x30323449: // I420
@@ -989,7 +1322,7 @@
fourcc = VIDCAP_FOURCC_YVU9;
break;
default:
- log_warn("failed to map 0x%08x to fourcc\n", data);
+ log_warn("failed to map 0x%08x to vidcap fourcc\n", data);
return -1;
}
@@ -1002,7 +1335,7 @@
switch ( fourcc )
{
case VIDCAP_FOURCC_RGB32:
- data = 0xe436eb7e; // MEDIASUBTYPE_RGB32.Data1
+ data = 0xe436eb7e;
break;
case VIDCAP_FOURCC_I420:
data = 0x30323449; // '024I' aka I420
@@ -1011,7 +1344,7 @@
data = 0x32595559;
break;
default:
- log_warn("failed to map '%s' to DS media type\n",
+ log_warn("failed to map '%s' to DShow media type\n",
vidcap_fourcc_string_get(fourcc));
return -1;
}
Modified: trunk/src/directshow/DirectShowSource.h
===================================================================
--- trunk/src/directshow/DirectShowSource.h 2007-09-06 15:39:40 UTC (rev 4)
+++ trunk/src/directshow/DirectShowSource.h 2007-09-07 21:19:26 UTC (rev 5)
@@ -55,7 +55,13 @@
private:
bool canConvertToRGB32();
+ bool checkFormat(const vidcap_fmt_info * fmtNominal,
+ vidcap_fmt_info * fmtNative,
+ int formatNum,
+ bool *needsFramerateEnforcing, bool *needsFormatConversion,
+ AM_MEDIA_TYPE **candidateMediaFormat) const;
+ // NOTE: this will soon be obsolete
AM_MEDIA_TYPE * getMediaType( CComPtr< IPin > pPin) const;
void printMediaFormatType(AM_MEDIA_TYPE *pMedia);
@@ -95,8 +101,11 @@
IMediaControl * pMediaControlIF_;
+ AM_MEDIA_TYPE *nativeMediaType_;
+
// when necessary to convert source output format
- IBaseFilter *pIntermediateFilter_;
+ //NOTE: these two will soon be obsolete
+ IBaseFilter *pIntermediateFilter_;
DWORD intermediateMediaType_;
CRITICAL_SECTION captureMutex_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: libvidcap c. m. <lib...@li...> - 2007-09-06 15:39:55
|
Revision: 4
http://libvidcap.svn.sourceforge.net/libvidcap/?rev=4&view=rev
Author: jpgrayson
Date: 2007-09-06 08:39:40 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
Add pkg-config file.
Fix installation directory for header files.
No longer use multibyte constants for fourcc values.
Add api function for mapping fourcc values to strings.
Modified Paths:
--------------
trunk/Makefile.am
trunk/configure.ac
trunk/examples/simplegrab.c
trunk/examples/vidcapTester/Grabber.cpp
trunk/include/vidcap/Makefile.am
trunk/include/vidcap/vidcap.h
trunk/src/Makefile.am
trunk/src/conv.h
trunk/src/directshow/DirectShowSource.cpp
trunk/src/sapi_qt.c
trunk/src/vidcap.c
Added Paths:
-----------
trunk/vidcap.pc.in
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/Makefile.am 2007-09-06 15:39:40 UTC (rev 4)
@@ -1,4 +1,7 @@
SUBDIRS = include src examples
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = vidcap.pc
+
dist-hook:
find $(distdir) -name ".svn" -type d -print0 | xargs -0 rm -rf
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/configure.ac 2007-09-06 15:39:40 UTC (rev 4)
@@ -1,11 +1,11 @@
+dnl Copyright (C) 2007 Wimba, Inc.
+
AC_PREREQ(2.59)
dnl package version
-m4_define(VC_MAJOR, [0])
-m4_define(VC_MINOR, [1])
-m4_define(VC_MICRO, [0])
+m4_define(VIDCAP_VERSION, [0.1])
-AC_INIT([libvidcap], VC_MAJOR.VC_MINOR.VC_MICRO, [jpgrayson (at) gmail (dot) com])
+AC_INIT([libvidcap], VIDCAP_VERSION, [jpg...@gm...])
AC_CONFIG_SRCDIR([include/vidcap/vidcap.h])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign -Wall])
@@ -36,6 +36,14 @@
ACX_PTHREAD
+AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
+
+if test x"$have_pkg_config" = "xno"; then
+ AC_MSG_ERROR(pkg-config is required to install this program)
+fi
+
+PKG_PROG_PKG_CONFIG
+
AC_CHECK_FUNCS(nanosleep gettimeofday snprintf Sleep)
AC_CHECK_HEADER(linux/videodev.h,
@@ -63,11 +71,15 @@
AM_CONDITIONAL(HAVE_QUICKTIME, test "x$have_quicktime" = "xyes")
AM_CONDITIONAL(HAVE_DIRECTSHOW, test "x$have_directshow" = "xyes")
+dnl TODO: how do we make the various quicktime frameworks fit in?
+AC_SUBST(PKG_REQUIRES)
+
AC_CONFIG_FILES([
Makefile
include/Makefile
include/vidcap/Makefile
examples/Makefile
+ vidcap.pc
src/Makefile
])
Modified: trunk/examples/simplegrab.c
===================================================================
--- trunk/examples/simplegrab.c 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/examples/simplegrab.c 2007-09-06 15:39:40 UTC (rev 4)
@@ -150,13 +150,10 @@
{
const int size = 255;
char * s = malloc(size);
- snprintf(s, size, "%3dx%3d %c%c%c%c %.2f %d/%d",
+ snprintf(s, size, "%3dx%3d %s %.2f %d/%d",
fmt_info->width,
fmt_info->height,
- (fmt_info->fourcc >> 24) & 0xff,
- (fmt_info->fourcc >> 16) & 0xff,
- (fmt_info->fourcc >> 8) & 0xff,
- (fmt_info->fourcc >> 0) & 0xff,
+ vidcap_fourcc_string_get(fmt_info->fourcc),
(float)fmt_info->fps_numerator /
(float)fmt_info->fps_denominator,
fmt_info->fps_numerator,
Modified: trunk/examples/vidcapTester/Grabber.cpp
===================================================================
--- trunk/examples/vidcapTester/Grabber.cpp 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/examples/vidcapTester/Grabber.cpp 2007-09-06 15:39:40 UTC (rev 4)
@@ -65,14 +65,10 @@
throw std::runtime_error("failed vidcap_format_info_get()");
qDebug() << " bind fmt:"
- << QString("%2x%3 %4%5%6%7 (0x%8) %9 %10/%11")
+ << QString("%2x%3 %4 %5 %6/%7")
.arg(fmt_info.width, 3)
.arg(fmt_info.height, 3)
- .arg(QChar(static_cast<uchar>(fmt_info.fourcc >> 24)))
- .arg(QChar(static_cast<uchar>(fmt_info.fourcc >> 16)))
- .arg(QChar(static_cast<uchar>(fmt_info.fourcc >> 8)))
- .arg(QChar(static_cast<uchar>(fmt_info.fourcc >> 0)))
- .arg(static_cast<uint>(fmt_info.fourcc), 8, 16, QChar('0'))
+ .arg(vidcap_fourcc_string_get(fmt_info.fourcc))
.arg(static_cast<double>(fmt_info.fps_numerator) /
static_cast<double>(fmt_info.fps_denominator),
0, 'f', 2)
Modified: trunk/include/vidcap/Makefile.am
===================================================================
--- trunk/include/vidcap/Makefile.am 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/include/vidcap/Makefile.am 2007-09-06 15:39:40 UTC (rev 4)
@@ -1,3 +1,5 @@
-pkginclude_HEADERS = \
+pkgincludedir = $(includedir)/vidcap
+
+pkginclude_HEADERS = \
vidcap.h \
converters.h
Modified: trunk/include/vidcap/vidcap.h
===================================================================
--- trunk/include/vidcap/vidcap.h 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/include/vidcap/vidcap.h 2007-09-06 15:39:40 UTC (rev 4)
@@ -33,9 +33,9 @@
#define VIDCAP_NAME_LENGTH 256
enum vidcap_fourccs {
- VIDCAP_FOURCC_I420 = 'i420',
- VIDCAP_FOURCC_YUY2 = 'yuy2',
- VIDCAP_FOURCC_RGB32 = ' rgb',
+ VIDCAP_FOURCC_I420 = 100,
+ VIDCAP_FOURCC_YUY2 = 101,
+ VIDCAP_FOURCC_RGB32 = 102,
};
typedef void vidcap_state;
@@ -143,6 +143,9 @@
int
vidcap_src_capture_stop(vidcap_src *);
+const char *
+vidcap_fourcc_string_get(int fourcc);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/src/Makefile.am 2007-09-06 15:39:40 UTC (rev 4)
@@ -3,10 +3,8 @@
lib_LTLIBRARIES = libvidcap.la
libvidcap_la_CPPFLAGS = -I$(top_srcdir)/include
-libvidcap_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-multichar \
- $(PTHREAD_CFLAGS)
-libvidcap_la_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-multichar \
- $(PTHREAD_CFLAGS)
+libvidcap_la_CFLAGS = -Wall -Wextra -Wno-unused-parameter $(PTHREAD_CFLAGS)
+libvidcap_la_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter $(PTHREAD_CFLAGS)
libvidcap_la_LIBADD = $(PTHREAD_LIBS)
Modified: trunk/src/conv.h
===================================================================
--- trunk/src/conv.h 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/src/conv.h 2007-09-06 15:39:40 UTC (rev 4)
@@ -31,10 +31,10 @@
enum vidcap_fourccs_extra
{
- VIDCAP_FOURCC_RGB24 = ' r24',
- VIDCAP_FOURCC_RGB555 = 'r555',
- VIDCAP_FOURCC_YVU9 = 'yvu9',
- VIDCAP_FOURCC_2VUY = '2vuy',
+ VIDCAP_FOURCC_RGB24 = 200,
+ VIDCAP_FOURCC_RGB555 = 201,
+ VIDCAP_FOURCC_YVU9 = 202,
+ VIDCAP_FOURCC_2VUY = 203,
};
typedef int (*conv_func)(int width, int height,
Modified: trunk/src/directshow/DirectShowSource.cpp
===================================================================
--- trunk/src/directshow/DirectShowSource.cpp 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/src/directshow/DirectShowSource.cpp 2007-09-06 15:39:40 UTC (rev 4)
@@ -1011,11 +1011,8 @@
data = 0x32595559;
break;
default:
- log_warn("failed to map '%c%c%c%c' to DS media type\n",
- (char)((fourcc >> 24) & 0xff),
- (char)((fourcc >> 16) & 0xff),
- (char)((fourcc >> 8) & 0xff),
- (char)((fourcc >> 0) & 0xff));
+ log_warn("failed to map '%s' to DS media type\n",
+ vidcap_fourcc_string_get(fourcc));
return -1;
}
Modified: trunk/src/sapi_qt.c
===================================================================
--- trunk/src/sapi_qt.c 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/src/sapi_qt.c 2007-09-06 15:39:40 UTC (rev 4)
@@ -202,19 +202,15 @@
}
if ( qt_src_ctx->frame_count == 1 )
- log_info("capture time: %c%c%c%c %c%c%c%c %c%c%c%c %s\n",
+ log_info("capture time: %c%c%c%c %s %s %s\n",
(char)(pixel_format >> 24),
(char)(pixel_format >> 16),
(char)(pixel_format >> 8),
(char)(pixel_format >> 0),
- (char)(src_ctx->fmt_native.fourcc >> 24),
- (char)(src_ctx->fmt_native.fourcc >> 16),
- (char)(src_ctx->fmt_native.fourcc >> 8),
- (char)(src_ctx->fmt_native.fourcc >> 0),
- (char)(src_ctx->fmt_nominal.fourcc >> 24),
- (char)(src_ctx->fmt_nominal.fourcc >> 16),
- (char)(src_ctx->fmt_nominal.fourcc >> 8),
- (char)(src_ctx->fmt_nominal.fourcc >> 0),
+ vidcap_fourcc_string_get(
+ src_ctx->fmt_native.fourcc),
+ vidcap_fourcc_string_get(
+ src_ctx->fmt_nominal.fourcc),
src_ctx->src_info.identifier);
sapi_src_capture_notify(src_ctx,
@@ -285,27 +281,19 @@
if ( map_fourcc_to_ostype(src_ctx->fmt_native.fourcc, &pixel_format) )
{
- log_error("invalid bound fourcc '%c%c%c%c'\n",
- (char)(src_ctx->fmt_native.fourcc >> 24),
- (char)(src_ctx->fmt_native.fourcc >> 16),
- (char)(src_ctx->fmt_native.fourcc >> 8),
- (char)(src_ctx->fmt_native.fourcc >> 0));
+ log_error("invalid bound fourcc '%s'\n",
+ vidcap_fourcc_string_get(
+ src_ctx->fmt_native.fourcc));
return -1;
}
- log_info("setup decomp: %c%c%c%c %c%c%c%c %c%c%c%c %s\n",
+ log_info("setup decomp: %c%c%c%c %s %s %s\n",
(char)(pixel_format >> 24),
(char)(pixel_format >> 16),
(char)(pixel_format >> 8),
(char)(pixel_format >> 0),
- (char)(src_ctx->fmt_native.fourcc >> 24),
- (char)(src_ctx->fmt_native.fourcc >> 16),
- (char)(src_ctx->fmt_native.fourcc >> 8),
- (char)(src_ctx->fmt_native.fourcc >> 0),
- (char)(src_ctx->fmt_nominal.fourcc >> 24),
- (char)(src_ctx->fmt_nominal.fourcc >> 16),
- (char)(src_ctx->fmt_nominal.fourcc >> 8),
- (char)(src_ctx->fmt_nominal.fourcc >> 0),
+ vidcap_fourcc_string_get(src_ctx->fmt_native.fourcc),
+ vidcap_fourcc_string_get(src_ctx->fmt_nominal.fourcc),
src_ctx->src_info.identifier);
n = CFNumberCreate(0, kCFNumberSInt32Type, &pixel_format);
@@ -403,12 +391,9 @@
if ( map_fourcc_to_ostype(src_ctx->fmt_native.fourcc, &pixel_format) )
{
- log_error("invalid pixel format '%c%c%c%c' (0x%08x)\n",
- (char)(src_ctx->fmt_native.fourcc >> 24),
- (char)(src_ctx->fmt_native.fourcc >> 16),
- (char)(src_ctx->fmt_native.fourcc >> 8),
- (char)(src_ctx->fmt_native.fourcc >> 0),
- src_ctx->fmt_native.fourcc);
+ log_error("invalid pixel format '%s'\n",
+ vidcap_fourcc_string_get(
+ src_ctx->fmt_native.fourcc));
return (void *)-1;
}
Modified: trunk/src/vidcap.c
===================================================================
--- trunk/src/vidcap.c 2007-09-03 20:34:33 UTC (rev 3)
+++ trunk/src/vidcap.c 2007-09-06 15:39:40 UTC (rev 4)
@@ -369,12 +369,9 @@
if ( !src_ctx->format_validate(src_ctx, fmt_info, &fmt_native) )
{
- log_error("invalid format %dx%d %c%c%c%c %d/%d\n",
+ log_error("invalid format %dx%d %s %d/%d\n",
fmt_info->width, fmt_info->height,
- (char)(fmt_info->fourcc >> 24),
- (char)(fmt_info->fourcc >> 16),
- (char)(fmt_info->fourcc >> 8),
- (char)(fmt_info->fourcc >> 0),
+ vidcap_fourcc_string_get(fmt_info->fourcc),
fmt_info->fps_numerator,
fmt_info->fps_denominator);
return -1;
@@ -405,11 +402,9 @@
if ( !src_ctx->fmt_conv_buf_size )
{
- log_error("failed to get buffer size for %c%c%c%c\n",
- (char)(fmt_info->fourcc >> 24),
- (char)(fmt_info->fourcc >> 16),
- (char)(fmt_info->fourcc >> 8),
- (char)(fmt_info->fourcc >> 0));
+ log_error("failed to get buffer size for %s\n",
+ vidcap_fourcc_string_get(
+ fmt_info->fourcc));
return -1;
}
@@ -492,3 +487,26 @@
return ret;
}
+const char *
+vidcap_fourcc_string_get(int fourcc)
+{
+ switch ( fourcc )
+ {
+ case VIDCAP_FOURCC_I420:
+ return "i420";
+ case VIDCAP_FOURCC_YUY2:
+ return "yuy2";
+ case VIDCAP_FOURCC_RGB32:
+ return " rgb";
+ case VIDCAP_FOURCC_RGB24:
+ return " r24";
+ case VIDCAP_FOURCC_RGB555:
+ return "r555";
+ case VIDCAP_FOURCC_YVU9:
+ return "yvu9";
+ case VIDCAP_FOURCC_2VUY:
+ return "2vuy";
+ default:
+ return "????";
+ }
+}
Added: trunk/vidcap.pc.in
===================================================================
--- trunk/vidcap.pc.in (rev 0)
+++ trunk/vidcap.pc.in 2007-09-06 15:39:40 UTC (rev 4)
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=${prefix}/include
+
+Name: vidcap
+Description: Cross-platform video capture library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lvidcap @PTHREAD_LIBS@
+Libs.private:
+Cflags: -I${includedir}
+Requires.private: @PKG_REQUIRES@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|