summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-14 15:39:52 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-14 15:39:52 +0000
commitf452c1262fd167a90fd63e13bd2de7bf8c7ca17b (patch)
tree81c81f48ba9275c49c9654e9998fbcb1e75394d8 /libmpcodecs
parentc2c64b459fd7beba97569ab7849f90cbe8e5243e (diff)
downloadmpv-f452c1262fd167a90fd63e13bd2de7bf8c7ca17b.tar.bz2
mpv-f452c1262fd167a90fd63e13bd2de7bf8c7ca17b.tar.xz
Add support for decoding 4:2:2 and 4:4:4 Theora files.
Patch by Giorgio Vazzana [mywing81 gmail com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30585 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_theora.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c
index 35e3edfab8..b8be6d747b 100644
--- a/libmpcodecs/vd_theora.c
+++ b/libmpcodecs/vd_theora.c
@@ -41,11 +41,28 @@ LIBVD_EXTERN(theora)
#define THEORA_NUM_HEADER_PACKETS 3
+typedef struct theora_struct_st {
+ theora_state st;
+ theora_comment cc;
+ theora_info inf;
+} theora_struct_t;
+
+/** Convert Theora pixelformat to the corresponding IMGFMT_ */
+static uint32_t theora_pixelformat2imgfmt(theora_pixelformat fmt){
+ switch(fmt) {
+ case OC_PF_420: return IMGFMT_YV12;
+ case OC_PF_422: return IMGFMT_422P;
+ case OC_PF_444: return IMGFMT_444P;
+ }
+ return 0;
+}
+
// to set/get/query special features/parameters
static int control(sh_video_t *sh,int cmd,void* arg,...){
+ theora_struct_t *context = sh->context;
switch(cmd) {
case VDCTRL_QUERY_FORMAT:
- if (*(int*)arg == IMGFMT_YV12)
+ if (*(int*)arg == theora_pixelformat2imgfmt(context->inf.pixelformat))
return CONTROL_TRUE;
return CONTROL_FALSE;
}
@@ -53,12 +70,6 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
return CONTROL_UNKNOWN;
}
-typedef struct theora_struct_st {
- theora_state st;
- theora_comment cc;
- theora_info inf;
-} theora_struct_t;
-
/*
* init driver
*/
@@ -104,7 +115,7 @@ static int init(sh_video_t *sh){
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Theora video init ok!\n");
- return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,IMGFMT_YV12);
+ return mpcodecs_config_vo (sh,context->inf.frame_width,context->inf.frame_height,theora_pixelformat2imgfmt(context->inf.pixelformat));
err_out:
free(context);