[Drdivx-commits] SF.net SVN: drdivx: [370] DrDivX/trunk/drffmpeg
Brought to you by:
harikrishnan_v,
seabass089
From: <ro...@us...> - 2006-08-10 14:42:31
|
Revision: 370 Author: robux4 Date: 2006-08-10 07:21:13 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/drdivx/?rev=370&view=rev Log Message: ----------- add basic AVISynth support to DrFFMPEG command-line Modified Paths: -------------- DrDivX/trunk/drffmpeg/avformat.vcproj DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h DrDivX/trunk/drffmpeg/export/drffmpeg/avformat.h DrDivX/trunk/drffmpeg/libavcodec/imgconvert.c DrDivX/trunk/drffmpeg/libavcodec/raw.c DrDivX/trunk/drffmpeg/libavformat/allformats.c DrDivX/trunk/drffmpeg/libavformat/avienc.c Added Paths: ----------- DrDivX/trunk/drffmpeg/libavformat/avisynth.c Modified: DrDivX/trunk/drffmpeg/avformat.vcproj =================================================================== --- DrDivX/trunk/drffmpeg/avformat.vcproj 2006-08-10 06:54:26 UTC (rev 369) +++ DrDivX/trunk/drffmpeg/avformat.vcproj 2006-08-10 14:21:13 UTC (rev 370) @@ -20,7 +20,6 @@ OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="4" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" CharacterSet="2" > <Tool @@ -48,7 +47,6 @@ RuntimeLibrary="1" UsePrecompiledHeader="0" ObjectFile="$(IntDir)/libavformat/" - ProgramDataBaseFileName="$(IntDir)/libavformat/vc70.pdb" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" @@ -64,7 +62,7 @@ /> <Tool Name="VCLibrarianTool" - AdditionalDependencies="zlib.lib" + AdditionalDependencies="zlib.lib Vfw32.lib" OutputFile="$(OutDir)/avformat.lib" AdditionalLibraryDirectories=""$(ProjectDir)import\lib\$(ConfigurationName)\zlib";"$(ProjectDir)import\lib\$(ConfigurationName)\directxsdk"" /> @@ -89,7 +87,6 @@ OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="4" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" CharacterSet="2" > <Tool @@ -114,7 +111,6 @@ RuntimeLibrary="0" UsePrecompiledHeader="0" ObjectFile="$(IntDir)/libavformat/" - ProgramDataBaseFileName="$(IntDir)/libavformat/vc70.pdb" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" @@ -130,7 +126,7 @@ /> <Tool Name="VCLibrarianTool" - AdditionalDependencies="zlib.lib" + AdditionalDependencies="zlib.lib Vfw32.lib" OutputFile="$(OutDir)/avformat.lib" AdditionalLibraryDirectories=""$(ProjectDir)import\lib\$(ConfigurationName)\zlib";"$(ProjectDir)import\lib\$(ConfigurationName)\directxsdk"" /> @@ -164,11 +160,11 @@ > </File> <File - RelativePath=".\libavformat\adtsenc.c" + RelativePath="libavformat\adtsenc.c" > </File> <File - RelativePath=".\libavformat\aiff.c" + RelativePath="libavformat\aiff.c" > </File> <File @@ -208,10 +204,14 @@ > </File> <File - RelativePath=".\libavformat\avs.c" + RelativePath=".\libavformat\avisynth.c" > </File> <File + RelativePath="libavformat\avs.c" + > + </File> + <File RelativePath="libavformat\crc.c" > </File> @@ -220,7 +220,7 @@ > </File> <File - RelativePath=".\libavformat\daud.c" + RelativePath="libavformat\daud.c" > </File> <File @@ -292,7 +292,7 @@ > </File> <File - RelativePath=".\libavformat\mm.c" + RelativePath="libavformat\mm.c" > </File> <File @@ -332,7 +332,7 @@ > </File> <File - RelativePath=".\libavformat\nuv.c" + RelativePath="libavformat\nuv.c" > </File> <File @@ -340,19 +340,19 @@ > </File> <File - RelativePath=".\libavformat\oggparseflac.c" + RelativePath="libavformat\oggparseflac.c" > </File> <File - RelativePath=".\libavformat\oggparseogm.c" + RelativePath="libavformat\oggparseogm.c" > </File> <File - RelativePath=".\libavformat\oggparsetheora.c" + RelativePath="libavformat\oggparsetheora.c" > </File> <File - RelativePath=".\libavformat\oggparsevorbis.c" + RelativePath="libavformat\oggparsevorbis.c" > </File> <File @@ -392,7 +392,7 @@ > </File> <File - RelativePath=".\libavformat\smacker.c" + RelativePath="libavformat\smacker.c" > </File> <File @@ -404,7 +404,7 @@ > </File> <File - RelativePath=".\libavformat\tta.c" + RelativePath="libavformat\tta.c" > </File> <File @@ -412,7 +412,7 @@ > </File> <File - RelativePath=".\libavformat\voc.c" + RelativePath="libavformat\voc.c" > </File> <File @@ -446,7 +446,7 @@ > </File> <File - RelativePath=".\export\drffmpeg\avformat.h" + RelativePath="export\drffmpeg\avformat.h" > </File> <File @@ -454,11 +454,11 @@ > </File> <File - RelativePath=".\export\drffmpeg\avio.h" + RelativePath="export\drffmpeg\avio.h" > </File> <File - RelativePath=".\export\drffmpeg\crc.h" + RelativePath="export\drffmpeg\crc.h" > </File> <File @@ -466,11 +466,11 @@ > </File> <File - RelativePath=".\export\drffmpeg\framehook.h" + RelativePath="export\drffmpeg\framehook.h" > </File> <File - RelativePath=".\libavformat\mov.h" + RelativePath="libavformat\mov.h" > </File> <File @@ -478,11 +478,11 @@ > </File> <File - RelativePath=".\libavformat\ogg2.h" + RelativePath="libavformat\ogg2.h" > </File> <File - RelativePath=".\export\drffmpeg\os_support.h" + RelativePath="export\drffmpeg\os_support.h" > </File> <File @@ -490,7 +490,7 @@ > </File> <File - RelativePath=".\libavformat\voc.h" + RelativePath="libavformat\voc.h" > </File> </Filter> @@ -498,19 +498,19 @@ Name="libavutil" > <File - RelativePath=".\export\drffmpeg\avutil.h" + RelativePath="export\drffmpeg\avutil.h" > </File> <File - RelativePath=".\export\drffmpeg\bswap.h" + RelativePath="export\drffmpeg\bswap.h" > </File> <File - RelativePath=".\export\drffmpeg\common.h" + RelativePath="export\drffmpeg\common.h" > </File> <File - RelativePath=".\libavutil\crc.c" + RelativePath="libavutil\crc.c" > </File> <File @@ -518,7 +518,7 @@ > </File> <File - RelativePath=".\export\drffmpeg\integer.h" + RelativePath="export\drffmpeg\integer.h" > </File> <File @@ -526,7 +526,7 @@ > </File> <File - RelativePath=".\export\drffmpeg\intfloat_readwrite.h" + RelativePath="export\drffmpeg\intfloat_readwrite.h" > </File> <File @@ -534,7 +534,7 @@ > </File> <File - RelativePath=".\export\drffmpeg\mathematics.h" + RelativePath="export\drffmpeg\mathematics.h" > </File> <File @@ -542,7 +542,7 @@ > </File> <File - RelativePath=".\export\drffmpeg\rational.h" + RelativePath="export\drffmpeg\rational.h" > </File> </Filter> @@ -550,27 +550,27 @@ Name="dshow" > <File - RelativePath=".\dshow\AudioCapture.cpp" + RelativePath="dshow\AudioCapture.cpp" > </File> <File - RelativePath=".\dshow\AudioCapture.h" + RelativePath="dshow\AudioCapture.h" > </File> <File - RelativePath=".\dshow\capture.cpp" + RelativePath="dshow\capture.cpp" > </File> <File - RelativePath=".\dshow\capture.h" + RelativePath="dshow\capture.h" > </File> <File - RelativePath=".\dshow\VideoCapture.cpp" + RelativePath="dshow\VideoCapture.cpp" > </File> <File - RelativePath=".\dshow\VideoCapture.h" + RelativePath="dshow\VideoCapture.h" > </File> </Filter> Modified: DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h =================================================================== --- DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h 2006-08-10 06:54:26 UTC (rev 369) +++ DrDivX/trunk/drffmpeg/export/drffmpeg/avcodec.h 2006-08-10 14:21:13 UTC (rev 370) @@ -273,6 +273,7 @@ PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_UYVY422, ///< Packed pixel, Cb Y0 Cr Y1 PIX_FMT_UYVY411, ///< Packed pixel, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_YUV420SP, ///< Planar YUV 4:2:0 (1 Cb & Cr sample per 2x2 Y samples) PIX_FMT_NB, }; Modified: DrDivX/trunk/drffmpeg/export/drffmpeg/avformat.h =================================================================== --- DrDivX/trunk/drffmpeg/export/drffmpeg/avformat.h 2006-08-10 06:54:26 UTC (rev 369) +++ DrDivX/trunk/drffmpeg/export/drffmpeg/avformat.h 2006-08-10 14:21:13 UTC (rev 370) @@ -439,6 +439,9 @@ /* avidec.c */ int avidec_init(void); +/* avisynth.c */ +int avisynth_init(void); + /* swf.c */ int swf_init(void); Modified: DrDivX/trunk/drffmpeg/libavcodec/imgconvert.c =================================================================== --- DrDivX/trunk/drffmpeg/libavcodec/imgconvert.c 2006-08-10 06:54:26 UTC (rev 369) +++ DrDivX/trunk/drffmpeg/libavcodec/imgconvert.c 2006-08-10 14:21:13 UTC (rev 370) @@ -63,7 +63,7 @@ } PixFmtInfo; /* this table gives more information about formats */ -static PixFmtInfo pix_fmt_info[PIX_FMT_NB] +static PixFmtInfo pix_fmt_info[PIX_FMT_NB] #if __STDC_VERSION__ < 199901L ; void avpicture_init_pixfmtinfo(void) @@ -74,7 +74,7 @@ pix_fmt_info[PIX_FMT_YUV420P].pixel_type = FF_PIXEL_PLANAR; pix_fmt_info[PIX_FMT_YUV420P].depth = 8; pix_fmt_info[PIX_FMT_YUV420P].x_chroma_shift = 1; - pix_fmt_info[PIX_FMT_YUV420P].y_chroma_shift = 1; + pix_fmt_info[PIX_FMT_YUV420P].y_chroma_shift = 1; pix_fmt_info[PIX_FMT_YUV422P].name = "yuv422p"; pix_fmt_info[PIX_FMT_YUV422P].nb_channels = 3; @@ -130,7 +130,7 @@ pix_fmt_info[PIX_FMT_YUVJ420P].color_type = FF_COLOR_YUV_JPEG; pix_fmt_info[PIX_FMT_YUVJ420P].pixel_type = FF_PIXEL_PLANAR; pix_fmt_info[PIX_FMT_YUVJ420P].depth = 8; - pix_fmt_info[PIX_FMT_YUVJ420P].x_chroma_shift = 1; + pix_fmt_info[PIX_FMT_YUVJ420P].x_chroma_shift = 1; pix_fmt_info[PIX_FMT_YUVJ420P].y_chroma_shift = 1; pix_fmt_info[PIX_FMT_YUVJ422P].name = "yuvj422p"; @@ -139,7 +139,7 @@ pix_fmt_info[PIX_FMT_YUVJ422P].pixel_type = FF_PIXEL_PLANAR; pix_fmt_info[PIX_FMT_YUVJ422P].depth = 8; pix_fmt_info[PIX_FMT_YUVJ422P].x_chroma_shift = 1; - pix_fmt_info[PIX_FMT_YUVJ422P].y_chroma_shift = 0; + pix_fmt_info[PIX_FMT_YUVJ422P].y_chroma_shift = 0; pix_fmt_info[PIX_FMT_YUVJ444P].name = "yuvj444p"; pix_fmt_info[PIX_FMT_YUVJ444P].nb_channels = 3; @@ -191,7 +191,7 @@ pix_fmt_info[PIX_FMT_RGB555].depth = 5; pix_fmt_info[PIX_FMT_RGB555].x_chroma_shift = 0; pix_fmt_info[PIX_FMT_RGB555].y_chroma_shift = 0; - + /* gray / mono formats */ pix_fmt_info[PIX_FMT_GRAY8].name = "gray"; pix_fmt_info[PIX_FMT_GRAY8].nb_channels = 1; @@ -213,7 +213,7 @@ /* paletted formats */ pix_fmt_info[PIX_FMT_PAL8].name = "pal8"; - pix_fmt_info[PIX_FMT_PAL8].nb_channels = 4; + pix_fmt_info[PIX_FMT_PAL8].nb_channels = 4; pix_fmt_info[PIX_FMT_PAL8].is_alpha = 1; pix_fmt_info[PIX_FMT_PAL8].color_type = FF_COLOR_RGB; pix_fmt_info[PIX_FMT_PAL8].pixel_type = FF_PIXEL_PALETTE; @@ -226,6 +226,14 @@ pix_fmt_info[PIX_FMT_UYVY411].depth = 8; pix_fmt_info[PIX_FMT_UYVY411].x_chroma_shift = 2; pix_fmt_info[PIX_FMT_UYVY411].y_chroma_shift = 0; + + pix_fmt_info[PIX_FMT_YUV420SP].name = "yuv420sp-yv12"; + pix_fmt_info[PIX_FMT_YUV420SP].nb_channels = 3; + pix_fmt_info[PIX_FMT_YUV420SP].color_type = FF_COLOR_YUV; + pix_fmt_info[PIX_FMT_YUV420SP].pixel_type = FF_PIXEL_PLANAR; + pix_fmt_info[PIX_FMT_YUV420SP].depth = 8; + pix_fmt_info[PIX_FMT_YUV420SP].x_chroma_shift = 1; + pix_fmt_info[PIX_FMT_YUV420SP].y_chroma_shift = 1; } #else = { @@ -400,6 +408,14 @@ .depth = 8, .x_chroma_shift = 2, .y_chroma_shift = 0, }, + [PIX_FMT_YUV420P] = { + .name = "yuv420sp-yv12", + .nb_channels = 3, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 1, .y_chroma_shift = 1, + }, }; #endif @@ -441,6 +457,7 @@ size = width * height; switch(pix_fmt) { case PIX_FMT_YUV420P: + case PIX_FMT_YUV420SP: case PIX_FMT_YUV422P: case PIX_FMT_YUV444P: case PIX_FMT_YUV410P: @@ -811,6 +828,14 @@ /* XXX: totally non optimized */ +static void yuv420sp_to_yuv420p(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + memcpy(dst->data[0], src->data[0], src->linesize[0] * height); + memcpy(dst->data[1], src->data[2], src->linesize[2] * height >> 1); + memcpy(dst->data[2], src->data[1], src->linesize[1] * height >> 1); +} + static void yuv422_to_yuv420p(AVPicture *dst, const AVPicture *src, int width, int height) { @@ -1914,7 +1939,7 @@ /* [PIX_FMT_UYVY422] = */{ /* .convert = */yuv420p_to_uyvy422 }, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_YUV422] = */{ + /* [PIX_FMT_YUV422] = */{ /* [PIX_FMT_YUV420P] = */{ /* .convert = */yuv422_to_yuv420p }, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, @@ -1986,7 +2011,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_YUV422P] = */{ + /* [PIX_FMT_YUV422P] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* [PIX_FMT_YUV422] = */{ /* .convert = */yuv422p_to_yuv422 }, /* PIX_FMT_RGB24 */ {NULL}, @@ -2010,7 +2035,7 @@ /* [PIX_FMT_UYVY422] = */{ /* .convert = */yuv422p_to_uyvy422 }, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_YUV444P] = */{ + /* [PIX_FMT_YUV444P] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* [PIX_FMT_RGB24] = */{ /* .convert = */yuv444p_to_rgb24 }, @@ -2058,7 +2083,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_YUV410P] = */{ + /* [PIX_FMT_YUV410P] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, @@ -2082,7 +2107,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_YUV411P] = */{ + /* [PIX_FMT_YUV411P] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, @@ -2231,7 +2256,7 @@ /* PIX_FMT_YUV422 */ {NULL}, /* [PIX_FMT_RGB24] = */{ /* .convert = */pal8_to_rgb24 }, /* [PIX_FMT_BGR24] = */{ /* .convert = */pal8_to_bgr24 }, - /* PIX_FMT_YUV422P */{ NULL }, + /* PIX_FMT_YUV422P */{NULL}, /* PIX_FMT_YUV444P */ {NULL}, /* [PIX_FMT_RGBA32] = */{ /* .convert = */pal8_to_rgba32 }, /* PIX_FMT_YUV410P */ {NULL}, @@ -2274,7 +2299,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_YUVJ422P] = */{ + /* [PIX_FMT_YUVJ422P] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, @@ -2298,7 +2323,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_YUVJ444P] = */{ + /* [PIX_FMT_YUVJ444P] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* [PIX_FMT_RGB24] = */{ /* .convert = */yuvj444p_to_rgb24 }, @@ -2322,7 +2347,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_XVMC_MPEG2_MC] = */{ + /* [PIX_FMT_XVMC_MPEG2_MC] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, @@ -2346,7 +2371,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_XVMC_MPEG2_IDCT] = */{ + /* [PIX_FMT_XVMC_MPEG2_IDCT] = */{ /* PIX_FMT_YUV420P */ {NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, @@ -2370,7 +2395,7 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_UYVY422] = */{ + /* [PIX_FMT_UYVY422] = */{ /* [PIX_FMT_YUV420P] = */{ /* .convert = */uyvy422_to_yuv420p }, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, @@ -2394,12 +2419,12 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, - /* [PIX_FMT_UYVY411] = */{ + /* [PIX_FMT_UYVY411] = */{ /* PIX_FMT_YUV420P */{NULL}, /* PIX_FMT_YUV422 */ {NULL}, /* PIX_FMT_RGB24 */ {NULL}, /* PIX_FMT_BGR24 */ {NULL}, - /* PIX_FMT_YUV422P */{ NULL }, + /* PIX_FMT_YUV422P */{NULL}, /* PIX_FMT_YUV444P */ {NULL}, /* PIX_FMT_RGBA32 */ {NULL}, /* PIX_FMT_YUV410P */ {NULL}, @@ -2418,6 +2443,30 @@ /* PIX_FMT_UYVY422 */ {NULL}, /* PIX_FMT_UYVY411 */ {NULL}, }, + /* [PIX_FMT_YUV420SP] = */{ + /* PIX_FMT_YUV420P */ {yuv420sp_to_yuv420p}, + /* [PIX_FMT_YUV422] = */{NULL}, + /* [PIX_FMT_RGB24] = */{NULL}, + /* [PIX_FMT_BGR24] = */{NULL}, + /* PIX_FMT_YUV422P */ {NULL}, + /* PIX_FMT_YUV444P */ {NULL}, + /* [PIX_FMT_RGBA32] = */{NULL}, + /* PIX_FMT_YUV410P */ {NULL}, + /* PIX_FMT_YUV411P */ {NULL}, + /* [PIX_FMT_RGB565] = */{NULL}, + /* [PIX_FMT_RGB555] = */{NULL}, + /* PIX_FMT_GRAY8 */ {NULL}, + /* PIX_FMT_MONOWHITE */ {NULL}, + /* PIX_FMT_MONOBLACK */ {NULL}, + /* PIX_FMT_PAL8 */ {NULL}, + /* PIX_FMT_YUVJ420P */ {NULL}, + /* PIX_FMT_YUVJ422P */ {NULL}, + /* PIX_FMT_YUVJ444P */ {NULL}, + /* PIX_FMT_XVMC_MPEG2_MC */ {NULL}, + /* PIX_FMT_XVMC_MPEG2_IDCT */ {NULL}, + /* [PIX_FMT_UYVY422] = */{NULL}, + /* PIX_FMT_UYVY411 */ {NULL}, + }, }; @@ -2980,6 +3029,7 @@ int i; if (pix_fmt != PIX_FMT_YUV420P && + pix_fmt != PIX_FMT_YUV420SP && pix_fmt != PIX_FMT_YUV422P && pix_fmt != PIX_FMT_YUV444P && pix_fmt != PIX_FMT_YUV411P) @@ -2991,6 +3041,7 @@ if (i == 1) { switch(pix_fmt) { case PIX_FMT_YUV420P: + case PIX_FMT_YUV420SP: width >>= 1; height >>= 1; break; Modified: DrDivX/trunk/drffmpeg/libavcodec/raw.c =================================================================== --- DrDivX/trunk/drffmpeg/libavcodec/raw.c 2006-08-10 06:54:26 UTC (rev 369) +++ DrDivX/trunk/drffmpeg/libavcodec/raw.c 2006-08-10 14:21:13 UTC (rev 370) @@ -36,19 +36,20 @@ } PixelFormatTag; const PixelFormatTag pixelFormatTags[] = { - { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ - { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, - { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') }, - { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') }, - { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') }, - { PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') }, - { PIX_FMT_GRAY8, MKTAG(' ', ' ', 'Y', '8') }, + { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ + { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, + { PIX_FMT_YUV420SP, MKTAG('Y', 'V', '1', '2') }, + { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') }, + { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') }, + { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') }, + { PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') }, + { PIX_FMT_GRAY8, MKTAG(' ', ' ', 'Y', '8') }, - { PIX_FMT_YUV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */ - { PIX_FMT_YUV422, MKTAG('Y', '4', '2', '2') }, - { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') }, - { PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') }, + { PIX_FMT_YUV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */ + { PIX_FMT_YUV422, MKTAG('Y', '4', '2', '2') }, + { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') }, + { PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') }, { -1, 0 }, }; Modified: DrDivX/trunk/drffmpeg/libavformat/allformats.c =================================================================== --- DrDivX/trunk/drffmpeg/libavformat/allformats.c 2006-08-10 06:54:26 UTC (rev 369) +++ DrDivX/trunk/drffmpeg/libavformat/allformats.c 2006-08-10 14:21:13 UTC (rev 370) @@ -46,6 +46,7 @@ mp3_init(); rm_init(); asf_init(); + avisynth_init(); #ifdef CONFIG_MUXERS avienc_init(); #endif //CONFIG_MUXERS Modified: DrDivX/trunk/drffmpeg/libavformat/avienc.c =================================================================== --- DrDivX/trunk/drffmpeg/libavformat/avienc.c 2006-08-10 06:54:26 UTC (rev 369) +++ DrDivX/trunk/drffmpeg/libavformat/avienc.c 2006-08-10 14:21:13 UTC (rev 370) @@ -159,6 +159,7 @@ { CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') }, { CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') }, { CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') }, + { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') }, { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') }, { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') }, { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') }, Added: DrDivX/trunk/drffmpeg/libavformat/avisynth.c =================================================================== --- DrDivX/trunk/drffmpeg/libavformat/avisynth.c (rev 0) +++ DrDivX/trunk/drffmpeg/libavformat/avisynth.c 2006-08-10 14:21:13 UTC (rev 370) @@ -0,0 +1,213 @@ +/* + * AVISynth support for ffmpeg system + * Copyright (c) 2006 DivX, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "avi.h" + +#ifndef CONFIG_WIN32 +#error AVISynth/VFW only available on Win32 +#endif + +#include <windows.h> +#include <vfw.h> + +typedef struct { + PAVISTREAM handle; + AVISTREAMINFO info; + DWORD read; + LONG chunck_size; + LONG chunck_samples; +} AVISynthStream; + +typedef struct { + PAVIFILE file; + AVISynthStream *streams; + size_t nb_streams; + size_t next_stream; +} AVISynthContext; + +static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) +{ + AVISynthContext *avs = s->priv_data; + HRESULT res; + AVIFILEINFO info; + DWORD id; + AVStream *st; + AVISynthStream *stream; + + AVIFileInit(); + + res = AVIFileOpen(&avs->file, s->filename, OF_READ|OF_SHARE_DENY_WRITE, NULL); + if (res != S_OK) + { + av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %d", res); + AVIFileExit(); + return -1; + } + + res = AVIFileInfo(avs->file, &info, sizeof(info)); + if (res != S_OK) + { + av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %d", res); + AVIFileExit(); + return -1; + } + + avs->nb_streams = info.dwStreams; + avs->streams = av_malloc(avs->nb_streams * sizeof(AVISynthStream)); + memset(avs->streams, 0, avs->nb_streams * sizeof(AVISynthStream)); + + for (id=0; id<info.dwStreams; id++) + { + stream = &avs->streams[id]; + stream->read = 0; + if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK) + { + if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK) + { + if (stream->info.fccType == streamtypeAUDIO) + { + WAVEFORMATEX wvfmt; + LONG struct_size = sizeof(WAVEFORMATEX); + if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) + continue; + + st = av_new_stream(s, id); + st->codec->codec_type = CODEC_TYPE_AUDIO; + + st->codec->block_align = wvfmt.nBlockAlign; + st->codec->channels = wvfmt.nChannels; + st->codec->sample_rate = wvfmt.nSamplesPerSec; + st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8; + st->codec->bits_per_sample = wvfmt.wBitsPerSample; + + stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate; + stream->chunck_size = stream->chunck_samples * wvfmt.wBitsPerSample / 8; + + st->codec->codec_id = wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_sample); + } + else if (stream->info.fccType == streamtypeVIDEO) + { + BITMAPINFO imgfmt; + LONG struct_size = sizeof(BITMAPINFO); + + stream->chunck_size = stream->info.dwSampleSize; + stream->chunck_samples = 1; + + if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) + continue; + + st = av_new_stream(s, id); + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->r_frame_rate.num = stream->info.dwRate; + st->r_frame_rate.den = stream->info.dwScale; + + st->codec->width = imgfmt.bmiHeader.biWidth; + st->codec->height = imgfmt.bmiHeader.biHeight; + + st->codec->bits_per_sample = stream->info.dwSampleSize * 8; + st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; + st->codec->codec_id = codec_get_id(codec_bmp_tags, stream->info.fccHandler); + + st->duration = stream->info.dwLength; + } + else continue; + + st->codec->codec_tag = stream->info.fccHandler; + + st->codec->stream_codec_tag = stream->info.fccHandler; + + av_set_pts_info(st, 64, info.dwScale, info.dwRate); + st->start_time = stream->info.dwStart; + } + } + } + + return 0; +} + +static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + AVISynthContext *avs = s->priv_data; + HRESULT res; + AVISynthStream *stream; + int stream_id = avs->next_stream; + + // handle interleaving manually... + stream = &avs->streams[avs->next_stream]; + avs->next_stream++; + if (avs->next_stream == avs->nb_streams) + avs->next_stream = 0; + + if (stream->read >= stream->info.dwLength) + return AVERROR_IO; + + if (av_new_packet(pkt, stream->chunck_size)) + return AVERROR_IO; + pkt->stream_index = stream_id; + + res = AVIStreamRead(stream->handle, stream->read, stream->chunck_samples, pkt->data, stream->chunck_size, &pkt->size, NULL); + + stream->read += stream->chunck_samples; + + return (res == S_OK) ? pkt->size : -1; +} + +static int avisynth_read_close(AVFormatContext *s) +{ + AVISynthContext *avs = s->priv_data; + + av_free(avs->streams); + AVIFileRelease(avs->file); + AVIFileExit(); + return 0; +} + +static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags) +{ + AVISynthContext *avs = s->priv_data; + int stream_id; + + for (stream_id = 0; stream_id < avs->nb_streams; stream_id++) + { + avs->streams[stream_id].read = pts * avs->streams[stream_id].chunck_samples; + } + + return 0; +} + +AVInputFormat avisynth_demuxer = { + "avs", + "AVISynth", + sizeof(AVISynthContext), + NULL, + avisynth_read_header, + avisynth_read_packet, + avisynth_read_close, + avisynth_read_seek, + NULL, + 0, + "avs", +}; + +int avisynth_init(void) +{ + av_register_input_format(&avisynth_demuxer); + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |