Projects
Multimedia
avidemux3
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 45
View file
avidemux3.changes
Changed
@@ -1,4 +1,15 @@ ------------------------------------------------------------------- +Fri Mar 22 22:41:51 UTC 2019 - enzokiel@kabelmail.de + +- Update to version 2.7.3 + + Vapoursynth is now dynamically loaded to avoid error popup + + ASF/WMV demuxer fix + + BMP decoder fix + + Re-enabled PNG decoder + + Basic save current state when crashing + + Misc small improvements + +------------------------------------------------------------------- Sun Mar 17 01:39:22 UTC 2019 - enzokiel@kabelmail.de - Update to version 2.7.2
View file
avidemux3.spec
Changed
@@ -22,7 +22,7 @@ Name: avidemux3 Summary: Graphical video editing and transcoding tool -Version: 2.7.2 +Version: 2.7.3 Release: 1 Url: http://avidemux.sourceforge.net/ ExclusiveArch: %ix86 x86_64
View file
avidemux_2.7.2.tar.gz/avidemux/common/ADM_audioFilter/src/audiofilter_bridge.cpp -> avidemux_2.7.3.tar.gz/avidemux/common/ADM_audioFilter/src/audiofilter_bridge.cpp
Changed
@@ -156,7 +156,6 @@ { // don't ask too much front. asked = (3*AUD_PROCESS_BUFFER_SIZE)/4-_tail; - asked/=_wavHeader.channels; // float->samples if(false==_incoming->getPCMPacket(_incomingBuffer.at(_tail), asked, &got,&dts)) { got=0;
View file
avidemux_2.7.2.tar.gz/avidemux/common/ADM_editor/src/ADM_edit.cpp -> avidemux_2.7.3.tar.gz/avidemux/common/ADM_editor/src/ADM_edit.cpp
Changed
@@ -437,7 +437,7 @@ { printf("[Editor] B- frame possible with that codec \n"); #define FCC_MATCHES(x) fourCC::check(info.fcc,(uint8_t *)x) - if(isMpeg4Compatible(info.fcc) || isMpeg12Compatible(info.fcc) || isVC1Compatible(info.fcc) || FCC_MATCHES("WMV3")) + if(isMpeg4Compatible(info.fcc) || isMpeg12Compatible(info.fcc) || FCC_MATCHES("VC1 ") || FCC_MATCHES("WMV3")) { ADM_info("[Editor] It is mpeg4-SP/ASP, try to guess all PTS\n"); uint64_t delay; @@ -464,9 +464,9 @@ } } int lastVideo=_segments.getNbSegments(); - if(lastVideo && isH264Compatible(info.fcc)) + if(lastVideo && (isH264Compatible(info.fcc) || FCC_MATCHES("WVC1"))) { - ADM_info("H264 in mp4 sometimes has invalid timestamps which confuse avidemux, checking\n"); + ADM_info("%s sometimes has invalid timestamps which confuse avidemux, checking\n",fourCC::tostring(info.fcc)); checkForValidPts(_segments.getSegment(lastVideo-1)); } if(true==checkForDoubledFps( video._aviheader,video.timeIncrementInUs))
View file
avidemux_2.7.2.tar.gz/avidemux/common/ADM_editor/src/ADM_segment.cpp -> avidemux_2.7.3.tar.gz/avidemux/common/ADM_editor/src/ADM_segment.cpp
Changed
@@ -124,8 +124,8 @@ ADM_info("Original frame increment %s = %" PRIu64" us\n",ADM_us2plain(ref->timeIncrementInUs),ref->timeIncrementInUs); uint64_t minDelta=100000; uint64_t maxDelta=0; - int fmin,fmax; - for (int frame=0; frame<info.nb_frames; frame++) + uint32_t fmin=0,fmax=0; + for (uint32_t frame=0; frame<info.nb_frames; frame++) { if (ref->_aviheader->getPtsDts(frame,&pts,&dts) && dts!=ADM_NO_PTS && dts!=0) { @@ -143,9 +143,14 @@ firstNonZeroDtsFrame=frame; } } - ADM_info("min increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(minDelta),minDelta,fmin); - ADM_info("max increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(maxDelta),maxDelta,fmax); - + if(maxDelta>=minDelta) + { + ADM_info("min increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(minDelta),minDelta,fmin); + ADM_info("max increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(maxDelta),maxDelta,fmax); + }else + { + ADM_warning("DTS missing, cannot probe time increment.\n"); + } //if (minDelta==ref->timeIncrementInUs*2) //ref->timeIncrementInUs=minDelta; @@ -176,7 +181,9 @@ else ADM_info("The first frame DTS = %" PRIu64" ms\n",dts/1000); if(pts!=ADM_NO_PTS &&pts) { - ADM_warning("The first frame has a PTS >0, adjusting to %" PRIu64" ms\n",pts/1000); + ADM_warning("The first frame has a PTS > 0, adjusting to %" PRIu64" %s\n", + (pts>=1000)? pts/1000 : pts, + (pts>=1000)? "ms" : "us"); ref->firstFramePts=pts; #ifdef ADM_ZERO_OFFSET seg._refStartTimeUs=pts;
View file
avidemux_2.7.2.tar.gz/avidemux/common/ADM_editor/src/utils/ADM_edCheckForInvalidPts.cpp -> avidemux_2.7.3.tar.gz/avidemux/common/ADM_editor/src/utils/ADM_edCheckForInvalidPts.cpp
Changed
@@ -78,6 +78,23 @@ ADM_info("No B-frames and no PTS, setting PTS equal DTS\n"); return setPtsEqualDts(hdr,inc); } + // check whether DTS are completely missing, ignore the first frame + bool noDts=true; + for(uint32_t i=1;i<totalFrames;i++) + { + uint64_t pts,dts; + hdr->getPtsDts(i,&pts,&dts); + if(dts!=ADM_NO_PTS) + { + noDts=false; + break; + } + } + if(!stats.nbBFrames && !stats.nbPtsgoingBack && hdr->providePts() && noDts) + { + ADM_info("No B-frames and no DTS, setting DTS equal PTS\n"); + return setPtsEqualDts(hdr,inc); + } if(stats.nbPtsgoingBack>1 || (stats.nbBFrames && hdr->providePts()==false)) {
View file
avidemux_2.7.2.tar.gz/avidemux/qt4/xdg_data/org.avidemux.Avidemux.appdata.xml.in -> avidemux_2.7.3.tar.gz/avidemux/qt4/xdg_data/org.avidemux.Avidemux.appdata.xml.in
Changed
@@ -29,6 +29,6 @@ </screenshots> <content_rating type="oars-1.1"/> <releases> - <release version="${AVIDEMUX_VERSION}" date="${BUILD_DATE}"/> + <release version="${AVIDEMUX_VERSION}" date="2019-03-21"/> </releases> </component>
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_core/include/ADM_crashdump.h -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_core/include/ADM_crashdump.h
Changed
@@ -6,6 +6,7 @@ #include "ADM_crashdump_apple.h" #include "ADM_crashdump_other.h" #include "ADM_crashdump_unix.h" +#include "ADM_crashdump_vs.h" #ifdef __cplusplus extern "C"
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_core/include/ADM_crashdump_other.h -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_core/include/ADM_crashdump_other.h
Changed
@@ -1,4 +1,4 @@ -#if !defined(__APPLE__) && !defined(__unix__) && !defined(__MINGW32__) && !defined ADM_CRASHDUMP_OTHER_H +#if !defined(__APPLE__) && !defined(__unix__) && !defined(__MINGW32__) && !defined ADM_CRASHDUMP_OTHER_H &&!defined _MSC_VER #define ADM_CRASHDUMP_OTHER_H #define installSigHandler(...) {}
View file
avidemux_2.7.3.tar.gz/avidemux_core/ADM_core/include/ADM_crashdump_vs.h
Added
@@ -0,0 +1,11 @@ +/** + * \file ADM_crashdump_mingw + * \brief Catch low level error, mingw version + */ +#if defined(_MSC_VER) + +#pragma once +ADM_CORE6_EXPORT void installSigHandler(void); +ADM_CORE6_EXPORT void uninstallSigHandler(void); + +#endif
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_core/src/ADM_crashdump_vs.cpp -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_core/src/ADM_crashdump_vs.cpp
Changed
@@ -1,4 +1,114 @@ +#include <windows.h> +#include <excpt.h> +#include <string> #include "ADM_crashdump.h" +static ADM_saveFunction *mysaveFunction = NULL; +static ADM_fatalFunction *myFatalFunction = NULL; + +void ADM_setCrashHook(ADM_saveFunction *save, ADM_fatalFunction *fatal,ADM_sigIntFunction *other) +{ + mysaveFunction = save; + myFatalFunction = fatal; + } + +/** + * + * @param exceptionRecord + * @param contextRecord + */ +void HandleException(const char *message,struct _EXCEPTION_RECORD *exceptionRecord, struct _CONTEXT *contextRecord) +{ + std::string s; + fflush(stderr); + fflush(stdout); + + static int running = 0; + + if (running) + exit(1); + + running = 1; + + if (mysaveFunction) + mysaveFunction(); + + + + void *process = GetCurrentProcess(); + + fflush(stdout); + + const char *title; + if(!message) title="Crash"; + else title=message; + if (myFatalFunction) + myFatalFunction(title, s.c_str()); + fflush(stderr); + fflush(stdout); + exit(1); +} +/** + * + * @param exceptionRecord + * @param establisherFrame + * @param contextRecord + * @param dispatcherContext + * @return + */ +EXCEPTION_DISPOSITION ExceptionHandler(struct _EXCEPTION_RECORD *exceptionRecord, void *establisherFrame, struct _CONTEXT *contextRecord, void *dispatcherContext) +{ + HandleException("ExceptionHandler",exceptionRecord, contextRecord); + return ExceptionContinueExecution; +} +/** + * + * @param exceptionInfo + * @return + */ +LONG WINAPI ExceptionFilter(struct _EXCEPTION_POINTERS *exceptionInfo) +{ + HandleException("ExceptionFilter",exceptionInfo->ExceptionRecord, exceptionInfo->ContextRecord); + return EXCEPTION_CONTINUE_SEARCH; +} +/** + * + * @param pExceptionInfo + * @return + */ +LONG WINAPI TopLevelExceptionHandler(struct _EXCEPTION_POINTERS *exceptionInfo) +{ + HandleException("TopLevelExceptionHandler",exceptionInfo->ExceptionRecord, exceptionInfo->ContextRecord); + return EXCEPTION_CONTINUE_SEARCH; +} + +/** + * + * @param info + * @param lineno + * @param file + */ +void ADM_backTrack(const char *info, int lineno, const char *file) +{ + char title[2048]={0}; + snprintf(title,2000,"%s at line %d, file %s\n",info,lineno,file); + HandleException(title,NULL, NULL); +} + + +/** + * \fn installSigHandler + * \brief add hook to catch exception (null pointers etc...) + */ +ADM_CORE6_EXPORT void installSigHandler(void) +{ + SetUnhandledExceptionFilter(ExceptionFilter); +} +/** + * \fn uninstallSigHandler + * \brief + */ +ADM_CORE6_EXPORT void uninstallSigHandler(void) +{ + +} -void ADM_backTrack(const char *info, int lineno, const char *file) { } -void ADM_setCrashHook(ADM_saveFunction *save, ADM_fatalFunction *fatal,ADM_sigIntFunction *other) { }
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_core/src/CMakeLists.txt -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_core/src/CMakeLists.txt
Changed
@@ -4,7 +4,6 @@ ADM_coreTranslator.cpp ADM_prettyPrint.cpp ) - IF (MINGW) SET(ADM_core_SRCS ${ADM_core_SRCS} ADM_crashdump_mingw.cpp ADM_folder_win32.cpp ADM_folder_mingw.cpp ADM_win32_mingw.cpp ) ELSEIF (APPLE)
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_coreDemuxerMpeg/src/dmx_io.cpp -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_coreDemuxerMpeg/src/dmx_io.cpp
Changed
@@ -188,6 +188,8 @@ if(myFd.fileSize >= threshold-tolerance && myFd.fileSize <= threshold+tolerance) break; threshold<<=1; + if(i==1) + tolerance<<=3; // 8 MiB starting with 1 GiB fragment size } } count++;
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_coreImageLoader/include/ADM_imageLoader.h -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_coreImageLoader/include/ADM_imageLoader.h
Changed
@@ -38,14 +38,16 @@ { uint32_t i; i = 0; - i=(((uint32_t)(read16LE()))<<0)+(((uint32_t)read16LE())<<16); + i += (((uint32_t)(read16LE())) << 0); + i += (((uint32_t)read16LE()) << 16); return i; } uint32_t read32BE () { uint32_t i; i = 0; - i=(((uint32_t)(read16BE()))<<16)+(((uint32_t)read16BE())<<0); + i += (((uint32_t)(read16BE())) << 16); + i +=(((uint32_t)read16BE()) << 0); return i; } uint16_t read16LE () @@ -53,7 +55,8 @@ uint16_t i; i = 0; - i = (read8( ) ) + (read8( )<< 8); + i += (read8()); + i +=(read8() << 8); return i; } uint16_t read16BE () @@ -61,7 +64,8 @@ uint16_t i; i = 0; - i = (read8( ) <<8) + (read8( )<< 0); + i += (read8() << 8); + i += (read8()); return i; } uint8_t read8 () @@ -88,7 +92,10 @@ READ_FIELD(biBitCount,16) READ_FIELD(biCompression,32) READ_FIELD(biSizeImage,32) - READ_FIELD(biSize,32) + READ_FIELD(biXPelsPerMeter,32) + READ_FIELD(biYPelsPerMeter,32) + READ_FIELD(biClrUsed,32) + READ_FIELD(biClrImportant,32) } protected:
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_coreImageLoader/src/ADM_imageLoader.cpp -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_coreImageLoader/src/ADM_imageLoader.cpp
Changed
@@ -105,12 +105,12 @@ swap=true; } - if(ADM_COLOR_RGB24==sourceFormat) + if(ADM_COLOR_RGB24==sourceFormat || ADM_COLOR_BGR24==sourceFormat) swap=true; - ADMColorScalerSimple converter(w,h,sourceFormat,ADM_COLOR_YV12); - converter.convertImage(source,image); - + ADMColorScalerSimple converter(w,h,sourceFormat,ADM_COLOR_YV12); + converter.convertImage(source,image); + if(swap) { uint8_t **s=image->_planes,*v; @@ -205,7 +205,7 @@ */ static bool readJpegInfo(FILE *fd, int &width, int &height) { - uint16_t tag = 0, count = 0, off; + uint16_t tag = 0, count = 0, off = 0; int w,h; fseek(fd, 0, SEEK_END); int fileLength=ftell(fd); @@ -305,8 +305,13 @@ // Load the binary coded image ADM_byteBuffer buffer(_imgSize); fseek(fd, 0, SEEK_SET); - fread(buffer.at(0),_imgSize,1,fd); + int r=fread(buffer.at(0),_imgSize,1,fd); fclose(fd); + if(!r) + { + ADM_warning("Cannot read JPEG file.\n"); + return NULL; + } // ADMImageRef tmpImage(w,h); // It is a reference image @@ -335,7 +340,7 @@ ADMImage *createImageFromFile_png(const char *filename) { - uint32_t offset,size; + uint32_t size; FILE *fd=NULL; uint32_t w,h; @@ -356,8 +361,13 @@ fseek(fd,0,SEEK_SET); ADM_byteBuffer buffer(size); - fread(buffer.at(0),size,1,fd); + int r=fread(buffer.at(0),size,1,fd); fclose(fd); + if(!r) + { + ADM_warning("Cannot read PNG file.\n"); + return NULL; + } ADMImageRef tmpImage(w,h); // Decode PNG decoders *dec=ADM_coreCodecGetDecoder (fourCC::get((uint8_t *)"PNG "), w, h, 0 , NULL,0); @@ -370,10 +380,7 @@ bin.data=buffer.at(0); bin.dataLength=size; // This is more than actually, but who cares... - bool success=dec->uncompress (&bin, &tmpImage); - - - if(!success) + if(!dec->uncompress (&bin, &tmpImage)) { ADM_warning("PNG Decompressing failed\n"); delete dec; @@ -397,10 +404,10 @@ { ADM_BITMAPINFOHEADER bmph; - uint8_t fcc_tab[4]; uint32_t offset; FILE *fd=NULL; - uint32_t w,h; + uint32_t w,h,bpp; + int bufSize; fd = ADM_fopen(filename, "rb"); if(!fd) @@ -415,7 +422,7 @@ offset = reader.read32LE(); reader.readBmphLE(bmph); - if (bmph.biCompression != 0 &bmph.biCompression!=3) + if(bmph.biCompression && bmph.biCompression!=3) { ADM_warning("[imageLoader] BMP2:Cannot handle compressed bmp (%08x)\n",bmph.biCompression); fclose(fd); @@ -423,25 +430,87 @@ } w = bmph.biWidth; h = bmph.biHeight; + if(w > MAXIMUM_SIZE) + { + ADM_warning("Width %u exceeds maximum supported (%u)\n",w,MAXIMUM_SIZE); + fclose(fd); + return NULL; + } + if(h > MAXIMUM_SIZE) + { + ADM_warning("Height %u exceeds maximum supported (%u)\n",h,MAXIMUM_SIZE); + fclose(fd); + return NULL; + } + bpp = bmph.biBitCount; + switch(bpp) + { + case 24: + case 32: + break; + default: + ADM_warning("Only 24 and 32 bpp bitmaps are supported.\n"); + fclose(fd); + return NULL; + } + + if(bpp == 32) + { + if(bmph.biCompression == 3) + { // read channel masks, FIXME: BGR is assumed + reader.read32LE(); // red + reader.read32LE(); // green + uint32_t bmask=reader.read32LE(); // blue + uint32_t amask=reader.read32LE(); // alpha + if((!amask && bmask == 0xff00) || amask == 0xff) + bpp=96; // xBGR + } + bufSize=w*h*4; + }else // 24 + { + bufSize=w*h*3; + } + ADM_info("[imageLoader] BMP2 W: %" PRIu32" H: %" PRIu32" offset : %" PRIu32"\n", w, h, offset); // Load the binary coded image fseek(fd,offset,SEEK_SET); - ADM_byteBuffer buffer(w*h*4); + ADM_byteBuffer buffer(bufSize); - fread(buffer.at(0),w*h*4,1,fd); + uint32_t count=fread(buffer.at(0),bufSize,1,fd); fclose(fd); + if(!count) + { + ADM_warning("Read incomplete.\n"); + return NULL; + } + + // Decode DIB + decoders *dec=ADM_coreCodecGetDecoder (fourCC::get((uint8_t *)"DIB "), w, h, 0, NULL, bpp); + if(!dec) + { + ADM_warning("Cannot get DIB decoder"); + return NULL; + } - // Colorconversion + ADMCompressedImage bin; + bin.data=buffer.at(0); + bin.dataLength=bufSize; - - ADMImageRefWrittable ref(w,h); - - ref._planes[0]=buffer.at(0)+(h-1)*w*3; - ref._planeStride[0]=-w*3; - ref._colorspace=ADM_COLOR_RGB24; + ADMImageRef ref(w,h); - return convertImageColorSpace(&ref,w,h); + if(!dec->uncompress(&bin,&ref)) + { + ADM_warning("DIB decoding failed\n"); + delete dec; + dec=NULL; + return NULL; + } + + ADMImage *image=convertImageColorSpace(&ref,w,h); + delete dec; + dec=NULL; + return image; } /** * \fn ADM_identidyImageFile @@ -452,7 +521,6 @@ { uint8_t fcc_tab[4]; FILE *fd; - uint32_t off,tag=0,count,size; // 1- identity the file type // @@ -463,7 +531,12 @@ ADM_info("[imageIdentify] Cannot open that file!\n"); return ADM_PICTURE_UNKNOWN; } - fread(fcc_tab, 4, 1, fd); + if (!fread(fcc_tab, 4, 1, fd)) + { + ADM_warning("Cannot read image file.\n"); + fclose(fd); + return ADM_PICTURE_UNKNOWN; + } // 2- JPEG ? if (fcc_tab[0] == 0xff && fcc_tab[1] == 0xd8)
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_coreUtils/src/avidemutils.cpp -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_coreUtils/src/avidemutils.cpp
Changed
@@ -510,6 +510,8 @@ break; } threshold<<=1; + if(i==1) + tolerance<<=3; // 8 MiB starting with 1 GiB fragment size } if(!success) return false;
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_codecSearch.cpp -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_codecSearch.cpp
Changed
@@ -124,7 +124,10 @@ if ((fcc == 0) || fourCC::check (fcc, (uint8_t *) "DIB ")) { // RGB 16 Codecs - printf ("\n using DIB codec (%d bpp)\n",(int)bpp); + if(bpp!=96) + printf ("\n using DIB codec (%d bpp%s)\n",(int)bpp,(bpp==32)? " BGRx" : ""); + else + printf ("\n using DIB codec (%d bpp xBGR)\n",32); return (decoders *) (new decoderRGB16 (w,h,fcc,extraLen,extraData,bpp)); //0 }
View file
avidemux_2.7.2.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_rgb16.cpp -> avidemux_2.7.3.tar.gz/avidemux_core/ADM_coreVideoCodec/src/ADM_rgb16.cpp
Changed
@@ -26,7 +26,7 @@ : decoders ( w, h, fcc, extraDataLen, extraData, bpp) { _bpp = bpp; - bytePerPixel=_bpp>>3; + bytePerPixel=(_bpp & 0x3f)>>3; decoded = new uint8_t[2*bytePerPixel * w * h]; } /** @@ -56,7 +56,8 @@ colorspace = ADM_COLOR_RGB555; break; case 24: - case 32: + case 32: // BGRx + case 96: // fake bpp indicating xBGR colorspace = ADM_COLOR_BGR24; break; default: @@ -66,7 +67,7 @@ // Pack... // Invert scanline src = in->data+lineSize*(_h-1); - if (_bpp == 32) // 32 -> 24 + if (_bpp == 32 || _bpp == 96) // 32 -> 24 { outBytePerPixel=3; destStride=outBytePerPixel*_w; @@ -77,11 +78,19 @@ for(j = 0; j < _w; j++) // 32 32 32 32 { - ptr[0] = buf[1]; // remove alpha channel + reorder. IT would be more efficient to do it in colorspace... + if(_bpp == 32) + { + ptr[0] = buf[0]; // remove alpha channel + reorder. IT would be more efficient to do it in colorspace... + ptr[1] = buf[1]; + ptr[2] = buf[2]; + }else // xBGR + { + ptr[0] = buf[1]; ptr[1] = buf[2]; ptr[2] = buf[3]; - ptr += 3; - buf += 4; + } + ptr += 3; + buf += 4; } src -= lineSize; dst += _w * 3;
View file
avidemux_2.7.3.tar.gz/avidemux_core/ffmpeg_package/patches/upstream
Added
+(directory)
View file
avidemux_2.7.3.tar.gz/avidemux_core/ffmpeg_package/patches/upstream/0001-avutil-mem-gcc9.patch
Added
@@ -0,0 +1,30 @@ +From 4361293fcf59edb56879c36edcd25f0a91e0edf8 Mon Sep 17 00:00:00 2001 +From: Mark Harris <mark.hsj@gmail.com> +Date: Sat, 24 Nov 2018 13:02:02 -0800 +Subject: [PATCH] avutil/mem: Fix invalid use of av_alloc_size + +The alloc_size attribute is valid only on functions that return a +pointer. GCC 9 (not yet released) warns about invalid usage: + +./libavutil/mem.h:342:1: warning: 'alloc_size' attribute ignored on a function returning int' [-Wattributes] + 342 | av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + | ^~~~~~~~~~~~~ + +Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> +--- + libavutil/mem.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavutil/mem.h b/libavutil/mem.h +index 55ae573ac9a..5fb1a02dd9c 100644 +--- a/libavutil/mem.h ++++ b/libavutil/mem.h +@@ -339,7 +339,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size) + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. + */ +-av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); ++int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + + /** + * Reallocate the given buffer if it is not large enough, otherwise do nothing.
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_audioDecoders/ADM_ad_lav/ADM_ad_lav.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_audioDecoders/ADM_ad_lav/ADM_ad_lav.cpp
Changed
@@ -259,7 +259,7 @@ _blockalign=378; } } - ADM_info("[ADM_ad_lav] init successful (blockalign %d), channels=%d\n",info->blockalign,_context->channels); + ADM_info("[ADM_ad_lav] init successful (blockalign %d), channels=%d\n",_blockalign,_context->channels); if(_context->sample_rate!=outputFrequency) { ADM_warning("Output frequency does not match input frequency (SBR ?) : %d / %d\n", @@ -424,49 +424,54 @@ \fn run */ - -#define CHECK_CONTENT(n) - uint8_t ADM_AudiocoderLavcodec::run(uint8_t *inptr, uint32_t nbIn, float *outptr, uint32_t *nbOut) { + *nbOut=0; + // Shrink + if(_head && (_tail+nbIn)*3>ADMWA_BUF*2) + { + memmove(_buffer,_buffer+_head,_tail-_head); + _tail-=_head; + _head=0; + } + // + ADM_assert(nbIn+_tail<ADMWA_BUF); + memcpy(_buffer+_tail,inptr,nbIn); + _tail+=nbIn; + + AVPacket pkt; + av_init_packet(&pkt); + int nbChunk,res=0; + while(_tail-_head>=_blockalign) + { + nbChunk=(_tail-_head)/_blockalign; + pkt.size=nbChunk*_blockalign; + pkt.data=_buffer+_head; - *nbOut=0; - // Shrink - if(_head && (_tail+nbIn)*3>ADMWA_BUF*2) - { - memmove(_buffer,_buffer+_head,_tail-_head); - _tail-=_head; - _head=0; - } - // - ADM_assert(nbIn+_tail<ADMWA_BUF); - memcpy(_buffer+_tail,inptr,nbIn); - _tail+=nbIn; - - AVPacket pkt; - av_init_packet(&pkt); - int nbChunk,out,gotData; - while(_tail-_head>=_blockalign) + avcodec_send_packet(_context, &pkt); + // Regardless of the outcome, always consume the data. + _head+=nbChunk*_blockalign; + + while(!res) { - nbChunk=(_tail-_head)/_blockalign; - pkt.size=nbChunk*_blockalign; - pkt.data=_buffer+_head; - - out=avcodec_decode_audio4(_context, _frame, &gotData, &pkt); - if(out<0) + res=avcodec_receive_frame(_context, _frame); + if(res==AVERROR(EAGAIN)) break; // we need to send more input + if(res==AVERROR_EOF) + { + return 1; + } + if(res<0) { - ADM_warning( "[ADM_ad_lav] *** decoding error (%u)***\n",_blockalign); - _head+=1; // Try skipping some bytes - continue; + char er[2048]={0}; + av_make_error_string(er, sizeof(er)-1, res); + ADM_warning("[ADM_ad_lav] decoding error: %s\n",er); + return 1; } - _head+=out; // consumed bytes - if(!gotData) - continue; + bool invalid=false; int toCheck=1; if(_context->sample_fmt==AV_SAMPLE_FMT_FLTP || _context->sample_fmt==AV_SAMPLE_FMT_S32P) toCheck=channels; - for(int i=0;i<toCheck;i++) { @@ -477,20 +482,20 @@ } } if(invalid) - continue; + break; switch(_context->sample_fmt) { - case AV_SAMPLE_FMT_FLT: decodeToFloat(&outptr,nbOut);break; - case AV_SAMPLE_FMT_FLTP: decodeToFloatPlanar(&outptr,nbOut);break; - case AV_SAMPLE_FMT_S32P: decodeToS32Planar(&outptr,nbOut);break; - case AV_SAMPLE_FMT_S32: decodeToS32(&outptr,nbOut);break; - - default: - ADM_info("Decoder created using ??? %d...\n",_context->sample_fmt); - ADM_assert(0); - break; + case AV_SAMPLE_FMT_FLT: decodeToFloat(&outptr,nbOut);break; + case AV_SAMPLE_FMT_FLTP: decodeToFloatPlanar(&outptr,nbOut);break; + case AV_SAMPLE_FMT_S32P: decodeToS32Planar(&outptr,nbOut);break; + case AV_SAMPLE_FMT_S32: decodeToS32(&outptr,nbOut);break; + default: + ADM_info("Decoder created using ??? %d...\n",_context->sample_fmt); + ADM_assert(0); + break; } } + } if(!sbrChecked) {
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp
Changed
@@ -234,15 +234,15 @@ bool AUDMEncoder_Lavcodec::lastBlock(AVPacket *pkt,int &encoded) { int gotPacket; - int nbout=avcodec_encode_audio2(CONTEXT, pkt,NULL,&gotPacket); - if(nbout<0) - { - printError("Encoding lastBlock",nbout); - return false; - } - if(gotPacket) - encoded=pkt->size; - return true; + int er=avcodec_encode_audio2(CONTEXT, pkt,NULL,&gotPacket); + if(er<0) + { + printError("Encoding lastBlock",er); + return false; + } + if(gotPacket) + encoded=pkt->size; + return true; } /** @@ -297,17 +297,17 @@ printError("Fill audio",er); return false; } - - int nbout = avcodec_encode_audio2(CONTEXT, &pkt,_frame,&gotPacket); - if(nbout>=0 && gotPacket) + + er = avcodec_encode_audio2(CONTEXT, &pkt,_frame,&gotPacket); + if(er<0) { - cprintf("Got %d bytes \n",pkt.size); - encoded=pkt.size; + printError("Encoding",er); + return false; } - else + if(gotPacket) { - printError("Encoding",nbout); - return false; + cprintf("Got %d bytes \n",pkt.size); + encoded=pkt.size; } return true; } @@ -437,7 +437,6 @@ */ bool AUDMEncoder_Lavcodec::encode(uint8_t *dest, uint32_t *len, uint32_t *samples) { - uint32_t nbout; int retries=16; bool r; int sz; @@ -471,17 +470,17 @@ { if(false==encodeBlock(0,dest,sz)) { - ADM_warning("Error while flushing lame\n"); + ADM_warning("Error flushing encoder\n"); return false; } *len=sz; *samples=_chunk/channels; - ADM_info("[Lav] Flushing, last block is %d bytes\n",nbout); + ADM_info("[Lav] Flushing, last block is %d bytes\n",sz); return true; }else { } - ADM_info("[Lav] No data to flush\n",nbout); + ADM_info("[Lav] No data to flush\n"); return true; } } @@ -507,7 +506,6 @@ */ bool configure (CONFcouple **setup) { - int ret=0; lav_encoder config=defaultConfig; if(*setup) {
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Asf/ADM_asfPacket.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Asf/ADM_asfPacket.cpp
Changed
@@ -138,7 +138,11 @@ uint32_t paddingLen; int lengthTypeFlags,propertyFlags,multiplePayloadPresent; int sequenceType,sequence,offsetLenType,replicaLenType,streamNumberLenType,mediaObjectNumberLenType; - + int mediaObjectNumber, offset,replica,r; + int32_t remaining; + uint32_t payloadLen=0; + uint32_t keyframe; + packetStart=ftello(_fd); @@ -202,11 +206,7 @@ packetLen=packetLen-paddingLen; } #endif - int mediaObjectNumber, offset,replica,r; - int32_t remaining; - uint32_t payloadLen; - uint32_t keyframe; - // Multi payload + // Multi payload if(multiplePayloadPresent) { uint8_t r=read8();
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkv.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkv.cpp
Changed
@@ -74,10 +74,8 @@ { ADM_ebml_file ebml; - uint64_t id,len; + uint64_t len; uint64_t alen; - ADM_MKV_TYPE type; - const char *ss; _timeBase=1000; // default value is 1 ms timebase (unit is in us) _isvideopresent=0; @@ -210,7 +208,7 @@ int bumped=0; for(int i=1;i<last;i++) { - uint64_t pts,dts; + uint64_t pts; pts=vid->index[i].Pts; lastDts+=increment; // This frame dts with no correction if(pts==ADM_NO_PTS) @@ -457,8 +455,6 @@ double dHalf=(500000.*(double)num)/((double)den); int half=dHalf-1; // half interval in us int first=0; - int bad=0; - int good=0; while( track->index[first].Pts==ADM_NO_PTS && first<nb) first++; // we should have some at least uint64_t zero= track->index[first].Pts; ADM_info("Num=%d Den=%d half=%d zero=%d first=%d\n",num,den,half,(int)zero,first); @@ -1086,6 +1082,7 @@ * @param hd * @return */ +#if 0 static int xypheLacingRead(uint8_t **hd) { int x=0; @@ -1100,6 +1097,7 @@ *hd=p; return x; } +#endif /** \fn mkreformatVorbisHeader \brief reformat oggvorbis header to avidemux style
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvEntries.cpp
Changed
@@ -245,8 +245,7 @@ //***************** Audio tracks ***************** if(entry.trackType==2 && _nbAudioTrack<ADM_MKV_MAX_TRACKS) { - uint32_t streamIndex; - mkvTrak *t=&(_tracks[1+_nbAudioTrack]); + mkvTrak *t=&(_tracks[1+_nbAudioTrack]); t->extraDataLen=entry.extraDataLen; ADM_info("This track has %d bytes of extradata\n",t->extraDataLen); // MS/ACM : ACMX
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvIndexer.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Matroska/ADM_mkvIndexer.cpp
Changed
@@ -38,9 +38,7 @@ */ uint8_t mkvHeader::videoIndexer(ADM_ebml_file *parser) { - uint64_t fileSize,len,bsize; - uint32_t alen,vlen; - uint64_t id; + uint64_t len,id; ADM_MKV_TYPE type; const char *ss; @@ -139,7 +137,7 @@ */ uint8_t mkvHeader::indexBlock(ADM_ebml_file *parser,uint32_t len,uint32_t clusterTimeCodeMs) { - int lacing,nbLaces,entryFlags=0; + int entryFlags=0; // uint64_t tail=parser->tell()+len; // Read Track id @@ -158,7 +156,7 @@ //if(!track) printf("TC: %d\n",timecode); uint8_t flags=parser->readu8(); - lacing=((flags>>1)&3); + //int lacing=((flags>>1)&3); addIndexEntry(track,parser,blockBegin,tail-blockBegin,entryFlags,clusterTimeCodeMs+timecode); parser->seek(tail); @@ -238,7 +236,7 @@ parser->readBin(readBuffer+rpt,size-3); // Search the frame type... - uint32_t nb,vopType,timeinc=16; + uint32_t nb,timeinc=16; ADM_vopS vops[10]; vops[0].type=AVI_KEY_FRAME; ADM_searchVop(readBuffer,readBuffer+rpt+size-3,&nb,vops, &timeinc); @@ -285,7 +283,6 @@ parser->readBin(readBuffer+rpt,size-3); uint8_t *begin=readBuffer; uint8_t *end=readBuffer+size-3+rpt; - uint32_t flags=0; while(begin<end) { int code=mkvFindStartCode(begin,end); @@ -450,12 +447,11 @@ */ uint8_t mkvHeader::indexClusters(ADM_ebml_file *parser) { - uint64_t fileSize,len,bsize; + uint64_t fileSize,len; uint64_t alen,vlen; uint64_t id; ADM_MKV_TYPE type; const char *ss; - uint64_t time; uint64_t pos; uint8_t res=1;
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4.cpp
Changed
@@ -305,7 +305,6 @@ uint8_t MP4Header::getExtraHeaderData(uint32_t *len, uint8_t **data) { -uint32_t old; *len=0;*data=NULL; if(_tracks[0].extraDataSize) {
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4.h -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4.h
Changed
@@ -193,9 +193,9 @@ int lookupIndex(int desc) ; bool parseTrun(int trackNo,adm_atom &son,const mp4TrafInfo &info); uint8_t decodeVideoAtom(void *ztom); - uint8_t parseMdia(void *ztom,uint32_t *trackType,uint32_t w, uint32_t h); + uint8_t parseMdia(void *ztom,uint32_t *trackType); uint8_t parseEdts(void *ztom,uint32_t trackType); - uint8_t parseStbl(void *ztom,uint32_t trackType,uint32_t w,uint32_t h,uint32_t trackScale); + uint8_t parseStbl(void *ztom,uint32_t trackType,uint32_t trackScale); uint8_t decodeEsds(void *ztom,uint32_t trackType); uint8_t updateCtts(MPsampleinfo *info ); bool refineFps(void);
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4Analyzer.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4Analyzer.cpp
Changed
@@ -90,89 +90,86 @@ \fn LookupMainAtoms \brief Search main atoms to ease job for other part */ -uint8_t MP4Header::lookupMainAtoms(void *ztom) +uint8_t MP4Header::lookupMainAtoms(void *ztom) { + adm_atom *tom=(adm_atom *)ztom; + adm_atom *moov,*moof=NULL; + bool success=true; + ADMAtoms id; + uint32_t container; + + ADM_info("Analyzing file and atoms\n"); - adm_atom *tom=(adm_atom *)ztom; - adm_atom *moov,*moof=NULL; - bool success=true; - ADMAtoms id; - uint32_t container; - ADM_info("Analyzing file and atoms\n"); - - if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOV,&moov)) - { - ADM_warning("Cannot locate moov atom\n"); - return 0; - } - ADM_assert(moov); - while(!moov->isDone()) - { - adm_atom son(moov); - if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) + if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOV,&moov)) { - aprintf("[Lookup]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); + ADM_warning("Cannot locate moov atom\n"); + return 0; } - else + ADM_assert(moov); + while(!moov->isDone()) { - switch( id) - { - case ADM_MP4_MVHD: parseMvhd(&son);break; - case ADM_MP4_TRACK: - if(!parseTrack(&son)) + adm_atom son(moov); + if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) + { + aprintf("[Lookup]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); + }else + { + switch(id) { - ADM_info("Parse Track failed\n"); - success=false; - } ; - break; - default : - aprintf("atom %s not handled\n",fourCC::tostringBE(son.getFCC())); - break; - } - - + case ADM_MP4_MVHD: parseMvhd(&son);break; + case ADM_MP4_TRACK: + if(!parseTrack(&son)) + { + ADM_info("Parse Track failed\n"); + success=false; + } + break; + default: + aprintf("atom %s not handled\n",fourCC::tostringBE(son.getFCC())); + break; + } + } + son.skipAtom(); } - son.skipAtom(); - } - delete moov; - if(!success) - { - if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof)) + delete moov; + if(!success) { - ADM_info("Cannot find all needed atoms\n"); - }else - { - ADM_info("It is a Dash/fragmented file\n"); - _flavor=Mp4Dash; - int moofFound=1; - while(1) - { - parseMoof(*moof); - delete moof; - moof=NULL; - if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof)) - { - break; - } - moofFound++; - } - ADM_info("Found %d fragments\n",moofFound); - } - } - - ADM_info("Done finding main atoms\n"); - return success; + if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof)) + { + ADM_info("Cannot find all needed atoms\n"); + }else + { + ADM_info("It is a Dash/fragmented file\n"); + _flavor=Mp4Dash; + int moofFound=1; + while(1) + { + parseMoof(*moof); + delete moof; + moof=NULL; + if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof)) + { + break; + } + moofFound++; + } + ADM_info("Found %d fragments\n",moofFound); + } + } + + ADM_info("Done finding main atoms\n"); + return success; } /** - \fn parseMvhd - \brief Parse mvhd header + \fn parseMvhd + \brief Parse mvhd header */ void MP4Header::parseMvhd(void *ztom) { adm_atom *tom = (adm_atom*)ztom; int version = tom->read(); - tom->skipBytes(3); // flags + tom->skipBytes(3); // flags if (version == 1) tom->skipBytes(16); @@ -206,128 +203,131 @@ */ uint8_t MP4Header::parseTrack(void *ztom) { - adm_atom *tom=(adm_atom *)ztom; - ADMAtoms id; - uint32_t container; - uint32_t w,h; - uint32_t trackType=TRACK_OTHER; - _currentDelay=0; - _currentStartOffset=0; - ADM_info("Parsing Track\n"); - while(!tom->isDone()) - { - adm_atom son(tom); - if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) - { - aprintf("[Track]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); - son.skipAtom(); - continue; - } - aprintf("\tProcessing atom %s \n",fourCC::tostringBE(son.getFCC())); - switch(id) - { - case ADM_MP4_TKHD: - { - int version = son.read(); - - son.skipBytes(3); - - if (version == 1) - tom->skipBytes(16); - else - tom->skipBytes(8); - - aprintf("Track Id: %" PRIu32"\n", son.read32()); - son.skipBytes(4); - - uint64_t duration = (version == 1) ? son.read64() : son.read32(); - - aprintf( "Duration: %" PRIu32" (ms)\n", (duration * 1000) / _videoScale); - son.skipBytes(8); - son.skipBytes(8); - son.skipBytes(36); - - w = son.read32() >> 16; - h = son.read32() >> 16; - - aprintf("tkhd: %ld %ld\n", w, h); - break; - } - case ADM_MP4_MDIA: + adm_atom *tom=(adm_atom *)ztom; + ADMAtoms id; + uint32_t container; + uint32_t w,h; + uint32_t trackType=TRACK_OTHER; + _currentDelay=0; + _currentStartOffset=0; + + ADM_info("Parsing Track\n"); + while(!tom->isDone()) + { + adm_atom son(tom); + if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) { - if(!parseMdia(&son,&trackType,w,h)) - return false; - break; + aprintf("[Track]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); + son.skipAtom(); + continue; } - case ADM_MP4_EDTS: + aprintf("\tProcessing atom %s \n",fourCC::tostringBE(son.getFCC())); + switch(id) { - ADM_info("EDTS atom found\n"); - parseEdts(&son,trackType); - break; + case ADM_MP4_TKHD: + { + int version = son.read(); + + son.skipBytes(3); + + if(version == 1) + tom->skipBytes(16); + else + tom->skipBytes(8); + + aprintf("Track Id: %" PRIu32"\n", son.read32()); + son.skipBytes(4); + + uint64_t duration = (version == 1) ? son.read64() : son.read32(); + + aprintf( "Duration: %" PRIu32" (ms)\n", (duration * 1000) / _videoScale); + son.skipBytes(8); + son.skipBytes(8); + son.skipBytes(36); + + w = son.read32() >> 16; + h = son.read32() >> 16; + + aprintf("tkhd: %ld %ld\n", w, h); + break; + } + case ADM_MP4_MDIA: + { + if(!parseMdia(&son,&trackType)) + return false; + break; + } + case ADM_MP4_EDTS: + { + ADM_info("EDTS atom found\n"); + parseEdts(&son,trackType); + break; + } + default: + ADM_info("Unprocessed atom :%s\n",fourCC::tostringBE(son.getFCC())); } - default: - ADM_info("Unprocessed atom :%s\n",fourCC::tostringBE(son.getFCC())); - } - son.skipAtom(); - } - return 1; + son.skipAtom(); + } + return 1; } /** \fn parseMdia \brief Parse mdia header */ -uint8_t MP4Header::parseMdia(void *ztom,uint32_t *trackType,uint32_t w, uint32_t h) +uint8_t MP4Header::parseMdia(void *ztom,uint32_t *trackType) { - adm_atom *tom=(adm_atom *)ztom; - ADMAtoms id; - uint32_t container; - uint32_t trackScale=_videoScale; - uint64_t trackDuration; - *trackType=TRACK_OTHER; - uint8_t r=0; - ADM_info("<<Parsing Mdia>>\n"); - while(!tom->isDone()) - { - adm_atom son(tom); - if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) - { - aprintf("[MDIA]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); - son.skipAtom(); - continue; - } - switch(id) - { - case ADM_MP4_MDHD: - { - int version = son.read(); - - son.skipBytes(3); // flags - - if (version == 1) - son.skipBytes(16); - else - son.skipBytes(8); - - trackScale = son.read32(); - - aprintf( "MDHD, Trackscale in mdhd: %u\n", trackScale); - - if (!trackScale) - trackScale = 600; // default - - uint64_t duration = (version == 1) ? son.read64() : son.read32(); - - aprintf( "MDHD, duration in mdhd: %u (unscaled)\n", duration); - duration = (duration * 1000.) / trackScale; - aprintf( "MDHD, duration in mdhd: %u (scaled ms)\n", duration); - trackDuration = duration; -// printf("MDHD, Track duration: %s, trackScale: %u\n", ms2timedisplay((1000 * duration) / trackScale), trackScale); - - break; - } - case ADM_MP4_HDLR: - { - uint32_t type; + adm_atom *tom=(adm_atom *)ztom; + ADMAtoms id; + uint32_t container; + uint32_t trackScale=_videoScale; + uint64_t trackDuration=0; + *trackType=TRACK_OTHER; + uint8_t r=0; + + ADM_info("<<Parsing Mdia>>\n"); + + while(!tom->isDone()) + { + adm_atom son(tom); + if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) + { + aprintf("[MDIA]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); + son.skipAtom(); + continue; + } + switch(id) + { + case ADM_MP4_MDHD: + { + int version = son.read(); + + son.skipBytes(3); // flags + + if(version == 1) + son.skipBytes(16); + else + son.skipBytes(8); + + trackScale = son.read32(); + + aprintf( "MDHD, Trackscale in mdhd: %u\n", trackScale); + + if(!trackScale) + trackScale = 600; // default + + uint64_t duration = (version == 1) ? son.read64() : son.read32(); + + aprintf( "MDHD, duration in mdhd: %u (unscaled)\n", duration); + duration = (duration * 1000.) / trackScale; + aprintf( "MDHD, duration in mdhd: %u (scaled ms)\n", duration); + trackDuration = duration; + //printf("MDHD, Track duration: %s, trackScale: %u\n", ms2timedisplay((1000 * duration) / trackScale), trackScale); + + break; + } + case ADM_MP4_HDLR: + { + uint32_t type; son.read32(); son.read32(); @@ -335,11 +335,11 @@ printf("[HDLR]\n"); switch(type) { - default: - *trackType=TRACK_OTHER; - ADM_info("Found other type track\n"); - break; - case MKFCCR('v','i','d','e')://'vide': + default: + *trackType=TRACK_OTHER; + ADM_info("Found other type track\n"); + break; + case MKFCCR('v','i','d','e'): // 'vide' *trackType=TRACK_VIDEO; _tracks[0].delay=_currentDelay; _tracks[0].startOffset=_currentStartOffset; @@ -348,13 +348,13 @@ _videoScale=trackScale; _tracks[0].scale=_videoScale; break; - case MKFCCR('s','o','u','n'): //'soun': + case MKFCCR('s','o','u','n'): // 'soun' _tracks[1+nbAudioTrack].delay=_currentDelay; _tracks[1+nbAudioTrack].startOffset=_currentStartOffset; *trackType=TRACK_AUDIO; ADM_info("hdlr audio found \n "); break; - case MKFCCR('u','r','l',' ')://'url ': + case MKFCCR('u','r','l',' '): // 'url ' { int s; son.read32(); @@ -366,45 +366,42 @@ str[s]=0; ADM_info("Url : <%s>\n",str); delete [] str; - } - break; - + break; + } } break; - } - case ADM_MP4_MINF: - { - // We are only interested in stbl - - while(!son.isDone()) + } + case ADM_MP4_MINF: { - adm_atom grandson(&son); - if(!ADM_mp4SearchAtomName(grandson.getFCC(), &id,&container)) - { - aprintf("[MINF]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); - grandson.skipAtom(); - continue; - } - if(id==ADM_MP4_STBL) - { - if(! parseStbl(&grandson,*trackType, w, h,trackScale)) - { - ADM_info("STBL failed\n"); - return 0; - } - r=1; - } - grandson.skipAtom(); + // We are only interested in stbl + while(!son.isDone()) + { + adm_atom grandson(&son); + if(!ADM_mp4SearchAtomName(grandson.getFCC(), &id,&container)) + { + aprintf("[MINF]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); + grandson.skipAtom(); + continue; + } + if(id==ADM_MP4_STBL) + { + if(!parseStbl(&grandson,*trackType,trackScale)) + { + ADM_info("STBL failed\n"); + return 0; + } + r=1; + } + grandson.skipAtom(); + } + break; + } + default: + aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC())); } - } - break; - default: - aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC())); - } - - son.skipAtom(); - } - return r; + son.skipAtom(); + } + return r; } /** * \fn parseElst @@ -430,34 +427,33 @@ { if(1==version) { - editDuration[i]=(int64_t)tom->read64(); - mediaTime[i]=(int64_t)tom->read64(); + editDuration[i]=(int64_t)tom->read64(); + mediaTime[i]=(int64_t)tom->read64(); }else { - editDuration[i]=(int32_t)tom->read32(); - mediaTime[i]=(int32_t)tom->read32(); + editDuration[i]=(int32_t)tom->read32(); + mediaTime[i]=(int32_t)tom->read32(); } - playbackSpeed=tom->read32(); - ADM_info("Duration : %d, mediaTime:%d speed=%d \n",(int)editDuration[i],(int)mediaTime[i],(int)playbackSpeed); - } - + playbackSpeed=tom->read32(); + ADM_info("Duration : %d, mediaTime:%d speed=%d \n",(int)editDuration[i],(int)mediaTime[i],(int)playbackSpeed); + } + switch(nb) { - case 1: - if(mediaTime[0]>0) - { - adv=mediaTime[0]; - } - break; - case 2: - if(mediaTime[0]==-1) - { - dlay=editDuration[0]; - adv=mediaTime[1]; - } - break; - default: - break; + case 1: + if(mediaTime[0]>0) + { + adv=mediaTime[0]; + } + break; + case 2: + if(mediaTime[0]==-1) + { + dlay=editDuration[0]; + adv=mediaTime[1]; + } + break; + default:break; } ADM_info("delay = %" PRId64" in movie scale units, skip to time %" PRId64" in track scale units.\n",dlay,adv); @@ -473,83 +469,76 @@ */ uint8_t MP4Header::parseEdts(void *ztom,uint32_t trackType) { - adm_atom *tom=(adm_atom *)ztom; - ADMAtoms id; - uint32_t container; - - ADM_info("Parsing Edts, trackType=%d\n",trackType); - while(!tom->isDone()) - { - adm_atom son(tom); - if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) - { - aprintf("[EDTS]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); - son.skipAtom(); - continue; - } - switch(id) + adm_atom *tom=(adm_atom *)ztom; + ADMAtoms id; + uint32_t container; + + ADM_info("Parsing Edts, trackType=%d\n",trackType); + while(!tom->isDone()) { - case ADM_MP4_ELST: - { - ADM_info("ELST atom found\n"); - parseElst(&son,&_currentDelay,&_currentStartOffset); - son.skipAtom(); - break; - - } - break; - default: - aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC())); - } - } - - tom->skipAtom(); - return true; + adm_atom son(tom); + if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) + { + aprintf("[EDTS]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); + son.skipAtom(); + continue; + } + switch(id) + { + case ADM_MP4_ELST: + { + ADM_info("ELST atom found\n"); + parseElst(&son,&_currentDelay,&_currentStartOffset); + son.skipAtom(); + break; + } + default: + aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC())); + } + } + + tom->skipAtom(); + return 1; } /** \fn parseStbl \brief parse sample table. this is the most important function. */ -uint8_t MP4Header::parseStbl(void *ztom,uint32_t trackType,uint32_t w,uint32_t h,uint32_t trackScale) +uint8_t MP4Header::parseStbl(void *ztom,uint32_t trackType,uint32_t trackScale) { - adm_atom *tom=(adm_atom *)ztom; - ADMAtoms id; - uint32_t container; - MPsampleinfo info; - - - memset(&info,0,sizeof(info)); - - - ADM_info("<<Parsing Stbl>>\n"); - while(!tom->isDone()) - { - adm_atom son(tom); - if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) - { - aprintf("[STBL]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); - son.skipAtom(); - continue; - } - switch(id) - { - case ADM_MP4_STSS: // Sync sample atom (i.e. keyframes) - { - son.read32(); - info.nbSync=son.read32(); - ADM_info("Stss:%u\n",info.nbSync); - if(info.nbSync) - { - info.Sync=new uint32_t[info.nbSync]; - for(int i=0;i<info.nbSync;i++) - { - info.Sync[i]=son.read32(); - } - } - break; - - } - case ADM_MP4_STTS: + adm_atom *tom=(adm_atom *)ztom; + ADMAtoms id; + uint32_t container; + MPsampleinfo info; + + ADM_info("<<Parsing Stbl>>\n"); + while(!tom->isDone()) + { + adm_atom son(tom); + if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container)) + { + aprintf("[STBL]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC())); + son.skipAtom(); + continue; + } + switch(id) + { + case ADM_MP4_STSS: // Sync sample atom (i.e. keyframes) + { + son.read32(); + info.nbSync=son.read32(); + ADM_info("Stss:%u\n",info.nbSync); + if(info.nbSync) + { + info.Sync=new uint32_t[info.nbSync]; + for(int i=0;i<info.nbSync;i++) + { + info.Sync[i]=son.read32(); + } + } + break; + } + case ADM_MP4_STTS: { ADM_info("stts:%" PRIu32"\n",son.read32()); // version & flags info.nbStts=son.read32(); @@ -560,16 +549,15 @@ //double dur; for(int i=0;i<info.nbStts;i++) { - - info.SttsN[i]=son.read32(); - info.SttsC[i]=son.read32(); - aprintf("stts: count:%u size:%u (unscaled)\n",info.SttsN[i],info.SttsC[i]); - //dur*=1000.*1000.;; // us - //dur/=myScale; + info.SttsN[i]=son.read32(); + info.SttsC[i]=son.read32(); + aprintf("stts: count:%u size:%u (unscaled)\n",info.SttsN[i],info.SttsC[i]); + //dur*=1000.*1000.;; // us + //dur/=myScale; } + break; } - break; - case ADM_MP4_STSC: + case ADM_MP4_STSC: { son.read32(); info.nbSc=son.read32(); @@ -577,51 +565,48 @@ info.Sn=new uint32_t[info.nbSc]; for(int j=0;j<info.nbSc;j++) { - - info.Sc[j]=son.read32(); - info.Sn[j]=son.read32(); - son.read32(); - aprintf("\t sc %d : sc start:%u sc count: %u\n",j,info.Sc[j],info.Sn[j]); + info.Sc[j]=son.read32(); + info.Sn[j]=son.read32(); + son.read32(); + aprintf("\t sc %d : sc start:%u sc count: %u\n",j,info.Sc[j],info.Sn[j]); } - + break; } - break; - case ADM_MP4_STSZ: - { - uint32_t n; - son.read32(); - n=son.read32(); - info.nbSz=son.read32(); - info.SzIndentical=0; - ADM_info("%" PRIu32" frames /%" PRIu32" nbsz..\n",n,info.nbSz); - if(n) - { - aprintf("\t\t%" PRIu32" frames of the same size %" PRIu32" , n=%" PRIu32"\n", - info.nbSz,info.SzIndentical,n); - info.SzIndentical=n; - info.Sz=NULL; - } - else - { - info.Sz=new uint32_t[info.nbSz]; - for(int j=0;j<info.nbSz;j++) - { - info.Sz[j]=son.read32(); - } - } - } - break; - case ADM_MP4_CTTS: // Composition time to sample + case ADM_MP4_STSZ: + { + uint32_t n; + son.read32(); + n=son.read32(); + info.nbSz=son.read32(); + info.SzIndentical=0; + ADM_info("%" PRIu32" frames /%" PRIu32" nbsz..\n",n,info.nbSz); + if(n) + { + aprintf("\t\t%" PRIu32" frames of the same size %" PRIu32" , n=%" PRIu32"\n", + info.nbSz,info.SzIndentical,n); + info.SzIndentical=n; + info.Sz=NULL; + }else + { + info.Sz=new uint32_t[info.nbSz]; + for(int j=0;j<info.nbSz;j++) + { + info.Sz[j]=son.read32(); + } + } + break; + } + case ADM_MP4_CTTS: // Composition time to sample { - uint32_t n,i,j,k,v; + uint32_t n,i,k; - ADM_info("ctts:%" PRIu32"\n",son.read32()); // version & flags - n=son.read32(); - if(n==1) // all the same , ignore - { + ADM_info("ctts:%" PRIu32"\n",son.read32()); // version & flags + n=son.read32(); + if(n==1) // all the same , ignore + { break; - } - aprintf("Found %d ctts elements\n",n); + } + aprintf("Found %d ctts elements\n",n); uint32_t *values=new uint32_t [n]; uint32_t *count=new uint32_t [n]; for(i=0;i<n;i++) @@ -657,624 +642,630 @@ } ADM_assert(info.nbCtts<sum+1); ADM_info("Found %u elements\n",info.nbCtts); + break; } - break; - case ADM_MP4_STCO: - { - son.skipBytes(4); - - info.nbCo = son.read32(); - ADM_info("\t\tnbCo: %u\n", info.nbCo); - - info.Co = new uint64_t[info.nbCo]; - - for(int j = 0; j < info.nbCo; j++) - { - info.Co[j] = son.read32(); - aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]); - } - } - break; - case ADM_MP4_STCO64: - { - son.skipBytes(4); - - info.nbCo = son.read32(); - ADM_info("\t\tnbCo: %u\n", info.nbCo); - - info.Co = new uint64_t[info.nbCo]; - - for(int j = 0; j< info.nbCo; j++) - { - info.Co[j] = son.read64(); - aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]); - } - } - break; - case ADM_MP4_STSD: - { + case ADM_MP4_STCO: + { + son.skipBytes(4); + + info.nbCo = son.read32(); + ADM_info("\t\tnbCo: %u\n", info.nbCo); + + info.Co = new uint64_t[info.nbCo]; + + for(int j = 0; j < info.nbCo; j++) + { + info.Co[j] = son.read32(); + aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]); + } + break; + } + case ADM_MP4_STCO64: + { + son.skipBytes(4); + + info.nbCo = son.read32(); + ADM_info("\t\tnbCo: %u\n", info.nbCo); + + info.Co = new uint64_t[info.nbCo]; + + for(int j = 0; j< info.nbCo; j++) + { + info.Co[j] = son.read64(); + aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]); + } + break; + } + case ADM_MP4_STSD: + { son.read32(); // flags & version int nbEntries=son.read32(); int left; aprintf("[STSD]Found %d entries\n",nbEntries); for(int i=0;i<nbEntries;i++) { - int entrySize=son.read32(); - int entryName=son.read32(); - left=entrySize-8; - if(i || (trackType==TRACK_VIDEO && _videoFound) || (trackType==TRACK_OTHER)) - { - son.skipBytes(left); - ADM_info("[STSD] ignoring %s, size %u\n",fourCC::tostringBE(entryName),entrySize); - if(trackType==TRACK_OTHER) ADM_info("[STSD] because track=other\n"); - continue; - } - switch(trackType) - { - case TRACK_VIDEO: - { - uint32_t lw=0,lh=0; - ADM_info("[STSD] VIDEO %s, size %u\n",fourCC::tostringBE(entryName),entrySize); - son.skipBytes(8); // reserved etc.. - left-=8; - son.read32(); // version/revision - left-=4; - printf("[STSD] vendor %s\n",fourCC::tostringBE(son.read32())); - left-=4; - - son.skipBytes(8); // spatial qual etc.. - left-=8; - - printf("[STSD] width :%u\n",lw=son.read16()); - printf("[STSD] height :%u\n",lh=son.read16()); - left-=4; - - son.skipBytes(8); // Resolution - left-=8; - - printf("[STSD] datasize :%u\n",son.read32()); - left-=4; - - printf("[STSD] FrameCount :%u\n",son.read16()); - left-=4; - - // Codec name - uint32_t u32=son.read(); - if(u32>31) u32=31; - printf("Codec string :%d <",u32); - for(int i=0;i<u32;i++) printf("%c",son.read()); - printf(">\n"); - son.skipBytes(32-1-u32); - left-=32; - // - if(left>=4) - { - son.read32(); - left-=4; //Depth & color Id - }else left=0; - // - printf("LEFT:%d\n",left); + int entrySize=son.read32(); + int entryName=son.read32(); + left=entrySize-8; + if(i || (trackType==TRACK_VIDEO && _videoFound) || (trackType==TRACK_OTHER)) + { + son.skipBytes(left); + ADM_info("[STSD] ignoring %s, size %u\n",fourCC::tostringBE(entryName),entrySize); + if(trackType==TRACK_OTHER) ADM_info("[STSD] because track=other\n"); + continue; + } + switch(trackType) + { + case TRACK_VIDEO: + { + uint32_t lw=0,lh=0; + ADM_info("[STSD] VIDEO %s, size %u\n",fourCC::tostringBE(entryName),entrySize); + son.skipBytes(8); // reserved etc.. + left-=8; + son.read32(); // version/revision + left-=4; + printf("[STSD] vendor %s\n",fourCC::tostringBE(son.read32())); + left-=4; + + son.skipBytes(8); // spatial qual etc.. + left-=8; + + printf("[STSD] width :%u\n",lw=son.read16()); + printf("[STSD] height :%u\n",lh=son.read16()); + left-=4; + + son.skipBytes(8); // Resolution + left-=8; + + printf("[STSD] datasize :%u\n",son.read32()); + left-=4; + + printf("[STSD] FrameCount :%u\n",son.read16()); + left-=4; + + // Codec name + uint32_t u32=son.read(); + if(u32>31) u32=31; + printf("Codec string :%d <",u32); + for(int i=0;i<u32;i++) printf("%c",son.read()); + printf(">\n"); + son.skipBytes(32-1-u32); + left-=32; + + if(left>=4) + { + son.read32(); + left-=4; // Depth & color Id + }else left=0; + + printf("LEFT:%d\n",left); - if(left>8) + //if(left>8) + // decodeVideoAtom(&son); + + _video_bih.biWidth=_mainaviheader.dwWidth=lw ; + _video_bih.biHeight=_mainaviheader.dwHeight=lh; + _video_bih.biCompression=_videostream.fccHandler; + +#define commonPart(x) _videostream.fccHandler=_video_bih.biCompression=fourCC::get((uint8_t *)#x); + switch(entryName) + { + case MKFCCR('h','d','v','5'): // hdv5 { -// decodeVideoAtom(&son); + commonPart(MPEG); + adm_atom hdv5(&son); + printf("Reading hdv5, got %s\n",fourCC::tostringBE(hdv5.getFCC())); + left=0; + + break; } - // -#define commonPart(x) _videostream.fccHandler=_video_bih.biCompression=fourCC::get((uint8_t *)#x); + case MKFCCR('m','j','p','b'): //mjpegb + { + commonPart(MJPB); + left=0; - _video_bih.biWidth=_mainaviheader.dwWidth=lw ; - _video_bih.biHeight=_mainaviheader.dwHeight=lh; - _video_bih.biCompression=_videostream.fccHandler; + break; + } + case MKFCCR('S','V','Q','1'): //mjpegb + { + commonPart(SVQ1); + left=0; - // - switch(entryName) + break; + } + case MKFCCR('m','j','p','a'): //mjpegb { - case MKFCCR('h','d','v','5'): // hdv5 - { - commonPart(MPEG); - adm_atom hdv5(&son); - printf("Reading hdv5, got %s\n",fourCC::tostringBE(hdv5.getFCC())); - - left=0; - } + commonPart(MJPG); + left=0; + break; - case MKFCCR('m','j','p','b'): //mjpegb - { - commonPart(MJPB); - left=0; - } - break; - case MKFCCR('S','V','Q','1'): //mjpegb - { - commonPart(SVQ1); - left=0; - } - break; - - case MKFCCR('m','j','p','a'): //mjpegb - { - commonPart(MJPG); - left=0; - } - break; + } case MKFCCR('s','2','6','3'): //s263 d263 - { - commonPart(H263); - adm_atom d263(&son); - printf("Reading s253, got %s\n",fourCC::tostringBE(d263.getFCC())); - left=0; - } - break; - case MKFCCR('m','p','4','v'): //mp4v - { - commonPart(DIVX); - adm_atom esds(&son); - printf("Reading esds, got %s\n",fourCC::tostringBE(esds.getFCC())); - if(esds.getFCC()==MKFCCR('e','s','d','s')) - decodeEsds(&esds,TRACK_VIDEO); - left=0; - } - break; - case MKFCCR('S','V','Q','3'): - {//'SVQ3': + { + commonPart(H263); + adm_atom d263(&son); + printf("Reading s253, got %s\n",fourCC::tostringBE(d263.getFCC())); + left=0; + + break; + } + case MKFCCR('m','p','4','v'): //mp4v + { + commonPart(DIVX); + adm_atom esds(&son); + printf("Reading esds, got %s\n",fourCC::tostringBE(esds.getFCC())); + if(esds.getFCC()==MKFCCR('e','s','d','s')) + decodeEsds(&esds,TRACK_VIDEO); + left=0; + + break; + } + case MKFCCR('S','V','Q','3'): + { //'SVQ3': // For SVQ3, the codec needs it to begin by SVQ3 // We go back by 4 bytes to get the 4CC - printf("SVQ3 atom found\n"); - VDEO.extraDataSize=left+4; - VDEO.extraData=new uint8_t[ VDEO.extraDataSize ]; - if(!son.readPayload(VDEO.extraData+4,VDEO.extraDataSize-4 )) - { - GUI_Error_HIG(QT_TRANSLATE_NOOP("mp4demuxer","Problem reading SVQ3 headers"), NULL); - } - VDEO.extraData[0]='S'; - VDEO.extraData[1]='V'; - VDEO.extraData[2]='Q'; - VDEO.extraData[3]='3'; - printf("SVQ3 Header size : %" PRIu32"",_videoExtraLen); - commonPart(SVQ3); - left=0; - } - break; - case MKFCCR('d','v','c',' ') : //'dvc ': - case MKFCCR('d','v','c','p'): //'dvcp': - commonPart(DVSD); - break; - case MKFCCR('c','v','i','d'): //'cvid' - commonPart(cvid); - break; - case MKFCCR('h','2','6','3'): //'dv': - commonPart(H263); - break; - case MKFCCR('M','J','P','G'): //'jpeg': - case MKFCCR('j','p','e','g'): //'jpeg': - case MKFCCR('A','V','D','J'): //'jpeg': - commonPart(MJPG); - break; - case MKFCCR('A','V','d','n'): // DNxHD - commonPart(AVdn); - break; + printf("SVQ3 atom found\n"); + VDEO.extraDataSize=left+4; + VDEO.extraData=new uint8_t[ VDEO.extraDataSize ]; + if(!son.readPayload(VDEO.extraData+4,VDEO.extraDataSize-4 )) + { + GUI_Error_HIG(QT_TRANSLATE_NOOP("mp4demuxer","Problem reading SVQ3 headers"), NULL); + } + VDEO.extraData[0]='S'; + VDEO.extraData[1]='V'; + VDEO.extraData[2]='Q'; + VDEO.extraData[3]='3'; + printf("SVQ3 Header size : %" PRIu32"",_videoExtraLen); + commonPart(SVQ3); + left=0; + + break; + } + case MKFCCR('d','v','c',' '): // 'dvc ' + case MKFCCR('d','v','c','p'): // 'dvcp' + commonPart(DVSD); + break; + + case MKFCCR('c','v','i','d'): // 'cvid' + commonPart(cvid); + break; + + case MKFCCR('h','2','6','3'): // 'dv': + commonPart(H263); + break; + + case MKFCCR('M','J','P','G'): // 'jpeg' + case MKFCCR('j','p','e','g'): // 'jpeg' + case MKFCCR('A','V','D','J'): // 'jpeg' + commonPart(MJPG); + break; + + case MKFCCR('A','V','d','n'): // DNxHD + commonPart(AVdn); + break; // - case MKFCCR('h','e','v','1'): // hev1 / hevc - case MKFCCR('h','v','c','1'): // hev1 / hevc - { - commonPart(H265); - while(!son.isDone()) - { - adm_atom avcc(&son); - printf("Reading hev1, got %s\n",fourCC::tostringBE(avcc.getFCC())); - if( avcc.getFCC()== MKFCCR('h','v','c','C')) - { - VDEO.extraDataSize=avcc.getRemainingSize(); - ADM_info("Found %d bytes of extradata \n",VDEO.extraDataSize); - VDEO.extraData=new uint8_t [VDEO.extraDataSize]; - avcc.readPayload(VDEO.extraData,VDEO.extraDataSize); - mixDump(VDEO.extraData,VDEO.extraDataSize); - avcc.skipAtom(); - } - } // while - son.skipAtom(); - left=0; - } - break; + case MKFCCR('h','e','v','1'): // hev1 / hevc + case MKFCCR('h','v','c','1'): // hev1 / hevc + { + commonPart(H265); + while(!son.isDone()) + { + adm_atom avcc(&son); + printf("Reading hev1, got %s\n",fourCC::tostringBE(avcc.getFCC())); + if( avcc.getFCC()== MKFCCR('h','v','c','C')) + { + VDEO.extraDataSize=avcc.getRemainingSize(); + ADM_info("Found %d bytes of extradata \n",VDEO.extraDataSize); + VDEO.extraData=new uint8_t [VDEO.extraDataSize]; + avcc.readPayload(VDEO.extraData,VDEO.extraDataSize); + mixDump(VDEO.extraData,VDEO.extraDataSize); + avcc.skipAtom(); + } + } // while + son.skipAtom(); + left=0; + + break; + } // - case MKFCCR('a','v','c','1'): // avc1 - { - commonPart(H264); - // There is a avcC atom just after - // configuration data for h264 -nextAtom: - adm_atom avcc(&son); - printf("Reading avcC, got %s\n",fourCC::tostringBE(avcc.getFCC())); - switch(avcc.getFCC()) - { - case MKFCCR('a','v','c','C'): break; - default: - case MKFCCR('c','o','l','r'): // Color atom - case MKFCCR('p','a','s','p'): - case MKFCCR('c','l','a','p'): - avcc.skipAtom(); - goto nextAtom; - break; - } - int len,offset; - VDEO.extraDataSize=avcc.getRemainingSize(); - VDEO.extraData=new uint8_t [VDEO.extraDataSize]; - avcc.readPayload(VDEO.extraData,VDEO.extraDataSize); - printf("avcC size:%d\n",VDEO.extraDataSize); - // Dump some info - #define MKD8(x) VDEO.extraData[x] - #define MKD16(x) ((MKD8(x)<<8)+MKD8(x+1)) - #define MKD32(x) ((MKD16(x)<<16)+MKD16(x+2)) - - printf("avcC Revision :%x\n", MKD8(0)); - printf("avcC AVCProfileIndication :%x\n", MKD8(1)); - printf("avcC profile_compatibility:%x\n", MKD8(2)); - printf("avcC AVCLevelIndication :%x\n", MKD8(3)); - - printf("avcC lengthSizeMinusOne :%x\n", MKD8(4)); - printf("avcC NumSeq :%x\n", MKD8(5)); - len=MKD16(6); - printf("avcC sequenceParSetLen :%x ",len ); - offset=8; - mixDump(VDEO.extraData+offset,len); - - offset=8+len; - printf("avcC numOfPictureParSets :%x\n", MKD8(offset++)); - len=MKD16(offset); - offset++; - printf("avcC Pic len :%x\n",len); - mixDump(VDEO.extraData+offset,len); - left=0; - } - break; - default: - if(left>10) - { - adm_atom avcc(&son); - printf("Reading , got %s\n",fourCC::tostringBE(avcc.getFCC())); - left=0; - - } - break; - } // Entry name - } - break; - case TRACK_AUDIO: - { - uint32_t channels,bpp,encoding,fq,packSize; - - // Put some defaults - ADIO.encoding=1234; - ADIO.frequency=44100; - ADIO.byterate=128000>>3; - ADIO.channels=2; - ADIO.bitspersample=16; - - printf("[STSD] AUDIO <%s>, 0x%08x, size %u\n",fourCC::tostringBE(entryName),entryName,entrySize); - son.skipBytes(8); // reserved etc.. - left-=8; - - int atomVersion=son.read16(); // version - left-=2; - printf("[STSD]Revision :%d\n",atomVersion); - son.skipBytes(2); // revision - left-=2; - - printf("[STSD]Vendor : %s\n",fourCC::tostringBE(son.read32())); - left-=4; - - ADIO.channels=channels=son.read16(); // Channel - left-=2; - printf("[STSD]Channels :%d\n",ADIO.channels); - ADIO.bitspersample=bpp=son.read16(); // version/revision - left-=2; - printf("[STSD]Bit per sample :%d\n",bpp); - - encoding=son.read16(); // version/revision - left-=2; - printf("[STSD]Encoding :%d\n",encoding); - - packSize=son.read16(); // Packet Size - left-=2; - printf("[STSD]Packet size :%d\n",encoding); - - - fq=ADIO.frequency=son.read16(); - printf("[STSD]Fq:%u\n",fq); - if(ADIO.frequency<6000) ADIO.frequency=48000; - printf("[STSD]Fq :%d\n",ADIO.frequency); // Bps - son.skipBytes(2); // Fixed point - left-=4; - printf("Bytes left : %d\n",left); - info.samplePerPacket=1; - info.bytePerPacket=1; - info.bytePerFrame=1; - - switch(atomVersion) + case MKFCCR('a','v','c','1'): // avc1 { - case 0:break; - case 1 : - { - info.samplePerPacket=son.read32(); - info.bytePerPacket=son.read32(); - info.bytePerFrame=son.read32(); - #define ADM_NOT_NULL(x) if(!info.x) info.x=1; - printf("[STSD] Sample per packet %u\n",info.samplePerPacket); - printf("[STSD] Bytes per packet %u\n",info.bytePerPacket); - printf("[STSD] Bytes per frame %u\n",info.bytePerFrame); - printf("[STSD] Bytes per sample %u\n",son.read32()); - ADM_NOT_NULL(samplePerPacket); - ADM_NOT_NULL(bytePerPacket); - ADM_NOT_NULL(bytePerFrame); - - left-=16; + commonPart(H264); + // There is a avcC atom just after + // configuration data for h264 + while(!son.isDone()) + { + adm_atom avcc(&son); + printf("Reading avcC, got %s\n",fourCC::tostringBE(avcc.getFCC())); + if(avcc.getFCC()!=MKFCCR('a','v','c','C')) + { + avcc.skipAtom(); + continue; } + + int len,offset; + VDEO.extraDataSize=avcc.getRemainingSize(); + VDEO.extraData=new uint8_t [VDEO.extraDataSize]; + avcc.readPayload(VDEO.extraData,VDEO.extraDataSize); + printf("avcC size:%d\n",VDEO.extraDataSize); + // Dump some info +#define MKD8(x) VDEO.extraData[x] +#define MKD16(x) ((MKD8(x)<<8)+MKD8(x+1)) +#define MKD32(x) ((MKD16(x)<<16)+MKD16(x+2)) + + printf("avcC Revision :%x\n", MKD8(0)); + printf("avcC AVCProfileIndication :%x\n", MKD8(1)); + printf("avcC profile_compatibility:%x\n", MKD8(2)); + printf("avcC AVCLevelIndication :%x\n", MKD8(3)); + + printf("avcC lengthSizeMinusOne :%x\n", MKD8(4)); + printf("avcC NumSeq :%x\n", MKD8(5)); + len=MKD16(6); + printf("avcC sequenceParSetLen :%x ",len ); + offset=8; + mixDump(VDEO.extraData+offset,len); + + offset=8+len; + printf("avcC numOfPictureParSets :%x\n", MKD8(offset++)); + len=MKD16(offset); + offset++; + printf("avcC Pic len :%x\n",len); + mixDump(VDEO.extraData+offset,len); break; + } // while + son.skipAtom(); + left=0; + + break; + } // avc1 + default: + if(left>10) + { + adm_atom avcc(&son); + printf("Reading , got %s\n",fourCC::tostringBE(avcc.getFCC())); + left=0; + } + break; + } // entryName + + break; + } // trackType + + case TRACK_AUDIO: + { + uint32_t channels,bpp,encoding,fq,packSize; + + // Put some defaults + ADIO.encoding=1234; + ADIO.frequency=44100; + ADIO.byterate=128000>>3; + ADIO.channels=2; + ADIO.bitspersample=16; + + printf("[STSD] AUDIO <%s>, 0x%08x, size %u\n",fourCC::tostringBE(entryName),entryName,entrySize); + son.skipBytes(8); // reserved etc.. + left-=8; + + int atomVersion=son.read16(); // version + left-=2; + printf("[STSD]Revision :%d\n",atomVersion); + son.skipBytes(2); // Revision level + left-=2; + + printf("[STSD]Vendor : %s\n",fourCC::tostringBE(son.read32())); + left-=4; + + ADIO.channels=channels=son.read16(); // Number of channels + left-=2; + printf("[STSD]Channels :%d\n",ADIO.channels); + ADIO.bitspersample=bpp=son.read16(); // Sample Size + left-=2; + printf("[STSD]Bit per sample :%d\n",bpp); + + encoding=son.read16(); // Compression ID + left-=2; + printf("[STSD]Encoding :%d\n",encoding); + + packSize=son.read16(); // Packet Size + left-=2; + printf("[STSD]Packet size :%d\n",packSize); + + fq=ADIO.frequency=son.read16(); + printf("[STSD]Fq:%u\n",fq); + if(ADIO.frequency<6000) ADIO.frequency=48000; + printf("[STSD]Fq :%d\n",ADIO.frequency); // Sample rate + son.skipBytes(2); // Fixed point + left-=4; + printf("Bytes left : %d\n",left); + info.samplePerPacket=1; + info.bytePerPacket=1; + info.bytePerFrame=1; + + switch(atomVersion) + { + case 0:break; + case 1 : + { + info.samplePerPacket=son.read32(); + info.bytePerPacket=son.read32(); + info.bytePerFrame=son.read32(); +#define ADM_NOT_NULL(x) if(!info.x) info.x=1; + printf("[STSD] Sample per packet %u\n",info.samplePerPacket); + printf("[STSD] Bytes per packet %u\n",info.bytePerPacket); + printf("[STSD] Bytes per frame %u\n",info.bytePerFrame); + printf("[STSD] Bytes per sample %u\n",son.read32()); + ADM_NOT_NULL(samplePerPacket); + ADM_NOT_NULL(bytePerPacket); + ADM_NOT_NULL(bytePerFrame); + + left-=16; + + break; + } case 2: - { - printf("v2.0 = %d\n",son.read32()); - printf("v2.1 = %d\n",son.read32()); - printf("v2.2 = %d\n",son.read32()); + { + printf("v2.0 = %d\n",son.read32()); + printf("v2.1 = %d\n",son.read32()); + printf("v2.2 = %d\n",son.read32()); #define MARK(x) {uint32_t v=son.read32(); printf(#x " => %d\n",v);x=v;} - MARK(channels); - printf("0x7f000 = 0x%x\n",son.read32()); - MARK(bpp); - printf("LPCM flags= %d\n",son.read32()); - printf("byte per frame = %d\n",son.read32()); - printf("sample per frame = %d\n",son.read32()); - ADIO.channels=channels; - info.bytePerPacket=bpp/8; - info.bytePerFrame=info.bytePerPacket*ADIO.channels; - left-=4*9; - } - break; + MARK(channels); + printf("0x7f000 = 0x%x\n",son.read32()); + MARK(bpp); + printf("LPCM flags= %d\n",son.read32()); + printf("byte per frame = %d\n",son.read32()); + printf("sample per frame = %d\n",son.read32()); + ADIO.channels=channels; + info.bytePerPacket=bpp/8; + info.bytePerFrame=info.bytePerPacket*ADIO.channels; + left-=4*9; + + break; } - printf("[STSD] chan:%u bpp:%u encoding:%u fq:%u (left %u)\n",channels,bpp,encoding,fq,left); + } // atomVersion + printf("[STSD] chan:%u bpp:%u encoding:%u fq:%u (left %u)\n",channels,bpp,encoding,fq,left); #define audioCodec(x) ADIO.encoding=WAV_##x; - switch(entryName) + switch(entryName) + { + case MKFCCR('a','c','-','3'): + case MKFCCR('s','a','c','3'): + audioCodec(AC3); + ADIO.byterate=128000>>3; + + break; + case MKFCCR('l','p','c','m'): + ADIO.frequency=44100; // Wrong ! + ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8; + audioCodec(PCM); + + break; + case MKFCCR('t','w','o','s'): + audioCodec(LPCM); + ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8; + if(info.bytePerPacket<2) + { + info.bytePerPacket=2; + info.bytePerFrame=2*ADIO.channels; + ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket); + } + + break; + case MKFCCR('u','l','a','w'): + audioCodec(ULAW); + ADIO.byterate=ADIO.frequency; + info.bytePerFrame=ADIO.channels; + + break; + case MKFCCR('s','o','w','t'): + audioCodec(PCM); + ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8; + if(info.bytePerPacket<2) + { + info.bytePerPacket=2; + info.bytePerFrame=2*ADIO.channels; + ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket); + } + + break; + case MKFCCR('.','m','p','3'): //.mp3 + audioCodec(MP3); + ADIO.byterate=128000>>3; + + break; + case MKFCCR('r','a','w',' '): + audioCodec(8BITS_UNSIGNED); + ADIO.byterate=ADIO.frequency*ADIO.channels; + + break; + case MKFCCR('s','a','m','r'): { - case MKFCCR('a','c','-','3'): - case MKFCCR('s','a','c','3'): - audioCodec(AC3); - ADIO.byterate=128000>>3; - break; - case MKFCCR('l','p','c','m'): - ADIO.frequency=44100; // Wrong ! - ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8; - audioCodec(PCM); - break; - case MKFCCR('t','w','o','s'): - audioCodec(LPCM); - ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8; - if(info.bytePerPacket<2) - { - info.bytePerPacket=2; - info.bytePerFrame=2*ADIO.channels; - - ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket); - } - break; - - case MKFCCR('u','l','a','w'): - audioCodec(ULAW); - ADIO.byterate=ADIO.frequency; - info.bytePerFrame=ADIO.channels; - break; - case MKFCCR('s','o','w','t'): - audioCodec(PCM); - ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8; - if(info.bytePerPacket<2) - { - info.bytePerPacket=2; - info.bytePerFrame=2*ADIO.channels; - - ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket); - } - - break; - case MKFCCR('.','m','p','3'): //.mp3 - audioCodec(MP3); - ADIO.byterate=128000>>3; - break; - case MKFCCR('r','a','w',' '): - audioCodec(8BITS_UNSIGNED); - ADIO.byterate=ADIO.frequency*ADIO.channels; - break; - case MKFCCR('s','a','m','r'): + audioCodec(AMRNB); + ADIO.frequency=8000; + ADIO.channels=1; + ADIO.bitspersample=16; + ADIO.byterate=12000/8; + if(left>10) { - audioCodec(AMRNB); - ADIO.frequency=8000; - ADIO.channels=1; - ADIO.bitspersample=16; - ADIO.byterate=12000/8; - if(left>10) - { - adm_atom amr(&son); - printf("Reading wave, got %s\n",fourCC::tostringBE(amr.getFCC())); - left=0; - } + adm_atom amr(&son); + printf("Reading wave, got %s\n",fourCC::tostringBE(amr.getFCC())); + left=0; } - break; - case MKFCCR('Q','D','M','2'): - { - int64_t sz; - audioCodec(QDM2); - sz=son.getRemainingSize(); - _tracks[1+nbAudioTrack].extraDataSize=sz; - _tracks[1+nbAudioTrack].extraData=new uint8_t[sz]; - son.readPayload(_tracks[1+nbAudioTrack].extraData,sz); - left=0; - } - break; - case MKFCCR('m','s',0,0x55): // why 55 ??? - case MKFCCR('m','s',0,0x11): // why 11 ??? - case MKFCCR('m','p','4','a'): + + break; + } + case MKFCCR('Q','D','M','2'): + { + int64_t sz; + audioCodec(QDM2); + sz=son.getRemainingSize(); + _tracks[1+nbAudioTrack].extraDataSize=sz; + _tracks[1+nbAudioTrack].extraData=new uint8_t[sz]; + son.readPayload(_tracks[1+nbAudioTrack].extraData,sz); + left=0; + + break; + } + case MKFCCR('m','s',0,0x55): // why 55 ??? + case MKFCCR('m','s',0,0x11): // why 11 ??? + case MKFCCR('m','p','4','a'): + { + if(entryName==MKFCCR('m','s',0,0x11)) + audioCodec(MSADPCM) + else + audioCodec(AAC); + + if(left>10) { - if(entryName==MKFCCR('m','s',0,0x11)) - audioCodec(MSADPCM) - else - audioCodec(AAC); - if(left>10) + while(!son.isDone()) + { + adm_atom wave(&son); + printf("> got %s atom\n",fourCC::tostringBE(wave.getFCC())); + switch(wave.getFCC()) { - while(!son.isDone()) - { - adm_atom wave(&son); - printf("> got %s atom\n",fourCC::tostringBE(wave.getFCC())); - switch(wave.getFCC()) - { case MKFCCR('c','h','a','n'): - printf("Found channel layout atom, skipping\n"); - break; - case MKFCCR('w','a','v','e'): - { - // mp4a - // wave - // frma - // mp4a - // esds - while(!wave.isDone()) - { - adm_atom item(&wave); - printf("parsing wave, got %s,0x%x\n",fourCC::tostringBE(item.getFCC()), - item.getFCC()); - - switch(item.getFCC()) - { - case MKFCCR('f','r','m','a'): - { - uint32_t codecid=item.read32(); - printf("frma Codec Id :%s\n",fourCC::tostringBE(codecid)); - } - break; - case MKFCCR('m','s',0,0x55): - case MKFCCR('m','s',0,0x11): + printf("Found channel layout atom, skipping\n"); + + break; + case MKFCCR('w','a','v','e'): // wave + { + while(!wave.isDone()) + { + adm_atom item(&wave); + printf("parsing wave, got %s,0x%x\n", fourCC::tostringBE(item.getFCC()), item.getFCC()); + + switch(item.getFCC()) + { + case MKFCCR('f','r','m','a'): // frma { - // We have a waveformat here - printf("[STSD]Found MS audio header:\n"); - ADIO.encoding=ADM_swap16(item.read16()); - ADIO.channels=ADM_swap16(item.read16()); - ADIO.frequency=ADM_swap32(item.read32()); - ADIO.byterate=ADM_swap32(item.read32()); - ADIO.blockalign=ADM_swap16(item.read16()); - ADIO.bitspersample=ADM_swap16(item.read16()); - printWavHeader(&(ADIO)); + uint32_t codecid=item.read32(); + printf("frma Codec Id :%s\n",fourCC::tostringBE(codecid)); + break; } - break; - case MKFCCR('m','p','4','a'): - break; - case MKFCCR('e','s','d','s'): - { - decodeEsds(&item,TRACK_AUDIO); - break; - } - break; - default: - break; - } - - item.skipAtom(); - - } // Wave iddone - left=0; - - } // if ==wave - break; - case MKFCCR('e','s','d','s'): - { - decodeEsds(&wave,TRACK_AUDIO); - break; - } - default: - printf("UNHANDLED ATOM : %s\n",fourCC::tostringBE(wave.getFCC())); - break; - } - wave.skipAtom(); - } // while - } // if left > 10 - left=0; - } - break; // mp4a + case MKFCCR('m','s',0,0x55): + case MKFCCR('m','s',0,0x11): + { // We have a waveformat here + printf("[STSD]Found MS audio header:\n"); + ADIO.encoding=ADM_swap16(item.read16()); + ADIO.channels=ADM_swap16(item.read16()); + ADIO.frequency=ADM_swap32(item.read32()); + ADIO.byterate=ADM_swap32(item.read32()); + ADIO.blockalign=ADM_swap16(item.read16()); + ADIO.bitspersample=ADM_swap16(item.read16()); + printWavHeader(&(ADIO)); + + break; + } + case MKFCCR('m','p','4','a'): // mp4a + break; + case MKFCCR('e','s','d','s'): // esds + { + decodeEsds(&item,TRACK_AUDIO); + break; + } + default:break; + } - } - // all audio part read for current track, if it is AAC and we have extrdata, check the channels... - refineAudio(&(ADIO),_tracks[1+nbAudioTrack].extraDataSize,_tracks[1+nbAudioTrack].extraData); - } - break; - default: - ADM_assert(0); - } - son.skipBytes(left); - } - } - break; - default: - printf("[STBL]Skipping atom %s\n",fourCC::tostringBE(son.getFCC())); - } - son.skipAtom(); - } - uint8_t r=0; - uint32_t nbo=0; - switch(trackType) - { - case TRACK_VIDEO: + item.skipAtom(); + + } // while(!wave.isDone()) + left=0; + break; + } // case wave + case MKFCCR('e','s','d','s'): + { + decodeEsds(&wave,TRACK_AUDIO); + break; + } + default: + printf("UNHANDLED ATOM : %s\n",fourCC::tostringBE(wave.getFCC())); + break; + } // switch(wave.getFCC) + wave.skipAtom(); + } // while(!son.isDone()) + } // if left > 10 + left=0; + break; + } // mp4a + } // entryName + + // all audio part read for current track, if it is AAC and we have extrdata, check the channels... + refineAudio(&(ADIO),_tracks[1+nbAudioTrack].extraDataSize,_tracks[1+nbAudioTrack].extraData); + break; + } // TRACK_AUDIO + default: + ADM_assert(0); + } // trackType + son.skipBytes(left); + } // for + break; + } // ADM_MP4_STSD + default: + printf("[STBL]Skipping atom %s\n",fourCC::tostringBE(son.getFCC())); + } // id + son.skipAtom(); + } // while + uint8_t r=0; + uint32_t nbo=0; + switch(trackType) + { + case TRACK_VIDEO: { - if(_tracks[0].index) - { - printf("Already got a video track\n"); - return 1; - } - r=indexify(&(_tracks[0]),trackScale,&info,0,&nbo); - - _videostream.dwLength= _mainaviheader.dwTotalFrames=_tracks[0].nbIndex; - // update fps - double f=_videostream.dwLength; - if(!r) return false; - ADM_info("Movie duration = %d\n",(int)_movieDuration); - ADM_info("# images = %d\n",(int)_mainaviheader.dwTotalFrames); - - if(_movieDuration) f=1000000.*f/_movieDuration; - else f=25000; - - ADM_info("Avg fps %f\n",(float)f); - - _videostream.dwRate=(uint32_t)floor(f+0.49); - _mainaviheader.dwMicroSecPerFrame=ADM_UsecFromFps1000(_videostream.dwRate); - // if we have a sync atom ??? - if(info.nbSync) - { - // Mark keyframes - for(int i=0;i<info.nbSync;i++) + if(_tracks[0].index) { - uint32_t sync=info.Sync[i]; - if(sync) sync--; - _tracks[0].index[sync].intra=AVI_KEY_FRAME; + printf("Already got a video track\n"); + return 1; } - } - else - { // All frames are kf - for(int i=0;i<_tracks[0].nbIndex;i++) + r=indexify(&(_tracks[0]),trackScale,&info,0,&nbo); + + _videostream.dwLength= _mainaviheader.dwTotalFrames=_tracks[0].nbIndex; + // update fps + double f=_videostream.dwLength; + if(!r) return false; + ADM_info("Movie duration = %d\n",(int)_movieDuration); + ADM_info("# images = %d\n",(int)_mainaviheader.dwTotalFrames); + + if(_movieDuration) f=1000000.*f/_movieDuration; + else f=25000; + + ADM_info("Avg fps %f\n",(float)f); + + _videostream.dwRate=(uint32_t)floor(f+0.49); + _mainaviheader.dwMicroSecPerFrame=ADM_UsecFromFps1000(_videostream.dwRate); + + // if we have a sync atom ??? + if(info.nbSync) { - _tracks[0].index[i].intra=AVI_KEY_FRAME; + // Mark keyframes + for(int i=0;i<info.nbSync;i++) + { + uint32_t sync=info.Sync[i]; + if(sync) sync--; + _tracks[0].index[sync].intra=AVI_KEY_FRAME; + } + }else + { // All frames are kf + for(int i=0;i<_tracks[0].nbIndex;i++) + { + _tracks[0].index[i].intra=AVI_KEY_FRAME; + } } - } - // Now do the CTTS thing - if(info.Ctts) - { - updateCtts(&info); - }else - { - // No ctts, dts=pts + // Now do the CTTS thing + if(info.Ctts) + { + updateCtts(&info); + }else + { // No ctts, dts=pts for(int i=0;i<_videostream.dwLength;i++) { - _tracks[0].index[i].pts= _tracks[0].index[i].dts; + _tracks[0].index[i].pts= _tracks[0].index[i].dts; } - } - VDEO.index[0].intra=AVI_KEY_FRAME; - } - break; - case TRACK_AUDIO: - printf("Cur audio track :%u\n",nbAudioTrack); + } + VDEO.index[0].intra=AVI_KEY_FRAME; + + break; + } // TRACK_VIDEO + case TRACK_AUDIO: + printf("Cur audio track :%u\n",nbAudioTrack); #if 0 if(info.SzIndentical ==1 && (ADIO.encoding==WAV_LPCM || ADIO.encoding==WAV_PCM )) { @@ -1304,11 +1295,11 @@ } break; - case TRACK_OTHER: - r=1; - break; - } - return r; + case TRACK_OTHER: + r=1; + break; + } + return r; } /** \fn decodeEsds @@ -1316,70 +1307,87 @@ */ uint8_t MP4Header::decodeEsds(void *ztom,uint32_t trackType) { -adm_atom *tom=(adm_atom *)ztom; -int tag,l; - // in case of mpeg4 we only take - // the mpeg4 vol header - printf("[MP4]Esds atom found\n"); - - tom->skipBytes(4); - tag=0xff; - while(tag!=Tag_DecSpecificInfo && !tom->isDone()) + adm_atom *tom=(adm_atom *)ztom; + int tag,l; + // in case of mpeg4 we only take + // the mpeg4 vol header + printf("[MP4]Esds atom found\n"); + + tom->skipBytes(4); + tag=0xff; + while(tag!=Tag_DecSpecificInfo && !tom->isDone()) + { + tag=tom->read(); + l=readPackedLen(tom); + printf("\t Tag : %u Len : %u\n",tag,l); + switch(tag) + { + case Tag_ES_Desc: + printf("\t ES_Desc\n"); + tom->skipBytes(3); + break; + case Tag_DecConfigDesc: { - tag=tom->read(); - l=readPackedLen(tom); - printf("\t Tag : %u Len : %u\n",tag,l); - switch(tag) + uint8_t objectTypeIndication=tom->read(); + printf("\tDecConfigDesc : Tag %u\n",objectTypeIndication); + if(trackType==TRACK_AUDIO && ADIO.encoding==WAV_AAC) + { + switch(objectTypeIndication) { - case Tag_ES_Desc: - printf("\t ES_Desc\n"); - tom->skipBytes(3); - break; - case Tag_DecConfigDesc: + case 0x69: + case 0x6b: + case 0x6d: + ADIO.encoding=WAV_MP3; + break; + case 226: + ADIO.encoding=WAV_AC3; + break; + } + } + tom->skipBytes(1+3+4+4); + break; + } + case Tag_DecSpecificInfo: + printf("\t DecSpecicInfo\n"); + switch(trackType) + { + case TRACK_VIDEO: // Video + if(!VDEO.extraDataSize) + { + VDEO.extraDataSize=l; + VDEO.extraData=new uint8_t[l]; + if(fread(VDEO.extraData,VDEO.extraDataSize,1,_fd)<1) { - uint8_t objectTypeIndication=tom->read(); - printf("\tDecConfigDesc : Tag %u\n",objectTypeIndication); - if(trackType==TRACK_AUDIO && ADIO.encoding==WAV_AAC) - { - switch(objectTypeIndication) - { - case 0x69: - case 0x6b: - case 0x6d: - ADIO.encoding=WAV_MP3; - break; - case 226:ADIO.encoding=WAV_AC3;break; - break; - - } - } - tom->skipBytes(1+3+4+4); - break; - } - case Tag_DecSpecificInfo: - printf("\t DecSpecicInfo\n"); - switch(trackType) - { - case TRACK_VIDEO: // Video - if(!VDEO.extraDataSize) - { - VDEO.extraDataSize=l; - VDEO.extraData=new uint8_t[l]; - fread(VDEO.extraData,VDEO.extraDataSize,1,_fd); - } - break; - case TRACK_AUDIO: - printf("Esds for audio\n"); - _tracks[1+nbAudioTrack].extraDataSize=l; - _tracks[1+nbAudioTrack].extraData=new uint8_t[l]; - fread(_tracks[1+nbAudioTrack].extraData, - _tracks[1+nbAudioTrack].extraDataSize,1,_fd); - printf("\t %d bytes of extraData\n",(int)l); - break; - default: printf("Unknown track type for esds %d\n",trackType); - } + ADM_warning("Error reading video extradata from file.\n"); + delete [] VDEO.extraData; + VDEO.extraData=NULL; + VDEO.extraDataSize=0; + }else + { + ADM_info("%d bytes of video extradata successfully read from file.\n",l); } - } + } + break; + case TRACK_AUDIO: + printf("Esds for audio\n"); + _tracks[1+nbAudioTrack].extraDataSize=l; + _tracks[1+nbAudioTrack].extraData=new uint8_t[l]; + if(fread(_tracks[1+nbAudioTrack].extraData, + _tracks[1+nbAudioTrack].extraDataSize,1,_fd)<1) + { + ADM_warning("Error reading audio extradata from file.\n"); + delete [] _tracks[1+nbAudioTrack].extraData; + _tracks[1+nbAudioTrack].extraData=NULL; + _tracks[1+nbAudioTrack].extraDataSize=0; + }else + { + ADM_info("%d bytes of audio extradata successfully read from file.\n",l); + } + break; + default: printf("Unknown track type for esds %d\n",trackType); + } + } // tag + } // while tom->skipAtom(); return 1;
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4Fragments.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4Fragments.cpp
Changed
@@ -55,7 +55,7 @@ { case ADM_MP4_MFHD: son.skipAtom();break; case ADM_MP4_TRAF: parseTraf(son,tom.getStartPos());break; - + default:break; } aprintf("[MOOF]Found atom %s \n",fourCC::tostringBE(son.getFCC())); son.skipAtom(); @@ -146,6 +146,7 @@ aprintf("[TFDT] Base DTS=%ld\n",(long int)info.baseDts); } break; + default:break; } aprintf("[MOOF]Found atom %s \n",fourCC::tostringBE(son.getFCC()));
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4audio.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Mp4/ADM_mp4audio.cpp
Changed
@@ -62,7 +62,7 @@ uint8_t sample[4]; fseeko(_fd, _index[0].offset, SEEK_SET); - fread(&sample, 1, 4, _fd); + if(fread(&sample, 1, 4, _fd) < 4) return; uint32_t fcc = sample[0] << 24 | sample[1] << 16 | sample[2] << 8 | sample[3]; int layer = 4 - ((fcc >> 17) & 0x3); @@ -123,7 +123,6 @@ bool ADM_mp4AudioAccess::getPacket(uint8_t *buffer, uint32_t *size, uint32_t maxSize,uint64_t *dts) { uint32_t r=0; - double delta; if(_current_index>=_nb_chunks) { if(_msg_ratelimit->done())
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_regular.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_odml_regular.cpp
Changed
@@ -38,7 +38,7 @@ uint32_t audioCount[9]={0,0,0,0, 0,0,0,0,0}; uint32_t forward[9]; uint32_t backward[9]; -int64_t startOfData; +int64_t startOfData=0; printf("Trying avi type 1 index\n"); if(!_regularIndex.offset) @@ -123,14 +123,12 @@ } uint32_t audiocount=0,videocount=0; - uint32_t audiototal=0; uint32_t audioSize=0; odmlIndex *track; int Achunk; count=_regularIndex.size >> 4; while(count) { -_again: fcc=len=0; fcc=read32(); flags=read32();
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_openDMLDepack.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/OpenDml/ADM_openDMLDepack.cpp
Changed
@@ -41,9 +41,6 @@ #define MAX_VOP 200 -/* Static ones */ - -static const char *s_voptype[4]={"I frame","P frame","B frame","D frame"}; /** \fn unpackPacked \brief Removed packed bitstream hack @@ -52,7 +49,6 @@ { uint32_t nbFrame; uint8_t ret=0; - uint32_t firstType, secondType,thirdType; uint32_t targetIndex=0,nbVop; uint32_t nbDuped=0; uint32_t timcincbits=16; /* Nb bits used to code time_inc 16 is a safe default */ @@ -80,8 +76,8 @@ #ifndef __HAIKU__ uint32_t originalPriority = getpriority(PRIO_PROCESS, 0); #endif - uint32_t priorityLevel; #if 0 + uint32_t priorityLevel; prefs->get(PRIORITY_INDEXING,&priorityLevel); setpriority(PRIO_PROCESS, 0, ADM_getNiceValue(priorityLevel)); #endif @@ -90,8 +86,6 @@ ADMCompressedImage image; image.data=buffer; uint32_t img=0; - uint32_t modulo,time_inc,vopcoded,vopType; - uint32_t timeincbits=16; uint32_t oldtimecode=0xffffffff; while(img<nbFrame) { @@ -149,8 +143,6 @@ myVops[0].offset=0; myVops[nbVop].offset=image.dataLength; - - uint32_t place; //if(nbVop>2) { aprintf("At %u, %d vop!\n",img,nbVop);
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/Pictures/ADM_pics.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/Pictures/ADM_pics.cpp
Changed
@@ -31,12 +31,15 @@ #define aprintf printf #endif -static uint16_t s16; -static uint32_t s32; #define MAX_ACCEPTED_OPEN_FILE 99999 #define US_PER_PIC (40*1000) +#ifdef __APPLE__ + #define MAX_LEN 1024 +#else + #define MAX_LEN 4096 +#endif /** * @@ -142,7 +145,6 @@ bool r=true; uint16_t s16; - uint32_t s32; BmpLowLevel low(fd); switch(type) // this is bad. All the offsets are hardcoded and could be actually different. @@ -164,6 +166,21 @@ break; } bpp = bmph.biBitCount; + if (bpp > 32) + { + ADM_warning("Invalid bpp = %d\n",bpp); + r=false; + break; + } + if (bpp == 32 && bmph.biCompression == 3) + { // read channel masks, FIXME: BGR is assumed + low.read32LE(); // red + low.read32LE(); // green + uint32_t bmask=low.read32LE(); // blue + uint32_t amask=low.read32LE(); // alpha + if((!amask && bmask == 0xff00) || amask == 0xff) + bpp=96; // xBGR + } aprintf("Bmp bpp=%d offset: %d (bmp header=%d,%d)\n", bpp, bmpHeaderOffset,sizeof(bmph),bmph.biSize); } break; @@ -171,7 +188,12 @@ { ADM_BITMAPINFOHEADER bmph; - fread(&s16, 2, 1, fd); + if (!fread(&s16, 2, 1, fd)) + { + ADM_warning("Cannot read bmp file.\n"); + r=false; + break; + } if (s16 != 0x4D42) { ADM_warning(" incorrect bmp sig.\n"); @@ -234,7 +256,12 @@ */ uint8_t picHeader::open(const char *inname) { - uint32_t nnum; + if(strlen(inname)>=MAX_LEN) + { + ADM_warning("Path too long, aborting.\n"); + return 0; + } + FILE *fd; int bpp = 0; @@ -259,7 +286,7 @@ } else { - char realstring[1024]; + char realstring[MAX_LEN]; sprintf(realstring, "%s%%0%" PRIu32"d.%s", prefix.c_str(), nbOfDigits, extension.c_str()); _filePrefix=std::string(realstring); _nbFiles = 0; @@ -369,7 +396,7 @@ */ FILE* picHeader::openFrameFile(uint32_t frameNum) { - char filename[250]; + char filename[MAX_LEN]; sprintf(filename, _filePrefix.c_str(), frameNum + _first); return ADM_fopen(filename, "rb"); }
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vs.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vs.cpp
Changed
@@ -17,10 +17,7 @@ #include "ADM_default.h" #include "fourcc.h" #include "ADM_vs.h" -#if !defined(__APPLE__) && !defined(_WIN32) - #include <dlfcn.h> -#endif - +#include "ADM_vsInternal.h" static const VSAPI *vsapi = NULL; #if 0 #define aprintf printf @@ -28,7 +25,7 @@ #define aprintf(...) {} #endif uint32_t ADM_UsecFromFps1000(uint32_t fps1000); - +extern vsDynaLoader dynaLoader; /** \fn open \brief open the flv file, gather infos and build index(es). @@ -37,11 +34,7 @@ uint8_t vsHeader::open(const char *name) { ADM_info("Opening %s as VapourSynth file\n",name); -#if !defined(__APPLE__) && !defined(_WIN32) - ADM_info("Trying to dlopen %s\n",VAPOURSYNTH_PYTHONLIB); - dlopen(VAPOURSYNTH_PYTHONLIB, RTLD_LAZY|RTLD_GLOBAL); -#endif - inited+=!!vsscript_init(); + inited+=!!dynaLoader.init(); if(!inited) { ADM_warning("Cannot initialize vsapi script_init. Check PYTHONPATH\n"); @@ -49,7 +42,7 @@ } if(!vsapi) { - vsapi = vsscript_getVSApi(); + vsapi = dynaLoader.getVSApi(); if(!vsapi) { ADM_warning("Cannot get vsAPI entry point\n"); @@ -58,13 +51,13 @@ } } ADM_info("VapourSynth init ok, opening file..\n"); - if (vsscript_evaluateFile(&_script, name, 0)) + if (dynaLoader.evaluateFile(&_script, name, 0)) { - ADM_warning("Evaluate script failed <%s>\n", vsscript_getError(_script)); + ADM_warning("Evaluate script failed <%s>\n", dynaLoader.getError(_script)); close(); return 0; } - _node = vsscript_getOutput(_script, 0); + _node = dynaLoader.getOutput(_script, 0); if (!_node) { ADM_warning("vsscript_getOutputNode failed\n"); @@ -194,13 +187,13 @@ } if(_script) { - vsscript_freeScript(_script); + dynaLoader.freeScript(_script); _script=NULL; } while(inited) { inited--; - vsscript_finalize(); + dynaLoader.finalize(); } vsapi=NULL; return 1;
View file
avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vsInternal.h
Added
@@ -0,0 +1,85 @@ +#pragma once + +#include "ADM_dynamicLoading.h" + +#if !defined(__APPLE__) && !defined(_WIN32) + #include <dlfcn.h> +#endif + + + + +#ifdef __APPLE__ + #define DLL_TO_LOAD "libvapoursynth-script.dylib" + #define PYTHONLIB "" +#else + #ifdef _WIN32 + #define DLL_TO_LOAD "vsscript.dll" + #define PYTHONLIB "" + #else + #define DLL_TO_LOAD "libvapoursynth-script.so" + #define PYTHONLIB VAPOURSYNTH_PYTHONLIB + #endif +#endif + + +/** + * + */ +class vsDynaLoader:public ADM_LibWrapper +{ +public: + + vsDynaLoader() + { + init=NULL; + getVSApi=NULL; + freeScript=NULL; + finalize=NULL; + getError=NULL; + getOutput=NULL; + evaluateFile=NULL; + operational=false; + } + bool vsInit(const char *dllName,const char *pythonLib) + { +#if !defined(__APPLE__) && !defined(_WIN32) + ADM_info("Trying to dlopen %s\n",VAPOURSYNTH_PYTHONLIB); + dlopen(VAPOURSYNTH_PYTHONLIB, RTLD_LAZY|RTLD_GLOBAL); +#endif + bool loaded= loadLibrary(dllName); + if(!loaded) + { + ADM_warning("Cannot load the vapoursynth-script library\n"); + return false; + } + if(! ADM_LibWrapper::getSymbols(7, + &init, "vsscript_init", + &getVSApi, "vsscript_getVSApi", + &freeScript, "vsscript_freeScript", + &finalize, "vsscript_finalize", + &getError, "vsscript_getError", + &getOutput, "vsscript_getOutput", + &evaluateFile, "vsscript_evaluateFile")) + { + ADM_warning("Cannot get symbols from vapoursynthlibrary\n"); + return false; + } + operational=true; + return true; + } + bool isOperational() + { + return operational; + } +public: + int (*init)(void); + const VSAPI *(*getVSApi)(void); + void (*freeScript)(VSScript *handle); + int (*finalize)(void); + const char *(*getError)(VSScript *handle); + VSNodeRef * (*getOutput)(VSScript *handle, int index); + int (*evaluateFile)(VSScript **handle, const char *scriptFilename, int flags); +protected: + bool operational; +}; \ No newline at end of file
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vsPlugin.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vsPlugin.cpp
Changed
@@ -16,19 +16,35 @@ #include "ADM_default.h" #include "ADM_vs.h" #include "ADM_demuxerInternal.h" +#include "ADM_vsInternal.h" +#if !defined(__APPLE__) && !defined(_WIN32) + #include <dlfcn.h> +#endif + + +vsDynaLoader dynaLoader; +static bool loaded=false; ADM_DEMUXER_BEGIN( vsHeader, 50, 1,0,0, "vs", "VapourSynth demuxer plugin (c) Mean 2015" ); + /** \fn Probe */ extern "C" uint32_t ADM_PLUGIN_EXPORT probe(uint32_t magic, const char *fileName) { + + // Check if we have the lib loaded + if(!loaded) + dynaLoader.vsInit(DLL_TO_LOAD,PYTHONLIB); + loaded=true; + if(!dynaLoader.isOperational()) + return 0; std::string fname=std::string(fileName); if(fname.length()<4) return 0; if (fname.substr(fname.length()-4) == std::string(".vpy"))
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vsProxy.cpp -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vsProxy.cpp
Changed
@@ -18,9 +18,12 @@ #include "fourcc.h" #include "ADM_vsProxy.h" - +#include "ADM_vsInternal.h" static const VSAPI *vsapi = NULL; +vsDynaLoader dynaLoader; +static bool loaded=false; + /** @@ -47,10 +50,10 @@ { if(_script) { - vsscript_freeScript(_script); + dynaLoader.freeScript(_script); _script=NULL; } - vsscript_finalize(); + dynaLoader.finalize(); } /** * @@ -88,29 +91,35 @@ ADM_info("Opening %s as VapourSynth file\n",name); + if(!loaded) + dynaLoader.vsInit(DLL_TO_LOAD,PYTHONLIB); + loaded=true; + if(!dynaLoader.isOperational()) + return 0; + - if (!vsscript_init()) + if (!dynaLoader.init()) { ADM_warning("Cannot initialize vsapi script_init. Check PYTHONPATH\n"); return false; } - vsapi = vsscript_getVSApi(); + vsapi = dynaLoader.getVSApi(); if(!vsapi) { ADM_warning("Cannot get vsAPI entry point\n"); - vsscript_finalize(); + dynaLoader.finalize(); return 0; } ADM_info("VapourSynth init ok, opening file..\n"); - if (vsscript_evaluateFile(&_script, name, 0)) + if (dynaLoader.evaluateFile(&_script, name, 0)) { - ADM_warning("Evaluate script failed <%s>\n", vsscript_getError(_script)); + ADM_warning("Evaluate script failed <%s>\n", dynaLoader.getError(_script)); abort(); return 0; } - _node = vsscript_getOutput(_script, 0); + _node = dynaLoader.getOutput(_script, 0); if (!_node) { ADM_warning("vsscript_getOutputNode failed\n"); @@ -166,8 +175,8 @@ bool success=manageSlave(slave,vi); delete slave; vsapi->freeNode(_node); - vsscript_freeScript(_script); - vsscript_finalize(); + dynaLoader.freeScript(_script); + dynaLoader.finalize(); _node=NULL; _script=NULL; return success;
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/CMakeLists.txt -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/CMakeLists.txt
Changed
@@ -1,6 +1,12 @@ include(admCheckVapourSynth) include(dm_plugin) checkVapourSynth() + + IF(NOT APPLE AND NOT WIN32 AND NOT MSVC) + SET(VS_SYSTEM_LIBS "-ldl") +ENDIF(NOT APPLE AND NOT WIN32 AND NOT MSVC) + + IF(USE_VAPOURSYNTH) IF(DO_COMMON) IF(NOT APPLE) @@ -12,29 +18,12 @@ #ADD_DEFINITIONS("-std=c++11") ADD_DEFINITIONS(${VAPOURSYNTHSCRIPT_CFLAGS}) SET(SRCS ADM_vsProxy.cpp ADM_vsProxy_cli.cpp) - ADD_EXECUTABLE(vsProxy ${SRCS}) - GET_PROPERTY(OLD - TARGET vsProxy - PROPERTY LINK_FLAGS) - IF("${OLD}" MATCHES ".*NOT.*FOUND") - SET(OLD "") - ENDIF("${OLD}" MATCHES ".*NOT.*FOUND") -# Keep -L, discard everything else - FOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS}) - IF(${i} MATCHES "^-L") - MESSAGE(STATUS "Updating linker flags => ${i}") - SET(OLD "${i} ${OLD} ") - ELSE(${i} MATCHES "^-L") - MESSAGE(STATUS "Updating linker libs => ${i}") - LIST(APPEND LIBS_TO_LINK ${i}) - ENDIF(${i} MATCHES "^-L") - ENDFOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS}) + ADD_EXECUTABLE(vsProxy ${SRCS}) # Add vs Proxy SET_TARGET_PROPERTIES(vsProxy PROPERTIES LINK_FLAGS "${OLD}") - TARGET_LINK_LIBRARIES(vsProxy ${LIBS_TO_LINK} ADM_core6 ADM_coreSocket6) + TARGET_LINK_LIBRARIES(vsProxy ADM_core6 ADM_coreSocket6) ELSE(NOT APPLE) ADD_DEFINITIONS(${VAPOURSYNTHSCRIPT_CFLAGS}) - LIST(APPEND LIBS_TO_LINK ${VAPOURSYNTHSCRIPT_LDFLAGS}) ENDIF(NOT APPLE) #---------------- # Add direct Loading @@ -43,10 +32,8 @@ ) INIT_DEMUXER(ADM_dm_vapoursynth) ADD_DEMUXER(ADM_dm_vapoursynth ${ADM_vs_SRCS}) - IF(NOT APPLE AND NOT WIN32 AND NOT MSVC) - LIST(APPEND LIBS_TO_LINK "-ldl") - ENDIF(NOT APPLE AND NOT WIN32 AND NOT MSVC) - TARGET_LINK_LIBRARIES(ADM_dm_vapoursynth ${LIBS_TO_LINK}) + TARGET_LINK_LIBRARIES(ADM_dm_vapoursynth "${VS_SYSTEM_LIBS}") + INSTALL_DEMUXER(ADM_dm_vapoursynth) #---------------- IF(NOT APPLE) @@ -59,6 +46,7 @@ ELSE(WIN32) TARGET_LINK_LIBRARIES(vsProxy -lstdc++) # clang ENDIF(WIN32) + TARGET_LINK_LIBRARIES(vsProxy "${VS_SYSTEM_LIBS}") ADM_INSTALL_BIN(vsProxy) ENDIF(NOT APPLE) ENDIF(DO_COMMON)
View file
avidemux_2.7.2.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/qt4/CMakeLists.txt -> avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/qt4/CMakeLists.txt
Changed
@@ -46,15 +46,7 @@ SET(OLD "") ENDIF("${OLD}" MATCHES ".*NOT.*FOUND") # Keep -L, discard everything else -FOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS}) - IF(${i} MATCHES "^-L") - MESSAGE(STATUS "Updating linker flags => ${i}") - SET(OLD "${i} ${OLD} ") - ELSE(${i} MATCHES "^-L") - MESSAGE(STATUS "Updating linker libs => ${i}") - LIST(APPEND LIBS_TO_LINK ${i}) - ENDIF(${i} MATCHES "^-L") -ENDFOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS}) + SET_TARGET_PROPERTIES(vsProxy_gui_${QT_EXTENSION} PROPERTIES LINK_FLAGS "${OLD}") @@ -73,5 +65,5 @@ set_target_properties(vsProxy_gui_${QT_EXTENSION} PROPERTIES WIN32_EXECUTABLE True) TARGET_LINK_LIBRARIES(vsProxy_gui_${QT_EXTENSION} ws2_32.lib winmm -mwindows ) ENDIF(MSVC) - +TARGET_LINK_LIBRARIES(vsProxy_gui_${QT_EXTENSION} "${VS_SYSTEM_LIBS}") ADM_INSTALL_BIN(vsProxy_gui_${QT_EXTENSION})
View file
avidemux_2.7.2.tar.gz/cmake/admCheckVapourSynth.cmake -> avidemux_2.7.3.tar.gz/cmake/admCheckVapourSynth.cmake
Changed
@@ -12,6 +12,7 @@ STRING(REGEX REPLACE "so.*$" "so" shortened "${shortened}" ) # Now it looks like this libpython3.6m.so set(${result} ${shortened}) + MESSAGE(STATUS "Got python lib : ${${result}}") endif(dep MATCHES ".*libpython3.*") endforeach(dep ${xoutput}) endmacro(GET_VAPOURSYNTH_PYTHON lib) @@ -25,10 +26,10 @@ IF (VAPOURSYNTH) PKG_CHECK_MODULES(VAPOURSYNTHSCRIPT vapoursynth-script) IF (VAPOURSYNTHSCRIPT_FOUND) - MESSAGE(STATUS "VSSCRIPT<${VAPOURSYNTHSCRIPT_CFLAGS}> < ${VAPOURSYNTHSCRIPT_LDFLAGS}>") + MESSAGE(STATUS "VSSCRIPT<${VAPOURSYNTHSCRIPT_CFLAGS}> < ${VAPOURSYNTHSCRIPT_LDFLAGS}> <${VAPOURSYNTHSCRIPT_LIBRARIES}>") IF(NOT APPLE AND NOT WIN32) - LIST(GET VAPOURSYNTHSCRIPT_LINK_LIBRARIES 0 xfirst) - GET_VAPOURSYNTH_PYTHON( ${xfirst} VAPOURSYNTH_PYTHONLIB) + LIST(GET VAPOURSYNTHSCRIPT_LIBRARIES 0 xfirst) + GET_VAPOURSYNTH_PYTHON( "${VAPOURSYNTHSCRIPT_LIBDIR}/lib${xfirst}.so" VAPOURSYNTH_PYTHONLIB) SET(VAPOURSYNTHSCRIPT_CFLAGS "${VAPOURSYNTHSCRIPT_CFLAGS} -DVAPOURSYNTH_PYTHONLIB='\"${VAPOURSYNTH_PYTHONLIB}\"'") ENDIF(NOT APPLE AND NOT WIN32) SET(USE_VAPOURSYNTH 1)
View file
avidemux_2.7.2.tar.gz/cmake/avidemuxVersion.cmake -> avidemux_2.7.3.tar.gz/cmake/avidemuxVersion.cmake
Changed
@@ -7,7 +7,7 @@ include(admTimeStamp) SET(CPACK_PACKAGE_VERSION_MAJOR "2") SET(CPACK_PACKAGE_VERSION_MINOR "7") -SET(CPACK_PACKAGE_VERSION_P "2") +SET(CPACK_PACKAGE_VERSION_P "3") SET(AVIDEMUX_MAJOR_MINOR "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") SET(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_P}") IF(NOT AVIDEMUX_VERSION)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.