annotate libmpcodecs/vd_mpegpes.c @ 21161:ad7747bce52d

Make compilation depending on USE_OSD unconditional. USE_OSD was hardcoded to true in configure, manually turning it off would break compilation, and most OSD-related code wasn't affected by it anyway so it did nothing useful.
author uau
date Wed, 22 Nov 2006 19:21:16 +0000
parents 9dbe188e65ad
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5476
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
1 #include <stdio.h>
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
2 #include <stdlib.h>
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
3
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
4 #include "config.h"
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
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
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
7
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
8 #include "vd_internal.h"
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
9
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
10 static vd_info_t info =
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
11 {
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
12 "MPEG 1/2 Video passthrough",
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
13 "mpegpes",
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
14 "A'rpi",
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
15 "A'rpi",
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
16 "for hw decoders"
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
17 };
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
18
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
19 LIBVD_EXTERN(mpegpes)
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
20
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
21 //#include "libmpdemux/parse_es.h"
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
22
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
23 #include "libvo/video_out.h"
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
24
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
25 // to set/get/query special features/parameters
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
26 static int control(sh_video_t *sh,int cmd,void* arg,...){
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
27 return CONTROL_UNKNOWN;
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
28 }
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
29
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
30 // init driver
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
31 static int init(sh_video_t *sh){
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
32 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_MPEGPES);
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
33 }
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
34
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
35 // uninit driver
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
36 static void uninit(sh_video_t *sh){
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
37 }
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
38
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
39 // decode a frame
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
40 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
41 mp_image_t* mpi;
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
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
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
59 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h);
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
60 packet.data=data;
7464
baac3cd44794 we don't need the 0x1FF hack any more
arpi
parents: 7180
diff changeset
61 packet.size=len;
5476
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
62 packet.timestamp=sh->timer*90000.0;
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
63 packet.id=0x1E0; //+sh_video->ds->id;
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
64 mpi->planes[0]=(uint8_t*)(&packet);
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
65 return mpi;
ac09ea252466 vd_mpegpes added
arpi
parents:
diff changeset
66 }