6 #include "libmpdemux/mpeg_hdr.h"
8 #include "vd_internal.h"
10 static vd_info_t info
=
12 "MPEG 1/2 Video passthrough",
21 //#include "libmpdemux/parse_es.h"
23 #include "libvo/video_out.h"
25 // to set/get/query special features/parameters
26 static int control(sh_video_t
*sh
,int cmd
,void* arg
,...){
27 return CONTROL_UNKNOWN
;
31 static int init(sh_video_t
*sh
){
32 return mpcodecs_config_vo(sh
,sh
->disp_w
,sh
->disp_h
,IMGFMT_MPEGPES
);
36 static void uninit(sh_video_t
*sh
){
40 static mp_image_t
* decode(sh_video_t
*sh
,void* data
,int len
,int flags
){
42 static vo_mpegpes_t packet
;
43 mp_mpeg_header_t picture
;
44 const unsigned char *d
= data
;
46 if(len
>10 && !d
[0] && !d
[1] && d
[2]==1 && d
[3]==0xB3) {
47 float old_aspect
= sh
->aspect
;
48 int oldw
= sh
->disp_w
, oldh
= sh
->disp_h
;
49 mp_header_process_sequence_header(&picture
, &d
[4]);
50 sh
->aspect
= mpeg12_aspect_info(&picture
);
51 sh
->disp_w
= picture
.display_picture_width
;
52 sh
->disp_h
= picture
.display_picture_height
;
53 if(sh
->aspect
!= old_aspect
|| sh
->disp_w
!= oldw
|| sh
->disp_h
!= oldh
) {
54 if(!mpcodecs_config_vo(sh
, sh
->disp_w
,sh
->disp_h
,IMGFMT_MPEGPES
))
59 mpi
=mpcodecs_get_image(sh
, MP_IMGTYPE_EXPORT
, 0, sh
->disp_w
, sh
->disp_h
);
62 packet
.timestamp
=sh
->timer
*90000.0;
63 packet
.id
=0x1E0; //+sh_video->ds->id;
64 mpi
->planes
[0]=(uint8_t*)(&packet
);