diff options
author | clsid2 <clsid2@users.sourceforge.net> | 2009-05-07 18:14:17 +0400 |
---|---|---|
committer | clsid2 <clsid2@users.sourceforge.net> | 2009-05-07 18:14:17 +0400 |
commit | 0f487cd7b86e52c7eb172696b4e4594b35941f8c (patch) | |
tree | 7cd1443b16c00c3c5c3c5adbc8ea3ef75add1b95 /src/filters/parser/mp4splitter | |
parent | 4fbc8710f841d3c2f3b735dbf7b32ada8348cfa2 (diff) |
Removed some unused files
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1097 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/parser/mp4splitter')
40 files changed, 0 insertions, 3280 deletions
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Aac2Mp4/Aac2Mp4.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Aac2Mp4/Aac2Mp4.cpp deleted file mode 100644 index aa3e6c149..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Aac2Mp4/Aac2Mp4.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/***************************************************************** -| -| AP4 - AAC to MP4 Converter -| -| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4File.h" -#include "Ap4FileWriter.h" -#include "Ap4FileByteStream.h" -#include "Ap4SyntheticSampleTable.h" -#include "Ap4AdtsParser.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "AAC to MP4 Converter - Version 0.1a - (c) 2002-2005 Gilles Boccon-Gibod" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: aac2mp4 [options] <input> <output>\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - AP4_Result result; - - if (argc < 2) { - PrintUsageAndExit(); - } - - // open the input - AP4_ByteStream* input; - try { - input = new AP4_FileByteStream(argv[1], AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception&) { - AP4_Debug("ERROR: cannot open input (%s)\n", argv[1]); - return 1; - } - - // open the output - AP4_ByteStream* output = new AP4_FileByteStream( - argv[2], - AP4_FileByteStream::STREAM_MODE_WRITE); - - // create a sample table - AP4_SyntheticSampleTable* sample_table = new AP4_SyntheticSampleTable(); - - // create an ADTS parser - AP4_AdtsParser parser; - bool initialized = false; - unsigned int sample_description_index = 0; - - // read from the input, feed, and get AAC frames - AP4_UI32 sample_rate = 0; - AP4_Cardinal sample_count = 0; - bool eos = false; - for(;;) { - // try to get a frame - AP4_AacFrame frame; - result = parser.FindFrame(frame); - if (AP4_SUCCEEDED(result)) { - AP4_Debug("AAC frame [%06d]: size = %d, %d kHz, %d ch\n", - sample_count, - frame.m_Info.m_FrameLength, - frame.m_Info.m_SamplingFrequency, - frame.m_Info.m_ChannelConfiguration); - if (!initialized) { - initialized = true; - - // create a sample description for our samples - AP4_DataBuffer dsi; - unsigned char aac_dsi[2] = {0x12, 0x10}; - dsi.SetData(aac_dsi, 2); - AP4_MpegAudioSampleDescription* sample_description = - new AP4_MpegAudioSampleDescription( - AP4_MPEG4_AUDIO_OTI, // object type - frame.m_Info.m_SamplingFrequency, - 16, // sample size - frame.m_Info.m_ChannelConfiguration, - &dsi, // decoder info - 6144, // buffer size - 128000, // max bitrate - 128000); // average bitrate - sample_description_index = sample_table->AddSampleDescription(sample_description); - sample_rate = frame.m_Info.m_SamplingFrequency; - } - - AP4_MemoryByteStream* sample_data = new AP4_MemoryByteStream(frame.m_Info.m_FrameLength); - frame.m_Source->ReadBytes(sample_data->GetBuffer(), frame.m_Info.m_FrameLength); - printf("%02x %02x %02x %02x\n", - sample_data->GetBuffer()[0], - sample_data->GetBuffer()[1], - sample_data->GetBuffer()[2], - sample_data->GetBuffer()[3]); - sample_table->AddSample(*sample_data, 0, frame.m_Info.m_FrameLength, sample_description_index); - sample_data->Release(); - sample_count++; - } else { - if (eos) break; - } - - // read some data and feed the parser - AP4_UI08 input_buffer[4096]; - AP4_Size bytes_read = 0; - AP4_Size to_read = parser.GetBytesFree(); - if (to_read) { - if (to_read > sizeof(input_buffer)) to_read = sizeof(input_buffer); - result = input->Read(input_buffer, to_read, &bytes_read); - if (AP4_SUCCEEDED(result)) { - AP4_Size to_feed = bytes_read; - result = parser.Feed(input_buffer, &to_feed); - if (AP4_FAILED(result)) { - AP4_Debug("ERROR: parser.Feed() failed (%d)\n", result); - return 1; - } - } else { - if (result == AP4_ERROR_EOS) { - eos = true; - } - } - } - } - - // create an audio track - AP4_Track* track = new AP4_Track(AP4_Track::TYPE_AUDIO, - sample_table, - 0, // track id - sample_rate, // movie time scale - sample_rate, // track time scale - sample_count*1024, // track duration - "eng", // language - 0, 0); // width, height - - // create a movie - AP4_Movie* movie = new AP4_Movie(); - - // add the track to the movie - movie->AddTrack(track); - - // create a multimedia file - AP4_File* file = new AP4_File(movie); - - // create a writer to write the file - AP4_FileWriter* writer = new AP4_FileWriter(*file); - - // write the file to the output - writer->Write(*output); - - delete writer; - delete file; - delete output; - - return 0; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp42Aac/Mp42Aac.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp42Aac/Mp42Aac.cpp deleted file mode 100644 index b5d4ec004..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp42Aac/Mp42Aac.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 to AAC File Converter -| -| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4Atom.h" -#include "Ap4File.h" -#include "Ap4Sample.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 To AAC File Converter - Version 0.1a\n"\ - "(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: ap42aac [options] <input> <output>\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| WriteAdtsHeader -+---------------------------------------------------------------------*/ -static AP4_Result -WriteAdtsHeader(AP4_ByteStream* output, unsigned int frame_size) -{ - unsigned char bits[7]; - - bits[0] = 0xFF; - bits[1] = 0xF1; // 0xF9 (MPEG2) - bits[2] = 0x50; - bits[3] = 0x80 | ((frame_size+7) >> 11); - bits[4] = ((frame_size+7) >> 3)&0xFF; - bits[5] = (((frame_size+7) << 5)&0xFF) | 0x1F; - bits[6] = 0xFC; - - return output->Write(bits, 7); - - /* -0: syncword 12 always: '111111111111' -12: ID 1 0: MPEG-4, 1: MPEG-2 -13: layer 2 always: '00' -15: protection_absent 1 -16: profile 2 -18: sampling_frequency_index 4 -22: private_bit 1 -23: channel_configuration 3 -26: original/copy 1 -27: home 1 -28: emphasis 2 only if ID == 0 - -ADTS Variable header: these can change from frame to frame -28: copyright_identification_bit 1 -29: copyright_identification_start 1 -30: aac_frame_length 13 length of the frame including header (in bytes) -43: adts_buffer_fullness 11 0x7FF indicates VBR -54: no_raw_data_blocks_in_frame 2 -ADTS Error check -crc_check 16 only if protection_absent == 0 -*/ -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 3) { - PrintUsageAndExit(); - } - - // create the input stream - AP4_ByteStream* input = - new AP4_FileByteStream(argv[1], - AP4_FileByteStream::STREAM_MODE_READ); - - // create the output stream - AP4_ByteStream* output = - new AP4_FileByteStream(argv[2], - AP4_FileByteStream::STREAM_MODE_WRITE); - - // open the file - AP4_File* input_file = new AP4_File(*input); - - // get the movie - AP4_Movie* movie = input_file->GetMovie(); - if (movie != NULL) { - AP4_List<AP4_Track>& tracks = movie->GetTracks(); - AP4_Debug("Found %d Tracks\n", tracks.ItemCount()); - // get audio track - AP4_Track* audio_track = movie->GetTrack(AP4_Track::TYPE_AUDIO); - if (audio_track != NULL) { - // show info - AP4_Debug("Audio Track:\n"); - AP4_Debug(" duration: %ld ms\n", audio_track->GetDurationMs()); - AP4_Debug(" sample count: %ld\n", audio_track->GetSampleCount()); - - AP4_Sample sample; - AP4_DataBuffer data; - AP4_Ordinal index = 0; - while (AP4_SUCCEEDED(audio_track->ReadSample(index, sample, data))) { - WriteAdtsHeader(output, sample.GetSize()); - output->Write(data.GetData(), data.GetDataSize()); - AP4_Debug(" [%d] writing %ld bytes of data...\n", - index, sample.GetSize()); - index++; - } - } else { - AP4_Debug("No Audio Track found\n"); - } - } else { - AP4_Debug("No Movie in file\n"); - } - - delete input_file; - input->Release(); - output->Release(); - - return 0; -} - diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Decrypt/Mp4Decrypt.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Decrypt/Mp4Decrypt.cpp deleted file mode 100644 index 68791de7f..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Decrypt/Mp4Decrypt.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 Decrypter -| -| Copyright 2005 Gilles Boccon-Gibod -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4Atom.h" -#include "Ap4File.h" -#include "Ap4Sample.h" -#include "Ap4SampleDescription.h" -#include "Ap4IsmaCryp.h" -#include "Ap4Utils.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 Decrypter - Version 0.1a\n"\ - "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\n" - "usage: mp4decrypt [--key <n>:<k>:<salt>] <input> <output>\n" - " where <n> is a track index, <k> a 128-bit key in hex\n" - " and <salt> a 128-bit salting key\n" - " (several --key options can be used, one for each track)\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 3) { - PrintUsageAndExit(); - } - - // create a decrypting processor - AP4_IsmaDecryptingProcessor processor; - - // parse options - const char* input_filename = NULL; - const char* output_filename = NULL; - - char* arg; - while ((arg = *++argv)) { - if (!strcmp(arg, "--key")) { - arg = *++argv; - if (arg == NULL) { - fprintf(stderr, "ERROR: missing argument after --key option\n"); - return 1; - } - char* track_ascii = NULL; - char* key_ascii = NULL; - char* salt_ascii = NULL; - if (AP4_SplitArgs(arg, track_ascii, key_ascii, salt_ascii)) { - fprintf(stderr, "ERROR: invalid argument for --key option\n"); - return 1; - } - unsigned char key[16]; - unsigned char salt[16]; - unsigned int track = strtoul(track_ascii, NULL, 10); - if (AP4_ParseHex(key_ascii, key, 16)) { - fprintf(stderr, "ERROR: invalid hex format for key\n"); - } - if (AP4_ParseHex(salt_ascii, salt, 8)) { - fprintf(stderr, "ERROR: invalid hex format for salt\n"); - } - // set the key in the map - processor.GetKeyMap().SetKey(track, key, salt); - } else if (input_filename == NULL) { - input_filename = arg; - } else if (output_filename == NULL) { - output_filename = arg; - } else { - fprintf(stderr, "ERROR: unexpected argument (%s)\n", arg); - return 1; - } - } - - // check the arguments - if (input_filename == NULL) { - fprintf(stderr, "ERROR: missing input filename\n"); - return 1; - } - if (output_filename == NULL) { - fprintf(stderr, "ERROR: missing output filename\n"); - return 1; - } - - // create the input stream - AP4_ByteStream* input; - try{ - input = new AP4_FileByteStream(input_filename, - AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename); - return 1; - } - - // create the output stream - AP4_ByteStream* output; - try { - output = new AP4_FileByteStream(output_filename, - AP4_FileByteStream::STREAM_MODE_WRITE); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename); - return 1; - } - - // process/decrypt the file - processor.Process(*input, *output); - - // cleanup - input->Release(); - output->Release(); - - return 0; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Dump/Mp4Dump.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Dump/Mp4Dump.cpp deleted file mode 100644 index 07654b954..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Dump/Mp4Dump.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 File Dumper -| -| Copyright 2002 Gilles Boccon-Gibod -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4Atom.h" -#include "Ap4File.h" -#include "Ap4Sample.h" -#include "Ap4DataBuffer.h" -#include "Ap4AtomFactory.h" -#include "Ap4Utils.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 File Dumper - Version 0.2a\n"\ - "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: mp4dump [options] <input>\n" - "options are:\n" - " -track <track_id> <data_file>: writes the track data in data_file"); - exit(1); -} - -#if 0 -/*---------------------------------------------------------------------- -| DumpTrackData -+---------------------------------------------------------------------*/ -void -DumpTrackData(AP4_File* mp4_file, AP4_UI32 track_id, AP4_ByteStream* track_data) -{ - // get the track - AP4_Track* track = NULL; - AP4_Result result = mp4_file->GetTrack(track_id, track); - if (AP4_FAILED(result)) { - fprintf(stderr, "track not found (id = %d)", track_id); - return; - } - - // write the data - AP4_Sample sample; - AP4_DataBuffer sample_data; - AP4_Ordinal index = 0; - while (AP4_SUCCEEDED(track->ReadSample(index, sample, sample_data))) { - track_data->Write(sample_data.GetData(), sample_data.GetDataSize()); - index++; - } -} -#endif - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 2) { - PrintUsageAndExit(); - } - - // init the variables - AP4_UI32 track_id = 0; - AP4_ByteStream* input = NULL; - AP4_ByteStream* track_data = NULL; - - // parse the command line - argv++; - char* arg; - while ((arg = *argv++)) { - if (!strcmp(arg, "-track")) { - if (argv[0] && argv[1] && argv[2]) { - track_id = atoi(argv[0]); - if (track_id == 0) PrintUsageAndExit(); - track_data = - new AP4_FileByteStream(argv[1], - AP4_FileByteStream::STREAM_MODE_WRITE); - argv += 2; - } else { - PrintUsageAndExit(); - } - } else { - try { - input = - new AP4_FileByteStream(arg, - AP4_FileByteStream::STREAM_MODE_READ); - } catch(AP4_Exception e) { - AP4_Debug("ERROR: cannot open input (%d)\n", e.m_Error); - return 1; - } - } - } - - // open the output - AP4_ByteStream* output = - new AP4_FileByteStream("-stdout", - AP4_FileByteStream::STREAM_MODE_WRITE); - - // create an inspector - AP4_PrintInspector inspector(*output); - - // inspect the atoms one by one - AP4_Atom* atom; - //for (int i=0; i<1000; i++) { - AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory; - //MyTypeHandler my_type_handler; - //atom_factory.AddTypeHandler(&my_type_handler); - while (atom_factory.CreateAtomFromStream(*input, atom) == - AP4_SUCCESS) { - atom->Inspect(inspector); - delete atom; - } - //input->Seek(0); - //} - - // inspect the track data if needed - if ((track_id != 0) && (track_data != NULL)) { - //DumpTrackData(file, track_id, track_data); - } - - if (input) input->Release(); - if (output) output->Release(); - if (track_data) track_data->Release(); - - return 0; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Edit/Mp4Edit.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Edit/Mp4Edit.cpp deleted file mode 100644 index d28aba1d2..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Edit/Mp4Edit.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 File Processor -| -| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4Processor.h" -#include "Ap4Utils.h" -#include "Ap4ContainerAtom.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 File Editor - Version 0.5a\n"\ - "(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: mp4edit [commands] <input> <output>\n" - " where commands include one or more of:\n" - " --insert <atom_name>:<source_file>[:<position>]\n" - " --remove <atom_name>\n" - " --replace <atom_name>:<source_file>\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor -+---------------------------------------------------------------------*/ -class AP4_EditingProcessor : public AP4_Processor -{ -public: - // types - class Command { - public: - // types - typedef enum { - TYPE_INSERT, - TYPE_REMOVE, - TYPE_REPLACE - } Type; - - // constructor - Command(Type type, const char* atom_path, - const char* file_path, - int position = -1) : - m_Type(type), - m_AtomPath(atom_path), - m_FilePath(file_path), - m_Position(position) {} - - // members - Type m_Type; - AP4_String m_AtomPath; - AP4_String m_FilePath; - int m_Position; - }; - - // constructor and destructor - virtual ~AP4_EditingProcessor(); - - // methods - virtual AP4_Result Initialize(AP4_AtomParent& top_level); - AP4_Result AddCommand(Command::Type type, - const char* atom_path, - const char* file_path, - int position = -1); - -private: - // methods - AP4_Result InsertAtom(const char* file_path, - AP4_AtomParent* container, - int position); - AP4_Result DoRemove(Command* command, AP4_AtomParent& top_level); - AP4_Result DoInsert(Command* command, AP4_AtomParent& top_level); - AP4_Result DoReplace(Command* command, AP4_AtomParent& top_level); - - // members - AP4_List<Command> m_Commands; - AP4_AtomParent m_TopLevelParent; -}; - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor::~AP4_EditingProcessor -+---------------------------------------------------------------------*/ -AP4_EditingProcessor::~AP4_EditingProcessor() -{ - m_Commands.DeleteReferences(); -} - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor::AddCommand -+---------------------------------------------------------------------*/ -AP4_Result -AP4_EditingProcessor::AddCommand(Command::Type type, - const char* atom_path, - const char* file_path, - int position) -{ - return m_Commands.Add(new Command(type, atom_path, file_path, position)); -} - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor::Initialize -+---------------------------------------------------------------------*/ -AP4_Result -AP4_EditingProcessor::Initialize(AP4_AtomParent& top_level) -{ - AP4_Result result; - - AP4_List<Command>::Item* command_item = m_Commands.FirstItem(); - while (command_item) { - Command* command = command_item->GetData(); - switch (command->m_Type) { - case Command::TYPE_REMOVE: - result = DoRemove(command, top_level); - if (AP4_FAILED(result)) return result; - break; - - case Command::TYPE_INSERT: - result = DoInsert(command, top_level); - if (AP4_FAILED(result)) return result; - break; - - case Command::TYPE_REPLACE: - result = DoReplace(command, top_level); - if (AP4_FAILED(result)) return result; - break; - } - command_item = command_item->GetNext(); - } - - return AP4_SUCCESS; -} - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor::DoRemove -+---------------------------------------------------------------------*/ -AP4_Result -AP4_EditingProcessor::DoRemove(Command* command, AP4_AtomParent& top_level) -{ - AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str()); - if (atom == NULL) { - fprintf(stderr, "ERROR: atom '%s' not found\n", command->m_AtomPath.c_str()); - return AP4_FAILURE; - } else { - atom->Detach(); - delete atom; - return AP4_SUCCESS; - } -} - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor::InsertAtom -+---------------------------------------------------------------------*/ -AP4_Result -AP4_EditingProcessor::InsertAtom(const char* file_path, - AP4_AtomParent* container, - int position) -{ - // read the atom to insert - AP4_Atom* child = NULL; - AP4_ByteStream* input; - try { - input = new AP4_FileByteStream(file_path, - AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open atom file (%s)\n", file_path); - return AP4_FAILURE; - } - AP4_Result result; - result = AP4_AtomFactory::DefaultFactory.CreateAtomFromStream(*input, child); - input->Release(); - if (AP4_FAILED(result)) { - fprintf(stderr, "ERROR: failed to create atom\n"); - return AP4_FAILURE; - } - - // insert the atom - result = container->AddChild(child, position); - if (AP4_FAILED(result)) { - fprintf(stderr, "ERROR: failed to insert atom\n"); - delete child; - return result; - } - - return AP4_SUCCESS; -} - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor::DoInsert -+---------------------------------------------------------------------*/ -AP4_Result -AP4_EditingProcessor::DoInsert(Command* command, AP4_AtomParent& top_level) -{ - AP4_AtomParent* parent = NULL; - if (command->m_AtomPath.length() == 0) { - // insert into the toplevel list - parent = &top_level; - } else { - // find the atom to insert into - AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str(), true); - if (atom == NULL) { - fprintf(stderr, "ERROR: atom '%s' not found\n", - command->m_AtomPath.c_str()); - return AP4_FAILURE; - } - - // check that the atom is a container - parent = dynamic_cast<AP4_AtomParent*>(atom); - } - - // check that we have a place to insert into - if (parent == NULL) { - fprintf(stderr, "ERROR: atom '%s' is not a container\n", - command->m_AtomPath.c_str()); - return AP4_FAILURE; - } - - return InsertAtom(command->m_FilePath.c_str(), parent, command->m_Position); -} - -/*---------------------------------------------------------------------- -| AP4_EditingProcessor::DoReplace -+---------------------------------------------------------------------*/ -AP4_Result -AP4_EditingProcessor::DoReplace(Command* command, AP4_AtomParent& top_level) -{ - // remove the atom - AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str()); - if (atom == NULL) { - fprintf(stderr, "ERROR: atom '%s' not found\n", command->m_AtomPath.c_str()); - return AP4_FAILURE; - } else { - // find the position of the atom in the parent - AP4_AtomParent* parent = atom->GetParent(); - int position = 0; - AP4_List<AP4_Atom>::Item* list_item = parent->GetChildren().FirstItem(); - while (list_item) { - if (list_item->GetData() == atom) break; - position++; - list_item = list_item->GetNext(); - } - - // remove the atom from the parent - atom->Detach(); - delete atom; - - // insert the replacement - return InsertAtom(command->m_FilePath.c_str(), parent, position); - } -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 3) { - PrintUsageAndExit(); - } - - // create initial objects - AP4_EditingProcessor processor; - - // parse arguments - const char* input_filename = NULL; - const char* output_filename = NULL; - char* arg; - while ((arg = *++argv)) { - if (!strcmp(arg, "--insert")) { - char* param = *++argv; - if (param == NULL) { - fprintf(stderr, "ERROR: missing argument for --insert command\n"); - return 1; - } - char* atom_path = NULL; - char* file_path = NULL; - if (AP4_SUCCEEDED(AP4_SplitArgs(param, atom_path, file_path))) { - int position = -1; - char* position_str = NULL; - if (AP4_SUCCEEDED(AP4_SplitArgs(file_path, file_path, position_str))) { - if (position_str) { - position = strtoul(position_str, NULL, 10); - } - } - processor.AddCommand(AP4_EditingProcessor::Command::TYPE_INSERT, atom_path, file_path, position); - } else { - fprintf(stderr, "ERROR: invalid format for --insert command argument\n"); - return 1; - } - } else if (!strcmp(arg, "--remove")) { - char* atom_path = *++argv; - if (atom_path == NULL) { - fprintf(stderr, "ERROR: missing argument for --remove command\n"); - return 1; - } - processor.AddCommand(AP4_EditingProcessor::Command::TYPE_REMOVE, atom_path, ""); - } else if (!strcmp(arg, "--replace")) { - char* param = *++argv; - if (param == NULL) { - fprintf(stderr, "ERROR: missing argument for --replace command\n"); - return 1; - } - char* atom_path = NULL; - char* file_path = NULL; - if (AP4_SUCCEEDED(AP4_SplitArgs(param, atom_path, file_path))) { - processor.AddCommand(AP4_EditingProcessor::Command::TYPE_REPLACE, atom_path, file_path); - } else { - fprintf(stderr, "ERROR: invalid format for --replace command argument\n"); - return 1; - } - } else if (input_filename == NULL) { - input_filename = arg; - } else if (output_filename == NULL) { - output_filename = arg; - } else { - fprintf(stderr, "ERROR: invalid command line argument (%s)\n", arg); - return 1; - } - } - - // check arguments - if (input_filename == NULL) { - fprintf(stderr, "ERROR: missing input filename\n"); - return 1; - } - if (output_filename == NULL) { - fprintf(stderr, "ERROR: missing output filename\n"); - return 1; - } - - // create the input stream - AP4_ByteStream* input = NULL; - try { - input = new AP4_FileByteStream(input_filename, - AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename); - return 1; - } - - // create the output stream - AP4_ByteStream* output = NULL; - try { - output = new AP4_FileByteStream(output_filename, - AP4_FileByteStream::STREAM_MODE_WRITE); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename); - input->Release(); - return 1; - } - - // process! - processor.Process(*input, *output); - - // cleanup - input->Release(); - output->Release(); - - return 0; -} - diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Encrypt/Mp4Encrypt.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Encrypt/Mp4Encrypt.cpp deleted file mode 100644 index 7be866bc1..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Encrypt/Mp4Encrypt.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 Encrypter -| -| Copyright 2005 Gilles Boccon-Gibod -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| -****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4Atom.h" -#include "Ap4File.h" -#include "Ap4Sample.h" -#include "Ap4SampleDescription.h" -#include "Ap4IsmaCryp.h" -#include "Ap4Utils.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 Encrypter - Version 0.1a\n"\ - "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\n" - "usage: mp4encrypt --kms-uri <uri> [--key <n>:<k>:<salt>] <input> <output>\n" - " where <n> is a track index, <k> a 128-bit key in hex\n" - " and <salt> a 128-bit salting key\n" - " (several --key options can be used, one for each track)\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 5) { - PrintUsageAndExit(); - } - - // parse options - if (strcmp(*++argv, "--kms-uri")) { - fprintf(stderr, "ERROR: the first option must be --kms-uri\n"); - return 1; - } - const char* kms_uri = *++argv; - - // create an encrypting processor - AP4_IsmaEncryptingProcessor processor(kms_uri); - - // setup default values - const char* input_filename = NULL; - const char* output_filename = NULL; - - char* arg; - while ((arg = *++argv)) { - if (!strcmp(arg, "--key")) { - arg = *++argv; - if (arg == NULL) { - fprintf(stderr, "ERROR: missing argument for --key option\n"); - return 1; - } - char* track_ascii = NULL; - char* key_ascii = NULL; - char* salt_ascii = NULL; - if (AP4_FAILED(AP4_SplitArgs(arg, track_ascii, key_ascii, salt_ascii))) { - fprintf(stderr, "ERROR: invalid argument for --key option\n"); - return 1; - } - unsigned char key[16]; - unsigned char salt[8]; - unsigned int track = strtoul(track_ascii, NULL, 10); - if (AP4_ParseHex(key_ascii, key, 16)) { - fprintf(stderr, "ERROR: invalid hex format for key\n"); - } - if (AP4_ParseHex(salt_ascii, salt, 8)) { - fprintf(stderr, "ERROR: invalid hex format for salt\n"); - } - // set the key in the map - processor.GetKeyMap().SetKey(track, key, salt); - } else if (input_filename == NULL) { - input_filename = arg; - } else if (output_filename == NULL) { - output_filename = arg; - } else { - fprintf(stderr, "ERROR: unexpected argument (%s)\n", arg); - return 1; - } - } - - // check the arguments - if (input_filename == NULL) { - fprintf(stderr, "ERROR: missing input filename\n"); - return 1; - } - if (output_filename == NULL) { - fprintf(stderr, "ERROR: missing output filename\n"); - return 1; - } - if (kms_uri == NULL) { - fprintf(stderr, "ERROR: missing kms uri\n"); - return 1; - } - - // create the input stream - AP4_ByteStream* input; - try{ - input = new AP4_FileByteStream(input_filename, - AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename); - return 1; - } - - // create the output stream - AP4_ByteStream* output; - try { - output = new AP4_FileByteStream(output_filename, - AP4_FileByteStream::STREAM_MODE_WRITE); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename); - return 1; - } - - // process/decrypt the file - processor.Process(*input, *output); - - // cleanup - input->Release(); - output->Release(); - - return 0; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Extract/Mp4Extract.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Extract/Mp4Extract.cpp deleted file mode 100644 index c669ab09d..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Extract/Mp4Extract.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 File Processor -| -| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4AtomFactory.h" -#include "Ap4Utils.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 Atom Extractor - Version 0.5a\n"\ - "(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: mp4extract [options] <atom_path> <input> <output>\n" - " options:\n" - " --payload-only : ommit the atom header\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 4) { - PrintUsageAndExit(); - } - - // parse arguments - const char* atom_path = NULL; - const char* input_filename = NULL; - const char* output_filename = NULL; - bool payload_only = false; - char* arg; - while ((arg = *++argv)) { - if (!strcmp(arg, "--payload-only")) { - payload_only = true; - } else if (atom_path == NULL) { - atom_path = arg; - } else if (input_filename == NULL) { - input_filename = arg; - } else if (output_filename == NULL) { - output_filename = arg; - } else { - fprintf(stderr, "ERROR: invalid command line argument (%s)\n", arg); - return 1; - } - } - - // check arguments - if (atom_path == NULL) { - fprintf(stderr, "ERROR: missing atom path\n"); - return 1; - } - if (input_filename == NULL) { - fprintf(stderr, "ERROR: missing input filename\n"); - return 1; - } - if (output_filename == NULL) { - fprintf(stderr, "ERROR: missing output filename\n"); - return 1; - } - - // create the input stream - AP4_ByteStream* input; - try { - input = new AP4_FileByteStream(input_filename, - AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename); - return 1; - } - - // parse the atoms - AP4_AtomParent top_level; - AP4_Atom* atom; - AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory; - while (atom_factory.CreateAtomFromStream(*input, atom) == AP4_SUCCESS) { - top_level.AddChild(atom); - } - - // release the input - input->Release(); - - // find the atom - atom = top_level.FindChild(atom_path); - if (atom == NULL) { - fprintf(stderr, "ERROR: atom '%s' not found\n", atom_path); - return 1; - } - - // create the output stream - AP4_ByteStream* output; - try { - output = new AP4_FileByteStream(output_filename, - AP4_FileByteStream::STREAM_MODE_WRITE); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename); - return 1; - } - - // write the atom - if (payload_only) { - atom->WriteFields(*output); - } else { - atom->Write(*output); - } - - // cleanup - output->Release(); - - return 0; -} - diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Info/Mp4Info.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Info/Mp4Info.cpp deleted file mode 100644 index d03667f0e..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Info/Mp4Info.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 File Info -| -| Copyright 2002-2205 Gilles Boccon-Gibod & Julien Boeuf -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4Atom.h" -#include "Ap4File.h" -#include "Ap4Sample.h" -#include "Ap4SampleDescription.h" -#include "Ap4IsmaCryp.h" -#include "Ap4IsfmAtom.h" -#include "Ap4IkmsAtom.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 File Info - Version 0.1a\n"\ - "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: mp4info [options] <input>\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| ShowIsmaSampleDescription -+---------------------------------------------------------------------*/ -static void -ShowIsmaSampleDescription(AP4_IsmaCrypSampleDescription* description) -{ - if (description == NULL) return; - AP4_Debug(" [ENCRYPTED]\n"); - AP4_UI32 st = description->GetSchemeType(); - AP4_Debug(" Scheme Type: %c%c%c%c\n", - (char)((st>>24) & 0xFF), - (char)((st>>16) & 0xFF), - (char)((st>> 8) & 0xFF), - (char)((st ) & 0xFF)); - AP4_Debug(" Scheme Version: %d\n", description->GetSchemeVersion()); - AP4_Debug(" Scheme URI: %s\n", description->GetSchemeUri().c_str()); - AP4_IsmaCrypSchemeInfo* scheme_info = description->GetSchemeInfo(); - if (scheme_info == NULL) return; - if (description->GetSchemeType() != AP4_ISMACRYP_SCHEME_TYPE_IAEC) { - return; - } - - AP4_Debug(" iAEC Scheme Info:\n"); - AP4_IkmsAtom* ikms = (AP4_IkmsAtom*)scheme_info->GetSchiAtom().FindChild("iKMS"); - if (ikms) { - AP4_Debug(" KMS URI: %s\n", ikms->GetKmsUri().c_str()); - } - AP4_IsfmAtom* isfm = (AP4_IsfmAtom*)scheme_info->GetSchiAtom().FindChild("iSFM"); - if (isfm) { - AP4_Debug(" Selective Encryption: %s\n", isfm->GetSelectiveEncryption()?"yes":"no"); - AP4_Debug(" Key Indicator Length: %d\n", isfm->GetKeyIndicatorLength()); - AP4_Debug(" IV Length: %d\n", isfm->GetIvLength()); - } -} - -/*---------------------------------------------------------------------- -| ShowSampleDescription -+---------------------------------------------------------------------*/ -static void -ShowSampleDescription(AP4_SampleDescription* desc) -{ - AP4_SampleDescription::Type type = desc->GetType(); - - AP4_MpegSampleDescription* mpeg_desc = NULL; - if (type == AP4_SampleDescription::TYPE_MPEG) { - mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc); - } else if (type == AP4_SampleDescription::TYPE_ISMACRYP) { - AP4_IsmaCrypSampleDescription* isma_desc = dynamic_cast<AP4_IsmaCrypSampleDescription*>(desc); - ShowIsmaSampleDescription(isma_desc); - mpeg_desc = isma_desc->GetOriginalSampleDescription(); - } - if (mpeg_desc) { - AP4_Debug(" Stream Type: %s\n", mpeg_desc->GetStreamTypeString(mpeg_desc->GetStreamType())); - AP4_Debug(" Object Type: %s\n", mpeg_desc->GetObjectTypeString(mpeg_desc->GetObjectTypeId())); - AP4_Debug(" Max Bitrate: %d\n", mpeg_desc->GetMaxBitrate()); - AP4_Debug(" Avg Bitrate: %d\n", mpeg_desc->GetAvgBitrate()); - AP4_Debug(" Buffer Size: %d\n", mpeg_desc->GetBufferSize()); - if (mpeg_desc->GetStreamType() == AP4_AUDIO_STREAM_TYPE) { - AP4_MpegAudioSampleDescription* audio_desc = - dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc); - AP4_Debug(" Sample Rate: %d\n", audio_desc->GetSampleRate()); - AP4_Debug(" Sample Size: %d\n", audio_desc->GetSampleSize()); - AP4_Debug(" Channels: %d\n", audio_desc->GetChannelCount()); - } else if (mpeg_desc->GetStreamType() == AP4_VISUAL_STREAM_TYPE) { - AP4_MpegVideoSampleDescription* video_desc = - dynamic_cast<AP4_MpegVideoSampleDescription*>(mpeg_desc); - AP4_Debug(" Width: %d\n", video_desc->GetWidth()); - AP4_Debug(" Height: %d\n", video_desc->GetHeight()); - AP4_Debug(" Depth: %d\n", video_desc->GetDepth()); - } - } -} - -/*---------------------------------------------------------------------- -| ShowTrackInfo -+---------------------------------------------------------------------*/ -static void -ShowTrackInfo(AP4_Track* track) -{ - AP4_Debug(" type: "); - switch (track->GetType()) { - case AP4_Track::TYPE_AUDIO: AP4_Debug("Audio\n"); break; - case AP4_Track::TYPE_VIDEO: AP4_Debug("Video\n"); break; - case AP4_Track::TYPE_HINT: AP4_Debug("Hint\n"); break; - default: AP4_Debug("System\n");break; - } - AP4_Debug(" duration: %ld ms\n", track->GetDurationMs()); - AP4_Debug(" timescale: %ld\n", track->GetMediaTimeScale()); - AP4_Debug(" sample count: %ld\n", track->GetSampleCount()); - AP4_Sample sample; - AP4_Ordinal index = 0; - AP4_Ordinal desc_index = 0xFFFFFFFF; - while (AP4_SUCCEEDED(track->GetSample(index, sample))) { - if (sample.GetDescriptionIndex() != desc_index) { - desc_index = sample.GetDescriptionIndex(); - AP4_Debug(" [%d]: Format %d\n", index, desc_index); - - // get the sample description - AP4_SampleDescription* sample_desc = - track->GetSampleDescription(desc_index); - if (sample_desc != NULL) { - ShowSampleDescription(sample_desc); - } - } - index++; - } -} - -/*---------------------------------------------------------------------- -| ShowMovieInfo -+---------------------------------------------------------------------*/ -static void -ShowMovieInfo(AP4_Movie* movie) -{ - AP4_Debug("Movie:\n"); - AP4_Debug(" duration: %ld ms\n", movie->GetDurationMs()); - AP4_Debug(" time scale: %ld\n", movie->GetTimeScale()); - AP4_Debug("\n"); -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 2) { - PrintUsageAndExit(); - } - - AP4_ByteStream* input; - try { - input = new AP4_FileByteStream(argv[1], - AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open input file (%s)\n", argv[1]); - return 1; - } - - AP4_File* file = new AP4_File(*input); - - AP4_Movie* movie = file->GetMovie(); - if (movie != NULL) { - ShowMovieInfo(movie); - - AP4_List<AP4_Track>& tracks = movie->GetTracks(); - AP4_Debug("Found %d Tracks\n", tracks.ItemCount()); - - AP4_List<AP4_Track>::Item* track_item = tracks.FirstItem(); - int index = 1; - while (track_item) { - AP4_Debug("Track %d:\n", index); - index++; - ShowTrackInfo(track_item->GetData()); - track_item = track_item->GetNext(); - } - } else { - AP4_Debug("No movie found in the file\n"); - } - - delete file; - input->Release(); - - return 0; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4RtpHintInfo/Mp4RtpHintInfo.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4RtpHintInfo/Mp4RtpHintInfo.cpp deleted file mode 100644 index d54b7f371..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4RtpHintInfo/Mp4RtpHintInfo.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 Rtp Hint Info -| -| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| -****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4HintTrackReader.h" -#include "Ap4ByteStream.h" -#include "Ap4File.h" -#include "Ap4Movie.h" -#include "Ap4FileByteStream.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 Rtp Hint Info - Version 0.1a\n"\ - "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: mp4rtphintinfo [options] <input>\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| DumpRtpPackets -+---------------------------------------------------------------------*/ -static AP4_Result -DumpRtpPackets(AP4_HintTrackReader& reader, const char* file_name) -{ - // create the output stream - AP4_ByteStream* output; - try { - output = new AP4_FileByteStream(file_name, - AP4_FileByteStream::STREAM_MODE_WRITE); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open output file (%s)\n", file_name); - return AP4_FAILURE; - } - - // read the packets from the reader and write them in the output stream - AP4_DataBuffer data(1500); - AP4_TimeStamp ts; - while(AP4_SUCCEEDED(reader.GetNextPacket(data, ts))) { - output->Write(data.GetData(), data.GetDataSize()); - AP4_Debug("#########\n\tpacket contains %d bytes\n", data.GetDataSize()); - AP4_Debug("\tsent at time stamp %d\n\n", ts); - } - - output->Release(); - - return AP4_SUCCESS; -} - - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - AP4_Result result = AP4_SUCCESS; - - // parse the command line - if (argc != 2) PrintUsageAndExit(); - - // create the input stream - AP4_ByteStream* input; - try { - input = new AP4_FileByteStream(argv[1], - AP4_FileByteStream::STREAM_MODE_READ); - } catch (AP4_Exception) { - fprintf(stderr, "ERROR: cannot open input file (%s)\n", argv[1]); - return 1; - } - - AP4_File* file = new AP4_File(*input); - - - AP4_Movie* movie = file->GetMovie(); - if (movie != NULL) { - // get a hint track reader - AP4_Track* hint_track = movie->GetTrack(AP4_Track::TYPE_HINT, 1); - if (hint_track == NULL) { - AP4_Debug("No hint track in this movie\n"); - return AP4_FAILURE; - } - AP4_HintTrackReader reader(*hint_track, *movie, 0x01020304); - AP4_String rtp_file_name(argv[1]); - rtp_file_name += ".rtp"; - - // display the sdp - AP4_String sdp; - reader.GetSdpText(sdp); - AP4_Debug("sdp:\n%s\n\n", sdp.c_str()); - - // dump the packet - result = DumpRtpPackets(reader, rtp_file_name.c_str()); - if (AP4_FAILED(result)) goto bail; - - } else { - AP4_Debug("No movie found in the file\n"); - return AP4_FAILURE; - } - -bail: - delete file; - input->Release(); - - return result; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Tag/Mp4Tag.cpp b/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Tag/Mp4Tag.cpp deleted file mode 100644 index 1dcff3c73..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Apps/Mp4Tag/Mp4Tag.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/***************************************************************** -| -| AP4 - MP4 File Tagger -| -| Copyright 2002-2003 Gilles Boccon-Gibod -| -| -| This file is part of Bento4/AP4 (MP4 Atom Processing Library). -| -| Unless you have obtained Bento4 under a difference license, -| this version of Bento4 is Bento4|GPL. -| Bento4|GPL is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2, or (at your option) -| any later version. -| -| Bento4|GPL is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -| GNU General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with Bento4|GPL; see the file COPYING. If not, write to the -| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -| 02111-1307, USA. -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <stdlib.h> - -#include "Ap4.h" -#include "Ap4FileByteStream.h" -#include "Ap4Atom.h" -#include "Ap4File.h" - -/*---------------------------------------------------------------------- -| constants -+---------------------------------------------------------------------*/ -#define BANNER "MP4 File Tagger - Version 0.1a\n"\ - "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf" - -/*---------------------------------------------------------------------- -| PrintUsageAndExit -+---------------------------------------------------------------------*/ -static void -PrintUsageAndExit() -{ - fprintf(stderr, - BANNER - "\n\nusage: mp4tag [options] <input> <output>\n"); - exit(1); -} - -/*---------------------------------------------------------------------- -| main -+---------------------------------------------------------------------*/ -int -main(int argc, char** argv) -{ - if (argc < 3) { - PrintUsageAndExit(); - } - - AP4_ByteStream* input = - new AP4_FileByteStream(argv[1], - AP4_FileByteStream::STREAM_MODE_READ); - AP4_ByteStream* output = - new AP4_FileByteStream(argv[2], - AP4_FileByteStream::STREAM_MODE_WRITE); - - AP4_File* file = new AP4_File(*input); - //file->Write(output); - - printf("Successfully wrote %s in %s\n", argv[1], argv[2]); - - delete file; - delete input; - delete output; - - return 0; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/.classpath b/src/filters/parser/mp4splitter/AP4/Source/Java/.classpath deleted file mode 100644 index 233be1d2c..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/.classpath +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path=""/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="output" path=""/> -</classpath> diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/.project b/src/filters/parser/mp4splitter/AP4/Source/Java/.project deleted file mode 100644 index a7c1d0d05..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>Bento4</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Atom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Atom.java deleted file mode 100644 index be0dd49e9..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Atom.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.axiosys.bento4; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; - -public abstract class Atom { - public final static int TYPE_MOOV = 0x6d6f6f76; - public final static int TYPE_TRAK = 0x7472616b; - public final static int TYPE_HNTI = 0x686e7469; - public final static int TYPE_STBL = 0x7374626c; - public final static int TYPE_MDIA = 0x6d646961; - public final static int TYPE_DINF = 0x64696e66; - public final static int TYPE_MINF = 0x6d696e66; - public final static int TYPE_SCHI = 0x73636869; - public final static int TYPE_SINF = 0x73696e66; - public final static int TYPE_UDTA = 0x75647461; - public final static int TYPE_ILST = 0x696c7374; - public final static int TYPE_EDTS = 0x65647473; - public final static int TYPE_META = 0x6d657461; - public final static int TYPE_STSD = 0x73747364; - public final static int TYPE_MP4A = 0x6d703461; - public final static int TYPE_ENCA = 0x656e6361; - public final static int TYPE_MP4V = 0x6d703476; - public final static int TYPE_ENCV = 0x656e6376; - public final static int TYPE_IKMS = 0x694b4d53; - public final static int TYPE_TKHD = 0x746b6864; - public final static int TYPE_SCHM = 0x7363686d; - public final static int TYPE_HDLR = 0x68646c72; - - public final static int HEADER_SIZE = 8; - public final static int FULL_HEADER_SIZE = 12; - - // members - protected int type; - protected int size; - protected int flags; - protected int version; - protected boolean isFull; - - public static String typeString(int type) { - StringBuffer result = new StringBuffer(4); - - result.append((char)((type>>24)&0xFF)); - result.append((char)((type>>16)&0xFF)); - result.append((char)((type>> 8)&0xFF)); - result.append((char)((type )&0xFF)); - - return result.toString(); - } - - public static int nameToType(String name) { - return ((name.charAt(0)&0xFF)<<24) | - ((name.charAt(1)&0xFF)<<16) | - ((name.charAt(2)&0xFF)<< 8) | - ((name.charAt(3)&0xFF)); - } - - public Atom(int type, int size, boolean isFull) { - this.type = type; - this.size = size; - this.isFull = isFull; - } - - public Atom(int type, int size, boolean isFull, RandomAccessFile source) throws IOException { - this(type, size, isFull); - if (isFull) { - // read the version and flags - int extension = source.readInt(); - version = (extension>>24)&0xFF; - flags = extension&0xFFFFFF; - } else { - this.flags = 0; - this.version = 0; - } - } - - public int getType() { return type; } - public int getSize() { return size; } - public int getHeaderSize() { return isFull?FULL_HEADER_SIZE:HEADER_SIZE; } - public int getPayloadSize() { return size-getHeaderSize(); } - - public void write(DataOutputStream stream) throws IOException { - // write the header - writeHeader(stream); - - // write the fields - writeFields(stream); - } - - public void writeHeader(DataOutputStream stream) throws IOException { - // write the size - stream.writeInt(size); - - // write the type - stream.writeInt(type); - - // for full atoms, write version and flags - if (isFull) { - stream.writeInt(version<<24 | flags); - } - } - - protected abstract void writeFields(DataOutputStream stream) throws IOException; - - public byte[] toBytes() throws IOException { - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - DataOutputStream output = new DataOutputStream(stream); - write(output); - - return stream.toByteArray(); - } - - public byte[] getPayload() throws IOException { - byte[] bytes = toBytes(); - byte[] result = new byte[getPayloadSize()]; - System.arraycopy(bytes, getHeaderSize(), result, 0, result.length); - - return result; - } - - public String toString(String indentation) { - return indentation+"[" + typeString(type) + "] size=" + getHeaderSize() + "+" + getPayloadSize(); - } - - public String toString() { - return toString(""); - } -}
\ No newline at end of file diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomFactory.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomFactory.java deleted file mode 100644 index 0d39b686c..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomFactory.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; - -import com.axiosys.bento4.ismacryp.EncaSampleEntry; -import com.axiosys.bento4.ismacryp.EncvSampleEntry; -import com.axiosys.bento4.ismacryp.IkmsAtom; -import com.axiosys.bento4.ismacryp.SchmAtom; - -public class AtomFactory { - public static final AtomFactory DefaultFactory = new AtomFactory(); - - private int context = 0; - - public Atom createAtom(RandomAccessFile file) throws IOException, InvalidFormatException { - return createAtom(file, new int[] { (int) (file.length()-file.getFilePointer()) }); - } - - Atom createAtom(RandomAccessFile source, int[] bytesAvailable /* by reference */) throws IOException, InvalidFormatException { - Atom atom = null; - - // check that there are enough bytes for at least a header - if (bytesAvailable[0] < Atom.HEADER_SIZE) return null; - - // remember current file offset - long start = source.getFilePointer(); - - // read atom size - int size = source.readInt(); - - if (size == 0) { - // atom extends to end of file - size = (int)(source.length()-start); - } - - // check the size (we don't handle extended size yet) - if (size > bytesAvailable[0]) { - source.seek(start); - return null; - } - - if (size < 0) { - // something is corrupted - throw new InvalidFormatException("invalid atom size"); - } - - // read atom type - int type = source.readInt(); - - // create the atom - switch (type) { - case Atom.TYPE_STSD: - atom = new StsdAtom(size, source, this); - break; - - case Atom.TYPE_SCHM: - atom = new SchmAtom(size, source); - break; - - case Atom.TYPE_IKMS: - atom = new IkmsAtom(size, source); - break; - - case Atom.TYPE_TRAK: - atom = new TrakAtom(size, source, this); - break; - - case Atom.TYPE_TKHD: - atom = new TkhdAtom(size, source); - break; - - case Atom.TYPE_HDLR: - atom = new HdlrAtom(size, source); - break; - - // container atoms - case Atom.TYPE_MOOV: - case Atom.TYPE_HNTI: - case Atom.TYPE_STBL: - case Atom.TYPE_MDIA: - case Atom.TYPE_DINF: - case Atom.TYPE_MINF: - case Atom.TYPE_SCHI: - case Atom.TYPE_SINF: - case Atom.TYPE_UDTA: - case Atom.TYPE_ILST: - case Atom.TYPE_EDTS: { - int previousContext = context; - context = type; // set the context for the children - atom = new ContainerAtom(type, size, false, source, this); - context = previousContext; // restore the previous context - break; - } - - // full container atoms - case Atom.TYPE_META: - atom = new ContainerAtom(type, size, false, source, this); - break; - - // sample entries - case Atom.TYPE_MP4A: - atom = new Mp4aSampleEntry(size, source, this); - break; - - case Atom.TYPE_MP4V: - atom = new Mp4vSampleEntry(size, source, this); - break; - - case Atom.TYPE_ENCA: - atom = new EncaSampleEntry(size, source, this); - break; - - case Atom.TYPE_ENCV: - atom = new EncvSampleEntry(size, source, this); - break; - - default: - atom = new UnknownAtom(type, size, source); - break; - } - - // skip to the end of the atom - bytesAvailable[0] -= size; - source.seek(start+size); - - return atom; - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomList.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomList.java deleted file mode 100644 index b3104e8a2..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomList.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.ArrayList; - -public class AtomList implements AtomParent { - private final ArrayList atoms = new ArrayList(); - - public AtomList(String filename) throws IOException, InvalidFormatException { - RandomAccessFile input = new RandomAccessFile(filename, "r"); - Atom atom; - do { - atom = AtomFactory.DefaultFactory.createAtom(input); - if (atom != null) atoms.add(atom); - } while (atom != null); - //input.close(); do not close the input here as some atoms may need to read from it later - } - - public int getChildrenCount() { - return atoms.size(); - } - - public Atom getChild(int index) { - return (Atom)atoms.get(index); - } - - public Atom getChild(int type, int index) { - return AtomUtils.findChild(atoms, type, index); - } - - public String toString() { - StringBuffer result = new StringBuffer(); - String sep = ""; - for (int i=0; i<atoms.size(); i++) { - Atom atom = (Atom)atoms.get(i); - result.append(atom.toString() + sep); - sep = "\n"; - } - - return result.toString(); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomParent.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomParent.java deleted file mode 100644 index 042645c10..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomParent.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.axiosys.bento4; - -public interface AtomParent { - int getChildrenCount(); - Atom getChild(int index); - Atom getChild(int type, int index); -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomUtils.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomUtils.java deleted file mode 100644 index 76b421a3f..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AtomUtils.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.axiosys.bento4; - -import java.util.Iterator; -import java.util.List; - -public class AtomUtils { - public static Atom findAtom(AtomParent parent, String path) { - Atom atom = null; - while (path != null) { - int separator = path.indexOf('/'); - String atomName; - int index = 0; - if (separator > 0) { - atomName = path.substring(0, separator); - path = path.substring(separator+1); - } else { - atomName = path; - path = null; - } - - if (atomName.length() != 4) { - // we need at least 3 more chars - if (atomName.length() < 7) return null; - - // parse the name trailer - if (atomName.charAt(4) != '[' || atomName.charAt(atomName.length()-1) != ']') { - return null; - } - String indexString = atomName.substring(5, atomName.length()-1); - index = Integer.parseInt(indexString); - } - - int type = Atom.nameToType(atomName); - atom = parent.getChild(type, index); - if (path == null) return atom; - if (atom instanceof AtomParent) { - parent = (AtomParent)atom; - } else { - return null; - } - } - - return atom; - } - - public static Atom findChild(List atoms, int type, int index) { - for (Iterator i = atoms.iterator(); i.hasNext();) { - Atom atom = (Atom)i.next(); - if (atom.getType() == type) { - if (index-- == 0) return atom; - } - } - - return null; - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AudioSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AudioSampleEntry.java deleted file mode 100644 index 99bceb7c7..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/AudioSampleEntry.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; - -public class AudioSampleEntry extends MpegSampleEntry { - private int sampleRate; - private int channelCount; - private int sampleSize; - - protected AudioSampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(format, size, source, atomFactory); - } - - int getSampleRate() { return (sampleRate>>16)&0xFFFF; } - int getSampleSize() { return sampleSize; } - int getChannelCount() { return channelCount; } - - protected void readFields(RandomAccessFile source) throws IOException { - super.readFields(source); - - source.skipBytes(8); - channelCount = source.readUnsignedShort(); - sampleSize = source.readUnsignedShort(); - source.skipBytes(4); - sampleRate = source.readInt(); - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(); - result.append(indentation+"[" + typeString(type) + "] size=" + getHeaderSize() + "+" + getPayloadSize()); - result.append("\n" + indentation + " sample_rate = " + getSampleRate()); - result.append("\n" + indentation + " sample_size = " + sampleSize); - result.append("\n" + indentation + " channel_count = " + channelCount); - for (int i=0; i<children.size(); i++) { - result.append("\n"); - result.append(((Atom)children.get(i)).toString(indentation+" ")); - } - - return result.toString(); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ContainerAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ContainerAtom.java deleted file mode 100644 index eed46f4cb..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ContainerAtom.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.axiosys.bento4; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.ArrayList; - -public class ContainerAtom extends Atom implements AtomParent { - protected final ArrayList children = new ArrayList(); - - public ContainerAtom(int type, int size, boolean isFull, RandomAccessFile source) throws IOException { - super(type, size, isFull, source); - } - - public ContainerAtom(int type, int size, boolean isFull, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(type, size, isFull, source); - readChildren(atomFactory, source, getPayloadSize()); - } - - public Atom findAtom(String path) { - return AtomUtils.findAtom(this, path); - } - - protected void writeFields(DataOutputStream stream) throws IOException { - writeChildren(stream); - } - - protected void readChildren(AtomFactory atomFactory, RandomAccessFile source, int size) throws IOException, InvalidFormatException { - int[] bytesAvailable = new int[] { size }; - Atom atom; - do { - atom = atomFactory.createAtom(source, bytesAvailable); - if (atom != null) children.add(atom); - } while (atom != null); - } - - protected void writeChildren(DataOutputStream stream) throws IOException { - for (int i=0; i<children.size(); i++) { - Atom atom = (Atom)children.get(i); - atom.write(stream); - } - } - - public int getChildrenCount() { - return children.size(); - } - - public Atom getChild(int index) { - return (Atom)children.get(index); - } - - public Atom getChild(int type, int index) { - return AtomUtils.findChild(children, type, index); - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(); - result.append(super.toString(indentation)); - for (int i=0; i<children.size(); i++) { - result.append("\n"); - result.append(((Atom)children.get(i)).toString(indentation+" ")); - } - - return result.toString(); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/File.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/File.java deleted file mode 100644 index 9c2181722..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/File.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; - -public class File { - private AtomList atoms; - private Movie movie; - - public File(String filename) throws IOException, InvalidFormatException { - atoms = new AtomList(filename); - ContainerAtom moov = (ContainerAtom)atoms.getChild(Atom.TYPE_MOOV, 0); - if (moov == null) { - movie = null; - } else { - movie = new Movie(moov); - } - } - - public Movie getMovie() { - return movie; - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/HdlrAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/HdlrAtom.java deleted file mode 100644 index 9db7923a2..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/HdlrAtom.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.axiosys.bento4; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; - -public class HdlrAtom extends Atom { - private int handlerType; - private String handlerName; - - public HdlrAtom(int size, RandomAccessFile source) throws IOException { - super(TYPE_HDLR, size, true, source); - - source.skipBytes(4); - handlerType = source.readInt(); - source.skipBytes(12); - - // read the name unless it is empty - int nameSize = size-(FULL_HEADER_SIZE+20); - if (nameSize > 0) { - byte[] name = new byte[nameSize]; - source.read(name); - int nameChars = 0; - while (nameChars < name.length && name[nameChars] != 0) nameChars++; - handlerName = new String(name, 0, nameChars, "UTF-8"); - } - } - - public String getHandlerName() { - return handlerName; - } - - public int getHandlerType() { - return handlerType; - } - - protected void writeFields(DataOutputStream stream) throws IOException { - // not implemented yet - throw new RuntimeException("not implemented yet"); - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(super.toString(indentation)); - result.append("\n" + indentation + " handler_type = " + Atom.typeString(handlerType)); - result.append("\n" + indentation +" handler_name = " + handlerName); - - return result.toString(); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/InvalidFormatException.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/InvalidFormatException.java deleted file mode 100644 index 89b940347..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/InvalidFormatException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.axiosys.bento4;
-
-public class InvalidFormatException extends Exception {
-
- public InvalidFormatException() {
- super();
- }
-
- public InvalidFormatException(String message) {
- super(message);
- }
-
- public InvalidFormatException(Throwable cause) {
- super(cause);
- }
-
- public InvalidFormatException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Movie.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Movie.java deleted file mode 100644 index bb8e3ee2f..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Movie.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.axiosys.bento4; - -import java.util.ArrayList; - -public class Movie { - private ContainerAtom moov; - private ArrayList tracks = new ArrayList(); - - public Movie(ContainerAtom moov) { - this.moov = moov; - - for (int i=0; i<moov.getChildrenCount(); i++) { - Atom child = moov.getChild(i); - if (child.getType() == Atom.TYPE_TRAK) { - TrakAtom trak = (TrakAtom)child; - tracks.add(new Track(trak)); - } - } - } - - public Atom findAtom(String path) { - return AtomUtils.findAtom(moov, path); - } - - public Track[] getTracks() { - Track[] result = new Track[tracks.size()]; - tracks.toArray(result); - return result; - } - - public int[] getTrackIds() { - int[] result = new int[tracks.size()]; - for (int i=0; i<result.length; i++) { - Track track = (Track)tracks.get(i); - result[i] = track.getId(); - } - - return result; - } - - public Track getTrackById(int id) { - for (int i=0; i<tracks.size(); i++) { - Track track = (Track)tracks.get(i); - if (track.getId() == id) return track; - } - - return null; - } - - public int getTrackIndex(int id) { - for (int i=0; i<tracks.size(); i++) { - Track track = (Track)tracks.get(i); - if (track.getId() == id) return i; - } - - return -1; - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Mp4aSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Mp4aSampleEntry.java deleted file mode 100644 index c10995e9e..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Mp4aSampleEntry.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; - -public class Mp4aSampleEntry extends AudioSampleEntry { - Mp4aSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(TYPE_MP4A, size, source, atomFactory); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Mp4vSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Mp4vSampleEntry.java deleted file mode 100644 index 88bfab53a..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Mp4vSampleEntry.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; - -public class Mp4vSampleEntry extends VideoSampleEntry { - Mp4vSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(TYPE_MP4V, size, source, atomFactory); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/MpegSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/MpegSampleEntry.java deleted file mode 100644 index 8c1d83f18..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/MpegSampleEntry.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; - -public class MpegSampleEntry extends SampleEntry { - MpegSampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(format, size, source, atomFactory); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/SampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/SampleEntry.java deleted file mode 100644 index d4c403798..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/SampleEntry.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.axiosys.bento4; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; - -public class SampleEntry extends ContainerAtom { - private int dataReferenceIndex; - - SampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(format, size, false, source); - - // read the fields before the children atoms - int fieldsSize = getFieldsSize(); - readFields(source); - - // read children atoms (ex: esds and maybe others) - readChildren(atomFactory, source, size-HEADER_SIZE-fieldsSize); - } - - public void write(DataOutputStream stream) throws IOException { - // write the header - writeHeader(stream); - - // write the fields - writeFields(stream); - - // write the children atoms - writeChildren(stream); - } - - protected int getFieldsSize() { - return 8; - } - - protected void readFields(RandomAccessFile source) throws IOException { - source.skipBytes(6); - dataReferenceIndex = source.readUnsignedShort(); - } - - protected void writeFields(DataOutputStream stream) throws IOException { - byte[] reserved = new byte[] { 0,0,0,0,0,0 }; - stream.write(reserved); - stream.writeShort(dataReferenceIndex); - } - } diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/StsdAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/StsdAtom.java deleted file mode 100644 index 908fce7d2..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/StsdAtom.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.axiosys.bento4; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.ArrayList; - -public class StsdAtom extends Atom implements AtomParent { - private ArrayList entries = new ArrayList(); - - public StsdAtom(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(TYPE_STSD, size, true, source); - - // read the number of entries - int entryCount = source.readInt(); - int[] bytesAvailable = new int[] { size-FULL_HEADER_SIZE-4 }; - for (int i=0; i<entryCount; i++) { - Atom atom = atomFactory.createAtom(source, bytesAvailable); - if (atom != null) { - entries.add(atom); - } - } - } - - public void writeFields(DataOutputStream stream) throws IOException { - stream.writeInt(entries.size()); - - for (int i=0; i<entries.size(); i++) { - Atom atom = (Atom)entries.get(i); - atom.write(stream); - } - } - - - public int getChildrenCount() { - return entries.size(); - } - - public Atom getChild(int index) { - return (Atom)entries.get(index); - } - - public Atom getChild(int type, int index) { - return AtomUtils.findChild(entries, type, index); - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(); - result.append(super.toString(indentation)); - for (int i=0; i<entries.size(); i++) { - result.append("\n"); - result.append(((Atom)entries.get(i)).toString(indentation+" ")); - } - - return result.toString(); - } - - public String toString() { - return toString(""); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Test.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Test.java deleted file mode 100644 index 6ea3e82ef..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Test.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; - -public class Test { - - /** - * @param args - * @throws IOException - * @throws InvalidFormatException - */ - public static void main(String[] args) throws IOException, InvalidFormatException { - AtomList atoms = new AtomList(args[0]); - - if (args.length > 1) { - Atom atom = AtomUtils.findAtom(atoms, args[1]); - if (atom != null) { - System.out.println(atom); - byte[] payload = atom.getPayload(); - System.out.println(new String(payload)); - } - } else { - System.out.println(atoms); - } - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/TkhdAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/TkhdAtom.java deleted file mode 100644 index 69cb77050..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/TkhdAtom.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.axiosys.bento4; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; - -public class TkhdAtom extends Atom { - private int trackId; - private int duration; - private int creationTime; - private int modificationTime; - private int width; - private int height; - private int layer; - private int alternateGroup; - private int volume; - - int getDuration() { return duration; } - int getTrackId() { return trackId; } - - public TkhdAtom(int size, RandomAccessFile source) throws IOException { - super(TYPE_TKHD, size, true, source); - - if (version == 0) { - // we only deal with version 0 for now - creationTime = source.readInt(); - modificationTime = source.readInt(); - trackId = source.readInt(); - source.skipBytes(4); - duration = source.readInt(); - } else { - source.skipBytes(32); - } - - source.skipBytes(8); - layer = source.readUnsignedShort(); - alternateGroup = source.readUnsignedShort(); - volume = source.readUnsignedShort(); - source.skipBytes(2+9*4); - width = source.readInt(); - height = source.readInt(); - } - - protected void writeFields(DataOutputStream stream) throws IOException { - // not implemented yet - throw new RuntimeException("not implemented yet"); - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(super.toString(indentation)); - result.append("\n" + indentation + " track_id = " + trackId); - result.append("\n" + indentation +" duration = " + duration); - result.append("\n" + indentation +" creation_time = " + creationTime); - result.append("\n" + indentation +" modification_time = " + modificationTime); - result.append("\n" + indentation +" width = " + width); - result.append("\n" + indentation +" height = " + height); - result.append("\n" + indentation +" alternate_group = " + alternateGroup); - result.append("\n" + indentation +" layer = " + layer); - result.append("\n" + indentation +" volume = " + volume); - - return result.toString(); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Track.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Track.java deleted file mode 100644 index 71392c81f..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/Track.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.axiosys.bento4; - -public class Track { - - public static final Type TYPE_UNKNOWN = new Type("Unknown"); - public static final Type TYPE_AUDIO = new Type("Audio"); - public static final Type TYPE_VIDEO = new Type("Video"); - public static final Type TYPE_HINT = new Type("Hint"); - public static final Type TYPE_SYSTEMS = new Type("Systems"); - - public static class Type { - public static final int SOUN = 0x736f756e; - public static final int VIDE = 0x76696465; - public static final int HINT = 0x68696e74; - public static final int SDSM = 0x7364736d; - public static final int ODSM = 0x6f64736d; - - private String description; - - public static Type findType(int handlerType) { - switch (handlerType) { - case SOUN: return TYPE_AUDIO; - case VIDE: return TYPE_VIDEO; - case HINT: return TYPE_HINT; - case SDSM: - case ODSM: return TYPE_SYSTEMS; - default: return TYPE_UNKNOWN; - } - } - - public Type(String description) { - this.description = description; - } - - public String toString() { - return description; - } - } - - private Type type; - private TrakAtom trakAtom; - - public Track(TrakAtom trak) { - trakAtom = trak; - HdlrAtom hdlr = (HdlrAtom)trak.findAtom("mdia/hdlr"); - if (hdlr != null) { - type = Type.findType(hdlr.getHandlerType()); - } else { - type = TYPE_UNKNOWN; - } - } - - public Type getType() { - return type; - } - - public int getId() { - return trakAtom.getId(); - } - - public TrakAtom getTrakAtom() { - return trakAtom; - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/TrakAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/TrakAtom.java deleted file mode 100644 index 1e1337f8f..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/TrakAtom.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; - -public class TrakAtom extends ContainerAtom { - public TrakAtom(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(TYPE_TRAK, size, false, source, atomFactory); - } - - public int getId() { - TkhdAtom tkhd = (TkhdAtom)getChild(TYPE_TKHD, 0); - if (tkhd == null) { - return 0; - } else { - return tkhd.getTrackId(); - } - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/UnknownAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/UnknownAtom.java deleted file mode 100644 index 900020214..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/UnknownAtom.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.axiosys.bento4; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; - -public class UnknownAtom extends Atom { - private final static int CHUNK_SIZE = 4096; - - private final RandomAccessFile source; - private final int offset; - - public UnknownAtom(int type, int size, RandomAccessFile source, int offset) { - super(type, size, false); - this.source = source; - this.offset = offset; - } - - public UnknownAtom(int type, int size, RandomAccessFile source) throws IOException { - this(type, size, source, (int)source.getFilePointer()); - } - - public void writeFields(DataOutputStream stream) throws IOException { - int position = offset; - byte[] buffer = new byte[CHUNK_SIZE]; - int toCopy = getPayloadSize(); - while (toCopy > 0) { - int chunk = toCopy > CHUNK_SIZE ? CHUNK_SIZE : toCopy; - source.seek(position); - source.readFully(buffer, 0, chunk); - stream.write(buffer, 0, chunk); - toCopy -= chunk; - position += chunk; - } - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/VideoSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/VideoSampleEntry.java deleted file mode 100644 index 4ee2bb352..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/VideoSampleEntry.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.axiosys.bento4; - -import java.io.IOException; -import java.io.RandomAccessFile; - -public class VideoSampleEntry extends MpegSampleEntry { - private int width; - private int height; - private int horizontalResolution; - private int verticalResolution; - private int frameCount; - private int depth; - private String compressorName; - - protected VideoSampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(format, size, source, atomFactory); - } - - int getWidth() { return width; } - int getHeight() { return height; } - int getHorizontalResolution() { return horizontalResolution; } - int getVerticalResolution() { return verticalResolution; } - int getFrameCount() { return frameCount; } - int getDepth() { return depth; } - String getCompressorName() { return compressorName; } - - protected void readFields(RandomAccessFile source) throws IOException { - super.readFields(source); - - source.skipBytes(16); - width = source.readUnsignedShort(); - height = source.readUnsignedShort(); - horizontalResolution = source.readInt(); - verticalResolution = source.readInt(); - source.skipBytes(4); - frameCount = source.readUnsignedShort(); - - byte[] str = new byte[32]; - source.readFully(str); - int str_size = 0; - while (str[str_size] != 0) str_size++; - compressorName = new String(str, 0, str_size); - - depth = source.readUnsignedShort(); - source.skipBytes(2); - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(); - result.append(indentation+"[" + typeString(type) + "] size=" + getHeaderSize() + "+" + getPayloadSize()); - result.append("\n" + indentation + " width = " + width); - result.append("\n" + indentation + " height = " + height); - result.append("\n" + indentation + " horizontal_resolution = " + horizontalResolution); - result.append("\n" + indentation + " vertical_resolution = " + verticalResolution); - result.append("\n" + indentation + " frame_count = " + frameCount); - result.append("\n" + indentation + " depth = " + depth); - result.append("\n" + indentation + " compressor_name = " + compressorName); - for (int i=0; i<children.size(); i++) { - result.append("\n"); - result.append(((Atom)children.get(i)).toString(indentation+" ")); - } - - return result.toString(); - } - - public String toString() { - return toString(""); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncaSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncaSampleEntry.java deleted file mode 100644 index 824e4f4f2..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncaSampleEntry.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.axiosys.bento4.ismacryp; - -import java.io.IOException; -import java.io.RandomAccessFile; - -import com.axiosys.bento4.AtomFactory; -import com.axiosys.bento4.AudioSampleEntry; -import com.axiosys.bento4.InvalidFormatException; - -public class EncaSampleEntry extends AudioSampleEntry { - public EncaSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(TYPE_ENCA, size, source, atomFactory); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncvSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncvSampleEntry.java deleted file mode 100644 index e54257429..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncvSampleEntry.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.axiosys.bento4.ismacryp; - -import java.io.IOException; -import java.io.RandomAccessFile; - -import com.axiosys.bento4.AtomFactory; -import com.axiosys.bento4.InvalidFormatException; -import com.axiosys.bento4.VideoSampleEntry; - -public class EncvSampleEntry extends VideoSampleEntry { - public EncvSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException { - super(TYPE_ENCV, size, source, atomFactory); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/IkmsAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/IkmsAtom.java deleted file mode 100644 index 1b0b2478a..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/IkmsAtom.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.axiosys.bento4.ismacryp; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; - -import com.axiosys.bento4.Atom; - -public class IkmsAtom extends Atom { - private final String kmsUri; - - public IkmsAtom(int size, RandomAccessFile source) throws IOException { - super(TYPE_IKMS, size, true, source); - - byte[] str = new byte[size-getHeaderSize()]; - source.read(str); - int str_size = 0; - while (str[str_size] != 0) str_size++; - kmsUri = new String(str, 0, str_size, "UTF-8"); - } - - public String getKmsUri() { - return kmsUri; - } - - protected void writeFields(DataOutputStream stream) throws IOException { - byte[] bytes = kmsUri.getBytes("UTF-8"); - stream.write(bytes); - int termination = size-getHeaderSize()-bytes.length; - for (int i=0; i<termination; i++) { - stream.writeByte(0); - } - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(super.toString(indentation)); - result.append("\n"); - result.append(indentation + " kms_uri = " + kmsUri); - return result.toString(); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/IsmaCryp.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/IsmaCryp.java deleted file mode 100644 index c27318efd..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/IsmaCryp.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.axiosys.bento4.ismacryp; - -public final class IsmaCryp { - public static final int SCHEME_TYPE_IAEC = 0x69414543; -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/SchmAtom.java b/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/SchmAtom.java deleted file mode 100644 index 22b1d2759..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/Java/com/axiosys/bento4/ismacryp/SchmAtom.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.axiosys.bento4.ismacryp; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.RandomAccessFile; - -import com.axiosys.bento4.Atom; - -public class SchmAtom extends Atom { - private int schemeType; - private int schemeVersion; - private String schemeUri; - - public SchmAtom(int size, RandomAccessFile source) throws IOException { - super(TYPE_SCHM, size, true, source); - - schemeType = source.readInt(); - schemeVersion = source.readInt(); - - byte[] str = new byte[size-getHeaderSize()-8]; - source.read(str); - int str_size = 0; - while (str_size < str.length && str[str_size] != 0) str_size++; - schemeUri = new String(str, 0, str_size, "UTF-8"); - - } - - public int getSchemeType() { - return schemeType; - } - - public String getSchemeUri() { - return schemeUri; - } - - public int getSchemeVersion() { - return schemeVersion; - } - - protected void writeFields(DataOutputStream stream) throws IOException { - stream.writeInt(schemeType); - stream.writeInt(schemeVersion); - byte[] uri_bytes = schemeUri.getBytes("UTF-8"); - stream.write(uri_bytes); - int termination = size-getHeaderSize()-8-uri_bytes.length; - for (int i=0; i<termination; i++) { - stream.writeByte(0); - } - } - - public String toString(String indentation) { - StringBuffer result = new StringBuffer(super.toString(indentation)); - result.append("\n" + indentation + " scheme_type = " + Atom.typeString(schemeType)); - result.append("\n" + indentation + " scheme_version = " + schemeVersion); - result.append("\n" + indentation + " scheme_uri = " + schemeUri); - return result.toString(); - } -} diff --git a/src/filters/parser/mp4splitter/AP4/Source/System/StdC/Ap4StdCFileByteStream.cpp b/src/filters/parser/mp4splitter/AP4/Source/System/StdC/Ap4StdCFileByteStream.cpp deleted file mode 100644 index a4b6e7174..000000000 --- a/src/filters/parser/mp4splitter/AP4/Source/System/StdC/Ap4StdCFileByteStream.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/***************************************************************** -| -| File Byte Stream -| -| (c) 2001-2002 Gilles Boccon-Gibod -| -| - ****************************************************************/ - -/*---------------------------------------------------------------------- -| includes -+---------------------------------------------------------------------*/ -#include <stdio.h> -#include <errno.h> -#include <sys/stat.h> - -#include "Ap4FileByteStream.h" - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream -+---------------------------------------------------------------------*/ -class AP4_StdcFileByteStream: public AP4_ByteStream -{ -public: - // methods - AP4_StdcFileByteStream(AP4_ByteStream* delegator, - const char* name, - AP4_FileByteStream::Mode mode); - ~AP4_StdcFileByteStream(); - - // AP4_ByteStream methods - AP4_Result Read(void* buffer, - AP4_Size bytesToRead, - AP4_Size* bytesRead); - AP4_Result Write(const void* buffer, - AP4_Size bytesToWrite, - AP4_Size* bytesWritten); - AP4_Result Seek(AP4_Offset offset); - AP4_Result Tell(AP4_Offset& offset); - AP4_Result GetSize(AP4_Size& size); - - // AP4_Referenceable methods - void AddReference(); - void Release(); - -private: - // members - AP4_ByteStream* m_Delegator; - AP4_Cardinal m_ReferenceCount; - FILE* m_File; -}; - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::AP4_StdcFileByteStream -+---------------------------------------------------------------------*/ -AP4_StdcFileByteStream::AP4_StdcFileByteStream( - AP4_ByteStream * delegator, - const char* name, - AP4_FileByteStream::Mode mode) : - m_Delegator(delegator), - m_ReferenceCount(1), - m_File(NULL) -{ - if (!strcmp(name, "-stdin")) { - m_File = stdin; - } else if (!strcmp(name, "-stdout")) { - m_File = stdout; - } else if (!strcmp(name, "-stderr")) { - m_File = stderr; - } else { - switch (mode) { - case AP4_FileByteStream::STREAM_MODE_READ: - m_File = fopen(name, "rb"); - break; - - case AP4_FileByteStream::STREAM_MODE_WRITE: - m_File = fopen(name, "wb+"); - break; - - default: - throw AP4_Exception(AP4_ERROR_INVALID_PARAMETERS); - } - - if (m_File == NULL) { - if (errno == ENOENT) { - throw AP4_Exception(AP4_ERROR_NO_SUCH_FILE); - } else if (errno == EACCES) { - throw AP4_Exception(AP4_ERROR_PERMISSION_DENIED); - } else { - throw AP4_Exception(AP4_ERROR_CANNOT_OPEN_FILE); - } - } - } -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::~AP4_StdcFileByteStream -+---------------------------------------------------------------------*/ -AP4_StdcFileByteStream::~AP4_StdcFileByteStream() -{ - if (m_File && m_File != stdin && m_File != stdout && m_File != stderr) { - fclose(m_File); - } -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::AddReference -+---------------------------------------------------------------------*/ -void -AP4_StdcFileByteStream::AddReference() -{ - m_ReferenceCount++; -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::Release -+---------------------------------------------------------------------*/ -void -AP4_StdcFileByteStream::Release() -{ - if (--m_ReferenceCount == 0) { - delete m_Delegator; - } -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::Read -+---------------------------------------------------------------------*/ -AP4_Result -AP4_StdcFileByteStream::Read(void* buffer, - AP4_Size bytesToRead, - AP4_Size* bytesRead) -{ - size_t nbRead; - - nbRead = fread(buffer, 1, bytesToRead, m_File); - - if (nbRead > 0) { - if (bytesRead) *bytesRead = nbRead; - return AP4_SUCCESS; - } else if (feof(m_File)) { - if (bytesRead) *bytesRead = 0; - return AP4_ERROR_EOS; - } else { - if (bytesRead) *bytesRead = 0; - return AP4_ERROR_READ_FAILED; - } -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::Write -+---------------------------------------------------------------------*/ -AP4_Result -AP4_StdcFileByteStream::Write(const void* buffer, - AP4_Size bytesToWrite, - AP4_Size* bytesWritten) -{ - size_t nbWritten; - - nbWritten = fwrite(buffer, 1, bytesToWrite, m_File); - - if (nbWritten > 0) { - if (bytesWritten) *bytesWritten = nbWritten; - return AP4_SUCCESS; - } else { - if (bytesWritten) *bytesWritten = 0; - return AP4_ERROR_WRITE_FAILED; - } -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::Seek -+---------------------------------------------------------------------*/ -AP4_Result -AP4_StdcFileByteStream::Seek(AP4_Offset offset) -{ - size_t result; - - result = fseek(m_File, offset, SEEK_SET); - if (result == 0) { - return AP4_SUCCESS; - } else { - return AP4_FAILURE; - } -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::Tell -+---------------------------------------------------------------------*/ -AP4_Result -AP4_StdcFileByteStream::Tell(AP4_Offset& offset) -{ - offset = ftell(m_File); - return AP4_SUCCESS; -} - -/*---------------------------------------------------------------------- -| AP4_StdcFileByteStream::GetSize -+---------------------------------------------------------------------*/ -AP4_Result -AP4_StdcFileByteStream::GetSize(AP4_Size& size) -{ - struct stat info; - int result; - - result = fstat(fileno(m_File), &info); - if (result == 0) { - size = info.st_size; - return AP4_SUCCESS; - } else { - return AP4_FAILURE; - } -} - -/*---------------------------------------------------------------------- -| AP4_FileByteStream::AP4_FileByteStream -+---------------------------------------------------------------------*/ -AP4_FileByteStream::AP4_FileByteStream(const char* name, - AP4_FileByteStream::Mode mode) -{ - m_Delegate = new AP4_StdcFileByteStream(this, name, mode); -} - - - - - - - - - - - |