diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dxr3/dxr3_mpeg_encoders.c | 31 | ||||
-rw-r--r-- | src/dxr3/video_out_dxr3.c | 5 | ||||
-rw-r--r-- | src/dxr3/video_out_dxr3.h | 3 |
3 files changed, 31 insertions, 8 deletions
diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 2cdd945d5..04a07d0bc 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_mpeg_encoders.c,v 1.5 2002/07/03 19:38:45 mroi Exp $ + * $Id: dxr3_mpeg_encoders.c,v 1.6 2002/07/08 16:35:32 mroi Exp $ */ /* mpeg encoders for the dxr3 video out plugin. @@ -62,6 +62,7 @@ int dxr3_rte_init(dxr3_driver_t *drv); /* functions required by encoder api */ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame); static int rte_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame); +static int rte_on_unneeded(dxr3_driver_t *drv); static int rte_on_close(dxr3_driver_t *drv); /* helper function */ @@ -85,6 +86,7 @@ int dxr3_fame_init(dxr3_driver_t *drv); /* functions required by encoder api */ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame); static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame); +static int fame_on_unneeded(dxr3_driver_t *drv); static int fame_on_close(dxr3_driver_t *drv); /* encoder structure */ @@ -123,6 +125,7 @@ int dxr3_rte_init(dxr3_driver_t *drv) this->encoder_data.on_update_format = rte_on_update_format; this->encoder_data.on_frame_copy = NULL; this->encoder_data.on_display_frame = rte_on_display_frame; + this->encoder_data.on_unneeded = rte_on_unneeded; this->encoder_data.on_close = rte_on_close; this->context = 0; @@ -264,15 +267,22 @@ static int rte_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) return 1; } -static int rte_on_close(dxr3_driver_t *drv) +static int rte_on_unneeded(dxr3_driver_t *drv) { rte_data_t *this = (rte_data_t *)drv->enc; if (this->context) { rte_stop(this->context); rte_context_destroy(this->context); + this->context = 0; } - free(this); + return 1; +} + +static int rte_on_close(dxr3_driver_t *drv) +{ + rte_on_unneeded(drv); + free(drv->enc); drv->enc = 0; return 1; } @@ -315,6 +325,7 @@ int dxr3_fame_init(dxr3_driver_t *drv) this->encoder_data.on_update_format = fame_on_update_format; this->encoder_data.on_frame_copy = NULL; this->encoder_data.on_display_frame = fame_on_display_frame; + this->encoder_data.on_unneeded = fame_on_unneeded; this->encoder_data.on_close = fame_on_close; this->context = 0; @@ -489,13 +500,21 @@ static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) return 1; } -static int fame_on_close(dxr3_driver_t *drv) +static int fame_on_unneeded(dxr3_driver_t *drv) { fame_data_t *this = (fame_data_t *)drv->enc; - if (this->context) + if (this->context) { fame_close(this->context); - free(this); + this->context = 0; + } + return 1; +} + +static int fame_on_close(dxr3_driver_t *drv) +{ + fame_on_unneeded(drv); + free(drv->enc); drv->enc = 0; return 1; } diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index adf756f9f..e02810426 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_dxr3.c,v 1.35 2002/07/04 15:29:37 mroi Exp $ + * $Id: video_out_dxr3.c,v 1.36 2002/07/08 16:35:33 mroi Exp $ */ /* mpeg1 encoding video out plugin for the dxr3. @@ -419,6 +419,9 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge this->fd_video = CLOSED_FOR_DECODER; } + /* we do not need the mpeg encoders any more */ + if (this->enc) this->enc->on_unneeded(this); + /* for mpeg source, we don't have to do much. */ this->video_width = width; this->video_iheight = height; diff --git a/src/dxr3/video_out_dxr3.h b/src/dxr3/video_out_dxr3.h index 777081631..21c957d88 100644 --- a/src/dxr3/video_out_dxr3.h +++ b/src/dxr3/video_out_dxr3.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_dxr3.h,v 1.3 2002/06/30 10:47:06 mroi Exp $ + * $Id: video_out_dxr3.h,v 1.4 2002/07/08 16:35:33 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -124,6 +124,7 @@ struct encoder_data_s { int (*on_update_format)(dxr3_driver_t *, dxr3_frame_t *); int (*on_frame_copy)(dxr3_driver_t *, dxr3_frame_t *, uint8_t **src); int (*on_display_frame)(dxr3_driver_t *, dxr3_frame_t *); + int (*on_unneeded)(dxr3_driver_t *); int (*on_close)(dxr3_driver_t *); }; |