Overview
avidemux3.changes
Changed
x
1
2
-------------------------------------------------------------------
3
+Fri Mar 22 22:41:51 UTC 2019 - enzokiel@kabelmail.de
4
+
5
+- Update to version 2.7.3
6
+ + Vapoursynth is now dynamically loaded to avoid error popup
7
+ + ASF/WMV demuxer fix
8
+ + BMP decoder fix
9
+ + Re-enabled PNG decoder
10
+ + Basic save current state when crashing
11
+ + Misc small improvements
12
+
13
+-------------------------------------------------------------------
14
Sun Mar 17 01:39:22 UTC 2019 - enzokiel@kabelmail.de
15
16
- Update to version 2.7.2
17
avidemux3.spec
Changed
10
1
2
3
Name: avidemux3
4
Summary: Graphical video editing and transcoding tool
5
-Version: 2.7.2
6
+Version: 2.7.3
7
Release: 1
8
Url: http://avidemux.sourceforge.net/
9
ExclusiveArch: %ix86 x86_64
10
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
9
1
2
{
3
// don't ask too much front.
4
asked = (3*AUD_PROCESS_BUFFER_SIZE)/4-_tail;
5
- asked/=_wavHeader.channels; // float->samples
6
if(false==_incoming->getPCMPacket(_incomingBuffer.at(_tail), asked, &got,&dts))
7
{
8
got=0;
9
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
22
1
2
{
3
printf("[Editor] B- frame possible with that codec \n");
4
#define FCC_MATCHES(x) fourCC::check(info.fcc,(uint8_t *)x)
5
- if(isMpeg4Compatible(info.fcc) || isMpeg12Compatible(info.fcc) || isVC1Compatible(info.fcc) || FCC_MATCHES("WMV3"))
6
+ if(isMpeg4Compatible(info.fcc) || isMpeg12Compatible(info.fcc) || FCC_MATCHES("VC1 ") || FCC_MATCHES("WMV3"))
7
{
8
ADM_info("[Editor] It is mpeg4-SP/ASP, try to guess all PTS\n");
9
uint64_t delay;
10
11
}
12
}
13
int lastVideo=_segments.getNbSegments();
14
- if(lastVideo && isH264Compatible(info.fcc))
15
+ if(lastVideo && (isH264Compatible(info.fcc) || FCC_MATCHES("WVC1")))
16
{
17
- ADM_info("H264 in mp4 sometimes has invalid timestamps which confuse avidemux, checking\n");
18
+ ADM_info("%s sometimes has invalid timestamps which confuse avidemux, checking\n",fourCC::tostring(info.fcc));
19
checkForValidPts(_segments.getSegment(lastVideo-1));
20
}
21
if(true==checkForDoubledFps( video._aviheader,video.timeIncrementInUs))
22
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
41
1
2
ADM_info("Original frame increment %s = %" PRIu64" us\n",ADM_us2plain(ref->timeIncrementInUs),ref->timeIncrementInUs);
3
uint64_t minDelta=100000;
4
uint64_t maxDelta=0;
5
- int fmin,fmax;
6
- for (int frame=0; frame<info.nb_frames; frame++)
7
+ uint32_t fmin=0,fmax=0;
8
+ for (uint32_t frame=0; frame<info.nb_frames; frame++)
9
{
10
if (ref->_aviheader->getPtsDts(frame,&pts,&dts) && dts!=ADM_NO_PTS && dts!=0)
11
{
12
13
firstNonZeroDtsFrame=frame;
14
}
15
}
16
- ADM_info("min increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(minDelta),minDelta,fmin);
17
- ADM_info("max increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(maxDelta),maxDelta,fmax);
18
-
19
+ if(maxDelta>=minDelta)
20
+ {
21
+ ADM_info("min increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(minDelta),minDelta,fmin);
22
+ ADM_info("max increment %s = %" PRIu64" us for frame %d\n",ADM_us2plain(maxDelta),maxDelta,fmax);
23
+ }else
24
+ {
25
+ ADM_warning("DTS missing, cannot probe time increment.\n");
26
+ }
27
//if (minDelta==ref->timeIncrementInUs*2)
28
//ref->timeIncrementInUs=minDelta;
29
30
31
else ADM_info("The first frame DTS = %" PRIu64" ms\n",dts/1000);
32
if(pts!=ADM_NO_PTS &&pts)
33
{
34
- ADM_warning("The first frame has a PTS >0, adjusting to %" PRIu64" ms\n",pts/1000);
35
+ ADM_warning("The first frame has a PTS > 0, adjusting to %" PRIu64" %s\n",
36
+ (pts>=1000)? pts/1000 : pts,
37
+ (pts>=1000)? "ms" : "us");
38
ref->firstFramePts=pts;
39
#ifdef ADM_ZERO_OFFSET
40
seg._refStartTimeUs=pts;
41
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
25
1
2
ADM_info("No B-frames and no PTS, setting PTS equal DTS\n");
3
return setPtsEqualDts(hdr,inc);
4
}
5
+ // check whether DTS are completely missing, ignore the first frame
6
+ bool noDts=true;
7
+ for(uint32_t i=1;i<totalFrames;i++)
8
+ {
9
+ uint64_t pts,dts;
10
+ hdr->getPtsDts(i,&pts,&dts);
11
+ if(dts!=ADM_NO_PTS)
12
+ {
13
+ noDts=false;
14
+ break;
15
+ }
16
+ }
17
+ if(!stats.nbBFrames && !stats.nbPtsgoingBack && hdr->providePts() && noDts)
18
+ {
19
+ ADM_info("No B-frames and no DTS, setting DTS equal PTS\n");
20
+ return setPtsEqualDts(hdr,inc);
21
+ }
22
23
if(stats.nbPtsgoingBack>1 || (stats.nbBFrames && hdr->providePts()==false))
24
{
25
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
9
1
2
</screenshots>
3
<content_rating type="oars-1.1"/>
4
<releases>
5
- <release version="${AVIDEMUX_VERSION}" date="${BUILD_DATE}"/>
6
+ <release version="${AVIDEMUX_VERSION}" date="2019-03-21"/>
7
</releases>
8
</component>
9
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
9
1
2
#include "ADM_crashdump_apple.h"
3
#include "ADM_crashdump_other.h"
4
#include "ADM_crashdump_unix.h"
5
+#include "ADM_crashdump_vs.h"
6
7
#ifdef __cplusplus
8
extern "C"
9
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
7
1
2
-#if !defined(__APPLE__) && !defined(__unix__) && !defined(__MINGW32__) && !defined ADM_CRASHDUMP_OTHER_H
3
+#if !defined(__APPLE__) && !defined(__unix__) && !defined(__MINGW32__) && !defined ADM_CRASHDUMP_OTHER_H &&!defined _MSC_VER
4
#define ADM_CRASHDUMP_OTHER_H
5
6
#define installSigHandler(...) {}
7
avidemux_2.7.3.tar.gz/avidemux_core/ADM_core/include/ADM_crashdump_vs.h
Added
13
1
2
+/**
3
+ * \file ADM_crashdump_mingw
4
+ * \brief Catch low level error, mingw version
5
+ */
6
+#if defined(_MSC_VER)
7
+
8
+#pragma once
9
+ADM_CORE6_EXPORT void installSigHandler(void);
10
+ADM_CORE6_EXPORT void uninstallSigHandler(void);
11
+
12
+#endif
13
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
118
1
2
+#include <windows.h>
3
+#include <excpt.h>
4
+#include <string>
5
#include "ADM_crashdump.h"
6
+static ADM_saveFunction *mysaveFunction = NULL;
7
+static ADM_fatalFunction *myFatalFunction = NULL;
8
+
9
+void ADM_setCrashHook(ADM_saveFunction *save, ADM_fatalFunction *fatal,ADM_sigIntFunction *other)
10
+{
11
+ mysaveFunction = save;
12
+ myFatalFunction = fatal;
13
+ }
14
+
15
+/**
16
+ *
17
+ * @param exceptionRecord
18
+ * @param contextRecord
19
+ */
20
+void HandleException(const char *message,struct _EXCEPTION_RECORD *exceptionRecord, struct _CONTEXT *contextRecord)
21
+{
22
+ std::string s;
23
+ fflush(stderr);
24
+ fflush(stdout);
25
+
26
+ static int running = 0;
27
+
28
+ if (running)
29
+ exit(1);
30
+
31
+ running = 1;
32
+
33
+ if (mysaveFunction)
34
+ mysaveFunction();
35
+
36
+
37
+
38
+ void *process = GetCurrentProcess();
39
+
40
+ fflush(stdout);
41
+
42
+ const char *title;
43
+ if(!message) title="Crash";
44
+ else title=message;
45
+ if (myFatalFunction)
46
+ myFatalFunction(title, s.c_str());
47
+ fflush(stderr);
48
+ fflush(stdout);
49
+ exit(1);
50
+}
51
+/**
52
+ *
53
+ * @param exceptionRecord
54
+ * @param establisherFrame
55
+ * @param contextRecord
56
+ * @param dispatcherContext
57
+ * @return
58
+ */
59
+EXCEPTION_DISPOSITION ExceptionHandler(struct _EXCEPTION_RECORD *exceptionRecord, void *establisherFrame, struct _CONTEXT *contextRecord, void *dispatcherContext)
60
+{
61
+ HandleException("ExceptionHandler",exceptionRecord, contextRecord);
62
+ return ExceptionContinueExecution;
63
+}
64
+/**
65
+ *
66
+ * @param exceptionInfo
67
+ * @return
68
+ */
69
+LONG WINAPI ExceptionFilter(struct _EXCEPTION_POINTERS *exceptionInfo)
70
+{
71
+ HandleException("ExceptionFilter",exceptionInfo->ExceptionRecord, exceptionInfo->ContextRecord);
72
+ return EXCEPTION_CONTINUE_SEARCH;
73
+}
74
+/**
75
+ *
76
+ * @param pExceptionInfo
77
+ * @return
78
+ */
79
+LONG WINAPI TopLevelExceptionHandler(struct _EXCEPTION_POINTERS *exceptionInfo)
80
+{
81
+ HandleException("TopLevelExceptionHandler",exceptionInfo->ExceptionRecord, exceptionInfo->ContextRecord);
82
+ return EXCEPTION_CONTINUE_SEARCH;
83
+}
84
+
85
+/**
86
+ *
87
+ * @param info
88
+ * @param lineno
89
+ * @param file
90
+ */
91
+void ADM_backTrack(const char *info, int lineno, const char *file)
92
+{
93
+ char title[2048]={0};
94
+ snprintf(title,2000,"%s at line %d, file %s\n",info,lineno,file);
95
+ HandleException(title,NULL, NULL);
96
+}
97
+
98
+
99
+/**
100
+ * \fn installSigHandler
101
+ * \brief add hook to catch exception (null pointers etc...)
102
+ */
103
+ADM_CORE6_EXPORT void installSigHandler(void)
104
+{
105
+ SetUnhandledExceptionFilter(ExceptionFilter);
106
+}
107
+/**
108
+ * \fn uninstallSigHandler
109
+ * \brief
110
+ */
111
+ADM_CORE6_EXPORT void uninstallSigHandler(void)
112
+{
113
+
114
+}
115
116
-void ADM_backTrack(const char *info, int lineno, const char *file) { }
117
-void ADM_setCrashHook(ADM_saveFunction *save, ADM_fatalFunction *fatal,ADM_sigIntFunction *other) { }
118
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
9
1
2
ADM_coreTranslator.cpp
3
ADM_prettyPrint.cpp
4
)
5
-
6
IF (MINGW)
7
SET(ADM_core_SRCS ${ADM_core_SRCS} ADM_crashdump_mingw.cpp ADM_folder_win32.cpp ADM_folder_mingw.cpp ADM_win32_mingw.cpp )
8
ELSEIF (APPLE)
9
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
10
1
2
if(myFd.fileSize >= threshold-tolerance && myFd.fileSize <= threshold+tolerance)
3
break;
4
threshold<<=1;
5
+ if(i==1)
6
+ tolerance<<=3; // 8 MiB starting with 1 GiB fragment size
7
}
8
}
9
count++;
10
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
52
1
2
{
3
uint32_t i;
4
i = 0;
5
- i=(((uint32_t)(read16LE()))<<0)+(((uint32_t)read16LE())<<16);
6
+ i += (((uint32_t)(read16LE())) << 0);
7
+ i += (((uint32_t)read16LE()) << 16);
8
return i;
9
}
10
uint32_t read32BE ()
11
{
12
uint32_t i;
13
i = 0;
14
- i=(((uint32_t)(read16BE()))<<16)+(((uint32_t)read16BE())<<0);
15
+ i += (((uint32_t)(read16BE())) << 16);
16
+ i +=(((uint32_t)read16BE()) << 0);
17
return i;
18
}
19
uint16_t read16LE ()
20
21
uint16_t i;
22
23
i = 0;
24
- i = (read8( ) ) + (read8( )<< 8);
25
+ i += (read8());
26
+ i +=(read8() << 8);
27
return i;
28
}
29
uint16_t read16BE ()
30
31
uint16_t i;
32
33
i = 0;
34
- i = (read8( ) <<8) + (read8( )<< 0);
35
+ i += (read8() << 8);
36
+ i += (read8());
37
return i;
38
}
39
uint8_t read8 ()
40
41
READ_FIELD(biBitCount,16)
42
READ_FIELD(biCompression,32)
43
READ_FIELD(biSizeImage,32)
44
- READ_FIELD(biSize,32)
45
+ READ_FIELD(biXPelsPerMeter,32)
46
+ READ_FIELD(biYPelsPerMeter,32)
47
+ READ_FIELD(biClrUsed,32)
48
+ READ_FIELD(biClrImportant,32)
49
}
50
51
protected:
52
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
220
1
2
swap=true;
3
}
4
5
- if(ADM_COLOR_RGB24==sourceFormat)
6
+ if(ADM_COLOR_RGB24==sourceFormat || ADM_COLOR_BGR24==sourceFormat)
7
swap=true;
8
9
- ADMColorScalerSimple converter(w,h,sourceFormat,ADM_COLOR_YV12);
10
- converter.convertImage(source,image);
11
-
12
+ ADMColorScalerSimple converter(w,h,sourceFormat,ADM_COLOR_YV12);
13
+ converter.convertImage(source,image);
14
+
15
if(swap)
16
{
17
uint8_t **s=image->_planes,*v;
18
19
*/
20
static bool readJpegInfo(FILE *fd, int &width, int &height)
21
{
22
- uint16_t tag = 0, count = 0, off;
23
+ uint16_t tag = 0, count = 0, off = 0;
24
int w,h;
25
fseek(fd, 0, SEEK_END);
26
int fileLength=ftell(fd);
27
28
// Load the binary coded image
29
ADM_byteBuffer buffer(_imgSize);
30
fseek(fd, 0, SEEK_SET);
31
- fread(buffer.at(0),_imgSize,1,fd);
32
+ int r=fread(buffer.at(0),_imgSize,1,fd);
33
fclose(fd);
34
+ if(!r)
35
+ {
36
+ ADM_warning("Cannot read JPEG file.\n");
37
+ return NULL;
38
+ }
39
//
40
41
ADMImageRef tmpImage(w,h); // It is a reference image
42
43
ADMImage *createImageFromFile_png(const char *filename)
44
{
45
46
- uint32_t offset,size;
47
+ uint32_t size;
48
FILE *fd=NULL;
49
uint32_t w,h;
50
51
52
fseek(fd,0,SEEK_SET);
53
ADM_byteBuffer buffer(size);
54
55
- fread(buffer.at(0),size,1,fd);
56
+ int r=fread(buffer.at(0),size,1,fd);
57
fclose(fd);
58
+ if(!r)
59
+ {
60
+ ADM_warning("Cannot read PNG file.\n");
61
+ return NULL;
62
+ }
63
ADMImageRef tmpImage(w,h);
64
// Decode PNG
65
decoders *dec=ADM_coreCodecGetDecoder (fourCC::get((uint8_t *)"PNG "), w, h, 0 , NULL,0);
66
67
bin.data=buffer.at(0);
68
bin.dataLength=size; // This is more than actually, but who cares...
69
70
- bool success=dec->uncompress (&bin, &tmpImage);
71
-
72
-
73
- if(!success)
74
+ if(!dec->uncompress (&bin, &tmpImage))
75
{
76
ADM_warning("PNG Decompressing failed\n");
77
delete dec;
78
79
{
80
81
ADM_BITMAPINFOHEADER bmph;
82
- uint8_t fcc_tab[4];
83
uint32_t offset;
84
FILE *fd=NULL;
85
- uint32_t w,h;
86
+ uint32_t w,h,bpp;
87
+ int bufSize;
88
89
fd = ADM_fopen(filename, "rb");
90
if(!fd)
91
92
93
offset = reader.read32LE();
94
reader.readBmphLE(bmph);
95
- if (bmph.biCompression != 0 &bmph.biCompression!=3)
96
+ if(bmph.biCompression && bmph.biCompression!=3)
97
{
98
ADM_warning("[imageLoader] BMP2:Cannot handle compressed bmp (%08x)\n",bmph.biCompression);
99
fclose(fd);
100
101
}
102
w = bmph.biWidth;
103
h = bmph.biHeight;
104
+ if(w > MAXIMUM_SIZE)
105
+ {
106
+ ADM_warning("Width %u exceeds maximum supported (%u)\n",w,MAXIMUM_SIZE);
107
+ fclose(fd);
108
+ return NULL;
109
+ }
110
+ if(h > MAXIMUM_SIZE)
111
+ {
112
+ ADM_warning("Height %u exceeds maximum supported (%u)\n",h,MAXIMUM_SIZE);
113
+ fclose(fd);
114
+ return NULL;
115
+ }
116
+ bpp = bmph.biBitCount;
117
+ switch(bpp)
118
+ {
119
+ case 24:
120
+ case 32:
121
+ break;
122
+ default:
123
+ ADM_warning("Only 24 and 32 bpp bitmaps are supported.\n");
124
+ fclose(fd);
125
+ return NULL;
126
+ }
127
+
128
+ if(bpp == 32)
129
+ {
130
+ if(bmph.biCompression == 3)
131
+ { // read channel masks, FIXME: BGR is assumed
132
+ reader.read32LE(); // red
133
+ reader.read32LE(); // green
134
+ uint32_t bmask=reader.read32LE(); // blue
135
+ uint32_t amask=reader.read32LE(); // alpha
136
+ if((!amask && bmask == 0xff00) || amask == 0xff)
137
+ bpp=96; // xBGR
138
+ }
139
+ bufSize=w*h*4;
140
+ }else // 24
141
+ {
142
+ bufSize=w*h*3;
143
+ }
144
+
145
ADM_info("[imageLoader] BMP2 W: %" PRIu32" H: %" PRIu32" offset : %" PRIu32"\n", w, h, offset);
146
// Load the binary coded image
147
fseek(fd,offset,SEEK_SET);
148
149
- ADM_byteBuffer buffer(w*h*4);
150
+ ADM_byteBuffer buffer(bufSize);
151
152
- fread(buffer.at(0),w*h*4,1,fd);
153
+ uint32_t count=fread(buffer.at(0),bufSize,1,fd);
154
fclose(fd);
155
+ if(!count)
156
+ {
157
+ ADM_warning("Read incomplete.\n");
158
+ return NULL;
159
+ }
160
+
161
+ // Decode DIB
162
+ decoders *dec=ADM_coreCodecGetDecoder (fourCC::get((uint8_t *)"DIB "), w, h, 0, NULL, bpp);
163
+ if(!dec)
164
+ {
165
+ ADM_warning("Cannot get DIB decoder");
166
+ return NULL;
167
+ }
168
169
- // Colorconversion
170
+ ADMCompressedImage bin;
171
+ bin.data=buffer.at(0);
172
+ bin.dataLength=bufSize;
173
174
-
175
- ADMImageRefWrittable ref(w,h);
176
-
177
- ref._planes[0]=buffer.at(0)+(h-1)*w*3;
178
- ref._planeStride[0]=-w*3;
179
- ref._colorspace=ADM_COLOR_RGB24;
180
+ ADMImageRef ref(w,h);
181
182
- return convertImageColorSpace(&ref,w,h);
183
+ if(!dec->uncompress(&bin,&ref))
184
+ {
185
+ ADM_warning("DIB decoding failed\n");
186
+ delete dec;
187
+ dec=NULL;
188
+ return NULL;
189
+ }
190
+
191
+ ADMImage *image=convertImageColorSpace(&ref,w,h);
192
+ delete dec;
193
+ dec=NULL;
194
+ return image;
195
}
196
/**
197
* \fn ADM_identidyImageFile
198
199
{
200
uint8_t fcc_tab[4];
201
FILE *fd;
202
- uint32_t off,tag=0,count,size;
203
204
// 1- identity the file type
205
//
206
207
ADM_info("[imageIdentify] Cannot open that file!\n");
208
return ADM_PICTURE_UNKNOWN;
209
}
210
- fread(fcc_tab, 4, 1, fd);
211
+ if (!fread(fcc_tab, 4, 1, fd))
212
+ {
213
+ ADM_warning("Cannot read image file.\n");
214
+ fclose(fd);
215
+ return ADM_PICTURE_UNKNOWN;
216
+ }
217
218
// 2- JPEG ?
219
if (fcc_tab[0] == 0xff && fcc_tab[1] == 0xd8)
220
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
10
1
2
break;
3
}
4
threshold<<=1;
5
+ if(i==1)
6
+ tolerance<<=3; // 8 MiB starting with 1 GiB fragment size
7
}
8
if(!success)
9
return false;
10
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
13
1
2
if ((fcc == 0) || fourCC::check (fcc, (uint8_t *) "DIB "))
3
{
4
// RGB 16 Codecs
5
- printf ("\n using DIB codec (%d bpp)\n",(int)bpp);
6
+ if(bpp!=96)
7
+ printf ("\n using DIB codec (%d bpp%s)\n",(int)bpp,(bpp==32)? " BGRx" : "");
8
+ else
9
+ printf ("\n using DIB codec (%d bpp xBGR)\n",32);
10
return (decoders *) (new decoderRGB16 (w,h,fcc,extraLen,extraData,bpp)); //0
11
12
}
13
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
52
1
2
: decoders ( w, h, fcc, extraDataLen, extraData, bpp)
3
{
4
_bpp = bpp;
5
- bytePerPixel=_bpp>>3;
6
+ bytePerPixel=(_bpp & 0x3f)>>3;
7
decoded = new uint8_t[2*bytePerPixel * w * h];
8
}
9
/**
10
11
colorspace = ADM_COLOR_RGB555;
12
break;
13
case 24:
14
- case 32:
15
+ case 32: // BGRx
16
+ case 96: // fake bpp indicating xBGR
17
colorspace = ADM_COLOR_BGR24;
18
break;
19
default:
20
21
// Pack...
22
// Invert scanline
23
src = in->data+lineSize*(_h-1);
24
- if (_bpp == 32) // 32 -> 24
25
+ if (_bpp == 32 || _bpp == 96) // 32 -> 24
26
{
27
outBytePerPixel=3;
28
destStride=outBytePerPixel*_w;
29
30
31
for(j = 0; j < _w; j++) // 32 32 32 32
32
{
33
- ptr[0] = buf[1]; // remove alpha channel + reorder. IT would be more efficient to do it in colorspace...
34
+ if(_bpp == 32)
35
+ {
36
+ ptr[0] = buf[0]; // remove alpha channel + reorder. IT would be more efficient to do it in colorspace...
37
+ ptr[1] = buf[1];
38
+ ptr[2] = buf[2];
39
+ }else // xBGR
40
+ {
41
+ ptr[0] = buf[1];
42
ptr[1] = buf[2];
43
ptr[2] = buf[3];
44
- ptr += 3;
45
- buf += 4;
46
+ }
47
+ ptr += 3;
48
+ buf += 4;
49
}
50
src -= lineSize;
51
dst += _w * 3;
52
avidemux_2.7.3.tar.gz/avidemux_core/ffmpeg_package/patches/upstream
Added
2
1
+(directory)
2
avidemux_2.7.3.tar.gz/avidemux_core/ffmpeg_package/patches/upstream/0001-avutil-mem-gcc9.patch
Added
32
1
2
+From 4361293fcf59edb56879c36edcd25f0a91e0edf8 Mon Sep 17 00:00:00 2001
3
+From: Mark Harris <mark.hsj@gmail.com>
4
+Date: Sat, 24 Nov 2018 13:02:02 -0800
5
+Subject: [PATCH] avutil/mem: Fix invalid use of av_alloc_size
6
+
7
+The alloc_size attribute is valid only on functions that return a
8
+pointer. GCC 9 (not yet released) warns about invalid usage:
9
+
10
+./libavutil/mem.h:342:1: warning: 'alloc_size' attribute ignored on a function returning int' [-Wattributes]
11
+ 342 | av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
12
+ | ^~~~~~~~~~~~~
13
+
14
+Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
15
+---
16
+ libavutil/mem.h | 2 +-
17
+ 1 file changed, 1 insertion(+), 1 deletion(-)
18
+
19
+diff --git a/libavutil/mem.h b/libavutil/mem.h
20
+index 55ae573ac9a..5fb1a02dd9c 100644
21
+--- a/libavutil/mem.h
22
++++ b/libavutil/mem.h
23
+@@ -339,7 +339,7 @@ av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
24
+ * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be
25
+ * correctly aligned.
26
+ */
27
+-av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
28
++int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
29
+
30
+ /**
31
+ * Reallocate the given buffer if it is not large enough, otherwise do nothing.
32
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
129
1
2
_blockalign=378;
3
}
4
}
5
- ADM_info("[ADM_ad_lav] init successful (blockalign %d), channels=%d\n",info->blockalign,_context->channels);
6
+ ADM_info("[ADM_ad_lav] init successful (blockalign %d), channels=%d\n",_blockalign,_context->channels);
7
if(_context->sample_rate!=outputFrequency)
8
{
9
ADM_warning("Output frequency does not match input frequency (SBR ?) : %d / %d\n",
10
11
\fn run
12
13
*/
14
-
15
-#define CHECK_CONTENT(n)
16
-
17
uint8_t ADM_AudiocoderLavcodec::run(uint8_t *inptr, uint32_t nbIn, float *outptr, uint32_t *nbOut)
18
{
19
+ *nbOut=0;
20
+ // Shrink
21
+ if(_head && (_tail+nbIn)*3>ADMWA_BUF*2)
22
+ {
23
+ memmove(_buffer,_buffer+_head,_tail-_head);
24
+ _tail-=_head;
25
+ _head=0;
26
+ }
27
+ //
28
+ ADM_assert(nbIn+_tail<ADMWA_BUF);
29
+ memcpy(_buffer+_tail,inptr,nbIn);
30
+ _tail+=nbIn;
31
+
32
+ AVPacket pkt;
33
+ av_init_packet(&pkt);
34
+ int nbChunk,res=0;
35
+ while(_tail-_head>=_blockalign)
36
+ {
37
+ nbChunk=(_tail-_head)/_blockalign;
38
+ pkt.size=nbChunk*_blockalign;
39
+ pkt.data=_buffer+_head;
40
41
- *nbOut=0;
42
- // Shrink
43
- if(_head && (_tail+nbIn)*3>ADMWA_BUF*2)
44
- {
45
- memmove(_buffer,_buffer+_head,_tail-_head);
46
- _tail-=_head;
47
- _head=0;
48
- }
49
- //
50
- ADM_assert(nbIn+_tail<ADMWA_BUF);
51
- memcpy(_buffer+_tail,inptr,nbIn);
52
- _tail+=nbIn;
53
-
54
- AVPacket pkt;
55
- av_init_packet(&pkt);
56
- int nbChunk,out,gotData;
57
- while(_tail-_head>=_blockalign)
58
+ avcodec_send_packet(_context, &pkt);
59
+ // Regardless of the outcome, always consume the data.
60
+ _head+=nbChunk*_blockalign;
61
+
62
+ while(!res)
63
{
64
- nbChunk=(_tail-_head)/_blockalign;
65
- pkt.size=nbChunk*_blockalign;
66
- pkt.data=_buffer+_head;
67
-
68
- out=avcodec_decode_audio4(_context, _frame, &gotData, &pkt);
69
- if(out<0)
70
+ res=avcodec_receive_frame(_context, _frame);
71
+ if(res==AVERROR(EAGAIN)) break; // we need to send more input
72
+ if(res==AVERROR_EOF)
73
+ {
74
+ return 1;
75
+ }
76
+ if(res<0)
77
{
78
- ADM_warning( "[ADM_ad_lav] *** decoding error (%u)***\n",_blockalign);
79
- _head+=1; // Try skipping some bytes
80
- continue;
81
+ char er[2048]={0};
82
+ av_make_error_string(er, sizeof(er)-1, res);
83
+ ADM_warning("[ADM_ad_lav] decoding error: %s\n",er);
84
+ return 1;
85
}
86
- _head+=out; // consumed bytes
87
- if(!gotData)
88
- continue;
89
+
90
bool invalid=false;
91
int toCheck=1;
92
if(_context->sample_fmt==AV_SAMPLE_FMT_FLTP || _context->sample_fmt==AV_SAMPLE_FMT_S32P)
93
toCheck=channels;
94
-
95
96
for(int i=0;i<toCheck;i++)
97
{
98
99
}
100
}
101
if(invalid)
102
- continue;
103
+ break;
104
switch(_context->sample_fmt)
105
{
106
- case AV_SAMPLE_FMT_FLT: decodeToFloat(&outptr,nbOut);break;
107
- case AV_SAMPLE_FMT_FLTP: decodeToFloatPlanar(&outptr,nbOut);break;
108
- case AV_SAMPLE_FMT_S32P: decodeToS32Planar(&outptr,nbOut);break;
109
- case AV_SAMPLE_FMT_S32: decodeToS32(&outptr,nbOut);break;
110
-
111
- default:
112
- ADM_info("Decoder created using ??? %d...\n",_context->sample_fmt);
113
- ADM_assert(0);
114
- break;
115
+ case AV_SAMPLE_FMT_FLT: decodeToFloat(&outptr,nbOut);break;
116
+ case AV_SAMPLE_FMT_FLTP: decodeToFloatPlanar(&outptr,nbOut);break;
117
+ case AV_SAMPLE_FMT_S32P: decodeToS32Planar(&outptr,nbOut);break;
118
+ case AV_SAMPLE_FMT_S32: decodeToS32(&outptr,nbOut);break;
119
+ default:
120
+ ADM_info("Decoder created using ??? %d...\n",_context->sample_fmt);
121
+ ADM_assert(0);
122
+ break;
123
}
124
}
125
+ }
126
127
if(!sbrChecked)
128
{
129
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
89
1
2
bool AUDMEncoder_Lavcodec::lastBlock(AVPacket *pkt,int &encoded)
3
{
4
int gotPacket;
5
- int nbout=avcodec_encode_audio2(CONTEXT, pkt,NULL,&gotPacket);
6
- if(nbout<0)
7
- {
8
- printError("Encoding lastBlock",nbout);
9
- return false;
10
- }
11
- if(gotPacket)
12
- encoded=pkt->size;
13
- return true;
14
+ int er=avcodec_encode_audio2(CONTEXT, pkt,NULL,&gotPacket);
15
+ if(er<0)
16
+ {
17
+ printError("Encoding lastBlock",er);
18
+ return false;
19
+ }
20
+ if(gotPacket)
21
+ encoded=pkt->size;
22
+ return true;
23
}
24
25
/**
26
27
printError("Fill audio",er);
28
return false;
29
}
30
-
31
- int nbout = avcodec_encode_audio2(CONTEXT, &pkt,_frame,&gotPacket);
32
- if(nbout>=0 && gotPacket)
33
+
34
+ er = avcodec_encode_audio2(CONTEXT, &pkt,_frame,&gotPacket);
35
+ if(er<0)
36
{
37
- cprintf("Got %d bytes \n",pkt.size);
38
- encoded=pkt.size;
39
+ printError("Encoding",er);
40
+ return false;
41
}
42
- else
43
+ if(gotPacket)
44
{
45
- printError("Encoding",nbout);
46
- return false;
47
+ cprintf("Got %d bytes \n",pkt.size);
48
+ encoded=pkt.size;
49
}
50
return true;
51
}
52
53
*/
54
bool AUDMEncoder_Lavcodec::encode(uint8_t *dest, uint32_t *len, uint32_t *samples)
55
{
56
- uint32_t nbout;
57
int retries=16;
58
bool r;
59
int sz;
60
61
{
62
if(false==encodeBlock(0,dest,sz))
63
{
64
- ADM_warning("Error while flushing lame\n");
65
+ ADM_warning("Error flushing encoder\n");
66
return false;
67
}
68
*len=sz;
69
*samples=_chunk/channels;
70
- ADM_info("[Lav] Flushing, last block is %d bytes\n",nbout);
71
+ ADM_info("[Lav] Flushing, last block is %d bytes\n",sz);
72
return true;
73
}else
74
{
75
}
76
- ADM_info("[Lav] No data to flush\n",nbout);
77
+ ADM_info("[Lav] No data to flush\n");
78
return true;
79
}
80
}
81
82
*/
83
bool configure (CONFcouple **setup)
84
{
85
- int ret=0;
86
lav_encoder config=defaultConfig;
87
if(*setup)
88
{
89
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
27
1
2
uint32_t paddingLen;
3
int lengthTypeFlags,propertyFlags,multiplePayloadPresent;
4
int sequenceType,sequence,offsetLenType,replicaLenType,streamNumberLenType,mediaObjectNumberLenType;
5
-
6
+ int mediaObjectNumber, offset,replica,r;
7
+ int32_t remaining;
8
+ uint32_t payloadLen=0;
9
+ uint32_t keyframe;
10
+
11
12
13
packetStart=ftello(_fd);
14
15
packetLen=packetLen-paddingLen;
16
}
17
#endif
18
- int mediaObjectNumber, offset,replica,r;
19
- int32_t remaining;
20
- uint32_t payloadLen;
21
- uint32_t keyframe;
22
- // Multi payload
23
+ // Multi payload
24
if(multiplePayloadPresent)
25
{
26
uint8_t r=read8();
27
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
47
1
2
{
3
4
ADM_ebml_file ebml;
5
- uint64_t id,len;
6
+ uint64_t len;
7
uint64_t alen;
8
- ADM_MKV_TYPE type;
9
- const char *ss;
10
11
_timeBase=1000; // default value is 1 ms timebase (unit is in us)
12
_isvideopresent=0;
13
14
int bumped=0;
15
for(int i=1;i<last;i++)
16
{
17
- uint64_t pts,dts;
18
+ uint64_t pts;
19
pts=vid->index[i].Pts;
20
lastDts+=increment; // This frame dts with no correction
21
if(pts==ADM_NO_PTS)
22
23
double dHalf=(500000.*(double)num)/((double)den);
24
int half=dHalf-1; // half interval in us
25
int first=0;
26
- int bad=0;
27
- int good=0;
28
while( track->index[first].Pts==ADM_NO_PTS && first<nb) first++; // we should have some at least
29
uint64_t zero= track->index[first].Pts;
30
ADM_info("Num=%d Den=%d half=%d zero=%d first=%d\n",num,den,half,(int)zero,first);
31
32
* @param hd
33
* @return
34
*/
35
+#if 0
36
static int xypheLacingRead(uint8_t **hd)
37
{
38
int x=0;
39
40
*hd=p;
41
return x;
42
}
43
+#endif
44
/**
45
\fn mkreformatVorbisHeader
46
\brief reformat oggvorbis header to avidemux style
47
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
11
1
2
//***************** Audio tracks *****************
3
if(entry.trackType==2 && _nbAudioTrack<ADM_MKV_MAX_TRACKS)
4
{
5
- uint32_t streamIndex;
6
- mkvTrak *t=&(_tracks[1+_nbAudioTrack]);
7
+ mkvTrak *t=&(_tracks[1+_nbAudioTrack]);
8
t->extraDataLen=entry.extraDataLen;
9
ADM_info("This track has %d bytes of extradata\n",t->extraDataLen);
10
// MS/ACM : ACMX
11
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
61
1
2
*/
3
uint8_t mkvHeader::videoIndexer(ADM_ebml_file *parser)
4
{
5
- uint64_t fileSize,len,bsize;
6
- uint32_t alen,vlen;
7
- uint64_t id;
8
+ uint64_t len,id;
9
ADM_MKV_TYPE type;
10
const char *ss;
11
12
13
*/
14
uint8_t mkvHeader::indexBlock(ADM_ebml_file *parser,uint32_t len,uint32_t clusterTimeCodeMs)
15
{
16
- int lacing,nbLaces,entryFlags=0;
17
+ int entryFlags=0;
18
//
19
uint64_t tail=parser->tell()+len;
20
// Read Track id
21
22
//if(!track) printf("TC: %d\n",timecode);
23
uint8_t flags=parser->readu8();
24
25
- lacing=((flags>>1)&3);
26
+ //int lacing=((flags>>1)&3);
27
28
addIndexEntry(track,parser,blockBegin,tail-blockBegin,entryFlags,clusterTimeCodeMs+timecode);
29
parser->seek(tail);
30
31
parser->readBin(readBuffer+rpt,size-3);
32
// Search the frame type...
33
34
- uint32_t nb,vopType,timeinc=16;
35
+ uint32_t nb,timeinc=16;
36
ADM_vopS vops[10];
37
vops[0].type=AVI_KEY_FRAME;
38
ADM_searchVop(readBuffer,readBuffer+rpt+size-3,&nb,vops, &timeinc);
39
40
parser->readBin(readBuffer+rpt,size-3);
41
uint8_t *begin=readBuffer;
42
uint8_t *end=readBuffer+size-3+rpt;
43
- uint32_t flags=0;
44
while(begin<end)
45
{
46
int code=mkvFindStartCode(begin,end);
47
48
*/
49
uint8_t mkvHeader::indexClusters(ADM_ebml_file *parser)
50
{
51
- uint64_t fileSize,len,bsize;
52
+ uint64_t fileSize,len;
53
uint64_t alen,vlen;
54
uint64_t id;
55
ADM_MKV_TYPE type;
56
const char *ss;
57
- uint64_t time;
58
uint64_t pos;
59
uint8_t res=1;
60
61
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
9
1
2
3
uint8_t MP4Header::getExtraHeaderData(uint32_t *len, uint8_t **data)
4
{
5
-uint32_t old;
6
*len=0;*data=NULL;
7
if(_tracks[0].extraDataSize)
8
{
9
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
13
1
2
int lookupIndex(int desc) ;
3
bool parseTrun(int trackNo,adm_atom &son,const mp4TrafInfo &info);
4
uint8_t decodeVideoAtom(void *ztom);
5
- uint8_t parseMdia(void *ztom,uint32_t *trackType,uint32_t w, uint32_t h);
6
+ uint8_t parseMdia(void *ztom,uint32_t *trackType);
7
uint8_t parseEdts(void *ztom,uint32_t trackType);
8
- uint8_t parseStbl(void *ztom,uint32_t trackType,uint32_t w,uint32_t h,uint32_t trackScale);
9
+ uint8_t parseStbl(void *ztom,uint32_t trackType,uint32_t trackScale);
10
uint8_t decodeEsds(void *ztom,uint32_t trackType);
11
uint8_t updateCtts(MPsampleinfo *info );
12
bool refineFps(void);
13
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
2197
1
2
\fn LookupMainAtoms
3
\brief Search main atoms to ease job for other part
4
*/
5
-uint8_t MP4Header::lookupMainAtoms(void *ztom)
6
+uint8_t MP4Header::lookupMainAtoms(void *ztom)
7
{
8
+ adm_atom *tom=(adm_atom *)ztom;
9
+ adm_atom *moov,*moof=NULL;
10
+ bool success=true;
11
+ ADMAtoms id;
12
+ uint32_t container;
13
+
14
+ ADM_info("Analyzing file and atoms\n");
15
16
- adm_atom *tom=(adm_atom *)ztom;
17
- adm_atom *moov,*moof=NULL;
18
- bool success=true;
19
- ADMAtoms id;
20
- uint32_t container;
21
- ADM_info("Analyzing file and atoms\n");
22
-
23
- if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOV,&moov))
24
- {
25
- ADM_warning("Cannot locate moov atom\n");
26
- return 0;
27
- }
28
- ADM_assert(moov);
29
- while(!moov->isDone())
30
- {
31
- adm_atom son(moov);
32
- if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
33
+ if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOV,&moov))
34
{
35
- aprintf("[Lookup]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
36
+ ADM_warning("Cannot locate moov atom\n");
37
+ return 0;
38
}
39
- else
40
+ ADM_assert(moov);
41
+ while(!moov->isDone())
42
{
43
- switch( id)
44
- {
45
- case ADM_MP4_MVHD: parseMvhd(&son);break;
46
- case ADM_MP4_TRACK:
47
- if(!parseTrack(&son))
48
+ adm_atom son(moov);
49
+ if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
50
+ {
51
+ aprintf("[Lookup]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
52
+ }else
53
+ {
54
+ switch(id)
55
{
56
- ADM_info("Parse Track failed\n");
57
- success=false;
58
- } ;
59
- break;
60
- default :
61
- aprintf("atom %s not handled\n",fourCC::tostringBE(son.getFCC()));
62
- break;
63
- }
64
-
65
-
66
+ case ADM_MP4_MVHD: parseMvhd(&son);break;
67
+ case ADM_MP4_TRACK:
68
+ if(!parseTrack(&son))
69
+ {
70
+ ADM_info("Parse Track failed\n");
71
+ success=false;
72
+ }
73
+ break;
74
+ default:
75
+ aprintf("atom %s not handled\n",fourCC::tostringBE(son.getFCC()));
76
+ break;
77
+ }
78
+ }
79
+ son.skipAtom();
80
}
81
- son.skipAtom();
82
- }
83
- delete moov;
84
- if(!success)
85
- {
86
- if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof))
87
+ delete moov;
88
+ if(!success)
89
{
90
- ADM_info("Cannot find all needed atoms\n");
91
- }else
92
- {
93
- ADM_info("It is a Dash/fragmented file\n");
94
- _flavor=Mp4Dash;
95
- int moofFound=1;
96
- while(1)
97
- {
98
- parseMoof(*moof);
99
- delete moof;
100
- moof=NULL;
101
- if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof))
102
- {
103
- break;
104
- }
105
- moofFound++;
106
- }
107
- ADM_info("Found %d fragments\n",moofFound);
108
- }
109
- }
110
-
111
- ADM_info("Done finding main atoms\n");
112
- return success;
113
+ if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof))
114
+ {
115
+ ADM_info("Cannot find all needed atoms\n");
116
+ }else
117
+ {
118
+ ADM_info("It is a Dash/fragmented file\n");
119
+ _flavor=Mp4Dash;
120
+ int moofFound=1;
121
+ while(1)
122
+ {
123
+ parseMoof(*moof);
124
+ delete moof;
125
+ moof=NULL;
126
+ if(!ADM_mp4SimpleSearchAtom(tom, ADM_MP4_MOOF,&moof))
127
+ {
128
+ break;
129
+ }
130
+ moofFound++;
131
+ }
132
+ ADM_info("Found %d fragments\n",moofFound);
133
+ }
134
+ }
135
+
136
+ ADM_info("Done finding main atoms\n");
137
+ return success;
138
}
139
/**
140
- \fn parseMvhd
141
- \brief Parse mvhd header
142
+ \fn parseMvhd
143
+ \brief Parse mvhd header
144
*/
145
void MP4Header::parseMvhd(void *ztom)
146
{
147
adm_atom *tom = (adm_atom*)ztom;
148
int version = tom->read();
149
150
- tom->skipBytes(3); // flags
151
+ tom->skipBytes(3); // flags
152
153
if (version == 1)
154
tom->skipBytes(16);
155
156
*/
157
uint8_t MP4Header::parseTrack(void *ztom)
158
{
159
- adm_atom *tom=(adm_atom *)ztom;
160
- ADMAtoms id;
161
- uint32_t container;
162
- uint32_t w,h;
163
- uint32_t trackType=TRACK_OTHER;
164
- _currentDelay=0;
165
- _currentStartOffset=0;
166
- ADM_info("Parsing Track\n");
167
- while(!tom->isDone())
168
- {
169
- adm_atom son(tom);
170
- if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
171
- {
172
- aprintf("[Track]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
173
- son.skipAtom();
174
- continue;
175
- }
176
- aprintf("\tProcessing atom %s \n",fourCC::tostringBE(son.getFCC()));
177
- switch(id)
178
- {
179
- case ADM_MP4_TKHD:
180
- {
181
- int version = son.read();
182
-
183
- son.skipBytes(3);
184
-
185
- if (version == 1)
186
- tom->skipBytes(16);
187
- else
188
- tom->skipBytes(8);
189
-
190
- aprintf("Track Id: %" PRIu32"\n", son.read32());
191
- son.skipBytes(4);
192
-
193
- uint64_t duration = (version == 1) ? son.read64() : son.read32();
194
-
195
- aprintf( "Duration: %" PRIu32" (ms)\n", (duration * 1000) / _videoScale);
196
- son.skipBytes(8);
197
- son.skipBytes(8);
198
- son.skipBytes(36);
199
-
200
- w = son.read32() >> 16;
201
- h = son.read32() >> 16;
202
-
203
- aprintf("tkhd: %ld %ld\n", w, h);
204
- break;
205
- }
206
- case ADM_MP4_MDIA:
207
+ adm_atom *tom=(adm_atom *)ztom;
208
+ ADMAtoms id;
209
+ uint32_t container;
210
+ uint32_t w,h;
211
+ uint32_t trackType=TRACK_OTHER;
212
+ _currentDelay=0;
213
+ _currentStartOffset=0;
214
+
215
+ ADM_info("Parsing Track\n");
216
+ while(!tom->isDone())
217
+ {
218
+ adm_atom son(tom);
219
+ if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
220
{
221
- if(!parseMdia(&son,&trackType,w,h))
222
- return false;
223
- break;
224
+ aprintf("[Track]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
225
+ son.skipAtom();
226
+ continue;
227
}
228
- case ADM_MP4_EDTS:
229
+ aprintf("\tProcessing atom %s \n",fourCC::tostringBE(son.getFCC()));
230
+ switch(id)
231
{
232
- ADM_info("EDTS atom found\n");
233
- parseEdts(&son,trackType);
234
- break;
235
+ case ADM_MP4_TKHD:
236
+ {
237
+ int version = son.read();
238
+
239
+ son.skipBytes(3);
240
+
241
+ if(version == 1)
242
+ tom->skipBytes(16);
243
+ else
244
+ tom->skipBytes(8);
245
+
246
+ aprintf("Track Id: %" PRIu32"\n", son.read32());
247
+ son.skipBytes(4);
248
+
249
+ uint64_t duration = (version == 1) ? son.read64() : son.read32();
250
+
251
+ aprintf( "Duration: %" PRIu32" (ms)\n", (duration * 1000) / _videoScale);
252
+ son.skipBytes(8);
253
+ son.skipBytes(8);
254
+ son.skipBytes(36);
255
+
256
+ w = son.read32() >> 16;
257
+ h = son.read32() >> 16;
258
+
259
+ aprintf("tkhd: %ld %ld\n", w, h);
260
+ break;
261
+ }
262
+ case ADM_MP4_MDIA:
263
+ {
264
+ if(!parseMdia(&son,&trackType))
265
+ return false;
266
+ break;
267
+ }
268
+ case ADM_MP4_EDTS:
269
+ {
270
+ ADM_info("EDTS atom found\n");
271
+ parseEdts(&son,trackType);
272
+ break;
273
+ }
274
+ default:
275
+ ADM_info("Unprocessed atom :%s\n",fourCC::tostringBE(son.getFCC()));
276
}
277
- default:
278
- ADM_info("Unprocessed atom :%s\n",fourCC::tostringBE(son.getFCC()));
279
- }
280
- son.skipAtom();
281
- }
282
- return 1;
283
+ son.skipAtom();
284
+ }
285
+ return 1;
286
}
287
/**
288
\fn parseMdia
289
\brief Parse mdia header
290
*/
291
-uint8_t MP4Header::parseMdia(void *ztom,uint32_t *trackType,uint32_t w, uint32_t h)
292
+uint8_t MP4Header::parseMdia(void *ztom,uint32_t *trackType)
293
{
294
- adm_atom *tom=(adm_atom *)ztom;
295
- ADMAtoms id;
296
- uint32_t container;
297
- uint32_t trackScale=_videoScale;
298
- uint64_t trackDuration;
299
- *trackType=TRACK_OTHER;
300
- uint8_t r=0;
301
- ADM_info("<<Parsing Mdia>>\n");
302
- while(!tom->isDone())
303
- {
304
- adm_atom son(tom);
305
- if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
306
- {
307
- aprintf("[MDIA]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
308
- son.skipAtom();
309
- continue;
310
- }
311
- switch(id)
312
- {
313
- case ADM_MP4_MDHD:
314
- {
315
- int version = son.read();
316
-
317
- son.skipBytes(3); // flags
318
-
319
- if (version == 1)
320
- son.skipBytes(16);
321
- else
322
- son.skipBytes(8);
323
-
324
- trackScale = son.read32();
325
-
326
- aprintf( "MDHD, Trackscale in mdhd: %u\n", trackScale);
327
-
328
- if (!trackScale)
329
- trackScale = 600; // default
330
-
331
- uint64_t duration = (version == 1) ? son.read64() : son.read32();
332
-
333
- aprintf( "MDHD, duration in mdhd: %u (unscaled)\n", duration);
334
- duration = (duration * 1000.) / trackScale;
335
- aprintf( "MDHD, duration in mdhd: %u (scaled ms)\n", duration);
336
- trackDuration = duration;
337
-// printf("MDHD, Track duration: %s, trackScale: %u\n", ms2timedisplay((1000 * duration) / trackScale), trackScale);
338
-
339
- break;
340
- }
341
- case ADM_MP4_HDLR:
342
- {
343
- uint32_t type;
344
+ adm_atom *tom=(adm_atom *)ztom;
345
+ ADMAtoms id;
346
+ uint32_t container;
347
+ uint32_t trackScale=_videoScale;
348
+ uint64_t trackDuration=0;
349
+ *trackType=TRACK_OTHER;
350
+ uint8_t r=0;
351
+
352
+ ADM_info("<<Parsing Mdia>>\n");
353
+
354
+ while(!tom->isDone())
355
+ {
356
+ adm_atom son(tom);
357
+ if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
358
+ {
359
+ aprintf("[MDIA]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
360
+ son.skipAtom();
361
+ continue;
362
+ }
363
+ switch(id)
364
+ {
365
+ case ADM_MP4_MDHD:
366
+ {
367
+ int version = son.read();
368
+
369
+ son.skipBytes(3); // flags
370
+
371
+ if(version == 1)
372
+ son.skipBytes(16);
373
+ else
374
+ son.skipBytes(8);
375
+
376
+ trackScale = son.read32();
377
+
378
+ aprintf( "MDHD, Trackscale in mdhd: %u\n", trackScale);
379
+
380
+ if(!trackScale)
381
+ trackScale = 600; // default
382
+
383
+ uint64_t duration = (version == 1) ? son.read64() : son.read32();
384
+
385
+ aprintf( "MDHD, duration in mdhd: %u (unscaled)\n", duration);
386
+ duration = (duration * 1000.) / trackScale;
387
+ aprintf( "MDHD, duration in mdhd: %u (scaled ms)\n", duration);
388
+ trackDuration = duration;
389
+ //printf("MDHD, Track duration: %s, trackScale: %u\n", ms2timedisplay((1000 * duration) / trackScale), trackScale);
390
+
391
+ break;
392
+ }
393
+ case ADM_MP4_HDLR:
394
+ {
395
+ uint32_t type;
396
397
son.read32();
398
son.read32();
399
400
printf("[HDLR]\n");
401
switch(type)
402
{
403
- default:
404
- *trackType=TRACK_OTHER;
405
- ADM_info("Found other type track\n");
406
- break;
407
- case MKFCCR('v','i','d','e')://'vide':
408
+ default:
409
+ *trackType=TRACK_OTHER;
410
+ ADM_info("Found other type track\n");
411
+ break;
412
+ case MKFCCR('v','i','d','e'): // 'vide'
413
*trackType=TRACK_VIDEO;
414
_tracks[0].delay=_currentDelay;
415
_tracks[0].startOffset=_currentStartOffset;
416
417
_videoScale=trackScale;
418
_tracks[0].scale=_videoScale;
419
break;
420
- case MKFCCR('s','o','u','n'): //'soun':
421
+ case MKFCCR('s','o','u','n'): // 'soun'
422
_tracks[1+nbAudioTrack].delay=_currentDelay;
423
_tracks[1+nbAudioTrack].startOffset=_currentStartOffset;
424
*trackType=TRACK_AUDIO;
425
ADM_info("hdlr audio found \n ");
426
break;
427
- case MKFCCR('u','r','l',' ')://'url ':
428
+ case MKFCCR('u','r','l',' '): // 'url '
429
{
430
int s;
431
son.read32();
432
433
str[s]=0;
434
ADM_info("Url : <%s>\n",str);
435
delete [] str;
436
- }
437
- break;
438
-
439
+ break;
440
+ }
441
}
442
break;
443
- }
444
- case ADM_MP4_MINF:
445
- {
446
- // We are only interested in stbl
447
-
448
- while(!son.isDone())
449
+ }
450
+ case ADM_MP4_MINF:
451
{
452
- adm_atom grandson(&son);
453
- if(!ADM_mp4SearchAtomName(grandson.getFCC(), &id,&container))
454
- {
455
- aprintf("[MINF]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
456
- grandson.skipAtom();
457
- continue;
458
- }
459
- if(id==ADM_MP4_STBL)
460
- {
461
- if(! parseStbl(&grandson,*trackType, w, h,trackScale))
462
- {
463
- ADM_info("STBL failed\n");
464
- return 0;
465
- }
466
- r=1;
467
- }
468
- grandson.skipAtom();
469
+ // We are only interested in stbl
470
+ while(!son.isDone())
471
+ {
472
+ adm_atom grandson(&son);
473
+ if(!ADM_mp4SearchAtomName(grandson.getFCC(), &id,&container))
474
+ {
475
+ aprintf("[MINF]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
476
+ grandson.skipAtom();
477
+ continue;
478
+ }
479
+ if(id==ADM_MP4_STBL)
480
+ {
481
+ if(!parseStbl(&grandson,*trackType,trackScale))
482
+ {
483
+ ADM_info("STBL failed\n");
484
+ return 0;
485
+ }
486
+ r=1;
487
+ }
488
+ grandson.skipAtom();
489
+ }
490
+ break;
491
+ }
492
+ default:
493
+ aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC()));
494
}
495
- }
496
- break;
497
- default:
498
- aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC()));
499
- }
500
-
501
- son.skipAtom();
502
- }
503
- return r;
504
+ son.skipAtom();
505
+ }
506
+ return r;
507
}
508
/**
509
* \fn parseElst
510
511
{
512
if(1==version)
513
{
514
- editDuration[i]=(int64_t)tom->read64();
515
- mediaTime[i]=(int64_t)tom->read64();
516
+ editDuration[i]=(int64_t)tom->read64();
517
+ mediaTime[i]=(int64_t)tom->read64();
518
}else
519
{
520
- editDuration[i]=(int32_t)tom->read32();
521
- mediaTime[i]=(int32_t)tom->read32();
522
+ editDuration[i]=(int32_t)tom->read32();
523
+ mediaTime[i]=(int32_t)tom->read32();
524
}
525
- playbackSpeed=tom->read32();
526
- ADM_info("Duration : %d, mediaTime:%d speed=%d \n",(int)editDuration[i],(int)mediaTime[i],(int)playbackSpeed);
527
- }
528
-
529
+ playbackSpeed=tom->read32();
530
+ ADM_info("Duration : %d, mediaTime:%d speed=%d \n",(int)editDuration[i],(int)mediaTime[i],(int)playbackSpeed);
531
+ }
532
+
533
switch(nb)
534
{
535
- case 1:
536
- if(mediaTime[0]>0)
537
- {
538
- adv=mediaTime[0];
539
- }
540
- break;
541
- case 2:
542
- if(mediaTime[0]==-1)
543
- {
544
- dlay=editDuration[0];
545
- adv=mediaTime[1];
546
- }
547
- break;
548
- default:
549
- break;
550
+ case 1:
551
+ if(mediaTime[0]>0)
552
+ {
553
+ adv=mediaTime[0];
554
+ }
555
+ break;
556
+ case 2:
557
+ if(mediaTime[0]==-1)
558
+ {
559
+ dlay=editDuration[0];
560
+ adv=mediaTime[1];
561
+ }
562
+ break;
563
+ default:break;
564
}
565
ADM_info("delay = %" PRId64" in movie scale units, skip to time %" PRId64" in track scale units.\n",dlay,adv);
566
567
568
*/
569
uint8_t MP4Header::parseEdts(void *ztom,uint32_t trackType)
570
{
571
- adm_atom *tom=(adm_atom *)ztom;
572
- ADMAtoms id;
573
- uint32_t container;
574
-
575
- ADM_info("Parsing Edts, trackType=%d\n",trackType);
576
- while(!tom->isDone())
577
- {
578
- adm_atom son(tom);
579
- if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
580
- {
581
- aprintf("[EDTS]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
582
- son.skipAtom();
583
- continue;
584
- }
585
- switch(id)
586
+ adm_atom *tom=(adm_atom *)ztom;
587
+ ADMAtoms id;
588
+ uint32_t container;
589
+
590
+ ADM_info("Parsing Edts, trackType=%d\n",trackType);
591
+ while(!tom->isDone())
592
{
593
- case ADM_MP4_ELST:
594
- {
595
- ADM_info("ELST atom found\n");
596
- parseElst(&son,&_currentDelay,&_currentStartOffset);
597
- son.skipAtom();
598
- break;
599
-
600
- }
601
- break;
602
- default:
603
- aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC()));
604
- }
605
- }
606
-
607
- tom->skipAtom();
608
- return true;
609
+ adm_atom son(tom);
610
+ if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
611
+ {
612
+ aprintf("[EDTS]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
613
+ son.skipAtom();
614
+ continue;
615
+ }
616
+ switch(id)
617
+ {
618
+ case ADM_MP4_ELST:
619
+ {
620
+ ADM_info("ELST atom found\n");
621
+ parseElst(&son,&_currentDelay,&_currentStartOffset);
622
+ son.skipAtom();
623
+ break;
624
+ }
625
+ default:
626
+ aprintf("** atom NOT HANDLED [%s] \n",fourCC::tostringBE(son.getFCC()));
627
+ }
628
+ }
629
+
630
+ tom->skipAtom();
631
+ return 1;
632
}
633
/**
634
\fn parseStbl
635
\brief parse sample table. this is the most important function.
636
*/
637
-uint8_t MP4Header::parseStbl(void *ztom,uint32_t trackType,uint32_t w,uint32_t h,uint32_t trackScale)
638
+uint8_t MP4Header::parseStbl(void *ztom,uint32_t trackType,uint32_t trackScale)
639
{
640
- adm_atom *tom=(adm_atom *)ztom;
641
- ADMAtoms id;
642
- uint32_t container;
643
- MPsampleinfo info;
644
-
645
-
646
- memset(&info,0,sizeof(info));
647
-
648
-
649
- ADM_info("<<Parsing Stbl>>\n");
650
- while(!tom->isDone())
651
- {
652
- adm_atom son(tom);
653
- if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
654
- {
655
- aprintf("[STBL]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
656
- son.skipAtom();
657
- continue;
658
- }
659
- switch(id)
660
- {
661
- case ADM_MP4_STSS: // Sync sample atom (i.e. keyframes)
662
- {
663
- son.read32();
664
- info.nbSync=son.read32();
665
- ADM_info("Stss:%u\n",info.nbSync);
666
- if(info.nbSync)
667
- {
668
- info.Sync=new uint32_t[info.nbSync];
669
- for(int i=0;i<info.nbSync;i++)
670
- {
671
- info.Sync[i]=son.read32();
672
- }
673
- }
674
- break;
675
-
676
- }
677
- case ADM_MP4_STTS:
678
+ adm_atom *tom=(adm_atom *)ztom;
679
+ ADMAtoms id;
680
+ uint32_t container;
681
+ MPsampleinfo info;
682
+
683
+ ADM_info("<<Parsing Stbl>>\n");
684
+ while(!tom->isDone())
685
+ {
686
+ adm_atom son(tom);
687
+ if(!ADM_mp4SearchAtomName(son.getFCC(), &id,&container))
688
+ {
689
+ aprintf("[STBL]Found atom %s unknown\n",fourCC::tostringBE(son.getFCC()));
690
+ son.skipAtom();
691
+ continue;
692
+ }
693
+ switch(id)
694
+ {
695
+ case ADM_MP4_STSS: // Sync sample atom (i.e. keyframes)
696
+ {
697
+ son.read32();
698
+ info.nbSync=son.read32();
699
+ ADM_info("Stss:%u\n",info.nbSync);
700
+ if(info.nbSync)
701
+ {
702
+ info.Sync=new uint32_t[info.nbSync];
703
+ for(int i=0;i<info.nbSync;i++)
704
+ {
705
+ info.Sync[i]=son.read32();
706
+ }
707
+ }
708
+ break;
709
+ }
710
+ case ADM_MP4_STTS:
711
{
712
ADM_info("stts:%" PRIu32"\n",son.read32()); // version & flags
713
info.nbStts=son.read32();
714
715
//double dur;
716
for(int i=0;i<info.nbStts;i++)
717
{
718
-
719
- info.SttsN[i]=son.read32();
720
- info.SttsC[i]=son.read32();
721
- aprintf("stts: count:%u size:%u (unscaled)\n",info.SttsN[i],info.SttsC[i]);
722
- //dur*=1000.*1000.;; // us
723
- //dur/=myScale;
724
+ info.SttsN[i]=son.read32();
725
+ info.SttsC[i]=son.read32();
726
+ aprintf("stts: count:%u size:%u (unscaled)\n",info.SttsN[i],info.SttsC[i]);
727
+ //dur*=1000.*1000.;; // us
728
+ //dur/=myScale;
729
}
730
+ break;
731
}
732
- break;
733
- case ADM_MP4_STSC:
734
+ case ADM_MP4_STSC:
735
{
736
son.read32();
737
info.nbSc=son.read32();
738
739
info.Sn=new uint32_t[info.nbSc];
740
for(int j=0;j<info.nbSc;j++)
741
{
742
-
743
- info.Sc[j]=son.read32();
744
- info.Sn[j]=son.read32();
745
- son.read32();
746
- aprintf("\t sc %d : sc start:%u sc count: %u\n",j,info.Sc[j],info.Sn[j]);
747
+ info.Sc[j]=son.read32();
748
+ info.Sn[j]=son.read32();
749
+ son.read32();
750
+ aprintf("\t sc %d : sc start:%u sc count: %u\n",j,info.Sc[j],info.Sn[j]);
751
}
752
-
753
+ break;
754
}
755
- break;
756
- case ADM_MP4_STSZ:
757
- {
758
- uint32_t n;
759
- son.read32();
760
- n=son.read32();
761
- info.nbSz=son.read32();
762
- info.SzIndentical=0;
763
- ADM_info("%" PRIu32" frames /%" PRIu32" nbsz..\n",n,info.nbSz);
764
- if(n)
765
- {
766
- aprintf("\t\t%" PRIu32" frames of the same size %" PRIu32" , n=%" PRIu32"\n",
767
- info.nbSz,info.SzIndentical,n);
768
- info.SzIndentical=n;
769
- info.Sz=NULL;
770
- }
771
- else
772
- {
773
- info.Sz=new uint32_t[info.nbSz];
774
- for(int j=0;j<info.nbSz;j++)
775
- {
776
- info.Sz[j]=son.read32();
777
- }
778
- }
779
- }
780
- break;
781
- case ADM_MP4_CTTS: // Composition time to sample
782
+ case ADM_MP4_STSZ:
783
+ {
784
+ uint32_t n;
785
+ son.read32();
786
+ n=son.read32();
787
+ info.nbSz=son.read32();
788
+ info.SzIndentical=0;
789
+ ADM_info("%" PRIu32" frames /%" PRIu32" nbsz..\n",n,info.nbSz);
790
+ if(n)
791
+ {
792
+ aprintf("\t\t%" PRIu32" frames of the same size %" PRIu32" , n=%" PRIu32"\n",
793
+ info.nbSz,info.SzIndentical,n);
794
+ info.SzIndentical=n;
795
+ info.Sz=NULL;
796
+ }else
797
+ {
798
+ info.Sz=new uint32_t[info.nbSz];
799
+ for(int j=0;j<info.nbSz;j++)
800
+ {
801
+ info.Sz[j]=son.read32();
802
+ }
803
+ }
804
+ break;
805
+ }
806
+ case ADM_MP4_CTTS: // Composition time to sample
807
{
808
- uint32_t n,i,j,k,v;
809
+ uint32_t n,i,k;
810
811
- ADM_info("ctts:%" PRIu32"\n",son.read32()); // version & flags
812
- n=son.read32();
813
- if(n==1) // all the same , ignore
814
- {
815
+ ADM_info("ctts:%" PRIu32"\n",son.read32()); // version & flags
816
+ n=son.read32();
817
+ if(n==1) // all the same , ignore
818
+ {
819
break;
820
- }
821
- aprintf("Found %d ctts elements\n",n);
822
+ }
823
+ aprintf("Found %d ctts elements\n",n);
824
uint32_t *values=new uint32_t [n];
825
uint32_t *count=new uint32_t [n];
826
for(i=0;i<n;i++)
827
828
}
829
ADM_assert(info.nbCtts<sum+1);
830
ADM_info("Found %u elements\n",info.nbCtts);
831
+ break;
832
}
833
- break;
834
- case ADM_MP4_STCO:
835
- {
836
- son.skipBytes(4);
837
-
838
- info.nbCo = son.read32();
839
- ADM_info("\t\tnbCo: %u\n", info.nbCo);
840
-
841
- info.Co = new uint64_t[info.nbCo];
842
-
843
- for(int j = 0; j < info.nbCo; j++)
844
- {
845
- info.Co[j] = son.read32();
846
- aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]);
847
- }
848
- }
849
- break;
850
- case ADM_MP4_STCO64:
851
- {
852
- son.skipBytes(4);
853
-
854
- info.nbCo = son.read32();
855
- ADM_info("\t\tnbCo: %u\n", info.nbCo);
856
-
857
- info.Co = new uint64_t[info.nbCo];
858
-
859
- for(int j = 0; j< info.nbCo; j++)
860
- {
861
- info.Co[j] = son.read64();
862
- aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]);
863
- }
864
- }
865
- break;
866
- case ADM_MP4_STSD:
867
- {
868
+ case ADM_MP4_STCO:
869
+ {
870
+ son.skipBytes(4);
871
+
872
+ info.nbCo = son.read32();
873
+ ADM_info("\t\tnbCo: %u\n", info.nbCo);
874
+
875
+ info.Co = new uint64_t[info.nbCo];
876
+
877
+ for(int j = 0; j < info.nbCo; j++)
878
+ {
879
+ info.Co[j] = son.read32();
880
+ aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]);
881
+ }
882
+ break;
883
+ }
884
+ case ADM_MP4_STCO64:
885
+ {
886
+ son.skipBytes(4);
887
+
888
+ info.nbCo = son.read32();
889
+ ADM_info("\t\tnbCo: %u\n", info.nbCo);
890
+
891
+ info.Co = new uint64_t[info.nbCo];
892
+
893
+ for(int j = 0; j< info.nbCo; j++)
894
+ {
895
+ info.Co[j] = son.read64();
896
+ aprintf( "Chunk offset: %u / %u : %" PRIu64"\n", j, info.nbCo - 1, info.Co[j]);
897
+ }
898
+ break;
899
+ }
900
+ case ADM_MP4_STSD:
901
+ {
902
son.read32(); // flags & version
903
int nbEntries=son.read32();
904
int left;
905
aprintf("[STSD]Found %d entries\n",nbEntries);
906
for(int i=0;i<nbEntries;i++)
907
{
908
- int entrySize=son.read32();
909
- int entryName=son.read32();
910
- left=entrySize-8;
911
- if(i || (trackType==TRACK_VIDEO && _videoFound) || (trackType==TRACK_OTHER))
912
- {
913
- son.skipBytes(left);
914
- ADM_info("[STSD] ignoring %s, size %u\n",fourCC::tostringBE(entryName),entrySize);
915
- if(trackType==TRACK_OTHER) ADM_info("[STSD] because track=other\n");
916
- continue;
917
- }
918
- switch(trackType)
919
- {
920
- case TRACK_VIDEO:
921
- {
922
- uint32_t lw=0,lh=0;
923
- ADM_info("[STSD] VIDEO %s, size %u\n",fourCC::tostringBE(entryName),entrySize);
924
- son.skipBytes(8); // reserved etc..
925
- left-=8;
926
- son.read32(); // version/revision
927
- left-=4;
928
- printf("[STSD] vendor %s\n",fourCC::tostringBE(son.read32()));
929
- left-=4;
930
-
931
- son.skipBytes(8); // spatial qual etc..
932
- left-=8;
933
-
934
- printf("[STSD] width :%u\n",lw=son.read16());
935
- printf("[STSD] height :%u\n",lh=son.read16());
936
- left-=4;
937
-
938
- son.skipBytes(8); // Resolution
939
- left-=8;
940
-
941
- printf("[STSD] datasize :%u\n",son.read32());
942
- left-=4;
943
-
944
- printf("[STSD] FrameCount :%u\n",son.read16());
945
- left-=4;
946
-
947
- // Codec name
948
- uint32_t u32=son.read();
949
- if(u32>31) u32=31;
950
- printf("Codec string :%d <",u32);
951
- for(int i=0;i<u32;i++) printf("%c",son.read());
952
- printf(">\n");
953
- son.skipBytes(32-1-u32);
954
- left-=32;
955
- //
956
- if(left>=4)
957
- {
958
- son.read32();
959
- left-=4; //Depth & color Id
960
- }else left=0;
961
- //
962
- printf("LEFT:%d\n",left);
963
+ int entrySize=son.read32();
964
+ int entryName=son.read32();
965
+ left=entrySize-8;
966
+ if(i || (trackType==TRACK_VIDEO && _videoFound) || (trackType==TRACK_OTHER))
967
+ {
968
+ son.skipBytes(left);
969
+ ADM_info("[STSD] ignoring %s, size %u\n",fourCC::tostringBE(entryName),entrySize);
970
+ if(trackType==TRACK_OTHER) ADM_info("[STSD] because track=other\n");
971
+ continue;
972
+ }
973
+ switch(trackType)
974
+ {
975
+ case TRACK_VIDEO:
976
+ {
977
+ uint32_t lw=0,lh=0;
978
+ ADM_info("[STSD] VIDEO %s, size %u\n",fourCC::tostringBE(entryName),entrySize);
979
+ son.skipBytes(8); // reserved etc..
980
+ left-=8;
981
+ son.read32(); // version/revision
982
+ left-=4;
983
+ printf("[STSD] vendor %s\n",fourCC::tostringBE(son.read32()));
984
+ left-=4;
985
+
986
+ son.skipBytes(8); // spatial qual etc..
987
+ left-=8;
988
+
989
+ printf("[STSD] width :%u\n",lw=son.read16());
990
+ printf("[STSD] height :%u\n",lh=son.read16());
991
+ left-=4;
992
+
993
+ son.skipBytes(8); // Resolution
994
+ left-=8;
995
+
996
+ printf("[STSD] datasize :%u\n",son.read32());
997
+ left-=4;
998
+
999
+ printf("[STSD] FrameCount :%u\n",son.read16());
1000
+ left-=4;
1001
+
1002
+ // Codec name
1003
+ uint32_t u32=son.read();
1004
+ if(u32>31) u32=31;
1005
+ printf("Codec string :%d <",u32);
1006
+ for(int i=0;i<u32;i++) printf("%c",son.read());
1007
+ printf(">\n");
1008
+ son.skipBytes(32-1-u32);
1009
+ left-=32;
1010
+
1011
+ if(left>=4)
1012
+ {
1013
+ son.read32();
1014
+ left-=4; // Depth & color Id
1015
+ }else left=0;
1016
+
1017
+ printf("LEFT:%d\n",left);
1018
1019
- if(left>8)
1020
+ //if(left>8)
1021
+ // decodeVideoAtom(&son);
1022
+
1023
+ _video_bih.biWidth=_mainaviheader.dwWidth=lw ;
1024
+ _video_bih.biHeight=_mainaviheader.dwHeight=lh;
1025
+ _video_bih.biCompression=_videostream.fccHandler;
1026
+
1027
+#define commonPart(x) _videostream.fccHandler=_video_bih.biCompression=fourCC::get((uint8_t *)#x);
1028
+ switch(entryName)
1029
+ {
1030
+ case MKFCCR('h','d','v','5'): // hdv5
1031
{
1032
-// decodeVideoAtom(&son);
1033
+ commonPart(MPEG);
1034
+ adm_atom hdv5(&son);
1035
+ printf("Reading hdv5, got %s\n",fourCC::tostringBE(hdv5.getFCC()));
1036
+ left=0;
1037
+
1038
+ break;
1039
}
1040
- //
1041
-#define commonPart(x) _videostream.fccHandler=_video_bih.biCompression=fourCC::get((uint8_t *)#x);
1042
+ case MKFCCR('m','j','p','b'): //mjpegb
1043
+ {
1044
+ commonPart(MJPB);
1045
+ left=0;
1046
1047
- _video_bih.biWidth=_mainaviheader.dwWidth=lw ;
1048
- _video_bih.biHeight=_mainaviheader.dwHeight=lh;
1049
- _video_bih.biCompression=_videostream.fccHandler;
1050
+ break;
1051
+ }
1052
+ case MKFCCR('S','V','Q','1'): //mjpegb
1053
+ {
1054
+ commonPart(SVQ1);
1055
+ left=0;
1056
1057
- //
1058
- switch(entryName)
1059
+ break;
1060
+ }
1061
+ case MKFCCR('m','j','p','a'): //mjpegb
1062
{
1063
- case MKFCCR('h','d','v','5'): // hdv5
1064
- {
1065
- commonPart(MPEG);
1066
- adm_atom hdv5(&son);
1067
- printf("Reading hdv5, got %s\n",fourCC::tostringBE(hdv5.getFCC()));
1068
-
1069
- left=0;
1070
- }
1071
+ commonPart(MJPG);
1072
+ left=0;
1073
+
1074
break;
1075
- case MKFCCR('m','j','p','b'): //mjpegb
1076
- {
1077
- commonPart(MJPB);
1078
- left=0;
1079
- }
1080
- break;
1081
- case MKFCCR('S','V','Q','1'): //mjpegb
1082
- {
1083
- commonPart(SVQ1);
1084
- left=0;
1085
- }
1086
- break;
1087
-
1088
- case MKFCCR('m','j','p','a'): //mjpegb
1089
- {
1090
- commonPart(MJPG);
1091
- left=0;
1092
- }
1093
- break;
1094
+ }
1095
case MKFCCR('s','2','6','3'): //s263 d263
1096
- {
1097
- commonPart(H263);
1098
- adm_atom d263(&son);
1099
- printf("Reading s253, got %s\n",fourCC::tostringBE(d263.getFCC()));
1100
- left=0;
1101
- }
1102
- break;
1103
- case MKFCCR('m','p','4','v'): //mp4v
1104
- {
1105
- commonPart(DIVX);
1106
- adm_atom esds(&son);
1107
- printf("Reading esds, got %s\n",fourCC::tostringBE(esds.getFCC()));
1108
- if(esds.getFCC()==MKFCCR('e','s','d','s'))
1109
- decodeEsds(&esds,TRACK_VIDEO);
1110
- left=0;
1111
- }
1112
- break;
1113
- case MKFCCR('S','V','Q','3'):
1114
- {//'SVQ3':
1115
+ {
1116
+ commonPart(H263);
1117
+ adm_atom d263(&son);
1118
+ printf("Reading s253, got %s\n",fourCC::tostringBE(d263.getFCC()));
1119
+ left=0;
1120
+
1121
+ break;
1122
+ }
1123
+ case MKFCCR('m','p','4','v'): //mp4v
1124
+ {
1125
+ commonPart(DIVX);
1126
+ adm_atom esds(&son);
1127
+ printf("Reading esds, got %s\n",fourCC::tostringBE(esds.getFCC()));
1128
+ if(esds.getFCC()==MKFCCR('e','s','d','s'))
1129
+ decodeEsds(&esds,TRACK_VIDEO);
1130
+ left=0;
1131
+
1132
+ break;
1133
+ }
1134
+ case MKFCCR('S','V','Q','3'):
1135
+ { //'SVQ3':
1136
// For SVQ3, the codec needs it to begin by SVQ3
1137
// We go back by 4 bytes to get the 4CC
1138
- printf("SVQ3 atom found\n");
1139
- VDEO.extraDataSize=left+4;
1140
- VDEO.extraData=new uint8_t[ VDEO.extraDataSize ];
1141
- if(!son.readPayload(VDEO.extraData+4,VDEO.extraDataSize-4 ))
1142
- {
1143
- GUI_Error_HIG(QT_TRANSLATE_NOOP("mp4demuxer","Problem reading SVQ3 headers"), NULL);
1144
- }
1145
- VDEO.extraData[0]='S';
1146
- VDEO.extraData[1]='V';
1147
- VDEO.extraData[2]='Q';
1148
- VDEO.extraData[3]='3';
1149
- printf("SVQ3 Header size : %" PRIu32"",_videoExtraLen);
1150
- commonPart(SVQ3);
1151
- left=0;
1152
- }
1153
- break;
1154
- case MKFCCR('d','v','c',' ') : //'dvc ':
1155
- case MKFCCR('d','v','c','p'): //'dvcp':
1156
- commonPart(DVSD);
1157
- break;
1158
- case MKFCCR('c','v','i','d'): //'cvid'
1159
- commonPart(cvid);
1160
- break;
1161
- case MKFCCR('h','2','6','3'): //'dv':
1162
- commonPart(H263);
1163
- break;
1164
- case MKFCCR('M','J','P','G'): //'jpeg':
1165
- case MKFCCR('j','p','e','g'): //'jpeg':
1166
- case MKFCCR('A','V','D','J'): //'jpeg':
1167
- commonPart(MJPG);
1168
- break;
1169
- case MKFCCR('A','V','d','n'): // DNxHD
1170
- commonPart(AVdn);
1171
- break;
1172
+ printf("SVQ3 atom found\n");
1173
+ VDEO.extraDataSize=left+4;
1174
+ VDEO.extraData=new uint8_t[ VDEO.extraDataSize ];
1175
+ if(!son.readPayload(VDEO.extraData+4,VDEO.extraDataSize-4 ))
1176
+ {
1177
+ GUI_Error_HIG(QT_TRANSLATE_NOOP("mp4demuxer","Problem reading SVQ3 headers"), NULL);
1178
+ }
1179
+ VDEO.extraData[0]='S';
1180
+ VDEO.extraData[1]='V';
1181
+ VDEO.extraData[2]='Q';
1182
+ VDEO.extraData[3]='3';
1183
+ printf("SVQ3 Header size : %" PRIu32"",_videoExtraLen);
1184
+ commonPart(SVQ3);
1185
+ left=0;
1186
+
1187
+ break;
1188
+ }
1189
+ case MKFCCR('d','v','c',' '): // 'dvc '
1190
+ case MKFCCR('d','v','c','p'): // 'dvcp'
1191
+ commonPart(DVSD);
1192
+ break;
1193
+
1194
+ case MKFCCR('c','v','i','d'): // 'cvid'
1195
+ commonPart(cvid);
1196
+ break;
1197
+
1198
+ case MKFCCR('h','2','6','3'): // 'dv':
1199
+ commonPart(H263);
1200
+ break;
1201
+
1202
+ case MKFCCR('M','J','P','G'): // 'jpeg'
1203
+ case MKFCCR('j','p','e','g'): // 'jpeg'
1204
+ case MKFCCR('A','V','D','J'): // 'jpeg'
1205
+ commonPart(MJPG);
1206
+ break;
1207
+
1208
+ case MKFCCR('A','V','d','n'): // DNxHD
1209
+ commonPart(AVdn);
1210
+ break;
1211
//
1212
- case MKFCCR('h','e','v','1'): // hev1 / hevc
1213
- case MKFCCR('h','v','c','1'): // hev1 / hevc
1214
- {
1215
- commonPart(H265);
1216
- while(!son.isDone())
1217
- {
1218
- adm_atom avcc(&son);
1219
- printf("Reading hev1, got %s\n",fourCC::tostringBE(avcc.getFCC()));
1220
- if( avcc.getFCC()== MKFCCR('h','v','c','C'))
1221
- {
1222
- VDEO.extraDataSize=avcc.getRemainingSize();
1223
- ADM_info("Found %d bytes of extradata \n",VDEO.extraDataSize);
1224
- VDEO.extraData=new uint8_t [VDEO.extraDataSize];
1225
- avcc.readPayload(VDEO.extraData,VDEO.extraDataSize);
1226
- mixDump(VDEO.extraData,VDEO.extraDataSize);
1227
- avcc.skipAtom();
1228
- }
1229
- } // while
1230
- son.skipAtom();
1231
- left=0;
1232
- }
1233
- break;
1234
+ case MKFCCR('h','e','v','1'): // hev1 / hevc
1235
+ case MKFCCR('h','v','c','1'): // hev1 / hevc
1236
+ {
1237
+ commonPart(H265);
1238
+ while(!son.isDone())
1239
+ {
1240
+ adm_atom avcc(&son);
1241
+ printf("Reading hev1, got %s\n",fourCC::tostringBE(avcc.getFCC()));
1242
+ if( avcc.getFCC()== MKFCCR('h','v','c','C'))
1243
+ {
1244
+ VDEO.extraDataSize=avcc.getRemainingSize();
1245
+ ADM_info("Found %d bytes of extradata \n",VDEO.extraDataSize);
1246
+ VDEO.extraData=new uint8_t [VDEO.extraDataSize];
1247
+ avcc.readPayload(VDEO.extraData,VDEO.extraDataSize);
1248
+ mixDump(VDEO.extraData,VDEO.extraDataSize);
1249
+ avcc.skipAtom();
1250
+ }
1251
+ } // while
1252
+ son.skipAtom();
1253
+ left=0;
1254
+
1255
+ break;
1256
+ }
1257
//
1258
- case MKFCCR('a','v','c','1'): // avc1
1259
- {
1260
- commonPart(H264);
1261
- // There is a avcC atom just after
1262
- // configuration data for h264
1263
-nextAtom:
1264
- adm_atom avcc(&son);
1265
- printf("Reading avcC, got %s\n",fourCC::tostringBE(avcc.getFCC()));
1266
- switch(avcc.getFCC())
1267
- {
1268
- case MKFCCR('a','v','c','C'): break;
1269
- default:
1270
- case MKFCCR('c','o','l','r'): // Color atom
1271
- case MKFCCR('p','a','s','p'):
1272
- case MKFCCR('c','l','a','p'):
1273
- avcc.skipAtom();
1274
- goto nextAtom;
1275
- break;
1276
- }
1277
- int len,offset;
1278
- VDEO.extraDataSize=avcc.getRemainingSize();
1279
- VDEO.extraData=new uint8_t [VDEO.extraDataSize];
1280
- avcc.readPayload(VDEO.extraData,VDEO.extraDataSize);
1281
- printf("avcC size:%d\n",VDEO.extraDataSize);
1282
- // Dump some info
1283
- #define MKD8(x) VDEO.extraData[x]
1284
- #define MKD16(x) ((MKD8(x)<<8)+MKD8(x+1))
1285
- #define MKD32(x) ((MKD16(x)<<16)+MKD16(x+2))
1286
-
1287
- printf("avcC Revision :%x\n", MKD8(0));
1288
- printf("avcC AVCProfileIndication :%x\n", MKD8(1));
1289
- printf("avcC profile_compatibility:%x\n", MKD8(2));
1290
- printf("avcC AVCLevelIndication :%x\n", MKD8(3));
1291
-
1292
- printf("avcC lengthSizeMinusOne :%x\n", MKD8(4));
1293
- printf("avcC NumSeq :%x\n", MKD8(5));
1294
- len=MKD16(6);
1295
- printf("avcC sequenceParSetLen :%x ",len );
1296
- offset=8;
1297
- mixDump(VDEO.extraData+offset,len);
1298
-
1299
- offset=8+len;
1300
- printf("avcC numOfPictureParSets :%x\n", MKD8(offset++));
1301
- len=MKD16(offset);
1302
- offset++;
1303
- printf("avcC Pic len :%x\n",len);
1304
- mixDump(VDEO.extraData+offset,len);
1305
- left=0;
1306
- }
1307
- break;
1308
- default:
1309
- if(left>10)
1310
- {
1311
- adm_atom avcc(&son);
1312
- printf("Reading , got %s\n",fourCC::tostringBE(avcc.getFCC()));
1313
- left=0;
1314
-
1315
- }
1316
- break;
1317
- } // Entry name
1318
- }
1319
- break;
1320
- case TRACK_AUDIO:
1321
- {
1322
- uint32_t channels,bpp,encoding,fq,packSize;
1323
-
1324
- // Put some defaults
1325
- ADIO.encoding=1234;
1326
- ADIO.frequency=44100;
1327
- ADIO.byterate=128000>>3;
1328
- ADIO.channels=2;
1329
- ADIO.bitspersample=16;
1330
-
1331
- printf("[STSD] AUDIO <%s>, 0x%08x, size %u\n",fourCC::tostringBE(entryName),entryName,entrySize);
1332
- son.skipBytes(8); // reserved etc..
1333
- left-=8;
1334
-
1335
- int atomVersion=son.read16(); // version
1336
- left-=2;
1337
- printf("[STSD]Revision :%d\n",atomVersion);
1338
- son.skipBytes(2); // revision
1339
- left-=2;
1340
-
1341
- printf("[STSD]Vendor : %s\n",fourCC::tostringBE(son.read32()));
1342
- left-=4;
1343
-
1344
- ADIO.channels=channels=son.read16(); // Channel
1345
- left-=2;
1346
- printf("[STSD]Channels :%d\n",ADIO.channels);
1347
- ADIO.bitspersample=bpp=son.read16(); // version/revision
1348
- left-=2;
1349
- printf("[STSD]Bit per sample :%d\n",bpp);
1350
-
1351
- encoding=son.read16(); // version/revision
1352
- left-=2;
1353
- printf("[STSD]Encoding :%d\n",encoding);
1354
-
1355
- packSize=son.read16(); // Packet Size
1356
- left-=2;
1357
- printf("[STSD]Packet size :%d\n",encoding);
1358
-
1359
-
1360
- fq=ADIO.frequency=son.read16();
1361
- printf("[STSD]Fq:%u\n",fq);
1362
- if(ADIO.frequency<6000) ADIO.frequency=48000;
1363
- printf("[STSD]Fq :%d\n",ADIO.frequency); // Bps
1364
- son.skipBytes(2); // Fixed point
1365
- left-=4;
1366
- printf("Bytes left : %d\n",left);
1367
- info.samplePerPacket=1;
1368
- info.bytePerPacket=1;
1369
- info.bytePerFrame=1;
1370
-
1371
- switch(atomVersion)
1372
+ case MKFCCR('a','v','c','1'): // avc1
1373
{
1374
- case 0:break;
1375
- case 1 :
1376
- {
1377
- info.samplePerPacket=son.read32();
1378
- info.bytePerPacket=son.read32();
1379
- info.bytePerFrame=son.read32();
1380
- #define ADM_NOT_NULL(x) if(!info.x) info.x=1;
1381
- printf("[STSD] Sample per packet %u\n",info.samplePerPacket);
1382
- printf("[STSD] Bytes per packet %u\n",info.bytePerPacket);
1383
- printf("[STSD] Bytes per frame %u\n",info.bytePerFrame);
1384
- printf("[STSD] Bytes per sample %u\n",son.read32());
1385
- ADM_NOT_NULL(samplePerPacket);
1386
- ADM_NOT_NULL(bytePerPacket);
1387
- ADM_NOT_NULL(bytePerFrame);
1388
-
1389
- left-=16;
1390
+ commonPart(H264);
1391
+ // There is a avcC atom just after
1392
+ // configuration data for h264
1393
+ while(!son.isDone())
1394
+ {
1395
+ adm_atom avcc(&son);
1396
+ printf("Reading avcC, got %s\n",fourCC::tostringBE(avcc.getFCC()));
1397
+ if(avcc.getFCC()!=MKFCCR('a','v','c','C'))
1398
+ {
1399
+ avcc.skipAtom();
1400
+ continue;
1401
}
1402
+
1403
+ int len,offset;
1404
+ VDEO.extraDataSize=avcc.getRemainingSize();
1405
+ VDEO.extraData=new uint8_t [VDEO.extraDataSize];
1406
+ avcc.readPayload(VDEO.extraData,VDEO.extraDataSize);
1407
+ printf("avcC size:%d\n",VDEO.extraDataSize);
1408
+ // Dump some info
1409
+#define MKD8(x) VDEO.extraData[x]
1410
+#define MKD16(x) ((MKD8(x)<<8)+MKD8(x+1))
1411
+#define MKD32(x) ((MKD16(x)<<16)+MKD16(x+2))
1412
+
1413
+ printf("avcC Revision :%x\n", MKD8(0));
1414
+ printf("avcC AVCProfileIndication :%x\n", MKD8(1));
1415
+ printf("avcC profile_compatibility:%x\n", MKD8(2));
1416
+ printf("avcC AVCLevelIndication :%x\n", MKD8(3));
1417
+
1418
+ printf("avcC lengthSizeMinusOne :%x\n", MKD8(4));
1419
+ printf("avcC NumSeq :%x\n", MKD8(5));
1420
+ len=MKD16(6);
1421
+ printf("avcC sequenceParSetLen :%x ",len );
1422
+ offset=8;
1423
+ mixDump(VDEO.extraData+offset,len);
1424
+
1425
+ offset=8+len;
1426
+ printf("avcC numOfPictureParSets :%x\n", MKD8(offset++));
1427
+ len=MKD16(offset);
1428
+ offset++;
1429
+ printf("avcC Pic len :%x\n",len);
1430
+ mixDump(VDEO.extraData+offset,len);
1431
break;
1432
+ } // while
1433
+ son.skipAtom();
1434
+ left=0;
1435
+
1436
+ break;
1437
+ } // avc1
1438
+ default:
1439
+ if(left>10)
1440
+ {
1441
+ adm_atom avcc(&son);
1442
+ printf("Reading , got %s\n",fourCC::tostringBE(avcc.getFCC()));
1443
+ left=0;
1444
+ }
1445
+ break;
1446
+ } // entryName
1447
+
1448
+ break;
1449
+ } // trackType
1450
+
1451
+ case TRACK_AUDIO:
1452
+ {
1453
+ uint32_t channels,bpp,encoding,fq,packSize;
1454
+
1455
+ // Put some defaults
1456
+ ADIO.encoding=1234;
1457
+ ADIO.frequency=44100;
1458
+ ADIO.byterate=128000>>3;
1459
+ ADIO.channels=2;
1460
+ ADIO.bitspersample=16;
1461
+
1462
+ printf("[STSD] AUDIO <%s>, 0x%08x, size %u\n",fourCC::tostringBE(entryName),entryName,entrySize);
1463
+ son.skipBytes(8); // reserved etc..
1464
+ left-=8;
1465
+
1466
+ int atomVersion=son.read16(); // version
1467
+ left-=2;
1468
+ printf("[STSD]Revision :%d\n",atomVersion);
1469
+ son.skipBytes(2); // Revision level
1470
+ left-=2;
1471
+
1472
+ printf("[STSD]Vendor : %s\n",fourCC::tostringBE(son.read32()));
1473
+ left-=4;
1474
+
1475
+ ADIO.channels=channels=son.read16(); // Number of channels
1476
+ left-=2;
1477
+ printf("[STSD]Channels :%d\n",ADIO.channels);
1478
+ ADIO.bitspersample=bpp=son.read16(); // Sample Size
1479
+ left-=2;
1480
+ printf("[STSD]Bit per sample :%d\n",bpp);
1481
+
1482
+ encoding=son.read16(); // Compression ID
1483
+ left-=2;
1484
+ printf("[STSD]Encoding :%d\n",encoding);
1485
+
1486
+ packSize=son.read16(); // Packet Size
1487
+ left-=2;
1488
+ printf("[STSD]Packet size :%d\n",packSize);
1489
+
1490
+ fq=ADIO.frequency=son.read16();
1491
+ printf("[STSD]Fq:%u\n",fq);
1492
+ if(ADIO.frequency<6000) ADIO.frequency=48000;
1493
+ printf("[STSD]Fq :%d\n",ADIO.frequency); // Sample rate
1494
+ son.skipBytes(2); // Fixed point
1495
+ left-=4;
1496
+ printf("Bytes left : %d\n",left);
1497
+ info.samplePerPacket=1;
1498
+ info.bytePerPacket=1;
1499
+ info.bytePerFrame=1;
1500
+
1501
+ switch(atomVersion)
1502
+ {
1503
+ case 0:break;
1504
+ case 1 :
1505
+ {
1506
+ info.samplePerPacket=son.read32();
1507
+ info.bytePerPacket=son.read32();
1508
+ info.bytePerFrame=son.read32();
1509
+#define ADM_NOT_NULL(x) if(!info.x) info.x=1;
1510
+ printf("[STSD] Sample per packet %u\n",info.samplePerPacket);
1511
+ printf("[STSD] Bytes per packet %u\n",info.bytePerPacket);
1512
+ printf("[STSD] Bytes per frame %u\n",info.bytePerFrame);
1513
+ printf("[STSD] Bytes per sample %u\n",son.read32());
1514
+ ADM_NOT_NULL(samplePerPacket);
1515
+ ADM_NOT_NULL(bytePerPacket);
1516
+ ADM_NOT_NULL(bytePerFrame);
1517
+
1518
+ left-=16;
1519
+
1520
+ break;
1521
+ }
1522
case 2:
1523
- {
1524
- printf("v2.0 = %d\n",son.read32());
1525
- printf("v2.1 = %d\n",son.read32());
1526
- printf("v2.2 = %d\n",son.read32());
1527
+ {
1528
+ printf("v2.0 = %d\n",son.read32());
1529
+ printf("v2.1 = %d\n",son.read32());
1530
+ printf("v2.2 = %d\n",son.read32());
1531
#define MARK(x) {uint32_t v=son.read32(); printf(#x " => %d\n",v);x=v;}
1532
- MARK(channels);
1533
- printf("0x7f000 = 0x%x\n",son.read32());
1534
- MARK(bpp);
1535
- printf("LPCM flags= %d\n",son.read32());
1536
- printf("byte per frame = %d\n",son.read32());
1537
- printf("sample per frame = %d\n",son.read32());
1538
- ADIO.channels=channels;
1539
- info.bytePerPacket=bpp/8;
1540
- info.bytePerFrame=info.bytePerPacket*ADIO.channels;
1541
- left-=4*9;
1542
- }
1543
- break;
1544
+ MARK(channels);
1545
+ printf("0x7f000 = 0x%x\n",son.read32());
1546
+ MARK(bpp);
1547
+ printf("LPCM flags= %d\n",son.read32());
1548
+ printf("byte per frame = %d\n",son.read32());
1549
+ printf("sample per frame = %d\n",son.read32());
1550
+ ADIO.channels=channels;
1551
+ info.bytePerPacket=bpp/8;
1552
+ info.bytePerFrame=info.bytePerPacket*ADIO.channels;
1553
+ left-=4*9;
1554
+
1555
+ break;
1556
}
1557
- printf("[STSD] chan:%u bpp:%u encoding:%u fq:%u (left %u)\n",channels,bpp,encoding,fq,left);
1558
+ } // atomVersion
1559
+ printf("[STSD] chan:%u bpp:%u encoding:%u fq:%u (left %u)\n",channels,bpp,encoding,fq,left);
1560
#define audioCodec(x) ADIO.encoding=WAV_##x;
1561
- switch(entryName)
1562
+ switch(entryName)
1563
+ {
1564
+ case MKFCCR('a','c','-','3'):
1565
+ case MKFCCR('s','a','c','3'):
1566
+ audioCodec(AC3);
1567
+ ADIO.byterate=128000>>3;
1568
+
1569
+ break;
1570
+ case MKFCCR('l','p','c','m'):
1571
+ ADIO.frequency=44100; // Wrong !
1572
+ ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8;
1573
+ audioCodec(PCM);
1574
+
1575
+ break;
1576
+ case MKFCCR('t','w','o','s'):
1577
+ audioCodec(LPCM);
1578
+ ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8;
1579
+ if(info.bytePerPacket<2)
1580
+ {
1581
+ info.bytePerPacket=2;
1582
+ info.bytePerFrame=2*ADIO.channels;
1583
+ ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket);
1584
+ }
1585
+
1586
+ break;
1587
+ case MKFCCR('u','l','a','w'):
1588
+ audioCodec(ULAW);
1589
+ ADIO.byterate=ADIO.frequency;
1590
+ info.bytePerFrame=ADIO.channels;
1591
+
1592
+ break;
1593
+ case MKFCCR('s','o','w','t'):
1594
+ audioCodec(PCM);
1595
+ ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8;
1596
+ if(info.bytePerPacket<2)
1597
+ {
1598
+ info.bytePerPacket=2;
1599
+ info.bytePerFrame=2*ADIO.channels;
1600
+ ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket);
1601
+ }
1602
+
1603
+ break;
1604
+ case MKFCCR('.','m','p','3'): //.mp3
1605
+ audioCodec(MP3);
1606
+ ADIO.byterate=128000>>3;
1607
+
1608
+ break;
1609
+ case MKFCCR('r','a','w',' '):
1610
+ audioCodec(8BITS_UNSIGNED);
1611
+ ADIO.byterate=ADIO.frequency*ADIO.channels;
1612
+
1613
+ break;
1614
+ case MKFCCR('s','a','m','r'):
1615
{
1616
- case MKFCCR('a','c','-','3'):
1617
- case MKFCCR('s','a','c','3'):
1618
- audioCodec(AC3);
1619
- ADIO.byterate=128000>>3;
1620
- break;
1621
- case MKFCCR('l','p','c','m'):
1622
- ADIO.frequency=44100; // Wrong !
1623
- ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8;
1624
- audioCodec(PCM);
1625
- break;
1626
- case MKFCCR('t','w','o','s'):
1627
- audioCodec(LPCM);
1628
- ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8;
1629
- if(info.bytePerPacket<2)
1630
- {
1631
- info.bytePerPacket=2;
1632
- info.bytePerFrame=2*ADIO.channels;
1633
-
1634
- ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket);
1635
- }
1636
- break;
1637
-
1638
- case MKFCCR('u','l','a','w'):
1639
- audioCodec(ULAW);
1640
- ADIO.byterate=ADIO.frequency;
1641
- info.bytePerFrame=ADIO.channels;
1642
- break;
1643
- case MKFCCR('s','o','w','t'):
1644
- audioCodec(PCM);
1645
- ADIO.byterate=ADIO.frequency*ADIO.bitspersample*ADIO.channels/8;
1646
- if(info.bytePerPacket<2)
1647
- {
1648
- info.bytePerPacket=2;
1649
- info.bytePerFrame=2*ADIO.channels;
1650
-
1651
- ADM_info("[MP4] Overriding bytePer packet with %d\n",info.bytePerPacket);
1652
- }
1653
-
1654
- break;
1655
- case MKFCCR('.','m','p','3'): //.mp3
1656
- audioCodec(MP3);
1657
- ADIO.byterate=128000>>3;
1658
- break;
1659
- case MKFCCR('r','a','w',' '):
1660
- audioCodec(8BITS_UNSIGNED);
1661
- ADIO.byterate=ADIO.frequency*ADIO.channels;
1662
- break;
1663
- case MKFCCR('s','a','m','r'):
1664
+ audioCodec(AMRNB);
1665
+ ADIO.frequency=8000;
1666
+ ADIO.channels=1;
1667
+ ADIO.bitspersample=16;
1668
+ ADIO.byterate=12000/8;
1669
+ if(left>10)
1670
{
1671
- audioCodec(AMRNB);
1672
- ADIO.frequency=8000;
1673
- ADIO.channels=1;
1674
- ADIO.bitspersample=16;
1675
- ADIO.byterate=12000/8;
1676
- if(left>10)
1677
- {
1678
- adm_atom amr(&son);
1679
- printf("Reading wave, got %s\n",fourCC::tostringBE(amr.getFCC()));
1680
- left=0;
1681
- }
1682
+ adm_atom amr(&son);
1683
+ printf("Reading wave, got %s\n",fourCC::tostringBE(amr.getFCC()));
1684
+ left=0;
1685
}
1686
- break;
1687
- case MKFCCR('Q','D','M','2'):
1688
- {
1689
- int64_t sz;
1690
- audioCodec(QDM2);
1691
- sz=son.getRemainingSize();
1692
- _tracks[1+nbAudioTrack].extraDataSize=sz;
1693
- _tracks[1+nbAudioTrack].extraData=new uint8_t[sz];
1694
- son.readPayload(_tracks[1+nbAudioTrack].extraData,sz);
1695
- left=0;
1696
- }
1697
- break;
1698
- case MKFCCR('m','s',0,0x55): // why 55 ???
1699
- case MKFCCR('m','s',0,0x11): // why 11 ???
1700
- case MKFCCR('m','p','4','a'):
1701
+
1702
+ break;
1703
+ }
1704
+ case MKFCCR('Q','D','M','2'):
1705
+ {
1706
+ int64_t sz;
1707
+ audioCodec(QDM2);
1708
+ sz=son.getRemainingSize();
1709
+ _tracks[1+nbAudioTrack].extraDataSize=sz;
1710
+ _tracks[1+nbAudioTrack].extraData=new uint8_t[sz];
1711
+ son.readPayload(_tracks[1+nbAudioTrack].extraData,sz);
1712
+ left=0;
1713
+
1714
+ break;
1715
+ }
1716
+ case MKFCCR('m','s',0,0x55): // why 55 ???
1717
+ case MKFCCR('m','s',0,0x11): // why 11 ???
1718
+ case MKFCCR('m','p','4','a'):
1719
+ {
1720
+ if(entryName==MKFCCR('m','s',0,0x11))
1721
+ audioCodec(MSADPCM)
1722
+ else
1723
+ audioCodec(AAC);
1724
+
1725
+ if(left>10)
1726
{
1727
- if(entryName==MKFCCR('m','s',0,0x11))
1728
- audioCodec(MSADPCM)
1729
- else
1730
- audioCodec(AAC);
1731
- if(left>10)
1732
+ while(!son.isDone())
1733
+ {
1734
+ adm_atom wave(&son);
1735
+ printf("> got %s atom\n",fourCC::tostringBE(wave.getFCC()));
1736
+ switch(wave.getFCC())
1737
{
1738
- while(!son.isDone())
1739
- {
1740
- adm_atom wave(&son);
1741
- printf("> got %s atom\n",fourCC::tostringBE(wave.getFCC()));
1742
- switch(wave.getFCC())
1743
- {
1744
case MKFCCR('c','h','a','n'):
1745
- printf("Found channel layout atom, skipping\n");
1746
- break;
1747
- case MKFCCR('w','a','v','e'):
1748
- {
1749
- // mp4a
1750
- // wave
1751
- // frma
1752
- // mp4a
1753
- // esds
1754
- while(!wave.isDone())
1755
- {
1756
- adm_atom item(&wave);
1757
- printf("parsing wave, got %s,0x%x\n",fourCC::tostringBE(item.getFCC()),
1758
- item.getFCC());
1759
-
1760
- switch(item.getFCC())
1761
- {
1762
- case MKFCCR('f','r','m','a'):
1763
- {
1764
- uint32_t codecid=item.read32();
1765
- printf("frma Codec Id :%s\n",fourCC::tostringBE(codecid));
1766
- }
1767
- break;
1768
- case MKFCCR('m','s',0,0x55):
1769
- case MKFCCR('m','s',0,0x11):
1770
+ printf("Found channel layout atom, skipping\n");
1771
+
1772
+ break;
1773
+ case MKFCCR('w','a','v','e'): // wave
1774
+ {
1775
+ while(!wave.isDone())
1776
+ {
1777
+ adm_atom item(&wave);
1778
+ printf("parsing wave, got %s,0x%x\n", fourCC::tostringBE(item.getFCC()), item.getFCC());
1779
+
1780
+ switch(item.getFCC())
1781
+ {
1782
+ case MKFCCR('f','r','m','a'): // frma
1783
{
1784
- // We have a waveformat here
1785
- printf("[STSD]Found MS audio header:\n");
1786
- ADIO.encoding=ADM_swap16(item.read16());
1787
- ADIO.channels=ADM_swap16(item.read16());
1788
- ADIO.frequency=ADM_swap32(item.read32());
1789
- ADIO.byterate=ADM_swap32(item.read32());
1790
- ADIO.blockalign=ADM_swap16(item.read16());
1791
- ADIO.bitspersample=ADM_swap16(item.read16());
1792
- printWavHeader(&(ADIO));
1793
+ uint32_t codecid=item.read32();
1794
+ printf("frma Codec Id :%s\n",fourCC::tostringBE(codecid));
1795
1796
+ break;
1797
}
1798
- break;
1799
- case MKFCCR('m','p','4','a'):
1800
- break;
1801
- case MKFCCR('e','s','d','s'):
1802
- {
1803
- decodeEsds(&item,TRACK_AUDIO);
1804
- break;
1805
- }
1806
- break;
1807
- default:
1808
- break;
1809
- }
1810
-
1811
- item.skipAtom();
1812
-
1813
- } // Wave iddone
1814
- left=0;
1815
-
1816
- } // if ==wave
1817
- break;
1818
- case MKFCCR('e','s','d','s'):
1819
- {
1820
- decodeEsds(&wave,TRACK_AUDIO);
1821
- break;
1822
- }
1823
- default:
1824
- printf("UNHANDLED ATOM : %s\n",fourCC::tostringBE(wave.getFCC()));
1825
- break;
1826
- }
1827
- wave.skipAtom();
1828
- } // while
1829
- } // if left > 10
1830
- left=0;
1831
- }
1832
- break; // mp4a
1833
+ case MKFCCR('m','s',0,0x55):
1834
+ case MKFCCR('m','s',0,0x11):
1835
+ { // We have a waveformat here
1836
+ printf("[STSD]Found MS audio header:\n");
1837
+ ADIO.encoding=ADM_swap16(item.read16());
1838
+ ADIO.channels=ADM_swap16(item.read16());
1839
+ ADIO.frequency=ADM_swap32(item.read32());
1840
+ ADIO.byterate=ADM_swap32(item.read32());
1841
+ ADIO.blockalign=ADM_swap16(item.read16());
1842
+ ADIO.bitspersample=ADM_swap16(item.read16());
1843
+ printWavHeader(&(ADIO));
1844
+
1845
+ break;
1846
+ }
1847
+ case MKFCCR('m','p','4','a'): // mp4a
1848
+ break;
1849
+ case MKFCCR('e','s','d','s'): // esds
1850
+ {
1851
+ decodeEsds(&item,TRACK_AUDIO);
1852
+ break;
1853
+ }
1854
+ default:break;
1855
+ }
1856
1857
- }
1858
- // all audio part read for current track, if it is AAC and we have extrdata, check the channels...
1859
- refineAudio(&(ADIO),_tracks[1+nbAudioTrack].extraDataSize,_tracks[1+nbAudioTrack].extraData);
1860
- }
1861
- break;
1862
- default:
1863
- ADM_assert(0);
1864
- }
1865
- son.skipBytes(left);
1866
- }
1867
- }
1868
- break;
1869
- default:
1870
- printf("[STBL]Skipping atom %s\n",fourCC::tostringBE(son.getFCC()));
1871
- }
1872
- son.skipAtom();
1873
- }
1874
- uint8_t r=0;
1875
- uint32_t nbo=0;
1876
- switch(trackType)
1877
- {
1878
- case TRACK_VIDEO:
1879
+ item.skipAtom();
1880
+
1881
+ } // while(!wave.isDone())
1882
+ left=0;
1883
+ break;
1884
+ } // case wave
1885
+ case MKFCCR('e','s','d','s'):
1886
+ {
1887
+ decodeEsds(&wave,TRACK_AUDIO);
1888
+ break;
1889
+ }
1890
+ default:
1891
+ printf("UNHANDLED ATOM : %s\n",fourCC::tostringBE(wave.getFCC()));
1892
+ break;
1893
+ } // switch(wave.getFCC)
1894
+ wave.skipAtom();
1895
+ } // while(!son.isDone())
1896
+ } // if left > 10
1897
+ left=0;
1898
+ break;
1899
+ } // mp4a
1900
+ } // entryName
1901
+
1902
+ // all audio part read for current track, if it is AAC and we have extrdata, check the channels...
1903
+ refineAudio(&(ADIO),_tracks[1+nbAudioTrack].extraDataSize,_tracks[1+nbAudioTrack].extraData);
1904
+ break;
1905
+ } // TRACK_AUDIO
1906
+ default:
1907
+ ADM_assert(0);
1908
+ } // trackType
1909
+ son.skipBytes(left);
1910
+ } // for
1911
+ break;
1912
+ } // ADM_MP4_STSD
1913
+ default:
1914
+ printf("[STBL]Skipping atom %s\n",fourCC::tostringBE(son.getFCC()));
1915
+ } // id
1916
+ son.skipAtom();
1917
+ } // while
1918
+ uint8_t r=0;
1919
+ uint32_t nbo=0;
1920
+ switch(trackType)
1921
+ {
1922
+ case TRACK_VIDEO:
1923
{
1924
- if(_tracks[0].index)
1925
- {
1926
- printf("Already got a video track\n");
1927
- return 1;
1928
- }
1929
- r=indexify(&(_tracks[0]),trackScale,&info,0,&nbo);
1930
-
1931
- _videostream.dwLength= _mainaviheader.dwTotalFrames=_tracks[0].nbIndex;
1932
- // update fps
1933
- double f=_videostream.dwLength;
1934
- if(!r) return false;
1935
- ADM_info("Movie duration = %d\n",(int)_movieDuration);
1936
- ADM_info("# images = %d\n",(int)_mainaviheader.dwTotalFrames);
1937
-
1938
- if(_movieDuration) f=1000000.*f/_movieDuration;
1939
- else f=25000;
1940
-
1941
- ADM_info("Avg fps %f\n",(float)f);
1942
-
1943
- _videostream.dwRate=(uint32_t)floor(f+0.49);
1944
- _mainaviheader.dwMicroSecPerFrame=ADM_UsecFromFps1000(_videostream.dwRate);
1945
- // if we have a sync atom ???
1946
- if(info.nbSync)
1947
- {
1948
- // Mark keyframes
1949
- for(int i=0;i<info.nbSync;i++)
1950
+ if(_tracks[0].index)
1951
{
1952
- uint32_t sync=info.Sync[i];
1953
- if(sync) sync--;
1954
- _tracks[0].index[sync].intra=AVI_KEY_FRAME;
1955
+ printf("Already got a video track\n");
1956
+ return 1;
1957
}
1958
- }
1959
- else
1960
- { // All frames are kf
1961
- for(int i=0;i<_tracks[0].nbIndex;i++)
1962
+ r=indexify(&(_tracks[0]),trackScale,&info,0,&nbo);
1963
+
1964
+ _videostream.dwLength= _mainaviheader.dwTotalFrames=_tracks[0].nbIndex;
1965
+ // update fps
1966
+ double f=_videostream.dwLength;
1967
+ if(!r) return false;
1968
+ ADM_info("Movie duration = %d\n",(int)_movieDuration);
1969
+ ADM_info("# images = %d\n",(int)_mainaviheader.dwTotalFrames);
1970
+
1971
+ if(_movieDuration) f=1000000.*f/_movieDuration;
1972
+ else f=25000;
1973
+
1974
+ ADM_info("Avg fps %f\n",(float)f);
1975
+
1976
+ _videostream.dwRate=(uint32_t)floor(f+0.49);
1977
+ _mainaviheader.dwMicroSecPerFrame=ADM_UsecFromFps1000(_videostream.dwRate);
1978
+
1979
+ // if we have a sync atom ???
1980
+ if(info.nbSync)
1981
{
1982
- _tracks[0].index[i].intra=AVI_KEY_FRAME;
1983
+ // Mark keyframes
1984
+ for(int i=0;i<info.nbSync;i++)
1985
+ {
1986
+ uint32_t sync=info.Sync[i];
1987
+ if(sync) sync--;
1988
+ _tracks[0].index[sync].intra=AVI_KEY_FRAME;
1989
+ }
1990
+ }else
1991
+ { // All frames are kf
1992
+ for(int i=0;i<_tracks[0].nbIndex;i++)
1993
+ {
1994
+ _tracks[0].index[i].intra=AVI_KEY_FRAME;
1995
+ }
1996
}
1997
- }
1998
- // Now do the CTTS thing
1999
- if(info.Ctts)
2000
- {
2001
- updateCtts(&info);
2002
- }else
2003
- {
2004
- // No ctts, dts=pts
2005
+ // Now do the CTTS thing
2006
+ if(info.Ctts)
2007
+ {
2008
+ updateCtts(&info);
2009
+ }else
2010
+ { // No ctts, dts=pts
2011
for(int i=0;i<_videostream.dwLength;i++)
2012
{
2013
- _tracks[0].index[i].pts= _tracks[0].index[i].dts;
2014
+ _tracks[0].index[i].pts= _tracks[0].index[i].dts;
2015
}
2016
- }
2017
- VDEO.index[0].intra=AVI_KEY_FRAME;
2018
- }
2019
- break;
2020
- case TRACK_AUDIO:
2021
- printf("Cur audio track :%u\n",nbAudioTrack);
2022
+ }
2023
+ VDEO.index[0].intra=AVI_KEY_FRAME;
2024
+
2025
+ break;
2026
+ } // TRACK_VIDEO
2027
+ case TRACK_AUDIO:
2028
+ printf("Cur audio track :%u\n",nbAudioTrack);
2029
#if 0
2030
if(info.SzIndentical ==1 && (ADIO.encoding==WAV_LPCM || ADIO.encoding==WAV_PCM ))
2031
{
2032
2033
}
2034
2035
break;
2036
- case TRACK_OTHER:
2037
- r=1;
2038
- break;
2039
- }
2040
- return r;
2041
+ case TRACK_OTHER:
2042
+ r=1;
2043
+ break;
2044
+ }
2045
+ return r;
2046
}
2047
/**
2048
\fn decodeEsds
2049
2050
*/
2051
uint8_t MP4Header::decodeEsds(void *ztom,uint32_t trackType)
2052
{
2053
-adm_atom *tom=(adm_atom *)ztom;
2054
-int tag,l;
2055
- // in case of mpeg4 we only take
2056
- // the mpeg4 vol header
2057
- printf("[MP4]Esds atom found\n");
2058
-
2059
- tom->skipBytes(4);
2060
- tag=0xff;
2061
- while(tag!=Tag_DecSpecificInfo && !tom->isDone())
2062
+ adm_atom *tom=(adm_atom *)ztom;
2063
+ int tag,l;
2064
+ // in case of mpeg4 we only take
2065
+ // the mpeg4 vol header
2066
+ printf("[MP4]Esds atom found\n");
2067
+
2068
+ tom->skipBytes(4);
2069
+ tag=0xff;
2070
+ while(tag!=Tag_DecSpecificInfo && !tom->isDone())
2071
+ {
2072
+ tag=tom->read();
2073
+ l=readPackedLen(tom);
2074
+ printf("\t Tag : %u Len : %u\n",tag,l);
2075
+ switch(tag)
2076
+ {
2077
+ case Tag_ES_Desc:
2078
+ printf("\t ES_Desc\n");
2079
+ tom->skipBytes(3);
2080
+ break;
2081
+ case Tag_DecConfigDesc:
2082
{
2083
- tag=tom->read();
2084
- l=readPackedLen(tom);
2085
- printf("\t Tag : %u Len : %u\n",tag,l);
2086
- switch(tag)
2087
+ uint8_t objectTypeIndication=tom->read();
2088
+ printf("\tDecConfigDesc : Tag %u\n",objectTypeIndication);
2089
+ if(trackType==TRACK_AUDIO && ADIO.encoding==WAV_AAC)
2090
+ {
2091
+ switch(objectTypeIndication)
2092
{
2093
- case Tag_ES_Desc:
2094
- printf("\t ES_Desc\n");
2095
- tom->skipBytes(3);
2096
- break;
2097
- case Tag_DecConfigDesc:
2098
+ case 0x69:
2099
+ case 0x6b:
2100
+ case 0x6d:
2101
+ ADIO.encoding=WAV_MP3;
2102
+ break;
2103
+ case 226:
2104
+ ADIO.encoding=WAV_AC3;
2105
+ break;
2106
+ }
2107
+ }
2108
+ tom->skipBytes(1+3+4+4);
2109
+ break;
2110
+ }
2111
+ case Tag_DecSpecificInfo:
2112
+ printf("\t DecSpecicInfo\n");
2113
+ switch(trackType)
2114
+ {
2115
+ case TRACK_VIDEO: // Video
2116
+ if(!VDEO.extraDataSize)
2117
+ {
2118
+ VDEO.extraDataSize=l;
2119
+ VDEO.extraData=new uint8_t[l];
2120
+ if(fread(VDEO.extraData,VDEO.extraDataSize,1,_fd)<1)
2121
{
2122
- uint8_t objectTypeIndication=tom->read();
2123
- printf("\tDecConfigDesc : Tag %u\n",objectTypeIndication);
2124
- if(trackType==TRACK_AUDIO && ADIO.encoding==WAV_AAC)
2125
- {
2126
- switch(objectTypeIndication)
2127
- {
2128
- case 0x69:
2129
- case 0x6b:
2130
- case 0x6d:
2131
- ADIO.encoding=WAV_MP3;
2132
- break;
2133
- case 226:ADIO.encoding=WAV_AC3;break;
2134
- break;
2135
-
2136
- }
2137
- }
2138
- tom->skipBytes(1+3+4+4);
2139
- break;
2140
- }
2141
- case Tag_DecSpecificInfo:
2142
- printf("\t DecSpecicInfo\n");
2143
- switch(trackType)
2144
- {
2145
- case TRACK_VIDEO: // Video
2146
- if(!VDEO.extraDataSize)
2147
- {
2148
- VDEO.extraDataSize=l;
2149
- VDEO.extraData=new uint8_t[l];
2150
- fread(VDEO.extraData,VDEO.extraDataSize,1,_fd);
2151
- }
2152
- break;
2153
- case TRACK_AUDIO:
2154
- printf("Esds for audio\n");
2155
- _tracks[1+nbAudioTrack].extraDataSize=l;
2156
- _tracks[1+nbAudioTrack].extraData=new uint8_t[l];
2157
- fread(_tracks[1+nbAudioTrack].extraData,
2158
- _tracks[1+nbAudioTrack].extraDataSize,1,_fd);
2159
- printf("\t %d bytes of extraData\n",(int)l);
2160
- break;
2161
- default: printf("Unknown track type for esds %d\n",trackType);
2162
- }
2163
+ ADM_warning("Error reading video extradata from file.\n");
2164
+ delete [] VDEO.extraData;
2165
+ VDEO.extraData=NULL;
2166
+ VDEO.extraDataSize=0;
2167
+ }else
2168
+ {
2169
+ ADM_info("%d bytes of video extradata successfully read from file.\n",l);
2170
}
2171
- }
2172
+ }
2173
+ break;
2174
+ case TRACK_AUDIO:
2175
+ printf("Esds for audio\n");
2176
+ _tracks[1+nbAudioTrack].extraDataSize=l;
2177
+ _tracks[1+nbAudioTrack].extraData=new uint8_t[l];
2178
+ if(fread(_tracks[1+nbAudioTrack].extraData,
2179
+ _tracks[1+nbAudioTrack].extraDataSize,1,_fd)<1)
2180
+ {
2181
+ ADM_warning("Error reading audio extradata from file.\n");
2182
+ delete [] _tracks[1+nbAudioTrack].extraData;
2183
+ _tracks[1+nbAudioTrack].extraData=NULL;
2184
+ _tracks[1+nbAudioTrack].extraDataSize=0;
2185
+ }else
2186
+ {
2187
+ ADM_info("%d bytes of audio extradata successfully read from file.\n",l);
2188
+ }
2189
+ break;
2190
+ default: printf("Unknown track type for esds %d\n",trackType);
2191
+ }
2192
+ } // tag
2193
+ } // while
2194
2195
tom->skipAtom();
2196
return 1;
2197
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
18
1
2
{
3
case ADM_MP4_MFHD: son.skipAtom();break;
4
case ADM_MP4_TRAF: parseTraf(son,tom.getStartPos());break;
5
-
6
+ default:break;
7
}
8
aprintf("[MOOF]Found atom %s \n",fourCC::tostringBE(son.getFCC()));
9
son.skipAtom();
10
11
aprintf("[TFDT] Base DTS=%ld\n",(long int)info.baseDts);
12
}
13
break;
14
+ default:break;
15
}
16
17
aprintf("[MOOF]Found atom %s \n",fourCC::tostringBE(son.getFCC()));
18
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
18
1
2
uint8_t sample[4];
3
4
fseeko(_fd, _index[0].offset, SEEK_SET);
5
- fread(&sample, 1, 4, _fd);
6
+ if(fread(&sample, 1, 4, _fd) < 4) return;
7
8
uint32_t fcc = sample[0] << 24 | sample[1] << 16 | sample[2] << 8 | sample[3];
9
int layer = 4 - ((fcc >> 17) & 0x3);
10
11
bool ADM_mp4AudioAccess::getPacket(uint8_t *buffer, uint32_t *size, uint32_t maxSize,uint64_t *dts)
12
{
13
uint32_t r=0;
14
- double delta;
15
if(_current_index>=_nb_chunks)
16
{
17
if(_msg_ratelimit->done())
18
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
25
1
2
uint32_t audioCount[9]={0,0,0,0, 0,0,0,0,0};
3
uint32_t forward[9];
4
uint32_t backward[9];
5
-int64_t startOfData;
6
+int64_t startOfData=0;
7
8
printf("Trying avi type 1 index\n");
9
if(!_regularIndex.offset)
10
11
}
12
13
uint32_t audiocount=0,videocount=0;
14
- uint32_t audiototal=0;
15
uint32_t audioSize=0;
16
odmlIndex *track;
17
int Achunk;
18
count=_regularIndex.size >> 4;
19
while(count)
20
{
21
-_again:
22
fcc=len=0;
23
fcc=read32();
24
flags=read32();
25
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
47
1
2
3
#define MAX_VOP 200
4
5
-/* Static ones */
6
-
7
-static const char *s_voptype[4]={"I frame","P frame","B frame","D frame"};
8
/**
9
\fn unpackPacked
10
\brief Removed packed bitstream hack
11
12
{
13
uint32_t nbFrame;
14
uint8_t ret=0;
15
- uint32_t firstType, secondType,thirdType;
16
uint32_t targetIndex=0,nbVop;
17
uint32_t nbDuped=0;
18
uint32_t timcincbits=16; /* Nb bits used to code time_inc 16 is a safe default */
19
20
#ifndef __HAIKU__
21
uint32_t originalPriority = getpriority(PRIO_PROCESS, 0);
22
#endif
23
- uint32_t priorityLevel;
24
#if 0
25
+ uint32_t priorityLevel;
26
prefs->get(PRIORITY_INDEXING,&priorityLevel);
27
setpriority(PRIO_PROCESS, 0, ADM_getNiceValue(priorityLevel));
28
#endif
29
30
ADMCompressedImage image;
31
image.data=buffer;
32
uint32_t img=0;
33
- uint32_t modulo,time_inc,vopcoded,vopType;
34
- uint32_t timeincbits=16;
35
uint32_t oldtimecode=0xffffffff;
36
while(img<nbFrame)
37
{
38
39
myVops[0].offset=0;
40
myVops[nbVop].offset=image.dataLength;
41
42
-
43
- uint32_t place;
44
//if(nbVop>2)
45
{
46
aprintf("At %u, %d vop!\n",img,nbVop);
47
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
95
1
2
#define aprintf printf
3
#endif
4
5
-static uint16_t s16;
6
-static uint32_t s32;
7
#define MAX_ACCEPTED_OPEN_FILE 99999
8
9
#define US_PER_PIC (40*1000)
10
11
+#ifdef __APPLE__
12
+ #define MAX_LEN 1024
13
+#else
14
+ #define MAX_LEN 4096
15
+#endif
16
17
/**
18
*
19
20
21
bool r=true;
22
uint16_t s16;
23
- uint32_t s32;
24
BmpLowLevel low(fd);
25
26
switch(type) // this is bad. All the offsets are hardcoded and could be actually different.
27
28
break;
29
}
30
bpp = bmph.biBitCount;
31
+ if (bpp > 32)
32
+ {
33
+ ADM_warning("Invalid bpp = %d\n",bpp);
34
+ r=false;
35
+ break;
36
+ }
37
+ if (bpp == 32 && bmph.biCompression == 3)
38
+ { // read channel masks, FIXME: BGR is assumed
39
+ low.read32LE(); // red
40
+ low.read32LE(); // green
41
+ uint32_t bmask=low.read32LE(); // blue
42
+ uint32_t amask=low.read32LE(); // alpha
43
+ if((!amask && bmask == 0xff00) || amask == 0xff)
44
+ bpp=96; // xBGR
45
+ }
46
aprintf("Bmp bpp=%d offset: %d (bmp header=%d,%d)\n", bpp, bmpHeaderOffset,sizeof(bmph),bmph.biSize);
47
}
48
break;
49
50
{
51
ADM_BITMAPINFOHEADER bmph;
52
53
- fread(&s16, 2, 1, fd);
54
+ if (!fread(&s16, 2, 1, fd))
55
+ {
56
+ ADM_warning("Cannot read bmp file.\n");
57
+ r=false;
58
+ break;
59
+ }
60
if (s16 != 0x4D42)
61
{
62
ADM_warning(" incorrect bmp sig.\n");
63
64
*/
65
uint8_t picHeader::open(const char *inname)
66
{
67
- uint32_t nnum;
68
+ if(strlen(inname)>=MAX_LEN)
69
+ {
70
+ ADM_warning("Path too long, aborting.\n");
71
+ return 0;
72
+ }
73
+
74
FILE *fd;
75
int bpp = 0;
76
77
78
}
79
else
80
{
81
- char realstring[1024];
82
+ char realstring[MAX_LEN];
83
sprintf(realstring, "%s%%0%" PRIu32"d.%s", prefix.c_str(), nbOfDigits, extension.c_str());
84
_filePrefix=std::string(realstring);
85
_nbFiles = 0;
86
87
*/
88
FILE* picHeader::openFrameFile(uint32_t frameNum)
89
{
90
- char filename[250];
91
+ char filename[MAX_LEN];
92
sprintf(filename, _filePrefix.c_str(), frameNum + _first);
93
return ADM_fopen(filename, "rb");
94
}
95
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
77
1
2
#include "ADM_default.h"
3
#include "fourcc.h"
4
#include "ADM_vs.h"
5
-#if !defined(__APPLE__) && !defined(_WIN32)
6
- #include <dlfcn.h>
7
-#endif
8
-
9
+#include "ADM_vsInternal.h"
10
static const VSAPI *vsapi = NULL;
11
#if 0
12
#define aprintf printf
13
14
#define aprintf(...) {}
15
#endif
16
uint32_t ADM_UsecFromFps1000(uint32_t fps1000);
17
-
18
+extern vsDynaLoader dynaLoader;
19
/**
20
\fn open
21
\brief open the flv file, gather infos and build index(es).
22
23
uint8_t vsHeader::open(const char *name)
24
{
25
ADM_info("Opening %s as VapourSynth file\n",name);
26
-#if !defined(__APPLE__) && !defined(_WIN32)
27
- ADM_info("Trying to dlopen %s\n",VAPOURSYNTH_PYTHONLIB);
28
- dlopen(VAPOURSYNTH_PYTHONLIB, RTLD_LAZY|RTLD_GLOBAL);
29
-#endif
30
- inited+=!!vsscript_init();
31
+ inited+=!!dynaLoader.init();
32
if(!inited)
33
{
34
ADM_warning("Cannot initialize vsapi script_init. Check PYTHONPATH\n");
35
36
}
37
if(!vsapi)
38
{
39
- vsapi = vsscript_getVSApi();
40
+ vsapi = dynaLoader.getVSApi();
41
if(!vsapi)
42
{
43
ADM_warning("Cannot get vsAPI entry point\n");
44
45
}
46
}
47
ADM_info("VapourSynth init ok, opening file..\n");
48
- if (vsscript_evaluateFile(&_script, name, 0))
49
+ if (dynaLoader.evaluateFile(&_script, name, 0))
50
{
51
- ADM_warning("Evaluate script failed <%s>\n", vsscript_getError(_script));
52
+ ADM_warning("Evaluate script failed <%s>\n", dynaLoader.getError(_script));
53
close();
54
return 0;
55
}
56
- _node = vsscript_getOutput(_script, 0);
57
+ _node = dynaLoader.getOutput(_script, 0);
58
if (!_node)
59
{
60
ADM_warning("vsscript_getOutputNode failed\n");
61
62
}
63
if(_script)
64
{
65
- vsscript_freeScript(_script);
66
+ dynaLoader.freeScript(_script);
67
_script=NULL;
68
}
69
while(inited)
70
{
71
inited--;
72
- vsscript_finalize();
73
+ dynaLoader.finalize();
74
}
75
vsapi=NULL;
76
return 1;
77
avidemux_2.7.3.tar.gz/avidemux_plugins/ADM_demuxers/VapourSynth/ADM_vsInternal.h
Added
88
1
2
+#pragma once
3
+
4
+#include "ADM_dynamicLoading.h"
5
+
6
+#if !defined(__APPLE__) && !defined(_WIN32)
7
+ #include <dlfcn.h>
8
+#endif
9
+
10
+
11
+
12
+
13
+#ifdef __APPLE__
14
+ #define DLL_TO_LOAD "libvapoursynth-script.dylib"
15
+ #define PYTHONLIB ""
16
+#else
17
+ #ifdef _WIN32
18
+ #define DLL_TO_LOAD "vsscript.dll"
19
+ #define PYTHONLIB ""
20
+ #else
21
+ #define DLL_TO_LOAD "libvapoursynth-script.so"
22
+ #define PYTHONLIB VAPOURSYNTH_PYTHONLIB
23
+ #endif
24
+#endif
25
+
26
+
27
+/**
28
+ *
29
+ */
30
+class vsDynaLoader:public ADM_LibWrapper
31
+{
32
+public:
33
+
34
+ vsDynaLoader()
35
+ {
36
+ init=NULL;
37
+ getVSApi=NULL;
38
+ freeScript=NULL;
39
+ finalize=NULL;
40
+ getError=NULL;
41
+ getOutput=NULL;
42
+ evaluateFile=NULL;
43
+ operational=false;
44
+ }
45
+ bool vsInit(const char *dllName,const char *pythonLib)
46
+ {
47
+#if !defined(__APPLE__) && !defined(_WIN32)
48
+ ADM_info("Trying to dlopen %s\n",VAPOURSYNTH_PYTHONLIB);
49
+ dlopen(VAPOURSYNTH_PYTHONLIB, RTLD_LAZY|RTLD_GLOBAL);
50
+#endif
51
+ bool loaded= loadLibrary(dllName);
52
+ if(!loaded)
53
+ {
54
+ ADM_warning("Cannot load the vapoursynth-script library\n");
55
+ return false;
56
+ }
57
+ if(! ADM_LibWrapper::getSymbols(7,
58
+ &init, "vsscript_init",
59
+ &getVSApi, "vsscript_getVSApi",
60
+ &freeScript, "vsscript_freeScript",
61
+ &finalize, "vsscript_finalize",
62
+ &getError, "vsscript_getError",
63
+ &getOutput, "vsscript_getOutput",
64
+ &evaluateFile, "vsscript_evaluateFile"))
65
+ {
66
+ ADM_warning("Cannot get symbols from vapoursynthlibrary\n");
67
+ return false;
68
+ }
69
+ operational=true;
70
+ return true;
71
+ }
72
+ bool isOperational()
73
+ {
74
+ return operational;
75
+ }
76
+public:
77
+ int (*init)(void);
78
+ const VSAPI *(*getVSApi)(void);
79
+ void (*freeScript)(VSScript *handle);
80
+ int (*finalize)(void);
81
+ const char *(*getError)(VSScript *handle);
82
+ VSNodeRef * (*getOutput)(VSScript *handle, int index);
83
+ int (*evaluateFile)(VSScript **handle, const char *scriptFilename, int flags);
84
+protected:
85
+ bool operational;
86
+};
87
\ No newline at end of file
88
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
37
1
2
#include "ADM_default.h"
3
#include "ADM_vs.h"
4
#include "ADM_demuxerInternal.h"
5
+#include "ADM_vsInternal.h"
6
7
+#if !defined(__APPLE__) && !defined(_WIN32)
8
+ #include <dlfcn.h>
9
+#endif
10
+
11
+
12
+vsDynaLoader dynaLoader;
13
+static bool loaded=false;
14
ADM_DEMUXER_BEGIN( vsHeader, 50,
15
1,0,0,
16
"vs",
17
"VapourSynth demuxer plugin (c) Mean 2015"
18
);
19
20
+
21
/**
22
\fn Probe
23
*/
24
25
extern "C" uint32_t ADM_PLUGIN_EXPORT probe(uint32_t magic, const char *fileName)
26
{
27
+
28
+ // Check if we have the lib loaded
29
+ if(!loaded)
30
+ dynaLoader.vsInit(DLL_TO_LOAD,PYTHONLIB);
31
+ loaded=true;
32
+ if(!dynaLoader.isOperational())
33
+ return 0;
34
std::string fname=std::string(fileName);
35
if(fname.length()<4) return 0;
36
if (fname.substr(fname.length()-4) == std::string(".vpy"))
37
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
81
1
2
#include "fourcc.h"
3
4
#include "ADM_vsProxy.h"
5
-
6
+#include "ADM_vsInternal.h"
7
8
static const VSAPI *vsapi = NULL;
9
+vsDynaLoader dynaLoader;
10
+static bool loaded=false;
11
+
12
13
14
/**
15
16
{
17
if(_script)
18
{
19
- vsscript_freeScript(_script);
20
+ dynaLoader.freeScript(_script);
21
_script=NULL;
22
}
23
- vsscript_finalize();
24
+ dynaLoader.finalize();
25
}
26
/**
27
*
28
29
30
ADM_info("Opening %s as VapourSynth file\n",name);
31
32
+ if(!loaded)
33
+ dynaLoader.vsInit(DLL_TO_LOAD,PYTHONLIB);
34
+ loaded=true;
35
+ if(!dynaLoader.isOperational())
36
+ return 0;
37
+
38
39
40
- if (!vsscript_init())
41
+ if (!dynaLoader.init())
42
{
43
ADM_warning("Cannot initialize vsapi script_init. Check PYTHONPATH\n");
44
return false;
45
}
46
- vsapi = vsscript_getVSApi();
47
+ vsapi = dynaLoader.getVSApi();
48
if(!vsapi)
49
{
50
ADM_warning("Cannot get vsAPI entry point\n");
51
- vsscript_finalize();
52
+ dynaLoader.finalize();
53
return 0;
54
}
55
56
ADM_info("VapourSynth init ok, opening file..\n");
57
- if (vsscript_evaluateFile(&_script, name, 0))
58
+ if (dynaLoader.evaluateFile(&_script, name, 0))
59
{
60
- ADM_warning("Evaluate script failed <%s>\n", vsscript_getError(_script));
61
+ ADM_warning("Evaluate script failed <%s>\n", dynaLoader.getError(_script));
62
abort();
63
return 0;
64
}
65
- _node = vsscript_getOutput(_script, 0);
66
+ _node = dynaLoader.getOutput(_script, 0);
67
if (!_node)
68
{
69
ADM_warning("vsscript_getOutputNode failed\n");
70
71
bool success=manageSlave(slave,vi);
72
delete slave;
73
vsapi->freeNode(_node);
74
- vsscript_freeScript(_script);
75
- vsscript_finalize();
76
+ dynaLoader.freeScript(_script);
77
+ dynaLoader.finalize();
78
_node=NULL;
79
_script=NULL;
80
return success;
81
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
67
1
2
include(admCheckVapourSynth)
3
include(dm_plugin)
4
checkVapourSynth()
5
+
6
+ IF(NOT APPLE AND NOT WIN32 AND NOT MSVC)
7
+ SET(VS_SYSTEM_LIBS "-ldl")
8
+ENDIF(NOT APPLE AND NOT WIN32 AND NOT MSVC)
9
+
10
+
11
IF(USE_VAPOURSYNTH)
12
IF(DO_COMMON)
13
IF(NOT APPLE)
14
15
#ADD_DEFINITIONS("-std=c++11")
16
ADD_DEFINITIONS(${VAPOURSYNTHSCRIPT_CFLAGS})
17
SET(SRCS ADM_vsProxy.cpp ADM_vsProxy_cli.cpp)
18
- ADD_EXECUTABLE(vsProxy ${SRCS})
19
- GET_PROPERTY(OLD
20
- TARGET vsProxy
21
- PROPERTY LINK_FLAGS)
22
- IF("${OLD}" MATCHES ".*NOT.*FOUND")
23
- SET(OLD "")
24
- ENDIF("${OLD}" MATCHES ".*NOT.*FOUND")
25
-# Keep -L, discard everything else
26
- FOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS})
27
- IF(${i} MATCHES "^-L")
28
- MESSAGE(STATUS "Updating linker flags => ${i}")
29
- SET(OLD "${i} ${OLD} ")
30
- ELSE(${i} MATCHES "^-L")
31
- MESSAGE(STATUS "Updating linker libs => ${i}")
32
- LIST(APPEND LIBS_TO_LINK ${i})
33
- ENDIF(${i} MATCHES "^-L")
34
- ENDFOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS})
35
+ ADD_EXECUTABLE(vsProxy ${SRCS})
36
# Add vs Proxy
37
SET_TARGET_PROPERTIES(vsProxy PROPERTIES LINK_FLAGS "${OLD}")
38
- TARGET_LINK_LIBRARIES(vsProxy ${LIBS_TO_LINK} ADM_core6 ADM_coreSocket6)
39
+ TARGET_LINK_LIBRARIES(vsProxy ADM_core6 ADM_coreSocket6)
40
ELSE(NOT APPLE)
41
ADD_DEFINITIONS(${VAPOURSYNTHSCRIPT_CFLAGS})
42
- LIST(APPEND LIBS_TO_LINK ${VAPOURSYNTHSCRIPT_LDFLAGS})
43
ENDIF(NOT APPLE)
44
#----------------
45
# Add direct Loading
46
47
)
48
INIT_DEMUXER(ADM_dm_vapoursynth)
49
ADD_DEMUXER(ADM_dm_vapoursynth ${ADM_vs_SRCS})
50
- IF(NOT APPLE AND NOT WIN32 AND NOT MSVC)
51
- LIST(APPEND LIBS_TO_LINK "-ldl")
52
- ENDIF(NOT APPLE AND NOT WIN32 AND NOT MSVC)
53
- TARGET_LINK_LIBRARIES(ADM_dm_vapoursynth ${LIBS_TO_LINK})
54
+ TARGET_LINK_LIBRARIES(ADM_dm_vapoursynth "${VS_SYSTEM_LIBS}")
55
+
56
INSTALL_DEMUXER(ADM_dm_vapoursynth)
57
#----------------
58
IF(NOT APPLE)
59
60
ELSE(WIN32)
61
TARGET_LINK_LIBRARIES(vsProxy -lstdc++) # clang
62
ENDIF(WIN32)
63
+ TARGET_LINK_LIBRARIES(vsProxy "${VS_SYSTEM_LIBS}")
64
ADM_INSTALL_BIN(vsProxy)
65
ENDIF(NOT APPLE)
66
ENDIF(DO_COMMON)
67
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
25
1
2
SET(OLD "")
3
ENDIF("${OLD}" MATCHES ".*NOT.*FOUND")
4
# Keep -L, discard everything else
5
-FOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS})
6
- IF(${i} MATCHES "^-L")
7
- MESSAGE(STATUS "Updating linker flags => ${i}")
8
- SET(OLD "${i} ${OLD} ")
9
- ELSE(${i} MATCHES "^-L")
10
- MESSAGE(STATUS "Updating linker libs => ${i}")
11
- LIST(APPEND LIBS_TO_LINK ${i})
12
- ENDIF(${i} MATCHES "^-L")
13
-ENDFOREACH(i ${VAPOURSYNTHSCRIPT_LDFLAGS})
14
+
15
16
SET_TARGET_PROPERTIES(vsProxy_gui_${QT_EXTENSION} PROPERTIES LINK_FLAGS "${OLD}")
17
18
19
set_target_properties(vsProxy_gui_${QT_EXTENSION} PROPERTIES WIN32_EXECUTABLE True)
20
TARGET_LINK_LIBRARIES(vsProxy_gui_${QT_EXTENSION} ws2_32.lib winmm -mwindows )
21
ENDIF(MSVC)
22
-
23
+TARGET_LINK_LIBRARIES(vsProxy_gui_${QT_EXTENSION} "${VS_SYSTEM_LIBS}")
24
ADM_INSTALL_BIN(vsProxy_gui_${QT_EXTENSION})
25
avidemux_2.7.2.tar.gz/cmake/admCheckVapourSynth.cmake -> avidemux_2.7.3.tar.gz/cmake/admCheckVapourSynth.cmake
Changed
23
1
2
STRING(REGEX REPLACE "so.*$" "so" shortened "${shortened}" )
3
# Now it looks like this libpython3.6m.so
4
set(${result} ${shortened})
5
+ MESSAGE(STATUS "Got python lib : ${${result}}")
6
endif(dep MATCHES ".*libpython3.*")
7
endforeach(dep ${xoutput})
8
endmacro(GET_VAPOURSYNTH_PYTHON lib)
9
10
IF (VAPOURSYNTH)
11
PKG_CHECK_MODULES(VAPOURSYNTHSCRIPT vapoursynth-script)
12
IF (VAPOURSYNTHSCRIPT_FOUND)
13
- MESSAGE(STATUS "VSSCRIPT<${VAPOURSYNTHSCRIPT_CFLAGS}> < ${VAPOURSYNTHSCRIPT_LDFLAGS}>")
14
+ MESSAGE(STATUS "VSSCRIPT<${VAPOURSYNTHSCRIPT_CFLAGS}> < ${VAPOURSYNTHSCRIPT_LDFLAGS}> <${VAPOURSYNTHSCRIPT_LIBRARIES}>")
15
IF(NOT APPLE AND NOT WIN32)
16
- LIST(GET VAPOURSYNTHSCRIPT_LINK_LIBRARIES 0 xfirst)
17
- GET_VAPOURSYNTH_PYTHON( ${xfirst} VAPOURSYNTH_PYTHONLIB)
18
+ LIST(GET VAPOURSYNTHSCRIPT_LIBRARIES 0 xfirst)
19
+ GET_VAPOURSYNTH_PYTHON( "${VAPOURSYNTHSCRIPT_LIBDIR}/lib${xfirst}.so" VAPOURSYNTH_PYTHONLIB)
20
SET(VAPOURSYNTHSCRIPT_CFLAGS "${VAPOURSYNTHSCRIPT_CFLAGS} -DVAPOURSYNTH_PYTHONLIB='\"${VAPOURSYNTH_PYTHONLIB}\"'")
21
ENDIF(NOT APPLE AND NOT WIN32)
22
SET(USE_VAPOURSYNTH 1)
23
avidemux_2.7.2.tar.gz/cmake/avidemuxVersion.cmake -> avidemux_2.7.3.tar.gz/cmake/avidemuxVersion.cmake
Changed
10
1
2
include(admTimeStamp)
3
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
4
SET(CPACK_PACKAGE_VERSION_MINOR "7")
5
-SET(CPACK_PACKAGE_VERSION_P "2")
6
+SET(CPACK_PACKAGE_VERSION_P "3")
7
SET(AVIDEMUX_MAJOR_MINOR "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
8
SET(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_P}")
9
IF(NOT AVIDEMUX_VERSION)
10
Refresh
Refresh
Login required, please
login
or
signup
in order to comment