Mercurial > mplayer.hg
annotate libmpcodecs/vd_mpegpes.c @ 35627:51358e7bde85
Cosmetic: Add and adjust comments.
author | ib |
---|---|
date | Thu, 10 Jan 2013 10:48:27 +0000 |
parents | d32f75f79517 |
children | 139f2b064ef9 |
rev | line source |
---|---|
30421
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
1 /* |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
3 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
8 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
13 * |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
17 */ |
bbb6ebec87a0
Add missing license headers to all files in the libmpcodecs directory.
diego
parents:
29263
diff
changeset
|
18 |
5476 | 19 #include <stdio.h> |
20 #include <stdlib.h> | |
21 | |
22 #include "config.h" | |
23 #include "mp_msg.h" | |
20115
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
24 #include "libmpdemux/mpeg_hdr.h" |
5476 | 25 |
26 #include "vd_internal.h" | |
27 | |
30504
cc27da5d7286
Mark all ad_info_t/vd_info_t structure declarations as const.
diego
parents:
30421
diff
changeset
|
28 static const vd_info_t info = |
5476 | 29 { |
30 "MPEG 1/2 Video passthrough", | |
31 "mpegpes", | |
32 "A'rpi", | |
33 "A'rpi", | |
34 "for hw decoders" | |
35 }; | |
36 | |
37 LIBVD_EXTERN(mpegpes) | |
38 | |
39 //#include "libmpdemux/parse_es.h" | |
40 | |
41 #include "libvo/video_out.h" | |
42 | |
43 // to set/get/query special features/parameters | |
44 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
45 return CONTROL_UNKNOWN; | |
46 } | |
47 | |
48 // init driver | |
49 static int init(sh_video_t *sh){ | |
50 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_MPEGPES); | |
51 } | |
52 | |
53 // uninit driver | |
54 static void uninit(sh_video_t *sh){ | |
55 } | |
56 | |
57 // decode a frame | |
58 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
59 mp_image_t* mpi; | |
60 static vo_mpegpes_t packet; | |
20115
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
61 mp_mpeg_header_t picture; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
62 const unsigned char *d = data; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
63 |
34772 | 64 if (len <= 0 && !data) return NULL; // delay flush |
65 | |
20115
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
66 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
|
67 float old_aspect = sh->aspect; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
68 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
|
69 mp_header_process_sequence_header(&picture, &d[4]); |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
70 sh->aspect = mpeg12_aspect_info(&picture); |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
71 sh->disp_w = picture.display_picture_width; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
72 sh->disp_h = picture.display_picture_height; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
73 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
|
74 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
|
75 return 0; |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
76 } |
9dbe188e65ad
reinit codec chain when aspect ratio and/or resolution change
nicodvb
parents:
7464
diff
changeset
|
77 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
20115
diff
changeset
|
78 |
5476 | 79 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, sh->disp_w, sh->disp_h); |
80 packet.data=data; | |
7464 | 81 packet.size=len; |
5476 | 82 packet.timestamp=sh->timer*90000.0; |
83 packet.id=0x1E0; //+sh_video->ds->id; | |
84 mpi->planes[0]=(uint8_t*)(&packet); | |
85 return mpi; | |
86 } |