sample_muxer: clean-up to conform to style guide
Change-Id: I77a4657d71359777a8f55f40346014f90051e02d
This commit is contained in:
parent
49078292b4
commit
cb8899a920
7
Makefile
7
Makefile
@ -6,9 +6,8 @@ WEBMOBJS := mkvparser.o mkvreader.o mkvmuxer.o mkvmuxerutil.o mkvwriter.o
|
||||
OBJSA := $(WEBMOBJS:.o=_a.o)
|
||||
OBJSSO := $(WEBMOBJS:.o=_so.o)
|
||||
OBJECTS1 := sample.o
|
||||
OBJECTS2 := sample_muxer.o
|
||||
OBJECTS2 := sample_muxer.o vttreader.o webvttparser.o sample_muxer_metadata.o
|
||||
OBJECTS3 := dumpvtt.o vttreader.o webvttparser.o
|
||||
OBJECTS4 := vttreader.o webvttparser.o sample_muxer_metadata.o
|
||||
INCLUDES := -I.
|
||||
EXES := samplemuxer sample dumpvtt
|
||||
|
||||
@ -17,7 +16,7 @@ all: $(EXES)
|
||||
sample: sample.o $(LIBWEBMA)
|
||||
$(CXX) $^ -o $@
|
||||
|
||||
samplemuxer: sample_muxer.o $(LIBWEBMA) $(OBJECTS4)
|
||||
samplemuxer: $(OBJECTS2) $(LIBWEBMA)
|
||||
$(CXX) $^ -o $@
|
||||
|
||||
dumpvtt: $(OBJECTS3)
|
||||
@ -41,4 +40,4 @@ libwebm.so: $(OBJSSO)
|
||||
$(CXX) -c $(CXXFLAGS) -fPIC $(INCLUDES) $< -o $@
|
||||
|
||||
clean:
|
||||
$(RM) -f $(OBJECTS1) $(OBJECTS2) $(OBJECTS3) $(OBJECTS4) $(OBJSA) $(OBJSSO) $(LIBWEBMA) $(LIBWEBMSO) $(EXES) Makefile.bak
|
||||
$(RM) -f $(OBJECTS1) $(OBJECTS2) $(OBJECTS3) $(OBJSA) $(OBJSSO) $(LIBWEBMA) $(LIBWEBMSO) $(EXES) Makefile.bak
|
||||
|
@ -131,7 +131,7 @@ int ParseArgWebVTT(
|
||||
return 0; // not a WebVTT arg
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
char* input = NULL;
|
||||
@ -399,7 +399,11 @@ int main(int argc, char* argv[]) {
|
||||
// input file.
|
||||
|
||||
SampleMuxerMetadata metadata;
|
||||
metadata.Init(&muxer_segment);
|
||||
|
||||
if (!metadata.Init(&muxer_segment)) {
|
||||
printf("\n Could not initialize metadata cache.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (!LoadMetadataFiles(metadata_files, &metadata))
|
||||
return EXIT_FAILURE;
|
||||
|
@ -7,8 +7,12 @@ using std::string;
|
||||
SampleMuxerMetadata::SampleMuxerMetadata() : segment_(NULL) {
|
||||
}
|
||||
|
||||
void SampleMuxerMetadata::Init(mkvmuxer::Segment* s) {
|
||||
segment_ = s;
|
||||
bool SampleMuxerMetadata::Init(mkvmuxer::Segment* segment) {
|
||||
if (segment == NULL || segment_ != NULL)
|
||||
return false;
|
||||
|
||||
segment_ = segment;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SampleMuxerMetadata::Load(const char* file, Kind kind) {
|
||||
@ -63,28 +67,28 @@ bool SampleMuxerMetadata::AddTrack(
|
||||
const char* codec_id;
|
||||
|
||||
switch (kind) {
|
||||
case kSubtitles:
|
||||
type = 0x11;
|
||||
codec_id = "D_WEBVTT/SUBTITLES";
|
||||
break;
|
||||
case kSubtitles:
|
||||
type = 0x11;
|
||||
codec_id = "D_WEBVTT/SUBTITLES";
|
||||
break;
|
||||
|
||||
case kCaptions:
|
||||
type = 0x11;
|
||||
codec_id = "D_WEBVTT/CAPTIONS";
|
||||
break;
|
||||
case kCaptions:
|
||||
type = 0x11;
|
||||
codec_id = "D_WEBVTT/CAPTIONS";
|
||||
break;
|
||||
|
||||
case kDescriptions:
|
||||
type = 0x21;
|
||||
codec_id = "D_WEBVTT/DESCRIPTIONS";
|
||||
break;
|
||||
case kDescriptions:
|
||||
type = 0x21;
|
||||
codec_id = "D_WEBVTT/DESCRIPTIONS";
|
||||
break;
|
||||
|
||||
case kMetadata:
|
||||
type = 0x21;
|
||||
codec_id = "D_WEBVTT/METADATA";
|
||||
break;
|
||||
case kMetadata:
|
||||
type = 0x21;
|
||||
codec_id = "D_WEBVTT/METADATA";
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
track->set_type(type);
|
||||
|
@ -26,8 +26,9 @@ class SampleMuxerMetadata {
|
||||
|
||||
SampleMuxerMetadata();
|
||||
|
||||
// Bind this metadata object to the muxer instance.
|
||||
void Init(mkvmuxer::Segment* segment);
|
||||
// Bind this metadata object to the muxer instance. Returns false
|
||||
// if segment equals NULL, or Init has already been called.
|
||||
bool Init(mkvmuxer::Segment* segment);
|
||||
|
||||
// Parse the WebVTT file |filename| having the indicated |kind|, and
|
||||
// create a corresponding track in the segment. Returns false on
|
||||
|
Loading…
Reference in New Issue
Block a user