X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=libhb%2Fenctheora.c;h=e340bade5bc27fe55da2c7b22ca6dce16586b324;hb=f9341345b37e0738a140423297c222a7e40eddab;hp=3773b708a6a8af7a100871af000d34aec8a7120e;hpb=4e3f08663b249ff5604e4de3878a226b21f342dc;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/enctheora.c b/libhb/enctheora.c index 3773b708..e340bade 100644 --- a/libhb/enctheora.c +++ b/libhb/enctheora.c @@ -1,5 +1,5 @@ /* This file is part of the HandBrake source code. - Homepage: . + Homepage: . It may be used under the terms of the GNU General Public License. */ #include "hb.h" @@ -42,10 +42,10 @@ int enctheoraInit( hb_work_object_t * w, hb_job_t * job ) ti.offset_x = ti.offset_y = 0; ti.fps_numerator = job->vrate; ti.fps_denominator = job->vrate_base; - if (job->pixel_ratio) + if( job->anamorphic.mode ) { - ti.aspect_numerator = job->pixel_aspect_width; - ti.aspect_denominator = job->pixel_aspect_height; + ti.aspect_numerator = job->anamorphic.par_width; + ti.aspect_denominator = job->anamorphic.par_height; } else { @@ -122,39 +122,37 @@ int enctheoraWork( hb_work_object_t * w, hb_buffer_t ** buf_in, hb_buffer_t * in = *buf_in, * buf; yuv_buffer yuv; ogg_packet op; - static int last_p = 0; - memset(&op, 0, sizeof(op)); - memset(&yuv, 0, sizeof(yuv)); - - /* If this is the last empty frame, we're done */ - if(!in->data) + if ( in->size <= 0 ) { - if (!last_p) - { - last_p++; - goto finish; - } - *buf_out = NULL; + // EOF on input - send it downstream & say we're done. + // XXX may need to flush packets via a call to + // theora_encode_packetout(&pv->theora, 1, &op); + // but we don't have a timestamp to put on those packets so we + // drop them for now. + *buf_out = in; + *buf_in = NULL; return HB_WORK_DONE; } + memset(&op, 0, sizeof(op)); + memset(&yuv, 0, sizeof(yuv)); + yuv.y_width = job->width; yuv.y_height = job->height; yuv.y_stride = job->width; - yuv.uv_width = job->width / 2; - yuv.uv_height = job->height / 2; - yuv.uv_stride = job->width / 2; + yuv.uv_width = (job->width + 1) / 2; + yuv.uv_height = (job->height + 1) / 2; + yuv.uv_stride = yuv.uv_width; yuv.y = in->data; yuv.u = in->data + job->width * job->height; - yuv.v = in->data + job->width * job->height * 5/4; + yuv.v = in->data + ( job->width * job->height ) + ( yuv.uv_width * yuv.uv_height ); theora_encode_YUVin(&pv->theora, &yuv); -finish: - theora_encode_packetout(&pv->theora, last_p, &op); + theora_encode_packetout(&pv->theora, 0, &op); buf = hb_buffer_init( op.bytes + sizeof(op) ); memcpy(buf->data, &op, sizeof(op));