remove unnecessary ffmsindex.cpp

Originally committed to SVN as r2349.
This commit is contained in:
Karl Blomster 2008-09-12 17:40:58 +00:00
parent eb38d1820f
commit ecfc2b96c3
2 changed files with 62 additions and 93 deletions

View file

@ -19,41 +19,30 @@
// THE SOFTWARE. // THE SOFTWARE.
#include "ffmsindex.h" #include <iostream>
#include <string>
#include "ffms.h"
int main(int argc, char *argv[]) { int TrackMask;
try { bool Overwrite;
ParseCMDLine(argc, argv); std::string InputFile;
} catch (const char *Error) { std::string CacheFile;
std::cout << std::endl << Error << std::endl; std::string AudioFile;
return 1;
} catch (std::string Error) { FrameIndex *Index;
std::cout << std::endl << Error << std::endl;
return 1;
} catch (...) { void PrintUsage () {
std::cout << std::endl << "Unknown error" << std::endl; using namespace std;
return 1; cout << "FFmpegSource2 indexing app" << endl
<< "Usage: ffmsindex [options] inputfile [outputfile]" << endl
<< "If no output filename is specified, inputfile.ffindex will be used." << endl << endl
<< "Options:" << endl
<< "-f Overwrite existing index file if it exists (default: no)" << endl
<< "-t N Set the audio trackmask to N (-1 means decode all tracks, 0 means decode none; default: 0)" << endl
<< "-a NAME Set the audio output base filename to NAME (default: input filename)";
} }
FFMS_Init();
try {
DoIndexing();
} catch (const char *Error) {
std::cout << Error << std::endl;
FFMS_DestroyFrameIndex(Index);
return 1;
} catch (...) {
std::cout << std::endl << "Unknown error" << std::endl;
FFMS_DestroyFrameIndex(Index);
return 1;
}
FFMS_DestroyFrameIndex(Index);
return 0;
}
void ParseCMDLine (int argc, char *argv[]) { void ParseCMDLine (int argc, char *argv[]) {
if (argc <= 1) { if (argc <= 1) {
PrintUsage(); PrintUsage();
@ -108,16 +97,24 @@ void ParseCMDLine (int argc, char *argv[]) {
} }
static int __stdcall UpdateProgress(int State, int64_t Current, int64_t Total, void *Private) {
void PrintUsage () {
using namespace std; using namespace std;
cout << "FFmpegSource2 indexing app" << endl int *LastPercentage = (int *)Private;
<< "Usage: ffmsindex [options] inputfile [outputfile]" << endl int Percentage = int((double(Current)/double(Total)) * 100);
<< "If no output filename is specified, inputfile.ffindex will be used." << endl << endl
<< "Options:" << endl if (Percentage <= *LastPercentage)
<< "-f Overwrite existing index file if it exists (default: no)" << endl return 0;
<< "-t N Set the audio trackmask to N (-1 means decode all tracks, 0 means decode none; default: 0)" << endl
<< "-a NAME Set the audio output base filename to NAME (default: input filename)"; *LastPercentage = Percentage;
if (Percentage < 10)
cout << "\b\b";
else
cout << "\b\b\b";
cout << Percentage << "%";
return 0;
} }
@ -154,22 +151,34 @@ void DoIndexing () {
} }
static int __stdcall UpdateProgress(int State, int64_t Current, int64_t Total, void *Private) { int main(int argc, char *argv[]) {
using namespace std; try {
int *LastPercentage = (int *)Private; ParseCMDLine(argc, argv);
int Percentage = int((double(Current)/double(Total)) * 100); } catch (const char *Error) {
std::cout << std::endl << Error << std::endl;
return 1;
} catch (std::string Error) {
std::cout << std::endl << Error << std::endl;
return 1;
} catch (...) {
std::cout << std::endl << "Unknown error" << std::endl;
return 1;
}
if (Percentage <= *LastPercentage) FFMS_Init();
return 0;
*LastPercentage = Percentage; try {
DoIndexing();
if (Percentage < 10) } catch (const char *Error) {
cout << "\b\b"; std::cout << Error << std::endl;
else FFMS_DestroyFrameIndex(Index);
cout << "\b\b\b"; return 1;
} catch (...) {
cout << Percentage << "%"; std::cout << std::endl << "Unknown error" << std::endl;
FFMS_DestroyFrameIndex(Index);
return 1;
}
FFMS_DestroyFrameIndex(Index);
return 0; return 0;
} }

View file

@ -1,40 +0,0 @@
// Copyright (c) 2008 Karl Blomster
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#pragma once
#include <iostream>
#include <string>
#include "ffms.h"
int TrackMask;
bool Overwrite;
std::string InputFile;
std::string CacheFile;
std::string AudioFile;
FrameIndex *Index;
void PrintUsage();
void ParseCMDLine(int argc, char *argv[]);
void DoIndexing();
static int __stdcall UpdateProgress(int State, int64_t Current, int64_t Total, void *Private);