[xiph-commits] r14964 - in trunk/ffmpeg2theora: . src
j at svn.xiph.org
j at svn.xiph.org
Tue May 27 03:24:48 PDT 2008
Author: j
Date: 2008-05-27 03:24:48 -0700 (Tue, 27 May 2008)
New Revision: 14964
Modified:
trunk/ffmpeg2theora/
trunk/ffmpeg2theora/src/ffmpeg2theora.c
trunk/ffmpeg2theora/src/subtitles.c
trunk/ffmpeg2theora/src/theorautils.c
Log:
more memory leaks thanks ogg.k.ogg.k
Property changes on: trunk/ffmpeg2theora
___________________________________________________________________
Name: bzr:revision-info
- timestamp: 2008-05-26 13:13:21.148999929 +0200
committer: j
properties:
branch-nick: ffmpeg2theora
+ timestamp: 2008-05-27 12:08:51.190000057 +0200
committer: j
properties:
branch-nick: ffmpeg2theora
Name: bzr:revision-id:v3-single1-dHJ1bmsvZmZtcGVnMnRoZW9yYQ..
- 191 j-20080517230830-he5x8v2m8yrfiw35
192 j-20080518224037-pkmoctzf4qce7tog
193 j-20080518224409-6hbfp3k2ssn6egqa
194 j-20080520111939-dhi52qwbqe7a47cu
195 j-20080523092252-gj9k9db0s67vl7dw
196 j-20080523092420-l0850yrq1qkgz9t0
197 j-20080523093057-l5g0ezzy5geu0pey
198 j-20080523094343-kcno1dm2e1lr38q4
199 j-20080523163006-kjl6ewea5sxawmq2
200 j-20080523165904-l2vm52qae0hlqkhp
201 j-20080523175432-2ed953iktnl8c7cr
202 j-20080525100939-7oja8pk08v9fquiw
203 j-20080526111321-nhzaqh6ivzn0vs7b
+ 191 j-20080517230830-he5x8v2m8yrfiw35
192 j-20080518224037-pkmoctzf4qce7tog
193 j-20080518224409-6hbfp3k2ssn6egqa
194 j-20080520111939-dhi52qwbqe7a47cu
195 j-20080523092252-gj9k9db0s67vl7dw
196 j-20080523092420-l0850yrq1qkgz9t0
197 j-20080523093057-l5g0ezzy5geu0pey
198 j-20080523094343-kcno1dm2e1lr38q4
199 j-20080523163006-kjl6ewea5sxawmq2
200 j-20080523165904-l2vm52qae0hlqkhp
201 j-20080523175432-2ed953iktnl8c7cr
202 j-20080525100939-7oja8pk08v9fquiw
203 j-20080526111321-nhzaqh6ivzn0vs7b
204 j-20080527100851-2v5eyxxrq1riqi50
Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c 2008-05-27 10:20:55 UTC (rev 14963)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c 2008-05-27 10:24:48 UTC (rev 14964)
@@ -103,7 +103,7 @@
/**
* Allocate and initialise an AVFrame.
*/
-AVFrame *frame_alloc (int pix_fmt, int width, int height) {
+static AVFrame *frame_alloc (int pix_fmt, int width, int height) {
AVFrame *picture;
uint8_t *picture_buf;
int size;
@@ -123,10 +123,20 @@
}
/**
+ * Frees an AVFrame.
+ */
+static void frame_dealloc (AVFrame *frame) {
+ if (frame) {
+ avpicture_free((AVPicture*)frame);
+ av_free(frame);
+ }
+}
+
+/**
* initialize ff2theora with default values
* @return ff2theora struct
*/
-ff2theora ff2theora_init (){
+static ff2theora ff2theora_init (){
ff2theora this = calloc (1, sizeof (*this));
if (this != NULL){
this->disable_audio=0;
@@ -258,19 +268,19 @@
}
}
-static void prepare_yuv_buffer(ff2theora this, yuv_buffer *yuv, AVFrame *output_buffered) {
+static void prepare_yuv_buffer(ff2theora this, yuv_buffer *yuv, AVFrame *frame) {
/* pysical pages */
yuv->y_width = this->frame_width;
yuv->y_height = this->frame_height;
- yuv->y_stride = output_buffered->linesize[0];
+ yuv->y_stride = frame->linesize[0];
yuv->uv_width = this->frame_width / 2;
yuv->uv_height = this->frame_height / 2;
- yuv->uv_stride = output_buffered->linesize[1];
+ yuv->uv_stride = frame->linesize[1];
- yuv->y = output_buffered->data[0];
- yuv->u = output_buffered->data[1];
- yuv->v = output_buffered->data[2];
+ yuv->y = frame->data[0];
+ yuv->u = frame->data[1];
+ yuv->v = frame->data[2];
if (this->y_lut_used) {
lut_apply(this->y_lut, yuv->y, yuv->y, yuv->y_width, yuv->y_height, yuv->y_stride);
}
@@ -578,6 +588,7 @@
if (this->video_index >= 0 || this->audio_index >= 0){
AVFrame *frame=NULL;
+ AVFrame *frame_p=NULL;
AVFrame *output=NULL;
AVFrame *output_p=NULL;
AVFrame *output_tmp_p=NULL;
@@ -614,7 +625,7 @@
info.video_only=1;
if(!info.audio_only){
- frame = frame_alloc(vstream->codec->pix_fmt,
+ frame_p = frame = frame_alloc(vstream->codec->pix_fmt,
vstream->codec->width,vstream->codec->height);
output_tmp_p = output_tmp = frame_alloc(this->pix_fmt,
vstream->codec->width,vstream->codec->height);
@@ -961,16 +972,19 @@
avcodec_close(venc);
}
if (this->audio_index >= 0) {
+ if (this->audio_resample_ctx)
+ audio_resample_close(this->audio_resample_ctx);
avcodec_close(aenc);
}
oggmux_close (&info);
if(ppContext)
pp_free_context(ppContext);
if (!info.audio_only) {
- av_free(frame);
- av_free(output_p);
- av_free(output_tmp_p);
- av_free(output_resized_p);
+ frame_dealloc(frame_p);
+ frame_dealloc(output_p);
+ frame_dealloc(output_tmp_p);
+ frame_dealloc(output_resized_p);
+ frame_dealloc(output_buffered_p);
}
av_free(audio_buf);
av_free(resampled);
Modified: trunk/ffmpeg2theora/src/subtitles.c
===================================================================
--- trunk/ffmpeg2theora/src/subtitles.c 2008-05-27 10:20:55 UTC (rev 14963)
+++ trunk/ffmpeg2theora/src/subtitles.c 2008-05-27 10:24:48 UTC (rev 14964)
@@ -187,6 +187,7 @@
static char str[4096];
int warned=0;
+ this->subtitles = NULL;
FILE *f = fopen(this->filename, "r");
if (!f) {
fprintf(stderr,"WARNING - Failed to open subtitles file %s (%s)\n", this->filename, strerror(errno));
@@ -208,6 +209,7 @@
if (ret!=1) {
fprintf(stderr,"WARNING - Syntax error: %s\n",str);
fclose(f);
+ free(this->subtitles);
return -1;
}
if (id!=last_seen_id+1) {
@@ -222,6 +224,7 @@
if (ret!=8) {
fprintf(stderr,"WARNING - Syntax error: %s\n",str);
fclose(f);
+ free(this->subtitles);
return -1;
}
else {
@@ -238,6 +241,7 @@
if (!this->subtitles) {
fprintf(stderr, "Out of memory\n");
fclose(f);
+ free(this->subtitles);
return -1;
}
ret=kate_text_validate(kate_utf8,text,len+1);
Modified: trunk/ffmpeg2theora/src/theorautils.c
===================================================================
--- trunk/ffmpeg2theora/src/theorautils.c 2008-05-27 10:20:55 UTC (rev 14963)
+++ trunk/ffmpeg2theora/src/theorautils.c 2008-05-27 10:24:48 UTC (rev 14964)
@@ -555,6 +555,7 @@
ret = kate_ogg_encode_text(&ks->k, t0, t1, text, len, &op);
if (ret>=0) {
ogg_stream_packetin (&ks->ko, &op);
+ ogg_packet_clear (&op);
info->k_pkg++;
}
else {
@@ -565,6 +566,7 @@
ret = kate_ogg_encode_finish(&ks->k, -1, &op);
if (ret>=0) {
ogg_stream_packetin (&ks->ko, &op);
+ ogg_packet_clear (&op);
info->k_pkg++;
}
else {
@@ -588,6 +590,7 @@
ret = kate_ogg_encode_finish(&ks->k, t, &op);
if (ret>=0) {
ogg_stream_packetin (&ks->ko, &op);
+ ogg_packet_clear (&op);
info->k_pkg++;
}
else {
@@ -898,6 +901,7 @@
vorbis_info_clear (&info->vi);
ogg_stream_clear (&info->to);
+ theora_comment_clear (&info->tc);
theora_clear (&info->td);
#ifdef HAVE_KATE
@@ -909,6 +913,9 @@
}
#endif
+ if (info->with_skeleton)
+ ogg_stream_clear (&info->so);
+
if (info->outfile && info->outfile != stdout)
fclose (info->outfile);
@@ -921,4 +928,5 @@
if(info->kate_streams[n].katepage)
free(info->kate_streams[n].katepage);
}
+ free(info->kate_streams);
}
More information about the commits
mailing list