summaryrefslogtreecommitdiff
path: root/src/decoder.cc
diff options
context:
space:
mode:
authordeva <deva>2005-03-29 20:07:22 +0000
committerdeva <deva>2005-03-29 20:07:22 +0000
commit789ed99ffdeae638e9191ca99272e536f36f6934 (patch)
tree29c884d1a6838cbdfc46feb6fb81da7a003f5eec /src/decoder.cc
parent8baab8060621a4d219b84b14677990047ff0bf26 (diff)
Added a lot of error detection stuff to the camera, player, encoder and decoder objects.
Diffstat (limited to 'src/decoder.cc')
-rw-r--r--src/decoder.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/decoder.cc b/src/decoder.cc
index dfddd87..bf9b75c 100644
--- a/src/decoder.cc
+++ b/src/decoder.cc
@@ -52,7 +52,8 @@ Decoder::Decoder(Error* err,
if(!(iformat = av_find_input_format("dv1394"))) {
errobj->pushError("Failed to get input format dv1394.");
- exit(1);
+ fc = NULL;
+ return;
}
dvpars.device = device; /* "/dev/dv1394"; */
@@ -61,23 +62,27 @@ Decoder::Decoder(Error* err,
if(av_open_input_file(&ifc, "", iformat, 0, &dvpars) < 0) {
errobj->pushError("Device is in use.");
- fc = NULL; return;
+ fc = NULL;
+ return;
}
if(av_find_stream_info(ifc) < 0) {
errobj->pushError("Could not find enough parameters.");
- fc = NULL; return;
+ fc = NULL;
+ return;
}
dump_format(ifc, 1, "", 0);
if(!(dec_codec = avcodec_find_decoder(ifc->streams[0]->codec.codec_id))) {
errobj->pushError("Unsupported codec for input stream.");
- fc = NULL; return;
+ fc = NULL;
+ return;
}
if(avcodec_open(&ifc->streams[0]->codec, dec_codec) < 0) {
errobj->pushError("Error while opening codec for input stream.");
- fc = NULL; return;
+ fc = NULL;
+ return;
}
fc = ifc;
@@ -126,7 +131,7 @@ void Decoder::decode()
if(ret < 0) {
errobj->pushError("Error while decoding stream.");
- exit(1);
+ return;
}
len -= ret;