[MPlayer-cvslog] r22055 - in trunk: cfg-common.h libmpdemux/demux_mpg.c
nicodvb
subversion at mplayerhq.hu
Sun Jan 28 22:42:22 CET 2007
Author: nicodvb
Date: Sun Jan 28 22:42:22 2007
New Revision: 22055
Modified:
trunk/cfg-common.h
trunk/libmpdemux/demux_mpg.c
Log:
added code to scan the video stream to search the actual video codec used;
triggered only if requested by the user with option -psprobe.
Evo files require this option because H264 is stored like MPEG2
without using the PSM
Modified: trunk/cfg-common.h
==============================================================================
--- trunk/cfg-common.h (original)
+++ trunk/cfg-common.h Sun Jan 28 22:42:22 2007
@@ -235,6 +235,7 @@
{"tsprog", &ts_prog, CONF_TYPE_INT, CONF_RANGE, 0, 65534, NULL},
#define TS_MAX_PROBE_SIZE 2000000 /* don't forget to change this in libmpdemux/demux_ts.c too */
{"tsprobe", &ts_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
+ {"psprobe", &ps_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
{"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL},
// draw by slices or whole frame (useful with libmpeg2/libavcodec)
@@ -384,6 +385,7 @@
extern int ts_prog;
extern int ts_keep_broken;
extern off_t ts_probe;
+extern off_t ps_probe;
#include "stream/tv.h"
#include "stream/stream_radio.h"
Modified: trunk/libmpdemux/demux_mpg.c
==============================================================================
--- trunk/libmpdemux/demux_mpg.c (original)
+++ trunk/libmpdemux/demux_mpg.c Sun Jan 28 22:42:22 2007
@@ -41,6 +41,7 @@
extern char* dvdsub_lang;
static int mpeg_pts_error=0;
+off_t ps_probe = 0;
static int parse_psm(demuxer_t *demux, int len) {
unsigned char c, id, type;
@@ -1051,6 +1052,35 @@
}
}
+ if(!sh_video->format && ps_probe > 0) {
+ int mpeg2, h264, mpeg4, head;
+ off_t pos = stream_tell(demuxer->stream);
+
+ clear_stats();
+ do {
+ head=sync_video_packet(demuxer->video);
+ update_stats(head);
+ skip_video_packet(demuxer->video);
+ } while(stream_tell(demuxer->stream) < pos + ps_probe);
+
+ ds_free_packs(demuxer->video);
+ stream_seek(demuxer->stream, pos);
+ mp_msg(MSGT_DEMUX,MSGL_INFO,"MPEG packet stats: p100: %d p101: %d p1B6: %d p12x: %d sli: %d a: %d b: %d c: %d idr: %d sps: %d pps: %d\n",
+ num_elementary_packets100, num_elementary_packets101,
+ num_elementary_packets1B6, num_elementary_packets12x,
+ num_h264_slice, num_h264_dpa, num_h264_dpb, num_h264_dpc,
+ num_h264_idr, num_h264_sps, num_h264_pps);
+
+ if(num_elementary_packets1B6>3 && num_elementary_packets12x>=1 &&
+ num_elementary_packets100<=num_elementary_packets12x)
+ sh_video->format = 0x10000004;
+ else if((num_h264_slice>3 || (num_h264_dpa>3 && num_h264_dpb>3 && num_h264_dpc>3)) &&
+ num_h264_sps>=1 && num_h264_pps>=1 && num_h264_idr>=1 &&
+ num_elementary_packets1B6==0)
+ sh_video->format = 0x10000005;
+ else sh_video->format = 0x10000002;
+ }
+
return demuxer;
}
More information about the MPlayer-cvslog
mailing list