Mercurial > mplayer.hg
annotate libmpcodecs/vd_libmpeg2.c @ 5370:bb1d63fea638
ac3_iec958_build_burst moved from ac3-iec958.c
author | arpi |
---|---|
date | Wed, 27 Mar 2002 21:05:39 +0000 |
parents | 40f87aaaa2f3 |
children | 1f9c8301a7f2 |
rev | line source |
---|---|
4998 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
5 #include "mp_msg.h" | |
6 | |
7 #include "vd_internal.h" | |
8 | |
9 static vd_info_t info = | |
10 { | |
11 "MPEG 1/2 Video decoder", | |
12 "libmpeg2", | |
13 VFM_MPEG, | |
14 "A'rpi", | |
15 "Aaron & Walken", | |
16 "native" | |
17 }; | |
18 | |
19 LIBVD_EXTERN(libmpeg2) | |
20 | |
21 #include "libmpdemux/parse_es.h" | |
22 | |
23 #include "libvo/video_out.h" | |
24 #include "libmpeg2/mpeg2.h" | |
25 #include "libmpeg2/mpeg2_internal.h" | |
26 | |
27 extern picture_t *picture; // exported from libmpeg2/decode.c | |
28 | |
29 // to set/get/query special features/parameters | |
30 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
31 return CONTROL_UNKNOWN; | |
32 } | |
33 | |
34 // init driver | |
35 static int init(sh_video_t *sh){ | |
36 mpeg2_init(); | |
5003 | 37 picture->pp_options=divx_quality; |
4998 | 38 // send seq header to the decoder: *** HACK *** |
39 mpeg2_decode_data(NULL,videobuffer,videobuffer+videobuf_len,0); | |
40 mpeg2_allocate_image_buffers (picture); | |
5124 | 41 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); |
4998 | 42 } |
43 | |
44 // uninit driver | |
45 static void uninit(sh_video_t *sh){ | |
46 mpeg2_free_image_buffers (picture); | |
47 } | |
48 | |
49 // decode a frame | |
50 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
5145 | 51 mp_image_t* mpi; |
52 if(sh->codec->outfmt[sh->outfmtidx]==IMGFMT_MPEGPES){ | |
53 static vo_mpegpes_t packet; | |
54 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, | |
55 sh->disp_w, sh->disp_h); | |
56 // hardware decoding: | |
57 // mpeg2_decode_data(video_out, start, start+in_size,3); // parse headers | |
58 packet.data=data; | |
59 packet.size=len-4; | |
60 packet.timestamp=sh->timer*90000.0; | |
61 packet.id=0x1E0; //+sh_video->ds->id; | |
62 mpi->planes[0]=(uint8_t*)(&packet); | |
63 } else { | |
64 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_DRAW_CALLBACK, | |
65 sh->disp_w, sh->disp_h); | |
5360
40f87aaaa2f3
ported back hack for interlaced mpeg2, without it mplayer draws whole frame for every field -100% slowdown
iive
parents:
5145
diff
changeset
|
66 if( |
40f87aaaa2f3
ported back hack for interlaced mpeg2, without it mplayer draws whole frame for every field -100% slowdown
iive
parents:
5145
diff
changeset
|
67 mpeg2_decode_data(sh->video_out, data, data+len,flags&3)==0 // decode |
40f87aaaa2f3
ported back hack for interlaced mpeg2, without it mplayer draws whole frame for every field -100% slowdown
iive
parents:
5145
diff
changeset
|
68 )return NULL;//hack for interlaced mpeg2 |
5145 | 69 } |
4998 | 70 return mpi; |
71 } | |
72 |