From 789ed99ffdeae638e9191ca99272e536f36f6934 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 29 Mar 2005 20:07:22 +0000 Subject: Added a lot of error detection stuff to the camera, player, encoder and decoder objects. --- src/decoder.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/decoder.cc') 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; -- cgit v1.2.3