On Tue, 20 Jun 2006 17:19:06 +0200
Christian Bodenstedt <[EMAIL PROTECTED]> wrote:
[...]
> Now that everything compiled well I ran a first test with:
>
> transcode -i test.mpg -c 0-100 -y x264,null,raw -o test.264
>
> but it just created a 0 byte sized file. :-( Seems I should have a
> look at the source code now.
Hi, I quickly (*really* quickly) hacked the attached patch.
I was curious to see x264 in action, but also very pressed so I don't
even done any sanity check in code; neverthless, attached patch
seems to produce something viewable. Take a look, if you like, and don't
hesitate to criticize it :)
At very first glance, it seems the problem is that there isn't a clean
way to known buffer sizes in audio/video frames, at least at encoding
step.
Solving this issue involve a defining a common pratice, and, in the worst
case, adding another field to *frame_list_t structure, so it should not
be too painful.
Attached patch *start to* address this issue too, but I think it deserve
a separate discussion ;)
Best regards,
--
Francesco Romani - Ikitt ['people always complain, no matther what you do']
IM contact : (email first, Antispam default deny!) icq://27-83-87-867
known bugs : http://www.transcoding.org/cgi-bin/transcode?Bug_Showcase
tiny homepage : http://fromani.exit1.org (see IDEAS if you want send code!)
diff -u -r1.2 encode_x264.c
--- encode/encode_x264.c 11 Jun 2006 07:35:07 -0000 1.2
+++ encode/encode_x264.c 21 Jun 2006 09:14:15 -0000
@@ -910,7 +910,7 @@
{
PrivateData *pd;
x264_nal_t *nal;
- int nnal, i;
+ int nnal, i, size;
x264_picture_t pic, pic_out;
if (!self) {
@@ -947,18 +947,19 @@
// tc_log_msg("saving %d NAL(s)", nnal);
/* modified code from x264.c down there (IIRC). */
+ size = outframe->video_size;
outframe->video_size = 0;
for (i = 0; i < nnal; i++) {
- int size, ret;
+ int nal_size = size - outframe->video_size;
+ int ret;
- size = 0x7FFFFFFF //FIXME (need to know size of video_buf)
- - outframe->video_size;
ret = x264_nal_encode(outframe->video_buf + outframe->video_size,
- &size, 1, &nal[i]);
+ &nal_size, 1, &nal[i]);
if (ret < 0) {
tc_log_warn(MOD_NAME, "output buffer overflow");
break;
}
+ outframe->video_size += nal_size;
}
return 0;
diff -u -r1.13 framebuffer.h
--- src/framebuffer.h 29 Apr 2006 19:18:12 -0000 1.13
+++ src/framebuffer.h 21 Jun 2006 09:14:16 -0000
@@ -156,6 +156,7 @@
\
(vptr)->video_buf = (vptr)->internal_video_buf_0; \
(vptr)->video_buf2 = (vptr)->internal_video_buf_1; \
+ (vptr)->video_size = W * H * BPP/8; /* FIXME */ \
} while(0)
vframe_list_t *vframe_register(int id);