r3491 - trunk/libminisip/source/subsystem_media/video/codec
mikma at minisip.org
mikma at minisip.org
Sun Nov 18 21:52:11 CET 2007
Author: mikma
Date: 2007-11-18 21:52:10 +0100 (Sun, 18 Nov 2007)
New Revision: 3491
Modified:
trunk/libminisip/source/subsystem_media/video/codec/AVCoder.cxx
trunk/libminisip/source/subsystem_media/video/codec/AVDecoder.cxx
Log:
Throw an exception, which can be caught, instead of exit if a video error
occurs.
Modified: trunk/libminisip/source/subsystem_media/video/codec/AVCoder.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/video/codec/AVCoder.cxx 2007-11-18 20:42:34 UTC (rev 3490)
+++ trunk/libminisip/source/subsystem_media/video/codec/AVCoder.cxx 2007-11-18 20:52:10 UTC (rev 3491)
@@ -26,6 +26,7 @@
#include<sys/time.h>
#include<libmutil/mtime.h>
#include<libminisip/media/video/codec/VideoEncoderCallback.h>
+#include<libminisip/media/video/VideoException.h>
//#include<libminisip/media/rtp/RtpPacket.h>
#include<config.h>
@@ -94,8 +95,7 @@
codec = avcodec_find_encoder( CODEC_ID_H263P );
if( codec == NULL ){
- merr << "libavcodec does not support H263" << end;
- exit( 1 );
+ throw VideoException( "libavcodec does not support H263" );
}
int bitRate = 100 * 1000;
@@ -163,8 +163,7 @@
context->height = height; //height;
if( avcodec_open( context, codec ) != 0 ){
- merr << "Could not open libavcodec codec" << end;
- exit( 1 );
+ throw VideoException( "Could not open libavcodec codec" );
}
}
@@ -209,8 +208,7 @@
if( img_convert( (AVPicture*)&frame, context->pix_fmt,
(AVPicture*)image, srcFormat,
context->width, context->height ) < 0 ){
- merr << "Could not convert image to encoding format" << end;
- exit( 1 );
+ throw VideoException( "Could not convert image to encoding format" );
}
}
else{
Modified: trunk/libminisip/source/subsystem_media/video/codec/AVDecoder.cxx
===================================================================
--- trunk/libminisip/source/subsystem_media/video/codec/AVDecoder.cxx 2007-11-18 20:42:34 UTC (rev 3490)
+++ trunk/libminisip/source/subsystem_media/video/codec/AVDecoder.cxx 2007-11-18 20:52:10 UTC (rev 3491)
@@ -25,6 +25,7 @@
#include<config.h>
#include<libminisip/media/video/codec/AVDecoder.h>
#include<libminisip/media/video/ImageHandler.h>
+#include<libminisip/media/video/VideoException.h>
#include<iostream>
@@ -67,8 +68,7 @@
codec = avcodec_find_decoder( CODEC_ID_H263 );
if( codec == NULL ){
- fprintf( stderr, "libavcodec does not support H263" );
- exit( 1 );
+ throw VideoException( "libavcodec does not support H263" );
}
context = avcodec_alloc_context();
@@ -78,8 +78,7 @@
#endif
if( avcodec_open( context, codec ) != 0 ){
- fprintf( stderr, "Could not open libavcodec codec\n" );
- exit( 1 );
+ throw VideoException( "Could not open libavcodec codec" );
}
context->opaque = this;
More information about the Minisip-devel
mailing list