Mercurial > mplayer.hg
annotate libmpcodecs/vd_mpegpes.c @ 21473:6e03eb6af0b7
Move the generation of osdep/mplayer-rc.o back to the top-level Makefile,
having it as a part of osdep/libosdep.a is not enough.
based on a patch by Zuxy Meng, zuxy.meng gmail com
author | diego |
---|---|
date | Mon, 04 Dec 2006 11:59:23 +0000 |
parents | 9dbe188e65ad |
children | 0f1b5b68af32 |
rev | line source |
---|---|
5476 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
5 #include "mp_msg.h" | |
20115
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
6 #include "libmpdemux/mpeg_hdr.h" |
5476 | 7 |
8 #include "vd_internal.h" | |
9 | |
10 static vd_info_t info = | |
11 { | |
12 "MPEG 1/2 Video passthrough", | |
13 "mpegpes", | |
14 "A'rpi", | |
15 "A'rpi", | |
16 "for hw decoders" | |
17 }; | |
18 | |
19 LIBVD_EXTERN(mpegpes) | |
20 | |
21 //#include "libmpdemux/parse_es.h" | |
22 | |
23 #include "libvo/video_out.h" | |
24 | |
25 // to set/get/query special features/parameters | |
26 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
27 return CONTROL_UNKNOWN; | |
28 } | |
29 | |
30 // init driver | |
31 static int init(sh_video_t *sh){ | |
32 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_MPEGPES); | |
33 } | |
34 | |
35 // uninit driver | |
36 static void uninit(sh_video_t *sh){ | |
37 } | |
38 | |
39 // decode a frame | |
40 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
41 mp_image_t* mpi; | |
42 static vo_mpegpes_t packet; | |
20115
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
43 mp_mpeg_header_t picture; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
44 const unsigned char *d = data; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
45 |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
46 if(len>10 && !d[0] && !d[1] && d[2]==1 && d[3]==0xB3) { |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
47 float old_aspect = sh->aspect; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
48 int oldw = sh->disp_w, oldh = sh->disp_h; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
49 mp_header_process_sequence_header(&picture, &d[4]); |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
50 sh->aspect = mpeg12_aspect_info(&picture); |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
51 sh->disp_w = picture.display_picture_width; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
52 sh->disp_h = picture.display_picture_height; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
53 if(sh->aspect != old_aspect || sh->disp_w != oldw || sh->disp_h != oldh) { |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
54 if(!mpcodecs_config_vo(sh, sh->disp_w,sh->disp_h,IMGFMT_MPEGPES)) |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
55 return 0; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
56 } |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
57 } |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
58 |
5476 | 59 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); |
60 packet.data=data; | |
7464 | 61 packet.size=len; |
5476 | 62 packet.timestamp=sh->timer*90000.0; |
63 packet.id=0x1E0; //+sh_video->ds->id; | |
64 mpi->planes[0]=(uint8_t*)(&packet); | |
65 return mpi; | |
66 } |