]> rtime.felk.cvut.cz Git - frescor/streamer.git/commitdiff
Added closing of the FFmpeg output stream.
authorPavel Pisa <pi@baree.pikron.com>
Thu, 28 May 2009 05:01:14 +0000 (07:01 +0200)
committerPavel Pisa <pi@baree.pikron.com>
Thu, 28 May 2009 05:01:14 +0000 (07:01 +0200)
Resources are correctly released now.

Signed-off-by: Pavel Pisa <pi@baree.pikron.com>
output.c
output.h
streamer.c

index 260d58f926de857e20e97b71c7d0de7cb4cb521f..b5d60e64216f082e0586fc6552a405da2e8df8dc 100644 (file)
--- a/output.c
+++ b/output.c
@@ -49,6 +49,12 @@ AVFormatContext *open_output_stream(const char *dst, int port, enum CodecType co
     return s;
 }
 
+int close_output_stream(AVFormatContext *s)
+{
+  url_fclose(s->pb);
+  return 0;
+}
+
 int pkt_send(AVFormatContext *ctx, AVPacket *pkt)
 {
   static int inited;           /* FIXME: HACK! */
index 8ece7a9d1091ec41a1f32f8a5d0433725bf56fc7..d035ef810ed04cf94caf410aaec2b5212e8f9621 100644 (file)
--- a/output.h
+++ b/output.h
@@ -5,4 +5,6 @@
  */
 int pkt_send(AVFormatContext *ctx, AVPacket *pkt);
 AVFormatContext *open_output_stream(const char *dst, int port, enum CodecType codec_type);
+int close_output_stream(AVFormatContext *s);
+
 
index 1f85ce40850d0775b7ff99488bcd6f95b552a808..e794e9a514d8d5e08759c4994bd8702d386d562d 100644 (file)
@@ -263,6 +263,7 @@ int main(int argc, char *argv[])
 
        printf("Finishing\n");
 
+        close_output_stream(os);
 #else
        pthread_attr_t attr;
        pthread_t streamer_th;
@@ -280,6 +281,8 @@ int main(int argc, char *argv[])
        pthread_join(streamer_th, (void**) NULL);
 
        printf("Finishing\n");
+
+        close_output_stream(os);
 #endif
 
   return 0;