annotate libmpcodecs/vd_libmpeg2.c @ 5280:ea8f3e8f39c1

added aspect ratio support and local ctx
author alex
date Sat, 23 Mar 2002 17:29:35 +0000
parents 109377795585
children 40f87aaaa2f3
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"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
5 #include "mp_msg.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
6
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
7 #include "vd_internal.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 static vd_info_t info =
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
10 {
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
11 "MPEG 1/2 Video decoder",
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
12 "libmpeg2",
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
13 VFM_MPEG,
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
14 "A'rpi",
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
15 "Aaron & Walken",
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
16 "native"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
17 };
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
18
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
19 LIBVD_EXTERN(libmpeg2)
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 #include "libmpdemux/parse_es.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
22
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
23 #include "libvo/video_out.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
24 #include "libmpeg2/mpeg2.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
25 #include "libmpeg2/mpeg2_internal.h"
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
26
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
27 extern picture_t *picture; // exported from libmpeg2/decode.c
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
28
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
29 // to set/get/query special features/parameters
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
30 static int control(sh_video_t *sh,int cmd,void* arg,...){
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
31 return CONTROL_UNKNOWN;
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
32 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
33
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
34 // init driver
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
35 static int init(sh_video_t *sh){
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
36 mpeg2_init();
5003
88481d4b9e0e divx_quality and equalizer support done
arpi
parents: 4998
diff changeset
37 picture->pp_options=divx_quality;
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
38 // send seq header to the decoder: *** HACK ***
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
39 mpeg2_decode_data(NULL,videobuffer,videobuffer+videobuf_len,0);
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
40 mpeg2_allocate_image_buffers (picture);
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 5073
diff changeset
41 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
42 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
43
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
44 // uninit driver
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
45 static void uninit(sh_video_t *sh){
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
46 mpeg2_free_image_buffers (picture);
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
47 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
48
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
49 // decode a frame
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
50 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
5145
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
51 mp_image_t* mpi;
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
52 if(sh->codec->outfmt[sh->outfmtidx]==IMGFMT_MPEGPES){
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
53 static vo_mpegpes_t packet;
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
54 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
55 sh->disp_w, sh->disp_h);
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
56 // hardware decoding:
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
57 // mpeg2_decode_data(video_out, start, start+in_size,3); // parse headers
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
58 packet.data=data;
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
59 packet.size=len-4;
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
60 packet.timestamp=sh->timer*90000.0;
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
61 packet.id=0x1E0; //+sh_video->ds->id;
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
62 mpi->planes[0]=(uint8_t*)(&packet);
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
63 } else {
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
64 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_DRAW_CALLBACK,
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
65 sh->disp_w, sh->disp_h);
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
66 mpeg2_decode_data(sh->video_out, data, data+len,flags&3); // decode
109377795585 mpegpes support
arpi
parents: 5124
diff changeset
67 }
4998
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
68 return mpi;
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
69 }
c32191b02a66 mpng, libmpeg2 added, none of them finished :(
arpi
parents:
diff changeset
70