Mercurial > audlegacy
changeset 584:f6ebe4972465 trunk
[svn] remove unused components
author | nenolod |
---|---|
date | Thu, 02 Feb 2006 18:13:17 -0800 |
parents | 2abba1360af4 |
children | 72a03593dfc0 |
files | Plugins/Input/aac/libmp4v2/test/Makefile.am Plugins/Input/aac/libmp4v2/test/c_api.c Plugins/Input/aac/libmp4v2/test/mp4broadcaster.cpp Plugins/Input/aac/libmp4v2/test/mp4clip.cpp Plugins/Input/aac/libmp4v2/test/nullcreate.cpp Plugins/Input/aac/libmp4v2/test/nullvplayer.cpp Plugins/Input/aac/libmp4v2/test/urltrack.cpp Plugins/Input/aac/libmp4v2/util/Makefile.am Plugins/Input/aac/libmp4v2/util/mp4art.cpp Plugins/Input/aac/libmp4v2/util/mp4dump.cpp Plugins/Input/aac/libmp4v2/util/mp4dump60.dsp Plugins/Input/aac/libmp4v2/util/mp4extract.cpp Plugins/Input/aac/libmp4v2/util/mp4extract60.dsp Plugins/Input/aac/libmp4v2/util/mp4info.cpp Plugins/Input/aac/libmp4v2/util/mp4info.dsp Plugins/Input/aac/libmp4v2/util/mp4tags.cpp Plugins/Input/aac/libmp4v2/util/mp4trackdump.cpp Plugins/Input/aac/libmp4v2/util/mp4videoinfo.cpp |
diffstat | 18 files changed, 0 insertions(+), 2827 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/aac/libmp4v2/test/Makefile.am Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ - -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/mp4v2 - -check_PROGRAMS = c_api mp4broadcaster nullcreate nullvplayer urltrack mp4clip - -c_api_SOURCES = c_api.c -c_api_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la -lstdc++ - -mp4broadcaster_SOURCES = mp4broadcaster.cpp -mp4broadcaster_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la - -nullcreate_SOURCES = nullcreate.cpp -nullcreate_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la - -nullvplayer_SOURCES = nullvplayer.cpp -nullvplayer_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la - -urltrack_SOURCES = urltrack.cpp -urltrack_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la - -mp4clip_SOURCES = mp4clip.cpp -mp4clip_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la -
--- a/Plugins/Input/aac/libmp4v2/test/c_api.c Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -#include "mp4.h" - -main(int argc, char** argv) -{ -#if 0 - MP4FileHandle mp4File = MP4Read(argv[1], MP4_DETAILS_ERROR); - - if (!mp4File) { - exit(1); - } - - MP4Dump(mp4File, stdout, 0); - - MP4Close(mp4File); - - exit(0); -#else - MP4FileHandle mp4File; - - mp4File = MP4Modify(argv[1], MP4_DETAILS_ERROR, 0); - MP4SetVerbosity(mp4File, MP4_DETAILS_ALL); -#if 1 - u_int8_t* data=(u_int8_t*)"this is my tag data"; - u_int32_t len=strlen((char*)data); - MP4SetMetadataFreeForm(mp4File, "mytag1",data,len); - MP4SetMetadataFreeForm(mp4File, "my_tag2",data,len); -#endif - MP4Close(mp4File); - exit(0); -#endif -} -
--- a/Plugins/Input/aac/libmp4v2/test/mp4broadcaster.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,435 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -#include "mpeg4ip.h" -#include <arpa/inet.h> -#include "mp4.h" - -// forward declarations -static bool AssembleSdp( - MP4FileHandle mp4File, - const char* sdpFileName, - const char* destIpAddress); - -static bool InitSockets( - u_int32_t numSockets, - int* pSockets, - const char* destIpAddress); - -static u_int64_t GetUsecTime(); - -// globals -char* ProgName; -u_int16_t UdpBasePort = 20000; -u_int32_t MulticastTtl = 2; // increase value if necessary - -const u_int32_t SecsBetween1900And1970 = 2208988800U; - - -// the main show -int main(int argc, char** argv) -{ - // since we're a test program - // keep command line processing to a minimum - // and assume some defaults - ProgName = argv[0]; - char* sdpFileName = "./mp4broadcaster.sdp"; - char* destIpAddress = "224.1.2.3"; - - if (argc < 2) { - fprintf(stderr, "Usage: %s <file>\n", ProgName); - exit(1); - } - - char* mp4FileName = argv[1]; - u_int32_t verbosity = - MP4_DETAILS_ERROR | MP4_DETAILS_READ - | MP4_DETAILS_SAMPLE | MP4_DETAILS_HINT; - - // open the mp4 file - MP4FileHandle mp4File = MP4Read(mp4FileName, verbosity); - - if (mp4File == MP4_INVALID_FILE_HANDLE) { - // library will print an error message - exit(1); - } - - // check for hint tracks - u_int32_t numHintTracks = - MP4GetNumberOfTracks(mp4File, MP4_HINT_TRACK_TYPE); - - if (numHintTracks == 0) { - fprintf(stderr, "%s: File %s does not contain any hint tracks", - ProgName, mp4FileName); - exit(2); - } - - // assemble and write out sdp file - AssembleSdp(mp4File, sdpFileName, destIpAddress); - - // create two UDP sockets for each track that will be streamed - // one for the RTP media, one for the RTCP control - int* udpSockets = new int[numHintTracks * 2]; - - if (!InitSockets(numHintTracks, udpSockets, destIpAddress)) { - fprintf(stderr, "%s: Couldn't create UDP sockets\n", - ProgName); - exit(3); - } - - // initialize RTCP packet - u_int32_t ssrc = random(); - char rtcpCName[256]; - char* username = getlogin(); - char hostname[256]; - gethostname(hostname, sizeof(hostname)); - snprintf(rtcpCName, sizeof(rtcpCName), "%s@%s", username, hostname); - - u_int8_t rtcpPacket[512]; - u_int16_t rtcpPacketLength = 38; - - // RTCP SR - rtcpPacket[0] = 0x80; - rtcpPacket[1] = 0xC8; - rtcpPacket[2] = 0x00; - rtcpPacket[3] = 0x06; - *(u_int32_t*)&rtcpPacket[4] = htonl(ssrc); - - // RTCP SDES CNAME - rtcpPacket[28] = 0x80; - rtcpPacket[29] = 0xCA; - *(u_int32_t*)&rtcpPacket[32] = htonl(ssrc); - - rtcpPacket[36] = 0x01; - rtcpPacket[37] = strlen(rtcpCName); - strcpy((char*)&rtcpPacket[38], rtcpCName); - rtcpPacketLength += strlen(rtcpCName) + 1; - - // pad with zero's to 32 bit boundary - while (rtcpPacketLength % 4 != 0) { - rtcpPacket[rtcpPacketLength++] = 0; - } - - *(u_int16_t*)&rtcpPacket[30] = ntohs((rtcpPacketLength - 32) / 4); - - // initialize per track variables that we will use in main loop - MP4TrackId* hintTrackIds = new MP4TrackId[numHintTracks]; - MP4SampleId* nextHintIds = new MP4SampleId[numHintTracks]; - MP4SampleId* maxHintIds = new MP4SampleId[numHintTracks]; - u_int64_t* nextHintTimes = new MP4Timestamp[numHintTracks]; - u_int32_t* packetsSent = new u_int32_t[numHintTracks]; - u_int32_t* bytesSent = new u_int32_t[numHintTracks]; - - u_int32_t i; - - for (i = 0; i < numHintTracks; i++) { - hintTrackIds[i] = MP4FindTrackId(mp4File, i, MP4_HINT_TRACK_TYPE); - nextHintIds[i] = 1; - maxHintIds[i] = MP4GetTrackNumberOfSamples(mp4File, hintTrackIds[i]); - nextHintTimes[i] = (u_int64_t)-1; - packetsSent[i] = 0; - bytesSent[i] = 0; - } - - // remember the starting time - u_int64_t start = GetUsecTime(); - u_int64_t lastSR = 0; - - // main loop to stream data - while (true) { - u_int32_t nextTrackIndex = (u_int32_t)-1; - u_int64_t nextTime = (u_int64_t)-1; - - // find the next hint to send - for (i = 0; i < numHintTracks; i++) { - if (nextHintIds[i] > maxHintIds[i]) { - // have finished this track - continue; - } - - // need to get the time of the next hint - if (nextHintTimes[i] == (u_int64_t)-1) { - MP4Timestamp hintTime = - MP4GetSampleTime(mp4File, hintTrackIds[i], nextHintIds[i]); - - nextHintTimes[i] = - MP4ConvertFromTrackTimestamp(mp4File, hintTrackIds[i], - hintTime, MP4_USECS_TIME_SCALE); - } - - // check if this track's next hint is the earliest yet - if (nextHintTimes[i] > nextTime) { - continue; - } - - // make this our current choice for the next hint - nextTime = nextHintTimes[i]; - nextTrackIndex = i; - } - - // check exit condition, i.e all hints for all tracks have been used - if (nextTrackIndex == (u_int32_t)-1) { - break; - } - - // wait until the correct time to send next hint - // we assume we're not going to fall behind for testing purposes - // in a real application some skipping of samples might be needed - - u_int64_t now = GetUsecTime(); - int64_t waitTime = (start + nextTime) - now; - if (waitTime > 0) { - usleep(waitTime); - } - - now = GetUsecTime(); - - // emit RTCP Sender Reports every 5 seconds for all media streams - // not quite what a real app would do, but close enough for testing - if (now - lastSR >= 5000000) { - for (i = 0; i < numHintTracks; i++) { - now = GetUsecTime(); - - u_int32_t ntpSecs = - (now / MP4_USECS_TIME_SCALE) + SecsBetween1900And1970; - *(u_int32_t*)&rtcpPacket[8] = - htonl(ntpSecs); - - u_int32_t usecs = now % MP4_USECS_TIME_SCALE; - u_int32_t ntpUSecs = - (usecs << 12) + (usecs << 8) - ((usecs * 3650) >> 6); - *(u_int32_t*)&rtcpPacket[12] = - htonl(ntpUSecs); - - MP4Timestamp rtpStart = - MP4GetRtpTimestampStart(mp4File, hintTrackIds[i]); - - MP4Timestamp rtpOffset = - MP4ConvertToTrackTimestamp(mp4File, hintTrackIds[i], - now - start, MP4_USECS_TIME_SCALE); - - *(u_int32_t*)&rtcpPacket[16] = - htonl(rtpStart + rtpOffset); - - *(u_int32_t*)&rtcpPacket[20] = - htonl(packetsSent[i]); - *(u_int32_t*)&rtcpPacket[24] = - htonl(bytesSent[i]); - - send(udpSockets[i * 2 + 1], rtcpPacket, rtcpPacketLength, 0); - } - - lastSR = now; - } - - // send all the packets for this hint - // since this is just a test program - // we don't attempt to smooth out the transmission of the packets - - u_int16_t numPackets; - - MP4ReadRtpHint( - mp4File, - hintTrackIds[nextTrackIndex], - nextHintIds[nextTrackIndex], - &numPackets); - - // move along in this hint track - nextHintIds[nextTrackIndex]++; - nextHintTimes[nextTrackIndex] = (u_int64_t)-1; - - u_int16_t packetIndex; - - for (packetIndex = 0; packetIndex < numPackets; packetIndex++) { - u_int8_t* pPacket = NULL; - u_int32_t packetSize; - - // get the packet from the library - MP4ReadRtpPacket( - mp4File, - hintTrackIds[nextTrackIndex], - packetIndex, - &pPacket, - &packetSize, - ssrc); - - if (pPacket == NULL) { - // error, but forge on - continue; - } - - // send it out via UDP - send(udpSockets[nextTrackIndex * 2], pPacket, packetSize, 0); - - // free packet buffer - free(pPacket); - - bytesSent[nextTrackIndex] += packetSize - 12; - } - - packetsSent[nextTrackIndex] += numPackets; - } - - // main loop finished - - // close the UDP sockets - for (i = 0; i < numHintTracks; i++) { - close(udpSockets[i]); - } - - // close mp4 file - MP4Close(mp4File); - - // free up memory - delete [] hintTrackIds; - delete [] nextHintIds; - delete [] maxHintIds; - delete [] nextHintTimes; - delete [] packetsSent; - delete [] bytesSent; - - exit(0); -} - -static bool AssembleSdp( - MP4FileHandle mp4File, - const char* sdpFileName, - const char* destIpAddress) -{ - // open the destination sdp file - FILE* sdpFile = fopen(sdpFileName, "w"); - - if (sdpFile == NULL) { - fprintf(stderr, - "%s: couldn't open sdp file %s\n", - ProgName, sdpFileName); - return false; - } - - // add required header fields - fprintf(sdpFile, - "v=0\015\012" - "o=- 1 1 IN IP4 127.0.0.1\015\012" - "s=mp4broadcaster\015\012" - "e=NONE\015\012" - "c=IN IP4 %s/%u\015\012" - "b=RR:0\015\012", - destIpAddress, - MulticastTtl); - - // add session level info from mp4 file - fprintf(sdpFile, "%s", - MP4GetSessionSdp(mp4File)); - - // add per track info - u_int32_t numHintTracks = - MP4GetNumberOfTracks(mp4File, MP4_HINT_TRACK_TYPE); - - for (u_int32_t i = 0; i < numHintTracks; i++) { - MP4TrackId hintTrackId = - MP4FindTrackId(mp4File, i, MP4_HINT_TRACK_TYPE); - - if (hintTrackId == MP4_INVALID_TRACK_ID) { - continue; - } - - // get track sdp info from mp4 file - const char* mediaSdp = - MP4GetHintTrackSdp(mp4File, hintTrackId); - - // since we're going to broadcast instead of use RTSP for on-demand - // we need to fill in the UDP port numbers for the media - const char* portZero = strchr(mediaSdp, '0'); - if (portZero == NULL) { - continue; // mal-formed sdp - } - fprintf(sdpFile, "%.*s%u%s", - portZero - mediaSdp, - mediaSdp, - UdpBasePort + (i * 2), - portZero + 1); - } - - fclose(sdpFile); - - return true; -} - -static bool InitSockets( - u_int32_t numSocketPairs, - int* pSockets, - const char* destIpAddress) -{ - u_int32_t i; - - - for (i = 0; i < numSocketPairs * 2; i++) { - // create the socket - pSockets[i] = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - - if (pSockets[i] < 0) { - return false; - } - - // allow local listeners to multicast - int reuse = 1; - setsockopt(pSockets[i], SOL_SOCKET, SO_REUSEADDR, - &reuse, sizeof(reuse)); -#ifdef SO_REUSEPORT - // not all implementations have this option - setsockopt(pSockets[i], SOL_SOCKET, SO_REUSEPORT, - &reuse, sizeof(reuse)); -#endif - - // get a local source address - struct sockaddr_in sin; - sin.sin_family = AF_INET; - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - - if (bind(pSockets[i], (struct sockaddr*)&sin, sizeof(sin))) { - return false; - } - - // bind to the destination address - sin.sin_port = htons(UdpBasePort + i); - inet_aton(destIpAddress, &sin.sin_addr); - - if (connect(pSockets[i], (struct sockaddr*)&sin, sizeof(sin)) < 0) { - return false; - } - - // set the multicast time to live - setsockopt(pSockets[i], IPPROTO_IP, IP_MULTICAST_TTL, - &MulticastTtl, sizeof(MulticastTtl)); - } - - return true; -} - -// get absolute time expressed in microseconds -static u_int64_t GetUsecTime() -{ - struct timeval tv; - gettimeofday(&tv, NULL); - return (tv.tv_sec * 1000000) + tv.tv_usec; -} -
--- a/Plugins/Input/aac/libmp4v2/test/mp4clip.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001-2002. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -// N.B. mp4clips clips tracks in an mp4 file -// without regard to sync samples aka "key frames" -// as a testing app the burden is on the user to choose -// an appropriate clip start time - -#include "mp4.h" -#include "mpeg4ip_getopt.h" - -char* ProgName; - -// forward declaration -void ClipTrack( - MP4FileHandle srcFile, - MP4TrackId trackId, - MP4FileHandle dstFile, - float startTime, - float duration); - - -int main(int argc, char** argv) -{ - char* usageString = - "usage: %s [-t <track-id>] [-v [<level>]] [-s <start>] -l <duration> <file-name>\n"; - char* srcFileName = NULL; - char* dstFileName = NULL; - MP4TrackId trackId = MP4_INVALID_TRACK_ID; - u_int32_t verbosity = MP4_DETAILS_ERROR; - float startTime = 0.0; - float duration = 0.0; - - /* begin processing command line */ - ProgName = argv[0]; - while (true) { - int c = -1; - int option_index = 0; - static struct option long_options[] = { - { "length", 1, 0, 'l' }, - { "start", 1, 0, 's' }, - { "track", 1, 0, 't' }, - { "verbose", 2, 0, 'v' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } - }; - - c = getopt_long_only(argc, argv, "l:s:t:v::V", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case 'l': - if (sscanf(optarg, "%f", &duration) != 1) { - fprintf(stderr, - "%s: bad length specified: %s\n", - ProgName, optarg); - } - break; - case 's': - if (sscanf(optarg, "%f", &startTime) != 1) { - fprintf(stderr, - "%s: bad start time specified: %s\n", - ProgName, optarg); - } - break; - case 't': - if (sscanf(optarg, "%u", &trackId) != 1) { - fprintf(stderr, - "%s: bad track-id specified: %s\n", - ProgName, optarg); - exit(1); - } - break; - case 'v': - verbosity |= MP4_DETAILS_READ; - if (optarg) { - u_int32_t level; - if (sscanf(optarg, "%u", &level) == 1) { - if (level >= 2) { - verbosity |= MP4_DETAILS_TABLE; - } - if (level >= 3) { - verbosity |= MP4_DETAILS_SAMPLE; - } - if (level >= 4) { - verbosity = MP4_DETAILS_ALL; - } - } - } - break; - case '?': - fprintf(stderr, usageString, ProgName); - exit(0); - case 'V': - fprintf(stderr, "%s - %s version %s\n", - ProgName, MPEG4IP_PACKAGE, MPEG4IP_VERSION); - exit(0); - default: - fprintf(stderr, "%s: unknown option specified, ignoring: %c\n", - ProgName, c); - } - } - - /* check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, usageString, ProgName); - exit(1); - } - - if (verbosity) { - fprintf(stderr, "%s version %s\n", ProgName, MPEG4IP_VERSION); - } - - /* point to the specified file name */ - srcFileName = argv[optind++]; - - /* get dest file name */ - if ((argc - optind) > 0) { - dstFileName = argv[optind++]; - } - - /* warn about extraneous non-option arguments */ - if (optind < argc) { - fprintf(stderr, "%s: unknown options specified, ignoring: ", ProgName); - while (optind < argc) { - fprintf(stderr, "%s ", argv[optind++]); - } - fprintf(stderr, "\n"); - } - - if (duration == 0.0) { - fprintf(stderr, - "%s: please specify clip length with -l option\n", - ProgName); - } - - /* end processing of command line */ - - - MP4FileHandle srcFile = - MP4Modify(srcFileName, verbosity); - - if (!srcFile) { - exit(1); - } - - MP4FileHandle dstFile = - MP4_INVALID_FILE_HANDLE; - - if (dstFileName) { - dstFile = MP4Create(dstFileName, verbosity); - } - - if (trackId == MP4_INVALID_TRACK_ID) { - u_int32_t numTracks = MP4GetNumberOfTracks(srcFile); - - for (u_int32_t i = 0; i < numTracks; i++) { - trackId = MP4FindTrackId(srcFile, i); - ClipTrack(srcFile, trackId, dstFile, startTime, duration); - } - } else { - ClipTrack(srcFile, trackId, dstFile, startTime, duration); - } - - MP4Close(srcFile); - if (dstFile != MP4_INVALID_FILE_HANDLE) { - MP4Close(dstFile); - } - - return(0); -} - -void ClipTrack( - MP4FileHandle srcFile, - MP4TrackId trackId, - MP4FileHandle dstFile, - float startTime, - float duration) -{ - MP4Timestamp trackStartTime = - MP4ConvertToTrackTimestamp( - srcFile, - trackId, - (u_int64_t)(startTime * 1000), - MP4_MSECS_TIME_SCALE); - - MP4Duration trackDuration = - MP4ConvertToTrackDuration( - srcFile, - trackId, - (u_int64_t)(duration * 1000), - MP4_MSECS_TIME_SCALE); - - MP4EditId editId = - MP4AddTrackEdit( - srcFile, - trackId, - 1, - trackStartTime, - trackDuration); - - if (editId == MP4_INVALID_EDIT_ID) { - fprintf(stderr, - "%s: can't create track edit\n", - ProgName); - return; - } - - if (dstFile) { - MP4CopyTrack( - srcFile, - trackId, - dstFile, - true); - - MP4DeleteTrackEdit( - srcFile, - trackId, - editId); - } -} -
--- a/Plugins/Input/aac/libmp4v2/test/nullcreate.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -#include "mp4.h" -#if 0 -#include "mp4util.h" -#endif - -main(int argc, char** argv) -{ -#if 1 - if (argc < 2) { - fprintf(stderr, "Usage: %s <file>\n", argv[0]); - exit(1); - } - - u_int32_t verbosity = MP4_DETAILS_ALL; - - MP4FileHandle mp4File = MP4Create(argv[1], verbosity); - - if (!mp4File) { - exit(1); - } - - printf("Created skeleton\n"); - MP4Dump(mp4File); - - MP4SetODProfileLevel(mp4File, 1); - MP4SetSceneProfileLevel(mp4File, 1); - MP4SetVideoProfileLevel(mp4File, 1); - MP4SetAudioProfileLevel(mp4File, 1); - MP4SetGraphicsProfileLevel(mp4File, 1); - - MP4TrackId odTrackId = - MP4AddODTrack(mp4File); - - MP4TrackId bifsTrackId = - MP4AddSceneTrack(mp4File); - - MP4TrackId videoTrackId = -#if 0 - MP4AddVideoTrack(mp4File, 90000, 3000, 320, 240); -#else - MP4AddH264VideoTrack(mp4File, 90000, 3000, 320, 240, - 1, 2, 3, 1); - static uint8_t pseq[] = { 0, 1, 2, 3, 4, 5, 6,7, 8, 9 }; - - MP4AddH264SequenceParameterSet(mp4File, videoTrackId, pseq, 10); - MP4AddH264SequenceParameterSet(mp4File, videoTrackId, pseq, 6); - MP4AddH264PictureParameterSet(mp4File, videoTrackId, pseq, 7); - MP4AddH264PictureParameterSet(mp4File, videoTrackId, pseq, 8); - MP4AddH264PictureParameterSet(mp4File, videoTrackId, pseq, 7); - -#endif - - MP4TrackId videoHintTrackId = - MP4AddHintTrack(mp4File, videoTrackId); - - MP4TrackId audioTrackId = - MP4AddAudioTrack(mp4File, 44100, 1152); - - MP4TrackId audioHintTrackId = - MP4AddHintTrack(mp4File, audioTrackId); - - printf("Added tracks\n"); - MP4Dump(mp4File); - - MP4Close(mp4File); - - // MP4MakeIsmaCompliant(argv[1], verbosity); - - exit(0); -#else - uint8_t *bin = NULL; - - for (uint32_t ix = 4; ix < 1024; ix++) { - printf("pass %d\n", ix); - bin = (uint8_t *)malloc(ix); - for (uint32_t jx = 0; jx < ix; jx++) { - bin[jx] = ((uint32_t)random()) >> 24; - } - char *test; - test = MP4ToBase64(bin, ix); - uint8_t *ret; - uint32_t retsize; - ret = Base64ToBinary(test, strlen(test), &retsize); - if (retsize != ix) { - printf("return size not same %d %d\n", ix, retsize); - exit(0); - } - if (memcmp(ret, bin, ix) != 0) { - printf("memory not same\n"); - exit(0); - } - free(test); - free(ret); - free(bin); - } - return 0; -#endif -} -
--- a/Plugins/Input/aac/libmp4v2/test/nullvplayer.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -#include "mp4.h" - -main(int argc, char** argv) -{ - if (argc < 2) { - fprintf(stderr, "Usage: %s <file>\n", argv[0]); - exit(1); - } - - u_int32_t verbosity = MP4_DETAILS_ALL; - char* fileName = argv[1]; - - // open the mp4 file, and read meta-info - MP4FileHandle mp4File = MP4Read(fileName, verbosity); - - u_int8_t profileLevel = MP4GetVideoProfileLevel(mp4File); - - // get a handle on the first video track - MP4TrackId trackId = MP4FindTrackId(mp4File, 0, "video"); - - // gather the crucial track information - - u_int32_t timeScale = MP4GetTrackTimeScale(mp4File, trackId); - - // note all times and durations - // are in units of the track time scale - - MP4Duration trackDuration = MP4GetTrackDuration(mp4File, trackId); - - MP4SampleId numSamples = MP4GetTrackNumberOfSamples(mp4File, trackId); - - u_int32_t maxSampleSize = MP4GetTrackMaxSampleSize(mp4File, trackId); - - u_int8_t* pConfig; - u_int32_t configSize = 0; - - MP4GetTrackESConfiguration(mp4File, trackId, &pConfig, &configSize); - - // initialize decoder with Elementary Stream (ES) configuration - - // done with our copy of ES configuration - free(pConfig); - - - // now consecutively read and display the track samples - - u_int8_t* pSample = (u_int8_t*)malloc(maxSampleSize); - u_int32_t sampleSize; - MP4Timestamp sampleTime; - MP4Duration sampleDuration; - MP4Duration sampleRenderingOffset; - bool isSyncSample; - - for (MP4SampleId sampleId = 1; sampleId <= numSamples; sampleId++) { - - // give ReadSample our own buffer, and let it know how big it is - sampleSize = maxSampleSize; - - // read next sample from video track - MP4ReadSample(mp4File, trackId, sampleId, - &pSample, &sampleSize, - &sampleTime, &sampleDuration, &sampleRenderingOffset, - &isSyncSample); - - // convert timestamp and duration from track time to milliseconds - u_int64_t myTime = MP4ConvertFromTrackTimestamp(mp4File, trackId, - sampleTime, MP4_MSECS_TIME_SCALE); - - u_int64_t myDuration = MP4ConvertFromTrackDuration(mp4File, trackId, - sampleDuration, MP4_MSECS_TIME_SCALE); - - // decode frame and display it - } - - // close mp4 file - MP4Close(mp4File); - - - // Note to seek to time 'when' in the track - // use MP4GetSampleIdFromTime(MP4FileHandle hFile, - // MP4Timestamp when, bool wantSyncSample) - // 'wantSyncSample' determines if a sync sample is desired or not - // e.g. - // MP4Timestamp when = - // MP4ConvertToTrackTimestamp(mp4File, trackId, 30, MP4_SECS_TIME_SCALE); - // MP4SampleId newSampleId = MP4GetSampleIdFromTime(mp4File, when, true); - // MP4ReadSample(mp4File, trackId, newSampleId, ...); - // - // Note that start time for sample may be later than 'when' - - exit(0); -} -
--- a/Plugins/Input/aac/libmp4v2/test/urltrack.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -#include "mp4.h" - -main(int argc, char** argv) -{ - if (argc < 2) { - fprintf(stderr, "Usage: %s <file>\n", argv[0]); - exit(1); - } - - u_int32_t verbosity = 0 /* MP4_DETAILS_ALL */; - - MP4FileHandle mp4File = MP4Create(argv[1], verbosity); - - if (!mp4File) { - exit(1); - } - - MP4TrackId urlTrackId = -#if 0 - MP4AddTrack(mp4File, "URLF"); -#else - MP4AddHrefTrack(mp4File, 90000, MP4_INVALID_DURATION); -#endif - printf("urlTrackId %d\n", urlTrackId); - - u_int8_t i; - char url[128]; - - for (i = 1; i <= 5; i++) { - sprintf(url, "http://server.com/foo/bar%u.html", i); - - MP4WriteSample(mp4File, urlTrackId, - (u_int8_t*)url, strlen(url) + 1, (MP4Duration)i); - } - - MP4Close(mp4File); - - mp4File = MP4Read(argv[1], verbosity); - - // check that we can find the track again -#if 0 - urlTrackId = MP4FindTrackId(mp4File, 0, "URLF"); -#else - urlTrackId = MP4FindTrackId(mp4File, 0, MP4_CNTL_TRACK_TYPE); -#endif - printf("urlTrackId %d\n", urlTrackId); - - for (i = 1; i <= 5; i++) { - u_int8_t* pSample = NULL; - u_int32_t sampleSize = 0; - MP4Duration duration; - bool rc; - - rc = MP4ReadSample(mp4File, urlTrackId, i, - &pSample, &sampleSize, NULL, &duration); - - if (rc) { - printf("Sample %i duration "D64": %s\n", - i, duration, pSample); - free(pSample); - } else { - printf("Couldn't read sample %i\n", i); - } - } - - MP4Close(mp4File); - - exit(0); -} -
--- a/Plugins/Input/aac/libmp4v2/util/Makefile.am Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ - -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/mp4v2 -I$(top_builddir)/lib/mp4av - -AM_CXXFLAGS = @BILLS_CPPWARNINGS@ - -bin_PROGRAMS = mp4dump mp4extract mp4info mp4trackdump mp4tags mp4art mp4videoinfo - -mp4dump_SOURCES = mp4dump.cpp -mp4dump_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la - -mp4extract_SOURCES = mp4extract.cpp -mp4extract_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la - -mp4info_SOURCES = mp4info.cpp -mp4info_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la - -mp4trackdump_SOURCES = mp4trackdump.cpp -mp4trackdump_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la - -mp4videoinfo_SOURCES = mp4videoinfo.cpp -mp4videoinfo_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/mp4av/libmp4av.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la - -mp4tags_SOURCES = mp4tags.cpp -mp4tags_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la - -mp4art_SOURCES = mp4art.cpp -mp4art_LDADD = $(top_builddir)/lib/mp4v2/libmp4v2.la \ - $(top_builddir)/lib/gnu/libmpeg4ip_gnu.la - -EXTRA_DIST = mp4dump60.dsp mp4extract60.dsp \ - mp4info.dsp
--- a/Plugins/Input/aac/libmp4v2/util/mp4art.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved. - * - * Contributor(s): - * Bill May wmay@cisco.com (from mp4info.cpp) - */ - -#include "mp4.h" -#include "mpeg4ip_getopt.h" - -static void strip_filename (const char *name, char *buffer) -{ - const char *suffix, *slash; - if (name != NULL) { - suffix = strrchr(name, '.'); - slash = strrchr(name, '/'); - if (slash == NULL) slash = name; - else slash++; - if (suffix == NULL) - suffix = slash + strlen(slash); - memcpy(buffer, slash, suffix - slash); - buffer[suffix - slash] = '\0'; - } else { - strcpy(buffer, "out"); - } -} - -int main(int argc, char** argv) -{ - const char* usageString = - "<file-name>\n"; - - /* begin processing command line */ - char* ProgName = argv[0]; - while (true) { - int c = -1; - int option_index = 0; - static struct option long_options[] = { - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } - }; - - c = getopt_long_only(argc, argv, "V", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case '?': - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(0); - case 'V': - fprintf(stderr, "%s - %s version %s\n", ProgName, - MPEG4IP_PACKAGE, MPEG4IP_VERSION); - exit(0); - default: - fprintf(stderr, "%s: unknown option specified, ignoring: %c\n", - ProgName, c); - } - } - - /* check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(1); - } - - /* end processing of command line */ - printf("%s version %s\n", ProgName, MPEG4IP_VERSION); - - while (optind < argc) { - char *mp4FileName = argv[optind++]; - MP4FileHandle mp4file = MP4Read(mp4FileName); - if (mp4file != MP4_INVALID_FILE_HANDLE) { - uint8_t *art; - uint32_t art_size; - - if (MP4GetMetadataCoverArt(mp4file, &art, &art_size)) { - char filename[MAXPATHLEN]; - strip_filename(mp4FileName, filename); - strcat(filename, ".png"); - struct stat fstat; - if (stat(filename, &fstat) == 0) { - fprintf(stderr, "file %s already exists\n", filename); - } else { - FILE *ofile = fopen(filename, FOPEN_WRITE_BINARY); - if (ofile != NULL) { - fwrite(art, art_size, 1, ofile); - fclose(ofile); - printf("created file %s\n", filename); - } else { - fprintf(stderr, "couldn't create file %s\n", filename); - } - } - - free(art); - } else { - fprintf(stderr, "art not available for %s\n", mp4FileName); - } - MP4Close(mp4file); - } - } - - return(0); -} -
--- a/Plugins/Input/aac/libmp4v2/util/mp4dump.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -#include "mp4.h" -#include "mpeg4ip_getopt.h" - -int main(int argc, char** argv) -{ - char* usageString = "[-verbose=[<level>]] <file-name>\n"; - u_int32_t verbosity = MP4_DETAILS_ERROR; - bool dumpImplicits = false; - - /* begin processing command line */ - char* progName = argv[0]; - while (true) { - int c = -1; - int option_index = 0; - static struct option long_options[] = { - { "verbose", 2, 0, 'v' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } - }; - - c = getopt_long_only(argc, argv, "v::V", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case 'v': - verbosity |= MP4_DETAILS_TABLE; - if (optarg) { - u_int32_t level; - if (sscanf(optarg, "%u", &level) == 1) { - if (level >= 2) { - dumpImplicits = true; - } - if (level >= 3) { - verbosity = MP4_DETAILS_ALL; - } - } - } - break; - case '?': - fprintf(stderr, "usage: %s %s", progName, usageString); - exit(0); - case 'V': - fprintf(stderr, "%s - %s version %s\n", - progName, MPEG4IP_PACKAGE, MPEG4IP_VERSION); - exit(0); - default: - fprintf(stderr, "%s: unknown option specified, ignoring: %c\n", - progName, c); - } - } - - /* check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, "usage: %s %s\n", progName, usageString); - exit(1); - } - - /* point to the specified file names */ - char* mp4FileName = argv[optind++]; - - /* warn about extraneous non-option arguments */ - if (optind < argc) { - fprintf(stderr, "%s: unknown options specified, ignoring: ", progName); - while (optind < argc) { - fprintf(stderr, "%s ", argv[optind++]); - } - fprintf(stderr, "\n"); - } - - /* end processing of command line */ - if (verbosity != 0) { - fprintf(stdout, "%s version %s\n", progName, MPEG4IP_VERSION); - } - - MP4FileHandle mp4File = MP4Read(mp4FileName, verbosity); - - if (!mp4File) { - exit(1); - } - - MP4Dump(mp4File, stdout, dumpImplicits); - - MP4Close(mp4File); - - return(0); -} -
--- a/Plugins/Input/aac/libmp4v2/util/mp4dump60.dsp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mp4dump" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mp4dump - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mp4dump60.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mp4dump60.mak" CFG="mp4dump - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mp4dump - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "mp4dump - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mp4dump - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I ".." /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/mp4dump.exe" - -!ELSEIF "$(CFG)" == "mp4dump - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/mp4dump.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mp4dump - Win32 Release" -# Name "mp4dump - Win32 Debug" -# Begin Source File - -SOURCE=.\mp4dump.cpp -# End Source File -# End Target -# End Project
--- a/Plugins/Input/aac/libmp4v2/util/mp4extract.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -// N.B. mp4extract just extracts tracks/samples from an mp4 file -// For many track types this is insufficient to reconsruct a valid -// elementary stream (ES). Use "mp4creator -extract=<trackId>" if -// you need the ES reconstructed. - -#include "mp4.h" -#include "mpeg4ip_getopt.h" - -char* ProgName; -char* Mp4PathName; -char* Mp4FileName; - -// forward declaration -void ExtractTrack(MP4FileHandle mp4File, MP4TrackId trackId, - bool sampleMode, MP4SampleId sampleId, char* dstFileName = NULL); - -int main(int argc, char** argv) -{ - const char* usageString = - "[-l] [-t <track-id>] [-s <sample-id>] [-v [<level>]] <file-name>\n"; - bool doList = false; - bool doSamples = false; - MP4TrackId trackId = MP4_INVALID_TRACK_ID; - MP4SampleId sampleId = MP4_INVALID_SAMPLE_ID; - char* dstFileName = NULL; - u_int32_t verbosity = MP4_DETAILS_ERROR; - -fprintf(stderr, "You don't want to use this utility - use mp4creator --extract instead\n"); -fprintf(stderr, "If you really want to use it, remove this warning and the exit call\n"); -fprintf(stderr, "from the source file\n"); - exit(-1); - /* begin processing command line */ - ProgName = argv[0]; - while (true) { - int c = -1; - int option_index = 0; - static struct option long_options[] = { - { "list", 0, 0, 'l' }, - { "track", 1, 0, 't' }, - { "sample", 2, 0, 's' }, - { "verbose", 2, 0, 'v' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } - }; - - c = getopt_long_only(argc, argv, "lt:s::v::V", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case 'l': - doList = true; - break; - case 's': - doSamples = true; - if (optarg) { - if (sscanf(optarg, "%u", &sampleId) != 1) { - fprintf(stderr, - "%s: bad sample-id specified: %s\n", - ProgName, optarg); - } - } - break; - case 't': - if (sscanf(optarg, "%u", &trackId) != 1) { - fprintf(stderr, - "%s: bad track-id specified: %s\n", - ProgName, optarg); - exit(1); - } - break; - case 'v': - verbosity |= MP4_DETAILS_READ; - if (optarg) { - u_int32_t level; - if (sscanf(optarg, "%u", &level) == 1) { - if (level >= 2) { - verbosity |= MP4_DETAILS_TABLE; - } - if (level >= 3) { - verbosity |= MP4_DETAILS_SAMPLE; - } - if (level >= 4) { - verbosity = MP4_DETAILS_ALL; - } - } - } - break; - case '?': - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(0); - case 'V': - fprintf(stderr, "%s - %s version %s\n", - ProgName, MPEG4IP_PACKAGE, MPEG4IP_VERSION); - exit(0); - default: - fprintf(stderr, "%s: unknown option specified, ignoring: %c\n", - ProgName, c); - } - } - - /* check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(1); - } - - if (verbosity) { - fprintf(stderr, "%s version %s\n", ProgName, MPEG4IP_VERSION); - } - - /* point to the specified file names */ - Mp4PathName = argv[optind++]; - - /* get dest file name for a single track */ - if (trackId && (argc - optind) > 0) { - dstFileName = argv[optind++]; - } - - char* lastSlash = strrchr(Mp4PathName, '/'); - if (lastSlash) { - Mp4FileName = lastSlash + 1; - } else { - Mp4FileName = Mp4PathName; - } - - /* warn about extraneous non-option arguments */ - if (optind < argc) { - fprintf(stderr, "%s: unknown options specified, ignoring: ", ProgName); - while (optind < argc) { - fprintf(stderr, "%s ", argv[optind++]); - } - fprintf(stderr, "\n"); - } - - /* end processing of command line */ - - - MP4FileHandle mp4File = MP4Read(Mp4PathName, verbosity); - - if (!mp4File) { - exit(1); - } - - if (doList) { - MP4Info(mp4File); - exit(0); - } - - if (trackId == 0) { - u_int32_t numTracks = MP4GetNumberOfTracks(mp4File); - - for (u_int32_t i = 0; i < numTracks; i++) { - trackId = MP4FindTrackId(mp4File, i); - ExtractTrack(mp4File, trackId, doSamples, sampleId); - } - } else { - ExtractTrack(mp4File, trackId, doSamples, sampleId, dstFileName); - } - - MP4Close(mp4File); - - return(0); -} - -void ExtractTrack(MP4FileHandle mp4File, MP4TrackId trackId, - bool sampleMode, MP4SampleId sampleId, char* dstFileName) -{ - char outFileName[PATH_MAX]; - int outFd = -1; - int openFlags = O_WRONLY | O_TRUNC | OPEN_CREAT; - - if (!sampleMode) { - if (dstFileName == NULL) { - snprintf(outFileName, sizeof(outFileName), - "%s.t%u", Mp4FileName, trackId); - } else { - snprintf(outFileName, sizeof(outFileName), - "%s", dstFileName); - } - - outFd = open(outFileName, openFlags, 0644); - if (outFd == -1) { - fprintf(stderr, "%s: can't open %s: %s\n", - ProgName, outFileName, strerror(errno)); - return; - } - } - - MP4SampleId numSamples; - - if (sampleMode && sampleId != MP4_INVALID_SAMPLE_ID) { - numSamples = sampleId; - } else { - sampleId = 1; - numSamples = MP4GetTrackNumberOfSamples(mp4File, trackId); - } - - u_int8_t* pSample; - u_int32_t sampleSize; - - for ( ; sampleId <= numSamples; sampleId++) { - int rc; - - // signals to ReadSample() that it should malloc a buffer for us - pSample = NULL; - sampleSize = 0; - - rc = MP4ReadSample(mp4File, trackId, sampleId, &pSample, &sampleSize); - if (rc == 0) { - fprintf(stderr, "%s: read sample %u for %s failed\n", - ProgName, sampleId, outFileName); - break; - } - - if (sampleMode) { - snprintf(outFileName, sizeof(outFileName), "%s.t%u.s%u", - Mp4FileName, trackId, sampleId); - - outFd = open(outFileName, openFlags, 0644); - - if (outFd == -1) { - fprintf(stderr, "%s: can't open %s: %s\n", - ProgName, outFileName, strerror(errno)); - break; - } - } - - rc = write(outFd, pSample, sampleSize); - if (rc == -1 || (u_int32_t)rc != sampleSize) { - fprintf(stderr, "%s: write to %s failed: %s\n", - ProgName, outFileName, strerror(errno)); - break; - } - - free(pSample); - - if (sampleMode) { - close(outFd); - outFd = -1; - } - } - - if (outFd != -1) { - close(outFd); - } -} -
--- a/Plugins/Input/aac/libmp4v2/util/mp4extract60.dsp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mp4extract" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mp4extract - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mp4extract60.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mp4extract60.mak" CFG="mp4extract - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mp4extract - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "mp4extract - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mp4extract - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "mp4extra" -# PROP BASE Intermediate_Dir "mp4extra" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I ".." /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/mp4extract.exe" - -!ELSEIF "$(CFG)" == "mp4extract - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "mp4extr0" -# PROP BASE Intermediate_Dir "mp4extr0" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/mp4extract.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mp4extract - Win32 Release" -# Name "mp4extract - Win32 Debug" -# Begin Source File - -SOURCE=.\mp4extract.cpp -# End Source File -# End Target -# End Project
--- a/Plugins/Input/aac/libmp4v2/util/mp4info.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001-2002. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -#include "mp4.h" -#include "mpeg4ip_getopt.h" - - -int main(int argc, char** argv) -{ - const char* usageString = - "<file-name>\n"; - - /* begin processing command line */ - char* ProgName = argv[0]; - while (true) { - int c = -1; - int option_index = 0; - static struct option long_options[] = { - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } - }; - - c = getopt_long_only(argc, argv, "V", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case '?': - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(0); - case 'V': - fprintf(stderr, "%s - %s version %s\n", ProgName, - MPEG4IP_PACKAGE, MPEG4IP_VERSION); - exit(0); - default: - fprintf(stderr, "%s: unknown option specified, ignoring: %c\n", - ProgName, c); - } - } - - /* check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(1); - } - - /* end processing of command line */ - printf("%s version %s\n", ProgName, MPEG4IP_VERSION); - - while (optind < argc) { - char *mp4FileName = argv[optind++]; - - printf("%s:\n", mp4FileName); - - char* info = MP4FileInfo(mp4FileName); - - if (!info) { - fprintf(stderr, - "%s: can't open %s\n", - ProgName, mp4FileName); - continue; - } - - fputs(info, stdout); - MP4FileHandle mp4file = MP4Read(mp4FileName); - if (mp4file != MP4_INVALID_FILE_HANDLE) { - char *value; - uint16_t numvalue, numvalue2; - if (MP4GetMetadataName(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Name: %s\n", value); - free(value); - } - if (MP4GetMetadataArtist(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Artist: %s\n", value); - free(value); - } - if (MP4GetMetadataWriter(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Writer: %s\n", value); - free(value); - } - if (MP4GetMetadataComment(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Comment: %s\n", value); - free(value); - } - if (MP4GetMetadataTool(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Tool: %s\n", value); - free(value); - } - if (MP4GetMetadataYear(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Year: %s\n", value); - free(value); - } - if (MP4GetMetadataAlbum(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Album: %s\n", value); - free(value); - } - if (MP4GetMetadataTrack(mp4file, &numvalue, &numvalue2)) { - fprintf(stdout, " Metadata track: %u of %u\n", numvalue, - numvalue2); - } - if (MP4GetMetadataDisk(mp4file, &numvalue, &numvalue2)) { - fprintf(stdout, " Metadata Disk: %u of %u\n", numvalue, - numvalue2); - } - if (MP4GetMetadataGenre(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Genre: %s\n", value); - free(value); - } - if (MP4GetMetadataGrouping(mp4file, &value) && value != NULL) { - fprintf(stdout, " Metadata Grouping: %s\n", value); - free(value); - } - if (MP4GetMetadataTempo(mp4file, &numvalue)) { - fprintf(stdout, " Metadata Tempo: %u\n", numvalue); - } - MP4Close(mp4file); - } - free(info); - } - - return(0); -} -
--- a/Plugins/Input/aac/libmp4v2/util/mp4info.dsp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mp4info" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=mp4info - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mp4info.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mp4info.mak" CFG="mp4info - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mp4info - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "mp4info - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mp4info - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "mp4info___Win32_Release" -# PROP BASE Intermediate_Dir "mp4info___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I ".." /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "mp4info - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "mp4info___Win32_Debug" -# PROP BASE Intermediate_Dir "mp4info___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "mp4info - Win32 Release" -# Name "mp4info - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\mp4info.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project
--- a/Plugins/Input/aac/libmp4v2/util/mp4tags.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -/* mp4tags -- tool to set iTunes-compatible metadata tags - * - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * Contributed to MPEG4IP - * by Christopher League <league@contrapunctus.net> - */ - -#include "mp4.h" -#include "mpeg4ip_getopt.h" - -/* One-letter options -- if you want to rearrange these, change them - here, immediately below in OPT_STRING, and in the help text. */ -#define OPT_HELP 'h' -#define OPT_VERSION 'v' -#define OPT_ALBUM 'A' -#define OPT_ARTIST 'a' -#define OPT_TEMPO 'b' -#define OPT_COMMENT 'c' -#define OPT_DISK 'd' -#define OPT_DISKS 'D' -#define OPT_GENRE 'g' -#define OPT_GROUPING 'G' -#define OPT_SONG 's' -#define OPT_TRACK 't' -#define OPT_TRACKS 'T' -#define OPT_WRITER 'w' /* _composer_ */ -#define OPT_YEAR 'y' -#define OPT_REMOVE 'r' - -#define OPT_STRING "hvA:a:b:c:d:D:g:G:s:t:T:w:y:r:" - -static const char* help_text = -"OPTION... FILE...\n" -"Adds or modifies iTunes-compatible tags on MP4 files.\n" -"\n" -" -h, -help Display this help text and exit\n" -" -v, -version Display version information and exit\n" -" -A, -album STR Set the album title\n" -" -a, -artist STR Set the artist information\n" -" -b, -tempo NUM Set the tempo (beats per minute)\n" -" -c, -comment STR Set a general comment\n" -" -d, -disk NUM Set the disk number\n" -" -D, -disks NUM Set the number of disks\n" -" -g, -genre STR Set the genre name\n" -" -G, -grouping STR Set the grouping name\n" -" -s, -song STR Set the song title\n" -" -t, -track NUM Set the track number\n" -" -T, -tracks NUM Set the number of tracks\n" -" -w, -writer STR Set the composer information\n" -" -y, -year NUM Set the year\n" -" -r, -remove STR Remove tags by code (e.g. \"-r cs\"\n" -" removes the comment and song tags)\n" -"\n"; - - -int -main(int argc, char** argv) -{ - static struct option long_options[] = { - { "help", 0, 0, OPT_HELP }, - { "version", 0, 0, OPT_VERSION }, - { "album", 1, 0, OPT_ALBUM }, - { "artist", 1, 0, OPT_ARTIST }, - { "comment", 1, 0, OPT_COMMENT }, - { "disk", 1, 0, OPT_DISK }, - { "disks", 1, 0, OPT_DISKS }, - { "genre", 1, 0, OPT_GENRE }, - { "grouping",1, 0, OPT_GROUPING}, - { "song", 1, 0, OPT_SONG }, - { "tempo", 1, 0, OPT_TEMPO }, - { "track", 1, 0, OPT_TRACK }, - { "tracks", 1, 0, OPT_TRACKS }, - { "writer", 1, 0, OPT_WRITER }, - { "year", 1, 0, OPT_YEAR }, - { "remove", 1, 0, OPT_REMOVE }, - { NULL, 0, 0, 0 } - }; - - /* Sparse arrays of tag data: some space is wasted, but it's more - convenient to say tags[OPT_SONG] than to enumerate all the - metadata types (again) as a struct. */ - char *tags[UCHAR_MAX]; - int nums[UCHAR_MAX]; - - memset(tags, 0, sizeof(tags)); - memset(nums, 0, sizeof(nums)); - - /* Any modifications requested? */ - int mods = 0; - - /* Option-processing loop. */ - int c = getopt_long_only(argc, argv, OPT_STRING, long_options, NULL); - while (c != -1) { - int r = 2; - switch(c) { - /* getopt() returns '?' if there was an error. It already - printed the error message, so just return. */ - case '?': - return 1; - - /* Help and version requests handled here. */ - case OPT_HELP: - fprintf(stderr, "usage %s %s", argv[0], help_text); - return 0; - case OPT_VERSION: - fprintf(stderr, "%s - %s version %s\n", argv[0], MPEG4IP_PACKAGE, - MPEG4IP_VERSION); - return 0; - - /* Numeric arguments: convert them using sscanf(). */ - case OPT_DISK: case OPT_DISKS: - case OPT_TRACK: case OPT_TRACKS: - case OPT_TEMPO: - r = sscanf(optarg, "%d", &nums[c]); - if (r < 1) { - fprintf(stderr, "%s: option requires numeric argument -- %c\n", - argv[0], c); - return 2; - } - /* Break not, lest ye be broken. :) */ - /* All arguments: all valid options end up here, and we just - stuff the string pointer into the tags[] array. */ - default: - tags[c] = optarg; - mods++; - } /* end switch */ - - c = getopt_long_only(argc, argv, OPT_STRING, long_options, NULL); - } /* end while */ - - /* Check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, - "%s: You must specify at least one MP4 file.\n", - argv[0]); - fprintf(stderr, "usage %s %s", argv[0], help_text); - return 3; - } - - /* Check that we have at least one requested modification. Probably - it's useful instead to print the metadata if no modifications are - requested? */ - if (!mods) { - fprintf(stderr, - "%s: You must specify at least one tag modification.\n", - argv[0]); - fprintf(stderr, "usage %s %s", argv[0], help_text); - return 4; - } - - /* Loop through the non-option arguments, and modify the tags as - requested. */ - while (optind < argc) { - char *mp4 = argv[optind++]; - - MP4FileHandle h = MP4Modify(mp4); - if (h == MP4_INVALID_FILE_HANDLE) { - fprintf(stderr, "Could not open '%s'... aborting\n", mp4); - return 5; - } - - /* Remove any tags */ - if( tags[OPT_REMOVE] ) { - for(const char *p = tags[OPT_REMOVE]; *p; p++ ) { - switch(*p) { - case OPT_ALBUM: MP4DeleteMetadataAlbum(h); break; - case OPT_ARTIST: MP4DeleteMetadataArtist(h); break; - case OPT_COMMENT: MP4DeleteMetadataComment(h); break; - case OPT_DISK: MP4DeleteMetadataDisk(h); break; - case OPT_DISKS: MP4DeleteMetadataDisk(h); break; - case OPT_GENRE: MP4DeleteMetadataGenre(h); break; - case OPT_GROUPING:MP4DeleteMetadataGrouping(h); break; - case OPT_SONG: MP4DeleteMetadataName(h); break; - case OPT_WRITER: MP4DeleteMetadataWriter(h); break; - case OPT_YEAR: MP4DeleteMetadataYear(h); break; - case OPT_TEMPO: MP4DeleteMetadataTempo(h); break; - case OPT_TRACK: MP4DeleteMetadataTrack(h); break; - case OPT_TRACKS: MP4DeleteMetadataTrack(h); break; - } - } - } - - /* Track/disk numbers need to be set all at once, but we'd like to - allow users to just specify -T 12 to indicate that all existing - track numbers are out of 12. This means we need to look up the - current info if it is not being set. */ - uint16_t n0, m0, n1, m1; - - if (tags[OPT_TRACK] || tags[OPT_TRACKS]) { - n0 = m0 = 0; - MP4GetMetadataTrack(h, &n0, &m0); - n1 = tags[OPT_TRACK]? nums[OPT_TRACK] : n0; - m1 = tags[OPT_TRACKS]? nums[OPT_TRACKS] : m0; - MP4SetMetadataTrack(h, n1, m1); - } - if (tags[OPT_DISK] || tags[OPT_DISKS]) { - n0 = m0 = 0; - MP4GetMetadataDisk(h, &n0, &m0); - n1 = tags[OPT_DISK]? nums[OPT_DISK] : n0; - m1 = tags[OPT_DISKS]? nums[OPT_DISKS] : m0; - MP4SetMetadataDisk(h, n1, m1); - } - - /* Set the other relevant attributes */ - for (int i = 0; i < UCHAR_MAX; i++) { - if (tags[i]) { - switch(i) { - case OPT_ALBUM: MP4SetMetadataAlbum(h, tags[i]); break; - case OPT_ARTIST: MP4SetMetadataArtist(h, tags[i]); break; - case OPT_COMMENT: MP4SetMetadataComment(h, tags[i]); break; - case OPT_GENRE: MP4SetMetadataGenre(h, tags[i]); break; - case OPT_GROUPING:MP4SetMetadataGrouping(h, tags[i]); break; - case OPT_SONG: MP4SetMetadataName(h, tags[i]); break; - case OPT_WRITER: MP4SetMetadataWriter(h, tags[i]); break; - case OPT_YEAR: MP4SetMetadataYear(h, tags[i]); break; - case OPT_TEMPO: MP4SetMetadataTempo(h, nums[i]); break; - } - } - } - - MP4Close(h); - } /* end while optind < argc */ - - return 0; -} -
--- a/Plugins/Input/aac/libmp4v2/util/mp4trackdump.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -// N.B. mp4extract just extracts tracks/samples from an mp4 file -// For many track types this is insufficient to reconsruct a valid -// elementary stream (ES). Use "mp4creator -extract=<trackId>" if -// you need the ES reconstructed. - -#include "mp4.h" -#include "mpeg4ip_getopt.h" - -char* ProgName; -char* Mp4PathName; -char* Mp4FileName; -static void DumpTrack (MP4FileHandle mp4file, MP4TrackId tid) -{ - uint32_t numSamples; - MP4SampleId sid; - MP4Duration time; - uint32_t timescale; - uint64_t msectime; - - uint64_t sectime, mintime, hrtime; - - numSamples = MP4GetTrackNumberOfSamples(mp4file, tid); - timescale = MP4GetTrackTimeScale(mp4file, tid); - printf("mp4file %s, track %d, samples %d, timescale %d\n", - Mp4FileName, tid, numSamples, timescale); - - for (sid = 1; sid <= numSamples; sid++) { - time = MP4GetSampleTime(mp4file, tid, sid); - msectime = time; - msectime *= TO_U64(1000); - msectime /= timescale; - if (msectime == 0) { - hrtime = mintime = sectime = TO_U64(0); - } else { - hrtime = msectime / TO_U64(3600 * 1000); - msectime -= hrtime * TO_U64(3600 * 1000); - mintime = msectime / TO_U64(60 * 1000); - msectime -= (mintime * TO_U64(60 * 1000)); - sectime = msectime / TO_U64(1000); - msectime -= sectime * TO_U64(1000); - } - - printf("sampleId %6d, size %5u duration %8"U64F" time %8"U64F" %02"U64F":%02"U64F":%02"U64F".%03"U64F" %c\n", - sid, MP4GetSampleSize(mp4file, tid, sid), - MP4GetSampleDuration(mp4file, tid, sid), - time, hrtime, mintime, sectime, msectime, - MP4GetSampleSync(mp4file, tid, sid) == 1 ? 'S' : ' '); - } -} - -int main(int argc, char** argv) -{ - const char* usageString = - "[-l] [-t <track-id>] [-s <sample-id>] [-v [<level>]] <file-name>\n"; - MP4TrackId trackId = MP4_INVALID_TRACK_ID; - MP4SampleId sampleId = MP4_INVALID_SAMPLE_ID; - u_int32_t verbosity = MP4_DETAILS_ERROR; - - /* begin processing command line */ - ProgName = argv[0]; - while (true) { - int c = -1; - int option_index = 0; - static struct option long_options[] = { - { "track", 1, 0, 't' }, - { "sample", 1, 0, 's' }, - { "verbose", 2, 0, 'v' }, - { "version", 0, 0, 'V' }, - { NULL, 0, 0, 0 } - }; - - c = getopt_long_only(argc, argv, "t:v::V", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case 's': - if (sscanf(optarg, "%u", &sampleId) != 1) { - fprintf(stderr, "%s: bad sample-id specified: %s\n", - ProgName, optarg); - exit(1); - } - break; - case 't': - if (sscanf(optarg, "%u", &trackId) != 1) { - fprintf(stderr, - "%s: bad track-id specified: %s\n", - ProgName, optarg); - exit(1); - } - break; - case 'v': - verbosity |= MP4_DETAILS_READ; - if (optarg) { - u_int32_t level; - if (sscanf(optarg, "%u", &level) == 1) { - if (level >= 2) { - verbosity |= MP4_DETAILS_TABLE; - } - if (level >= 3) { - verbosity |= MP4_DETAILS_SAMPLE; - } - if (level >= 4) { - verbosity = MP4_DETAILS_ALL; - } - } - } - break; - case '?': - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(0); - case 'V': - fprintf(stderr, "%s - %s version %s\n", - ProgName, MPEG4IP_PACKAGE, MPEG4IP_VERSION); - exit(0); - default: - fprintf(stderr, "%s: unknown option specified, ignoring: %c\n", - ProgName, c); - } - } - - /* check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(1); - } - - if (verbosity) { - fprintf(stderr, "%s version %s\n", ProgName, MPEG4IP_VERSION); - } - - /* point to the specified file names */ - Mp4PathName = argv[optind++]; - - char* lastSlash = strrchr(Mp4PathName, '/'); - if (lastSlash) { - Mp4FileName = lastSlash + 1; - } else { - Mp4FileName = Mp4PathName; - } - - /* warn about extraneous non-option arguments */ - if (optind < argc) { - fprintf(stderr, "%s: unknown options specified, ignoring: ", ProgName); - while (optind < argc) { - fprintf(stderr, "%s ", argv[optind++]); - } - fprintf(stderr, "\n"); - } - - /* end processing of command line */ - - - MP4FileHandle mp4File = MP4Read(Mp4PathName, verbosity); - - if (!mp4File) { - exit(1); - } - - if (sampleId != MP4_INVALID_SAMPLE_ID) { - if (trackId == 0) { - fprintf(stderr, "%s: Must specify track for sample\n", ProgName); - return -1; - } - if (sampleId > MP4GetTrackNumberOfSamples(mp4File, trackId)) { - fprintf(stderr, "%s: Sample number %u is past end %u\n", - ProgName, sampleId, MP4GetTrackNumberOfSamples(mp4File, trackId)); - return -1; - } - uint32_t sample_size = MP4GetTrackMaxSampleSize(mp4File, trackId); - uint8_t *sample = (uint8_t *)malloc(sample_size); - MP4Timestamp sampleTime; - MP4Duration sampleDuration, sampleRenderingOffset; - uint32_t this_size = sample_size; - bool isSyncSample; - bool ret = MP4ReadSample(mp4File, - trackId, - sampleId, - &sample, - &this_size, - &sampleTime, - &sampleDuration, - &sampleRenderingOffset, - &isSyncSample); - if (ret == false) { - fprintf(stderr, "Sample read error\n"); - return -1; - } - printf("Track %u, Sample %u, Length %u\n", - trackId, sampleId, this_size); - - for (uint32_t ix = 0; ix < this_size; ix++) { - if ((ix % 16) == 0) printf("\n%04u ", ix); - printf("%02x ", sample[ix]); - } - printf("\n"); - } else { - if (trackId == 0) { - u_int32_t numTracks = MP4GetNumberOfTracks(mp4File); - - for (u_int32_t i = 0; i < numTracks; i++) { - trackId = MP4FindTrackId(mp4File, i); - DumpTrack(mp4File, trackId); - } - } else { - DumpTrack(mp4File, trackId); - } - } - - MP4Close(mp4File); - - return(0); -} -
--- a/Plugins/Input/aac/libmp4v2/util/mp4videoinfo.cpp Thu Feb 02 17:46:30 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is MPEG4IP. - * - * The Initial Developer of the Original Code is Cisco Systems Inc. - * Portions created by Cisco Systems Inc. are - * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. - * - * Contributor(s): - * Dave Mackie dmackie@cisco.com - */ - -// N.B. mp4extract just extracts tracks/samples from an mp4 file -// For many track types this is insufficient to reconsruct a valid -// elementary stream (ES). Use "mp4creator -extract=<trackId>" if -// you need the ES reconstructed. - -#include "mp4.h" -#include "mpeg4ip_getopt.h" -#include "mp4av.h" -#include "mp4av_h264.h" -char* ProgName; -char* Mp4PathName; -char* Mp4FileName; -static void ParseH264 (uint8_t *bptr, uint32_t blen, - uint32_t len_size, bool dump_off) -{ - uint8_t *fptr = bptr; - while (blen > len_size) { - uint32_t nal_len = 0; - switch (len_size) { - case 1: nal_len = *bptr; break; - case 2: nal_len = (bptr[0] << 8) | bptr[1]; break; - case 3: nal_len = (bptr[0] << 16) | (bptr[1] << 8) | bptr[2]; break; - case 4: nal_len = (bptr[0] << 24) | (bptr[1] << 16) | (bptr[2] << 8) | bptr[3]; break; - } - bptr += len_size; - blen -= len_size; - uint8_t nal_type = *bptr & 0x1f; - switch (nal_type) { - case H264_NAL_TYPE_NON_IDR_SLICE: printf(" NIDR-"); break; - case H264_NAL_TYPE_DP_A_SLICE: printf(" DPA-"); break; - case H264_NAL_TYPE_DP_B_SLICE: printf(" DPB-"); break; - case H264_NAL_TYPE_DP_C_SLICE: printf(" DPC-"); break; - case H264_NAL_TYPE_IDR_SLICE: printf(" IDR-"); break; - case H264_NAL_TYPE_SEI: printf(" SEI"); break; - case H264_NAL_TYPE_SEQ_PARAM: printf(" SEQ"); break; - case H264_NAL_TYPE_PIC_PARAM: printf(" PIC"); break; - case H264_NAL_TYPE_ACCESS_UNIT: printf(" AU"); break; - case H264_NAL_TYPE_END_OF_SEQ: printf(" EOS"); break; - case H264_NAL_TYPE_END_OF_STREAM: printf(" EOST"); break; - case H264_NAL_TYPE_FILLER_DATA: printf(" FILL"); break; - default: printf(" UNK(0x%x)", nal_type); break; - } - if (h264_nal_unit_type_is_slice(nal_type)) { - uint8_t slice_type; - h264_find_slice_type(bptr, nal_len, &slice_type, true); - printf("%s", h264_get_slice_name(slice_type)); - } - uint32_t off = bptr - fptr - len_size; - if (dump_off) printf("(%u)", off); - bptr += nal_len; - if (nal_len > blen) { - blen = 0; - } else - blen -= nal_len; - } -} - -static void ParseMpeg4 (uint8_t *bptr, uint32_t blen, bool dump_off) -{ - uint8_t *fptr = bptr; - while (blen > 4) { - if (bptr[0] == 0 && - bptr[1] == 0 && - bptr[2] == 1) { - if (bptr[3] > 0 && bptr[3] < MP4AV_MPEG4_VOL_START) { - printf(" VDOS"); - } else if (bptr[3] < 0x2f) { - printf(" VOL"); - } else if (bptr[3] == MP4AV_MPEG4_VOSH_START) { - printf(" VOSH"); - } else if (bptr[3] == MP4AV_MPEG4_VOSH_END) { - printf(" VOSHE"); - } else if (bptr[3] == MP4AV_MPEG4_USER_DATA_START) { - printf(" UD"); - } else if (bptr[3] == MP4AV_MPEG4_GOV_START) { - printf(" GOV"); - } else if (bptr[3] == 0xB4) { - printf(" VSE"); - } else if (bptr[3] == MP4AV_MPEG4_VO_START) { - printf(" VOS"); - } else if (bptr[3] == MP4AV_MPEG4_VOP_START) { - int type = MP4AV_Mpeg4GetVopType(bptr, blen); - switch (type) { - case VOP_TYPE_I: printf(" VOP-I"); break; - case VOP_TYPE_P: printf(" VOP-P"); break; - case VOP_TYPE_B: printf(" VOP-B"); break; - case VOP_TYPE_S: printf(" VOP-S"); break; - } - } else printf(" 0x%x", bptr[3]); - uint32_t off = bptr - fptr; - if (dump_off) printf("(%u)", off); - } - bptr++; - blen--; - } -} -static void DumpTrack (MP4FileHandle mp4file, MP4TrackId tid, - bool dump_off, bool dump_rend) -{ - uint32_t numSamples; - MP4SampleId sid; - uint8_t *buffer; - uint32_t max_frame_size; - uint32_t timescale; - uint64_t msectime; - const char *media_data_name; - uint32_t len_size = 0; - - numSamples = MP4GetTrackNumberOfSamples(mp4file, tid); - max_frame_size = MP4GetTrackMaxSampleSize(mp4file, tid) + 4; - media_data_name = MP4GetTrackMediaDataName(mp4file, tid); - if (strcasecmp(media_data_name, "avc1") == 0) { - MP4GetTrackH264LengthSize(mp4file, tid, &len_size); - } - buffer = (uint8_t *)malloc(max_frame_size); - if (buffer == NULL) { - printf("couldn't get buffer\n"); - return; - } - - timescale = MP4GetTrackTimeScale(mp4file, tid); - printf("mp4file %s, track %d, samples %d, timescale %d\n", - Mp4FileName, tid, numSamples, timescale); - - for (sid = 1; sid <= numSamples; sid++) { - MP4Timestamp sampleTime; - MP4Duration sampleDuration, sampleRenderingOffset; - bool isSyncSample = FALSE; - bool ret; - u_int8_t *temp; - uint32_t this_frame_size = max_frame_size; - temp = buffer; - ret = MP4ReadSample(mp4file, - tid, - sid, - &temp, - &this_frame_size, - &sampleTime, - &sampleDuration, - &sampleRenderingOffset, - &isSyncSample); - - msectime = sampleTime; - msectime *= TO_U64(1000); - msectime /= timescale; - - printf("sampleId %6d, size %5u time "U64"("U64")", - sid, MP4GetSampleSize(mp4file, tid, sid), - sampleTime, msectime); - if (dump_rend) printf(" %6"U64F, sampleRenderingOffset); - if (strcasecmp(media_data_name, "mp4v") == 0) { - ParseMpeg4(temp, this_frame_size, dump_off); - } else if (strcasecmp(media_data_name, "avc1") == 0) { - ParseH264(temp, this_frame_size, len_size, dump_off); - } - printf("\n"); - } -} - -int main(int argc, char** argv) -{ - const char* usageString = - "[options] mp4file where:\n" - "\t--track(-t)= <track-id> - display track id\n" - "\t--dump-offset(-d) - dump offset within sample\n" - "\t--rendering-offset(-r) - dump rendering offset\n" - "\t--verbose=<level> - mp4 file verbosity\n" - "\t--version(-V) - display version\n"; - MP4TrackId trackId = MP4_INVALID_TRACK_ID; - u_int32_t verbosity = MP4_DETAILS_ERROR; - bool dump_offset = false; - bool dump_rend = false; - /* begin processing command line */ - ProgName = argv[0]; - while (true) { - int c = -1; - int option_index = 0; - static struct option long_options[] = { - { "track", 1, 0, 't' }, - { "verbose", 2, 0, 'v' }, - { "version", 0, 0, 'V' }, - { "dump-offset", 0, 0, 'd'}, - { "rendering-offset", 0, 0, 'r'}, - { "help", 0, 0, '?'}, - { NULL, 0, 0, 0 } - }; - - c = getopt_long_only(argc, argv, "t:v::V?", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case 'd': dump_offset = true; break; - case 'r': dump_rend = true; break; - case 't': - if (sscanf(optarg, "%u", &trackId) != 1) { - fprintf(stderr, - "%s: bad track-id specified: %s\n", - ProgName, optarg); - exit(1); - } - break; - case 'v': - verbosity |= MP4_DETAILS_READ; - if (optarg) { - u_int32_t level; - if (sscanf(optarg, "%u", &level) == 1) { - if (level >= 2) { - verbosity |= MP4_DETAILS_TABLE; - } - if (level >= 3) { - verbosity |= MP4_DETAILS_SAMPLE; - } - if (level >= 4) { - verbosity = MP4_DETAILS_ALL; - } - } - } - break; - case '?': - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(0); - case 'V': - fprintf(stderr, "%s - %s version %s\n", - ProgName, MPEG4IP_PACKAGE, MPEG4IP_VERSION); - exit(0); - default: - fprintf(stderr, "%s: unknown option specified, ignoring: %c\n", - ProgName, c); - } - } - - /* check that we have at least one non-option argument */ - if ((argc - optind) < 1) { - fprintf(stderr, "usage: %s %s", ProgName, usageString); - exit(1); - } - - if (verbosity) { - fprintf(stderr, "%s version %s\n", ProgName, MPEG4IP_VERSION); - } - - /* point to the specified file names */ - Mp4PathName = argv[optind++]; - - char* lastSlash = strrchr(Mp4PathName, '/'); - if (lastSlash) { - Mp4FileName = lastSlash + 1; - } else { - Mp4FileName = Mp4PathName; - } - - /* warn about extraneous non-option arguments */ - if (optind < argc) { - fprintf(stderr, "%s: unknown options specified, ignoring: ", ProgName); - while (optind < argc) { - fprintf(stderr, "%s ", argv[optind++]); - } - fprintf(stderr, "\n"); - } - - /* end processing of command line */ - - - MP4FileHandle mp4File = MP4Read(Mp4PathName, verbosity); - - if (!mp4File) { - exit(1); - } - - if (trackId == MP4_INVALID_TRACK_ID) { - u_int32_t numTracks = MP4GetNumberOfTracks(mp4File, MP4_VIDEO_TRACK_TYPE); - printf("tracks %d\n", numTracks); - for (u_int32_t ix = 0; ix < numTracks; ix++) { - trackId = MP4FindTrackId(mp4File, ix, MP4_VIDEO_TRACK_TYPE); - DumpTrack(mp4File, trackId, dump_offset, dump_rend); - } - } else { - DumpTrack(mp4File, trackId, dump_offset, dump_rend); - } - - MP4Close(mp4File); - - return(0); -} -