Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iso segment validator refactoring part 1 #622

Merged
merged 3 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt -y install \
apache2 apache2-doc php php-dev php-xml php-curl php-xdebug libapache2-mod-php \
python2.7 \
openjdk-8-jdk ant \
gcc-multilib g++-multilib
g++
RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
RUN python2.7 get-pip.py
RUN pip2 install matplotlib
Expand Down
30 changes: 18 additions & 12 deletions ISOSegmentValidator/public/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

NAME= ValidateMP4

### include debug information: 1=yes, 0=no
DBG=1
SAN=0
COV=0
### include debug information: 1=yes, 'empty'=no (don't set to 0)
DBG=
SAN=
COV=

FLAGS+=-Wall -Wextra -Werror

## TODO: remove these
FLAGS+=-Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-parameter -Wno-int-to-pointer-cast -Wno-sequence-point -Wno-stringop-truncation
FLAGS+=-Wno-unused-result -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-parameter -Wno-int-to-pointer-cast -Wno-sequence-point -Wno-stringop-truncation

#compatibility=-static-libstdc++

Expand All @@ -33,9 +33,9 @@ CC= $(shell which g++)
FLAGS+=-std=c++11 -ffloat-store -Wall -I$(INCDIR) -DLITTLEENDIAN -Wno-multichar -Wno-unknown-pragmas -fpermissive -Wno-write-strings -fno-stack-protector

ifdef COV
LIBS= -lgcov #-lcurl
FLAGS+=-fprofile-generate -fprofile-arcs -ftest-coverage -Wl,-lgcov
LDFLAGS+=" -lgcov --coverage -WL -lgcov"
OBJDIR=$(BINDIR)
LIBS= -lgcov
FLAGS+=--coverage -fno-inline -fno-elide-constructors -fprofile-generate -fprofile-arcs -ftest-coverage -Wl,-lgcov
endif

ifdef SAN
Expand All @@ -49,7 +49,7 @@ SUFFIX= #.dbg
FLAGS+= -g
else
SUFFIX=
FLAGS+= -O2 -DGCC
FLAGS+= -Os -DGCC
endif

ifdef COV
Expand All @@ -64,7 +64,7 @@ OBJ= $(SRC:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o$(SUFFIX))
BIN= $(BINDIR)/$(NAME)$(SUFFIX).exe


default: depend bin tags
default: depend $(BINDIR) $(OBJDIR) binaries tags

dependencies:
@echo "" >dependencies
Expand All @@ -80,10 +80,10 @@ tags:
@echo update tag table
@ctags $(INCDIR)/*.h $(SRCDIR)/*.cpp

bin: $(OBJ)
binaries: $(OBJ)
@echo
@echo 'creating binary "$(BIN)"'
@$(CC) $(compatibility) -o $(BIN) $(OBJ) $(LIBS)
@$(CC) $(compatibility) -o $(BIN) $(OBJ) $(LIBS) $(LDFLAGS)
@echo '... done'
@echo

Expand All @@ -93,6 +93,12 @@ depend:
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) -I$(INCDIR) $(SRC) | sed '\''s@\(.*\)\.o[ :]@$(OBJDIR)/\1.o$(SUFFIX):@g'\'' >$(DEPEND)'
@echo

$(OBJDIR):
mkdir -p $(OBJDIR)

$(BINDIR):
mkdir -p $(BINDIR)

$(OBJDIR)/%.o$(SUFFIX): $(SRCDIR)/%.cpp
@echo 'compiling object file "$@" ...'
@$(CC) $(compatibility) -c -o $@ $(FLAGS) $<
Expand Down
42 changes: 0 additions & 42 deletions ISOSegmentValidator/public/linux/bin/Assemble

This file was deleted.

Binary file removed ISOSegmentValidator/public/linux/bin/ValidateMP4.exe
Binary file not shown.
22 changes: 0 additions & 22 deletions ISOSegmentValidator/public/linux/dependencies

This file was deleted.

Binary file removed ISOSegmentValidator/public/linux/obj/HelperMethods.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ISOSegmentValidator/public/linux/obj/ValidateBits.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ISOSegmentValidator/public/linux/obj/ValidateMP4.o
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions ISOSegmentValidator/public/linux/tags

This file was deleted.

6 changes: 3 additions & 3 deletions ISOSegmentValidator/public/src/EndianMP4.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extern "C" {

For example, to convert a Big Endian 32-bit unsigned integer to the current native format use:

long i = EndianU32_BtoN(data);
SInt32 i = EndianU32_BtoN(data);

This file is set up so that the function macro to nothing when the target runtime already
is the desired format (e.g. on Big Endian machines, EndianU32_BtoN() macros away).
Expand Down Expand Up @@ -321,7 +321,7 @@ typedef OSType BigEndianOSType;


/*
Implement �LtoB and �BtoL
Implement �LtoB and �BtoL
*/
#define EndianS16_LtoB(value) ((SInt16)Endian16_Swap(value))
#define EndianS16_BtoL(value) ((SInt16)Endian16_Swap(value))
Expand All @@ -339,7 +339,7 @@ typedef OSType BigEndianOSType;


