diff options
Diffstat (limited to 'src/dxr3/dxr3_mpeg_encoders.c')
-rw-r--r-- | src/dxr3/dxr3_mpeg_encoders.c | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 622e40128..e4ec99913 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.14 2003/11/05 21:58:22 mroi Exp $ + * $Id: dxr3_mpeg_encoders.c,v 1.15 2003/12/05 15:54:58 f1rmb Exp $ */ /* mpeg encoders for the dxr3 video out plugin. @@ -120,13 +120,12 @@ int dxr3_rte_init(dxr3_driver_t *drv) rte_data_t* this; if (!rte_init()) { - printf("dxr3_mpeg_encoder: failed to init librte\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to init librte\n")); return 0; } - this = malloc(sizeof(rte_data_t)); + this = xine_xmalloc(sizeof(rte_data_t)); if (!this) return 0; - memset(this, 0, sizeof(rte_data_t)); this->encoder_data.type = ENC_RTE; this->encoder_data.on_update_format = rte_on_update_format; @@ -157,7 +156,8 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) } if ((frame->vo_frame.pitches[0] % 16 != 0) || (frame->oheight % 16 != 0)) { - printf("dxr3_mpeg_encoder: rte only handles video dimensions which are multiples of 16\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: rte only handles video dimensions which are multiples of 16\n")); return 0; } @@ -167,7 +167,7 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) /* create new rte context */ this->context = rte_context_new(this->width, this->height, "mp1e", drv); if (!this->context) { - printf("dxr3_mpeg_encoder: failed to get rte context.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to get rte context.\n")); return 0; } context = this->context; /* shortcut */ @@ -178,7 +178,7 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) /* get mpeg codec handle */ codec = rte_codec_set(context, RTE_STREAM_VIDEO, 0, "mpeg1_video"); if (!codec) { - printf("dxr3_mpeg_encoder: could not create codec.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: could not create codec.\n")); rte_context_destroy(context); this->context = 0; return 0; @@ -210,36 +210,44 @@ static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) */ fps = 90000.0 / frame->vo_frame.duration; if (!rte_option_set(codec, "virtual_frame_rate", fps)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; virtual_frame_rate = %g.\n", fps); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; virtual_frame_rate = %g.\n", fps); if (!rte_option_set(codec, "coded_frame_rate", fps)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; coded_frame_rate = %g.\n", fps); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; coded_frame_rate = %g.\n", fps); if (!rte_option_set(codec, "bit_rate", (int)this->rte_bitrate)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; bit_rate = %d.\n", (int)this->rte_bitrate); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; bit_rate = %d.\n", (int)this->rte_bitrate); if (!rte_option_set(codec, "gop_sequence", "I")) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; gop_sequence = \"I\".\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; gop_sequence = \"I\".\n"); /* just to be sure, disable motion comp (not needed in I frames) */ if (!rte_option_set(codec, "motion_compensation", 0)) - printf("dxr3_mpeg_encoder: WARNING: rte_option_set failed; motion_compensation = 0.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: WARNING: rte_option_set failed; motion_compensation = 0.\n"); rte_set_input(context, RTE_VIDEO, RTE_PUSH, FALSE, NULL, NULL, NULL); rte_set_output(context, mp1e_callback, NULL, NULL); if (!rte_init_context(context)) { - printf("dxr3_mpeg_encoder: cannot init the context: %s\n", context->error); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: cannot init the context: %s\n"), context->error); rte_context_destroy(context); this->context = 0; return 0; } /* do the sync'ing and start encoding */ if (!rte_start_encoding(context)) { - printf("dxr3_mpeg_encoder: cannot start encoding: %s\n", context->error); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: cannot start encoding: %s\n"), context->error); rte_context_destroy(context); this->context = 0; return 0; } this->rte_ptr = rte_push_video_data(context, NULL, 0); if (!this->rte_ptr) { - printf("dxr3_mpeg_encoder: failed to get encoder buffer pointer.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: failed to get encoder buffer pointer.\n"); return 0; } @@ -303,13 +311,13 @@ static void mp1e_callback(rte_context *context, void *data, ssize_t size, void * written = write(drv->fd_video, data, size); if (written < 0) { - printf("dxr3_mpeg_encoder: video device write failed (%s)\n", - strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: video device write failed (%s)\n", strerror(errno)); return; } if (written != size) - printf("dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", - written, size); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", written, size); } #endif @@ -319,9 +327,8 @@ int dxr3_fame_init(dxr3_driver_t *drv) { fame_data_t *this; - this = malloc(sizeof(fame_data_t)); + this = xine_xmalloc(sizeof(fame_data_t)); if (!this) return 0; - memset(this, 0, sizeof(fame_data_t)); this->encoder_data.type = ENC_FAME; this->encoder_data.on_update_format = fame_on_update_format; @@ -374,14 +381,16 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame) this->context = fame_open(); if (!this->context) { - printf("dxr3_mpeg_encoder: Couldn't start the FAME library\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("dxr3_mpeg_encoder: Couldn't start the FAME library\n")); return 0; } if (!this->buffer) this->buffer = (unsigned char *)malloc(DEFAULT_BUFFER_SIZE); if (!this->buffer) { - printf("dxr3_mpeg_encoder: Couldn't allocate temp buffer for mpeg data\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Couldn't allocate temp buffer for mpeg data\n"); return 0; } @@ -476,12 +485,14 @@ static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame) written = write(drv->fd_video, this->buffer, size); if (written < 0) { - printf("dxr3_mpeg_encoder: video device write failed (%s)\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: video device write failed (%s)\n", strerror(errno)); return 0; } if (written != size) - printf("dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", written, size); return 1; } @@ -516,7 +527,8 @@ static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, dxr3_frame_ if (frame->vo_frame.format == XINE_IMGFMT_YUY2) { /* need YUY2->YV12 conversion */ if (!(this->out[0] && this->out[1] && this->out[2]) ) { - printf("dxr3_mpeg_encoder: Internal YV12 buffer not created.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "dxr3_mpeg_encoder: Internal YV12 buffer not created.\n"); return 0; } y = this->out[0] + frame->vo_frame.width * drv->top_bar; |