diff options
-rw-r--r-- | src/mov_encoder.cc | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/mov_encoder.cc b/src/mov_encoder.cc index 9554d09..917cd32 100644 --- a/src/mov_encoder.cc +++ b/src/mov_encoder.cc @@ -39,6 +39,9 @@ /* * $Log$ + * Revision 1.11 2005/05/03 17:12:53 deva + * Fixed a bug (forgot to set the frametime). + * * Revision 1.10 2005/05/03 08:31:59 deva * Removed the error object, and replaced it with a more generic info object. * @@ -203,49 +206,49 @@ void MovEncoder::encode(Frame *dvframe) // encode_audio(dvframe); } +#define WOW(x) fprintf(stderr, x); fflush(stderr); void MovEncoder::encode_video(Frame *dvframe) { - int16_t audiobuffer[48000]; int ret; AVFrame *rawframe = avcodec_alloc_frame(); - - uint8_t *ptr; + static int64_t timestamp = 0LL; int got_picture = 1; - int got_sound = 1; - int len; - ptr = (uint8_t *)dvframe->data; - len = dvframe->size; + // uint8_t *ptr; + // int len; + + // ptr = (uint8_t *)dvframe->data; + // len = dvframe->size; ///////////////////////// DECODE VIDEO - ret = avcodec_decode_video(dcc,//&dfc->streams[0]->codec, - rawframe, &got_picture, ptr, len); - if(!ret) { + // ret = avcodec_decode_video(dcc, rawframe, &got_picture, ptr, len); + ret = avcodec_decode_video(dcc, rawframe, &got_picture, dvframe->data, dvframe->size); + rawframe->pts = timestamp; + timestamp += 40000; + fprintf(stderr, "ret fra decode: %d\n", ret); fflush(stderr); + + if(ret <= 0) { fprintf(stderr, "Decoder fuckup during video decoding!\n"); fflush(stderr); return; } - ///////////////////////// ENCODE VIDEO ret = avcodec_encode_video(ecc, video_buffer, VIDEO_BUFFER_SIZE, rawframe); - - if(!ret) { + + if(ret <= 0) { fprintf(stderr, "MovEncoder fuckup during video encoding!\n"); fflush(stderr); return; } epkt.data = video_buffer; epkt.size = ret; - if(ecc->coded_frame) epkt.pts = ecc->coded_frame->pts; - if(ecc->coded_frame && ecc->coded_frame->key_frame) epkt.flags |= PKT_FLAG_KEY; av_write_frame(efc, &epkt); - - av_free(rawframe); FREE(rawframe); + av_free(rawframe); } #define INBUF_SIZE 48000 |