mirror of
https://github.com/mpv-player/mpv
synced 2025-03-07 22:57:42 +00:00
Better vprp aspect fix
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12054 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
12542092df
commit
10c153004d
@ -366,6 +366,10 @@ handle carriage return (i.e. \\r).
|
||||
.TP
|
||||
.B \-v, \-verbose
|
||||
Increment verbose level (more \-v means more verbosity).
|
||||
.TP
|
||||
.B \-useaviaspect
|
||||
With this option MPlayer and MEncoder will read and write the aspect setting
|
||||
from the OpenDML Video Property Header.
|
||||
.
|
||||
.PD 0
|
||||
.RSs
|
||||
|
@ -119,6 +119,8 @@
|
||||
{"dvbin", dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
|
||||
#endif
|
||||
|
||||
{"useaviaspect", &avi_use_vprp_aspect, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{"nouseaviaspect", &avi_use_vprp_aspect, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||
|
||||
// ------------------------- a-v sync options --------------------
|
||||
|
||||
@ -317,6 +319,8 @@ extern int ts_prog;
|
||||
extern int ts_keep_broken;
|
||||
extern off_t ts_probe;
|
||||
|
||||
extern int avi_use_vprp_aspect; /* defined in aviheader.c */
|
||||
|
||||
#include "libmpdemux/tv.h"
|
||||
|
||||
#ifdef USE_EDL
|
||||
|
@ -58,8 +58,6 @@ extern m_option_t vfwopts_conf[];
|
||||
extern m_option_t xvidencopts_conf[];
|
||||
#endif
|
||||
|
||||
extern float avi_prp_aspect;
|
||||
|
||||
extern m_option_t nuvopts_conf[];
|
||||
|
||||
m_option_t ovc_conf[]={
|
||||
@ -194,9 +192,6 @@ m_option_t mencoder_opts[]={
|
||||
// override FOURCC in output file
|
||||
{"ffourcc", &force_fourcc, CONF_TYPE_STRING, 0, 4, 4, NULL},
|
||||
|
||||
// avi muxer - include prp header with aspect ratio
|
||||
{"aviaspect", &avi_prp_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL},
|
||||
|
||||
{"pass", "The -pass option is obsolete. Use -lavcopts vpass=n or -divx4opts pass=n!\nRTFM!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
||||
{"passlogfile", &passtmpfile, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
|
||||
|
@ -28,6 +28,8 @@ extern void print_index(AVIINDEXENTRY *idx,int idx_size);
|
||||
extern void print_avistdindex_chunk(avistdindex_chunk *h);
|
||||
extern void print_avisuperindex_chunk(avisuperindex_chunk *h);
|
||||
|
||||
int avi_use_vprp_aspect = 0;
|
||||
|
||||
static int odml_get_vstream_id(int id, unsigned char res[])
|
||||
{
|
||||
unsigned char *p = (unsigned char *)&id;
|
||||
@ -343,7 +345,7 @@ while(1){
|
||||
for (i=0; i<vprp->nbFieldPerFrame; i++) {
|
||||
le2me_VIDEO_FIELD_DESC(&vprp->FieldInfo[i]);
|
||||
}
|
||||
if (sh_video) {
|
||||
if (avi_use_vprp_aspect && sh_video) {
|
||||
sh_video->aspect = GET_AVI_ASPECT(vprp->dwFrameAspectRatio);
|
||||
}
|
||||
if(verbose>=1) print_vprp(vprp);
|
||||
|
@ -34,7 +34,7 @@ extern char *info_comment;
|
||||
#define ODML_NOTKEYFRAME 0x80000000U
|
||||
#define MOVIALIGN 0x00001000
|
||||
|
||||
float avi_prp_aspect = -1.0;
|
||||
extern int avi_use_vprp_aspect;
|
||||
|
||||
struct avi_odmlidx_entry {
|
||||
uint64_t ofs;
|
||||
@ -227,6 +227,9 @@ static void write_avi_list(FILE *f,unsigned int id,int len){
|
||||
|
||||
static unsigned int avi_aspect(float aspect)
|
||||
{
|
||||
if (aspect <= 0.0) {
|
||||
aspect = 4.0/3.0;
|
||||
}
|
||||
if (aspect >= 3.99/3.0 &&
|
||||
aspect <= 4.01/3.0) return MAKE_AVI_ASPECT(4,3);
|
||||
if (aspect >= 15.99/9.0 &&
|
||||
@ -313,7 +316,7 @@ static void avifile_write_header(muxer_t *muxer){
|
||||
switch(muxer->streams[i]->type){
|
||||
case MUXER_TYPE_VIDEO:
|
||||
hdrsize+=muxer->streams[i]->bih->biSize+8; // strf
|
||||
if (avi_prp_aspect > 0) {
|
||||
if (avi_use_vprp_aspect) {
|
||||
hdrsize+=8+4*(9+8*1); // vprp
|
||||
}
|
||||
break;
|
||||
@ -348,13 +351,14 @@ static void avifile_write_header(muxer_t *muxer){
|
||||
s->h.fccHandler = s->bih->biCompression;
|
||||
s->h.rcFrame.right = s->bih->biWidth;
|
||||
s->h.rcFrame.bottom = s->bih->biHeight;
|
||||
if (avi_prp_aspect > 0) {
|
||||
if (avi_use_vprp_aspect) {
|
||||
sh_video_t *sh_video = s->source;
|
||||
// fill out vprp info
|
||||
memset(&vprp, 0, sizeof(vprp));
|
||||
vprp.dwVerticalRefreshRate = (s->h.dwRate+s->h.dwScale-1)/s->h.dwScale;
|
||||
vprp.dwHTotalInT = muxer->avih.dwWidth;
|
||||
vprp.dwVTotalInLines = muxer->avih.dwHeight;
|
||||
vprp.dwFrameAspectRatio = avi_aspect(avi_prp_aspect);
|
||||
vprp.dwFrameAspectRatio = avi_aspect(sh_video->aspect);
|
||||
vprp.dwFrameWidthInPixels = muxer->avih.dwWidth;
|
||||
vprp.dwFrameHeightInLines = muxer->avih.dwHeight;
|
||||
vprp.nbFieldPerFrame = 1;
|
||||
@ -382,15 +386,17 @@ static void avifile_write_header(muxer_t *muxer){
|
||||
int biSize=s->bih->biSize;
|
||||
le2me_BITMAPINFOHEADER(s->bih);
|
||||
write_avi_chunk(f,ckidSTREAMFORMAT,biSize,s->bih); /* BITMAPINFOHEADER */
|
||||
if (avi_prp_aspect > 0) {
|
||||
le2me_BITMAPINFOHEADER(s->bih);
|
||||
le2me_BITMAPINFOHEADER(s->bih);
|
||||
|
||||
if (avi_use_vprp_aspect) {
|
||||
int fields = vprp.nbFieldPerFrame;
|
||||
le2me_VideoPropHeader(&vprp);
|
||||
le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[0]);
|
||||
le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[1]);
|
||||
write_avi_chunk(f,mmioFOURCC('v','p','r','p'),
|
||||
sizeof(VideoPropHeader) -
|
||||
sizeof(VIDEO_FIELD_DESC)*(2-vprp.nbFieldPerFrame),
|
||||
&vprp); /* Video Properties Header */
|
||||
sizeof(VideoPropHeader) -
|
||||
sizeof(VIDEO_FIELD_DESC)*(2-fields),
|
||||
&vprp); /* Video Properties Header */
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user