mirror of https://github.com/mpv-player/mpv
Parse and use the information from the frame rate extension header for MPEG-2.
-identify still does not show the right values though. Fixes bug #1636. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30681 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
28cf6ea2be
commit
264e6c23fe
|
@ -81,6 +81,9 @@ static int header_process_sequence_extension (mp_mpeg_header_t * picture,
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
picture->progressive_sequence = (buffer[1] >> 3) & 1;
|
picture->progressive_sequence = (buffer[1] >> 3) & 1;
|
||||||
|
picture->frame_rate_extension_n = ((buffer[5] >> 5) & 3) + 1;
|
||||||
|
picture->frame_rate_extension_d = (buffer[5] & 0x1f) + 1;
|
||||||
|
|
||||||
picture->mpeg1 = 0;
|
picture->mpeg1 = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ typedef struct {
|
||||||
int aspect_ratio_information;
|
int aspect_ratio_information;
|
||||||
int frame_rate_code;
|
int frame_rate_code;
|
||||||
float fps;
|
float fps;
|
||||||
|
int frame_rate_extension_n;
|
||||||
|
int frame_rate_extension_d;
|
||||||
int bitrate; // 0x3FFFF==VBR
|
int bitrate; // 0x3FFFF==VBR
|
||||||
// timing:
|
// timing:
|
||||||
int picture_structure;
|
int picture_structure;
|
||||||
|
|
|
@ -433,6 +433,7 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
|
||||||
float frame_time=1;
|
float frame_time=1;
|
||||||
float pts1=d_video->pts;
|
float pts1=d_video->pts;
|
||||||
float pts=0;
|
float pts=0;
|
||||||
|
float fps;
|
||||||
int picture_coding_type=0;
|
int picture_coding_type=0;
|
||||||
int in_size=0;
|
int in_size=0;
|
||||||
video_codec_t video_codec = find_video_codec(sh_video);
|
video_codec_t video_codec = find_video_codec(sh_video);
|
||||||
|
@ -469,14 +470,15 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
|
||||||
case 0x100: picture_coding_type=(videobuffer[start+1] >> 3) & 7;break;
|
case 0x100: picture_coding_type=(videobuffer[start+1] >> 3) & 7;break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fps = picture.fps * picture.frame_rate_extension_n / picture.frame_rate_extension_d;
|
||||||
|
|
||||||
*start=videobuffer; in_size=videobuf_len;
|
*start=videobuffer; in_size=videobuf_len;
|
||||||
|
|
||||||
// get mpeg fps:
|
// get mpeg fps:
|
||||||
if(sh_video->fps!=picture.fps) if(!force_fps && !telecine){
|
if(sh_video->fps!=fps) if(!force_fps && !telecine){
|
||||||
mp_msg(MSGT_CPLAYER,MSGL_WARN,"Warning! FPS changed %5.3f -> %5.3f (%f) [%d] \n",sh_video->fps,picture.fps,sh_video->fps-picture.fps,picture.frame_rate_code);
|
mp_msg(MSGT_CPLAYER,MSGL_WARN,"Warning! FPS changed %5.3f -> %5.3f (%f) [%d] \n",sh_video->fps,fps,sh_video->fps-fps,picture.frame_rate_code);
|
||||||
sh_video->fps=picture.fps;
|
sh_video->fps=fps;
|
||||||
sh_video->frametime=1.0/picture.fps;
|
sh_video->frametime=1.0/fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix mpeg2 frametime:
|
// fix mpeg2 frametime:
|
||||||
|
|
Loading…
Reference in New Issue