00001 #include "asset.h"
00002 #include "file.h"
00003 #include "errorbox.h"
00004 #include "formatcheck.h"
00005 #include "mwindow.inc"
00006
00007 #include <libintl.h>
00008 #define _(String) gettext(String)
00009 #define gettext_noop(String) String
00010 #define N_(String) gettext_noop (String)
00011
00012 FormatCheck::FormatCheck(Asset *asset)
00013 {
00014 this->asset = asset;
00015 }
00016
00017 FormatCheck::~FormatCheck()
00018 {
00019 }
00020
00021 int FormatCheck::check_format()
00022 {
00023 int result = 0;
00024
00025 if(!result && asset->video_data)
00026 {
00027
00028 if(!File::supports_video(asset->format))
00029 {
00030 ErrorBox errorbox(PROGRAM_NAME ": Error");
00031 errorbox.create_objects(_("The format you selected doesn't support video."));
00032 errorbox.run_window();
00033 result = 1;
00034 }
00035 }
00036
00037 if(!result && asset->audio_data)
00038 {
00039 if(!File::supports_audio(asset->format))
00040 {
00041 ErrorBox errorbox(PROGRAM_NAME ": Error");
00042 errorbox.create_objects(_("The format you selected doesn't support audio."));
00043 errorbox.run_window();
00044 result = 1;
00045 }
00046
00047 if(!result && asset->bits == BITSIMA4 && asset->format != FILE_MOV)
00048 {
00049 ErrorBox errorbox(PROGRAM_NAME ": Error");
00050 errorbox.create_objects(_("IMA4 compression is only available in Quicktime movies."));
00051 errorbox.run_window();
00052 result = 1;
00053 }
00054
00055 if(!result && asset->bits == BITSULAW &&
00056 asset->format != FILE_MOV &&
00057 asset->format != FILE_PCM)
00058 {
00059 ErrorBox errorbox(PROGRAM_NAME ": Error");
00060 errorbox.create_objects(_("ULAW compression is only available in\n"
00061 "Quicktime Movies and PCM files."));
00062 errorbox.run_window();
00063 result = 1;
00064 }
00065 }
00066
00067 return result;
00068 }