summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-11-05 21:58:22 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-11-05 21:58:22 +0000
commit7d631c9305d8a8a88d7b1e14c73758102c624ecb (patch)
tree8c97b24ff6848dfd8c2b29748d9d8733b5f61c23 /src
parent9d1d6d55a705e16ebdff1451caabea3b7e97bd27 (diff)
downloadxine-lib-7d631c9305d8a8a88d7b1e14c73758102c624ecb.tar.gz
xine-lib-7d631c9305d8a8a88d7b1e14c73758102c624ecb.tar.bz2
use more sensible intervals (keyword: Voronoi) to guess the framerate
CVS patchset: 5697 CVS date: 2003/11/05 21:58:22
Diffstat (limited to 'src')
-rw-r--r--src/dxr3/dxr3_mpeg_encoders.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c
index 1461bea7f..622e40128 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.13 2003/09/11 10:01:03 mroi Exp $
+ * $Id: dxr3_mpeg_encoders.c,v 1.14 2003/11/05 21:58:22 mroi Exp $
*/
/* mpeg encoders for the dxr3 video out plugin.
@@ -410,42 +410,31 @@ static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame)
/* start guessing the framerate */
fps = 90000.0 / frame->vo_frame.duration;
- if (fabs(fps - 25) < 0.01) { /* PAL */
+ if (fps < 23.988) { /* NTSC-FILM */
#if LOG_ENC
- printf("dxr3_mpeg_encoder: setting mpeg output framerate to PAL (25 Hz)\n");
+ printf("dxr3_mpeg_encoder: setting mpeg output framerate to NTSC-FILM (23.976 Hz)\n");
#endif
- this->fp.frame_rate_num = 25;
- this->fp.frame_rate_den = 1;
- }
- else if (fabs(fps - 24) < 0.01) { /* FILM */
+ this->fp.frame_rate_num = 24000;
+ this->fp.frame_rate_den = 1001;
+ } else if (fps < 24.5) { /* FILM */
#if LOG_ENC
printf("dxr3_mpeg_encoder: setting mpeg output framerate to FILM (24 Hz)\n");
#endif
this->fp.frame_rate_num = 24;
this->fp.frame_rate_den = 1;
- }
- else if (fabs(fps - 23.976) < 0.01) { /* NTSC-FILM */
+ } else if (fps < 27.485) { /* PAL */
#if LOG_ENC
- printf("dxr3_mpeg_encoder: setting mpeg output framerate to NTSC-FILM (23.976 Hz)\n");
+ printf("dxr3_mpeg_encoder: setting mpeg output framerate to PAL (25 Hz)\n");
#endif
- this->fp.frame_rate_num = 24000;
- this->fp.frame_rate_den = 1001;
- }
- else if (fabs(fps - 29.97) < 0.01) { /* NTSC */
+ this->fp.frame_rate_num = 25;
+ this->fp.frame_rate_den = 1;
+ } else { /* NTSC */
#if LOG_ENC
printf("dxr3_mpeg_encoder: setting mpeg output framerate to NTSC (29.97 Hz)\n");
#endif
this->fp.frame_rate_num = 30000;
this->fp.frame_rate_den = 1001;
}
- else { /* try 1/fps, if not legal, libfame will go to PAL */
- this->fp.frame_rate_num = (int)(fps + 0.5);
- this->fp.frame_rate_den = 1;
-#if LOG_ENC
- printf("dxr3_mpeg_encoder: trying to set mpeg output framerate to %d Hz\n",
- this->fp.frame_rate_num);
-#endif
- }
fame_init (this->context, &this->fp, this->buffer, DEFAULT_BUFFER_SIZE);