Hello,

Ilyes wrote:
> The issue is with mpegencoder.cpp, line 94 and not ffmpeg (just make
> sure you have the latest release for your distribution). So it's about
> the not recommended usage of goto. You could just replace that piece
> of code with an if then else equivalent clause. I think that somebody
> sent me a patch about this but I still didn't find the time to merge
> it in LiveCam... I'll fix it asap.

Attached is a patch that fixes this issue.

--
Sébastien
--- mpegencoder.cpp.orig	2008-02-26 10:04:25.000000000 +0100
+++ mpegencoder.cpp	2008-02-26 09:21:23.000000000 +0100
@@ -68,29 +68,31 @@
     m_SourceFormat = fmt->pixelformat;
         
     m_Ctx = avcodec_alloc_context();
-    if (!m_Ctx) goto error;
+    if (m_Ctx) {
     
-    m_Picture = avcodec_alloc_frame();
-    if (!m_Picture) goto error;
+     m_Picture = avcodec_alloc_frame();
+     if (m_Picture) {
     
-    m_Ctx->bit_rate = 800000;
-    m_Ctx->width = fmt->width;
-    m_Ctx->height = fmt->height;
+      m_Ctx->bit_rate = 800000;
+      m_Ctx->width = fmt->width;
+      m_Ctx->height = fmt->height;
 
-    // frames per second
-    m_Ctx->time_base = (AVRational){1, 20};
-    m_Ctx->gop_size = 10; // emit one intra frame every ten frames
-    m_Ctx->max_b_frames = 3;
-    m_Ctx->pix_fmt = PIX_FMT_YUV420P;
-    
-    if (avcodec_open(m_Ctx, m_MPEGCodec) < 0) goto error;
-    
-    m_OutputFile = fopen(fn, "wb");
-    m_OutputBuf = (unsigned char*)malloc(BUFFER_SIZE);
-    
-    return 1;
+      // frames per second
+      m_Ctx->time_base = (AVRational){1, 20};
+      m_Ctx->gop_size = 10; // emit one intra frame every ten frames
+      m_Ctx->max_b_frames = 3;
+      m_Ctx->pix_fmt = PIX_FMT_YUV420P;
+    
+      if (avcodec_open(m_Ctx, m_MPEGCodec) >= 0) {
+    
+       m_OutputFile = fopen(fn, "wb");
+       m_OutputBuf = (unsigned char*)malloc(BUFFER_SIZE);
+    
+       return 1;
+      }
+     }
+    }
     
-error:
     if (m_Ctx) avcodec_close(m_Ctx);
     m_Ctx = NULL;
     
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
M560x-driver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/m560x-driver-devel

Reply via email to