annotate libmpcodecs/vd_libmpeg2.c @ 12443:ae4ae7ab636c

ENCA support (http://trific.ath.cx/software/enca/)
author henry
date Sat, 08 May 2004 17:52:25 +0000
parents 26f1b3ad4a77
children 7d681d8ebab8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
1 #include <stdio.h>
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
2 #include <stdlib.h>
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
3
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
4 #include "config.h"
8026
b465ba5897a3 usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents: 7957
diff changeset
5 #ifdef USE_LIBMPEG2
b465ba5897a3 usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents: 7957
diff changeset
6
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
7 #include "mp_msg.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
8
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
9 #include "vd_internal.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
10
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
11 //#undef MPEG12_POSTPROC
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
12
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
13 static vd_info_t info =
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
14 {
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
15 "MPEG 1/2 Video decoder libmpeg2-v0.3.1",
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
16 "libmpeg2",
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
17 "A'rpi & Fabian Franz",
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
18 "Aaron & Walken",
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
19 "native"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
20 };
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
21
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
22 LIBVD_EXTERN(libmpeg2)
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
23
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
24 //#include "libvo/video_out.h" // FIXME!!!
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
25
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
26 #include "libmpeg2/mpeg2.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
27 #include "libmpeg2/mpeg2_internal.h"
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
28 //#include "libmpeg2/convert.h"
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
29
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
30 #include "../cpudetect.h"
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
31
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
32 // to set/get/query special features/parameters
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
33 static int control(sh_video_t *sh,int cmd,void* arg,...){
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
34 return CONTROL_UNKNOWN;
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
35 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
36
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
37 // init driver
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
38 static int init(sh_video_t *sh){
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
39 mpeg2dec_t * mpeg2dec;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
40 const mpeg2_info_t * info;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
41 int accel;
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
42
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
43 accel = 0;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
44 if(gCpuCaps.hasMMX)
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
45 accel |= MPEG2_ACCEL_X86_MMX;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
46 if(gCpuCaps.hasMMX2)
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
47 accel |= MPEG2_ACCEL_X86_MMXEXT;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
48 if(gCpuCaps.has3DNow)
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
49 accel |= MPEG2_ACCEL_X86_3DNOW;
10267
d953763cc555 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 10250
diff changeset
50 if(gCpuCaps.hasAltiVec)
d953763cc555 libmpeg2-altivec patch by Magnus Damm <damm@opensource.se>:
arpi
parents: 10250
diff changeset
51 accel |= MPEG2_ACCEL_PPC_ALTIVEC;
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
52 #ifdef HAVE_MLIB
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
53 accel |= MPEG2_ACCEL_MLIB;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
54 #endif
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
55 mpeg2_accel(accel);
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
56
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
57 mpeg2dec = mpeg2_init ();
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
58
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
59 if(!mpeg2dec) return 0;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
60
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
61 mpeg2_custom_fbuf(mpeg2dec,1); // enable DR1
5675
0ff1b9ab7afc slices+field pictures fixed, initial sig11 workaround
arpi
parents: 5613
diff changeset
62
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
63 sh->context=mpeg2dec;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
64
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
65 return 1;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
66 //return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12);
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
67 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
68
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
69 // uninit driver
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
70 static void uninit(sh_video_t *sh){
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
71 mpeg2dec_t * mpeg2dec = sh->context;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
72 mpeg2_close (mpeg2dec);
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
73 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
74
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
75 static void draw_slice (void * _sh, uint8_t ** src, unsigned int y){
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
76 sh_video_t* sh = (sh_video_t*) _sh;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
77 mpeg2dec_t* mpeg2dec = sh->context;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
78 const mpeg2_info_t * info = mpeg2_info (mpeg2dec);
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
79 int stride[3];
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
80
9938
6f293e709a39 too verbose
alex
parents: 9925
diff changeset
81 // printf("draw_slice() y=%d \n",y);
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
82
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
83 stride[0]=mpeg2dec->decoder.stride;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
84 stride[1]=stride[2]=mpeg2dec->decoder.uv_stride;
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
85
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
86 mpcodecs_draw_slice(sh, (uint8_t **)src,
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
87 stride, info->sequence->display_width,
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
88 (y+16<=info->sequence->display_height) ? 16 :
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
89 info->sequence->display_height-y,
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
90 0, y);
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
91 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
92
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
93 // decode a frame
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
94 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
95 mpeg2dec_t * mpeg2dec = sh->context;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
96 const mpeg2_info_t * info = mpeg2_info (mpeg2dec);
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
97 mp_image_t* mpi=NULL;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
98 int drop_frame, framedrop=flags&3;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
99
11080
26f1b3ad4a77 skip null frames in mpeg files, patch by Zoltan Hidvegi <mplayer@hzoli.2y.net>
attila
parents: 10663
diff changeset
100 if(len<=0) return NULL; // skipped null frame
26f1b3ad4a77 skip null frames in mpeg files, patch by Zoltan Hidvegi <mplayer@hzoli.2y.net>
attila
parents: 10663
diff changeset
101
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
102 // append extra 'end of frame' code:
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
103 ((char*)data+len)[0]=0;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
104 ((char*)data+len)[1]=0;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
105 ((char*)data+len)[2]=1;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
106 ((char*)data+len)[3]=0xff;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
107 len+=4;
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
108
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
109 mpeg2_buffer (mpeg2dec, data, data+len);
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
110
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
111 while(1){
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
112 int state=mpeg2_parse (mpeg2dec);
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
113 switch(state){
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
114 case -1:
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
115 // parsing of the passed buffer finished, return.
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
116 // if(!mpi) printf("\nNO PICTURE!\n");
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
117 return mpi;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
118 case STATE_SEQUENCE:
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
119 // video parameters inited/changed, (re)init libvo:
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
120 if(!mpcodecs_config_vo(sh,
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
121 info->sequence->width,
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
122 info->sequence->height, IMGFMT_YV12)) return 0;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
123 break;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
124 case STATE_PICTURE: {
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
125 int type=info->current_picture->flags&PIC_MASK_CODING_TYPE;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
126 mp_image_t* mpi;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
127
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
128 drop_frame = framedrop && (mpeg2dec->decoder.coding_type == B_TYPE);
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
129 drop_frame |= framedrop>=2; // hard drop
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
130 if (drop_frame) {
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
131 mpeg2_skip(mpeg2dec, 1);
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
132 //printf("Dropping Frame ...\n");
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
133 break;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
134 }
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
135 mpeg2_skip(mpeg2dec, 0); //mpeg2skip skips frames until set again to 0
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
136
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
137 // get_buffer "callback":
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
138 mpi=mpcodecs_get_image(sh,MP_IMGTYPE_IPB,
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
139 (type==PIC_FLAG_CODING_TYPE_B)
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
140 ? ((!framedrop && vd_use_slices &&
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
141 (info->current_picture->flags&PIC_FLAG_PROGRESSIVE_FRAME)) ?
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
142 MP_IMGFLAG_DRAW_CALLBACK:0)
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
143 : (MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE),
10250
2bf4914e2253 fixed mem corruption bugs
arpi
parents: 9938
diff changeset
144 (info->sequence->picture_width+15)&(~15),
2bf4914e2253 fixed mem corruption bugs
arpi
parents: 9938
diff changeset
145 (info->sequence->picture_height+15)&(~15) );
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
146 if(!mpi) return 0; // VO ERROR!!!!!!!!
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
147 mpeg2_set_buf(mpeg2dec, mpi->planes, mpi);
10510
73b3e4336cd4 Add mpeg2_flags to mp_image_t, copy flags in vd_libmpeg2.c,
ranma
parents: 10267
diff changeset
148 if (info->current_picture->flags&PIC_FLAG_TOP_FIELD_FIRST)
10663
711159267b2d clean up field flags:
rfelker
parents: 10510
diff changeset
149 mpi->fields |= MP_IMGFIELD_TOP_FIRST;
711159267b2d clean up field flags:
rfelker
parents: 10510
diff changeset
150 else mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
10510
73b3e4336cd4 Add mpeg2_flags to mp_image_t, copy flags in vd_libmpeg2.c,
ranma
parents: 10267
diff changeset
151 if (info->current_picture->flags&PIC_FLAG_REPEAT_FIRST_FIELD)
10663
711159267b2d clean up field flags:
rfelker
parents: 10510
diff changeset
152 mpi->fields |= MP_IMGFIELD_REPEAT_FIRST;
711159267b2d clean up field flags:
rfelker
parents: 10510
diff changeset
153 else mpi->fields &= ~MP_IMGFIELD_REPEAT_FIRST;
711159267b2d clean up field flags:
rfelker
parents: 10510
diff changeset
154 mpi->fields |= MP_IMGFIELD_ORDERED;
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
155
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
156 #ifdef MPEG12_POSTPROC
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
157 if(!mpi->qscale){
10250
2bf4914e2253 fixed mem corruption bugs
arpi
parents: 9938
diff changeset
158 mpi->qstride=(info->sequence->picture_width+15)>>4;
2bf4914e2253 fixed mem corruption bugs
arpi
parents: 9938
diff changeset
159 mpi->qscale=malloc(mpi->qstride*((info->sequence->picture_height+15)>>4));
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
160 }
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
161 mpeg2dec->decoder.quant_store=mpi->qscale;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
162 mpeg2dec->decoder.quant_stride=mpi->qstride;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
163 mpi->pict_type=type; // 1->I, 2->P, 3->B
9925
420640a0f6d0 passing qscale_type around so the pp code can fix the mpeg2 <<1 thing
michael
parents: 9919
diff changeset
164 mpi->qscale_type= 1;
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
165 #endif
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
166
9859
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
167 if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK &&
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
168 !(mpi->flags&MP_IMGFLAG_DIRECT)){
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
169 // nice, filter/vo likes draw_callback :)
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
170 mpeg2dec->decoder.convert=draw_slice;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
171 mpeg2dec->decoder.fbuf_id=sh;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
172 } else
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
173 mpeg2dec->decoder.convert=NULL;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
174 break;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
175 }
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
176 case STATE_SLICE:
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
177 case STATE_END:
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
178 // decoding done:
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
179 if(mpi) printf("AJAJJJJJJJJ2!\n");
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
180 if(info->display_fbuf) mpi=info->display_fbuf->id;
16a7d1f4da38 Rewritten, to use new libmpeg2 0.3.1 API
arpi
parents: 8026
diff changeset
181 // return mpi;
7957
31fd09cc9ba2 passing picture_type (might be usefull for postprocessing)
michael
parents: 7756
diff changeset
182 }
31fd09cc9ba2 passing picture_type (might be usefull for postprocessing)
michael
parents: 7756
diff changeset
183 }
5465
1f9c8301a7f2 rewritten - it replaces libmpeg2/decode.c now
arpi
parents: 5360
diff changeset
184 }
8026
b465ba5897a3 usage of libmpeg2, liba52, mp3lib & svq1 can be disabled
arpi
parents: 7957
diff changeset
185 #endif