/*
Implement low level �_Swap functions.
Implement low level �_Swap functions.

extern UInt16 Endian16_Swap(UInt16 value);
extern UInt32 Endian32_Swap(UInt32 value);
Expand Down
28 changes: 14 additions & 14 deletions ISOSegmentValidator/public/src/HelperMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ limitations under the License.
//==========================================================================================

int FindAtomOffsets( atomOffsetEntry *aoe, UInt64 minOffset, UInt64 maxOffset,
long *atomCountOut, atomOffsetEntry **atomOffsetsOut )
SInt32 *atomCountOut, atomOffsetEntry **atomOffsetsOut )
{
int err = noErr;
long cnt = 0;
SInt32 cnt = 0;
atomOffsetEntry *atomOffsets = nil;
long max = 20;
SInt32 max = 20;
startAtomType startAtom;
UInt64 largeSize;
uuidType uuid;
UInt64 curOffset = minOffset;
long minAtomSize;
SInt32 minAtomSize;

printf ("<%s> : min %08llX max %08llX\n", __FUNCTION__, minOffset, maxOffset);
printf ("<%s> : min %08lX max %08lX\n", __FUNCTION__, minOffset, maxOffset);

BAILIFNULL( atomOffsets = (atomOffsetEntry *)calloc( max, sizeof(atomOffsetEntry)), allocFailedErr );

Expand All @@ -61,7 +61,7 @@ int FindAtomOffsets( atomOffsetEntry *aoe, UInt64 minOffset, UInt64 maxOffset,
atom_name[1] = ((char*)(&startAtom.type))[2];
atom_name[2] = ((char*)(&startAtom.type))[1];
atom_name[3] = ((char*)(&startAtom.type))[0];
printf ("atom_name <%s> offset %08llX\n",atom_name, curOffset - sizeof(startAtom.type));
printf ("atom_name <%s> offset %08lX\n",atom_name, curOffset - sizeof(startAtom.type));

if (startAtom.type == 'uuid') {
BAILIFERR( GetFileData( aoe, &uuid, curOffset, sizeof(uuid), &curOffset ) );
Expand Down Expand Up @@ -206,12 +206,12 @@ void logtempInfo(MovieInfoRec *mir)
return;
}

fprintf(leafInfoFile,"%ld\n",mir->numTIRs);
fprintf(leafInfoFile,"%u\n",mir->numTIRs);

for(int i = 0 ; i < mir->numTIRs ; i++)
{
TrackInfoRec *tir = &(mir->tirList[i]);
fprintf(leafInfoFile,"%lu\n",tir->mediaTimeScale);
fprintf(leafInfoFile,"%u\n",tir->mediaTimeScale);
}


Expand All @@ -229,7 +229,7 @@ void logtempInfo(MovieInfoRec *mir)

for(UInt32 j = 0 ; j < tir->numLeafs ; j++)
if(tir->leafInfo[j].hasFragments)
fprintf(leafInfoFile,"%d, %llu, %llu\n",tir->leafInfo[j].firstInSegment,(UInt64)roundl(tir->leafInfo[j].earliestPresentationTime*(long double)tir->mediaTimeScale),tir->leafInfo[j].offset);
fprintf(leafInfoFile,"%d, %lu, %lu\n",tir->leafInfo[j].firstInSegment,(UInt64)roundl(tir->leafInfo[j].earliestPresentationTime*(long double)tir->mediaTimeScale),tir->leafInfo[j].offset);
}

fclose(leafInfoFile);
Expand All @@ -247,15 +247,15 @@ void logLeafInfo(MovieInfoRec *mir)
return;
}

fprintf(leafInfoFile,"%lu\n",vg.accessUnitDurationNonIndexedTrack);
fprintf(leafInfoFile,"%u\n",vg.accessUnitDurationNonIndexedTrack);

fprintf(leafInfoFile,"%ld\n",mir->numTIRs);
fprintf(leafInfoFile,"%u\n",mir->numTIRs);


for(int i = 0 ; i < mir->numTIRs ; i++)
{
TrackInfoRec *tir = &(mir->tirList[i]);
fprintf(leafInfoFile,"%lu %lu\n",tir->trackID,tir->hdlrInfo->componentSubType);
fprintf(leafInfoFile,"%u %u\n",tir->trackID,tir->hdlrInfo->componentSubType);
}


Expand Down Expand Up @@ -320,12 +320,12 @@ UInt64 GetVariableLengthData(BitBuffer *bb, UInt32 wordLength, OSErr *errout)
data64 <<= wordLength;
dataTemp = GetBits(bb, wordLength + 1, &err); if (err) GOTOBAIL;
data64 |= (dataTemp & ~testMask);
printf ("dataTemp %llu data64 %llu testMask %llu\n", dataTemp, data64, testMask);
printf ("dataTemp %lu data64 %lu testMask %lu\n", dataTemp, data64, testMask);
}
while ((dataTemp & testMask) != 0);

bail:
printf ("return %llu\n", data64);
printf ("return %lu\n", data64);
*errout = err;
return data64;
}
Expand Down
2 changes: 1 addition & 1 deletion ISOSegmentValidator/public/src/HelperMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
#define ABS(a) (((a) < 0) ? -(a) : (a));

int FindAtomOffsets( atomOffsetEntry *aoe, UInt64 minOffset, UInt64 maxOffset,
long *atomCountOut, atomOffsetEntry **atomOffsetsOut );
SInt32 *atomCountOut, atomOffsetEntry **atomOffsetsOut );
TrackInfoRec * check_track( UInt32 theID );
UInt32 getTrakIndexByID(UInt32 track_ID);
UInt32 getMoofIndexByOffset(MoofInfoRec *moofInfo, UInt32 numFragments, UInt64 offset);
Expand Down
Loading