[FFmpeg-soc] MXF muxer version 0.0.2

Baptiste Coudurier baptiste.coudurier at smartjog.com
Sat Aug 23 17:56:37 CEST 2008


Hi guys,

Michael Niedermayer wrote:
> [...]
> 
>>>>
>>>>> [...]
>>>>>
>>>>>> @@ -87,6 +930,41 @@
>>>>>>      return 0;
>>>>>>  }
>>>>>>
>>>>>> +static int mxf_update_header_partition(AVFormatContext *s, int64_t
>>>>> footer_partition_offset)
>>>>>> +{
>>>>>> +    MXFContext *mxf = s->priv_data;
>>>>>> +    ByteIOContext *pb = s->pb;
>>>>>> +
>>>>>> +    if (!url_is_streamed(s->pb)) {
>>>>>> +        url_fseek(pb, mxf->header_byte_count_offset, SEEK_SET);
>>>>>> +        put_be64(pb, mxf->header_byte_count);
>>>>>> +        put_flush_packet(pb);
>>>>>> +
>>>>>> +        url_fseek(pb, mxf->header_footer_partition_offset,
>>> SEEK_SET);
>>>>>> +        put_be64(pb, footer_partition_offset);
>>>>>> +        put_flush_packet(pb);
>>>>>> +    } else {
>>>>>> +        av_log(s, AV_LOG_ERROR, "update header partition failed, non
>>>>> streamble out put\n");
>>>>>> +        return -1;
>>>>>> +    }
>>>>> we should support streamed files, not fail for them. I belive the
>>> footer
>>>>> partition is optional and when there is none also no pointer needs to
>>> point
>>>>> to one.
>>>>
>>>> 1)I understand like this:
>>>> when files is not streamed, we can seek by offset freely,
>>>> and when files is streamed, we can not seek.
>>>>
>>>> But if cannot, when wrting the header partition, we can not get the
>>> correct
>>>> value until end of the file, so how to update the correct field in header
>>>> partition?
>>>>
>>>> 2) according to s377m, footer partition is not optional.
>>> s377m says:
>>> "An MXF File shall be divided into a number of partitions:
>>>      one Header Partition which shall be followed by
>>>      zero or more Body Partitions, the last of which shall be followed by
>>>
>>>      zero or one Footer Partition
>>>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> "
>>>
>>>
>> It's my fault, I missed this improtant rule.
>> should we remove footer partition?
> 
> I think the footer should be written for non streamed files and
> ommited for streamed ones.
> 
> 
>> btw: it will be very helpful to hear some suggestion from Baptiste.
> 
> yes, i hope he finds some internet access soon whereever he is
> 

"The file footer shall be present unless a specialized operational
pattern is being used which defines it to be absent or optional."

OP1a does not override 377m in this matter, so I think a closed complete
footer must be present.

mxf_write_trailer should update header if possible (duration is very
useful) and write footer (without metadata if header is updated), we can
a RIP after footer to locate partitions if wanted, I don't think it is
necessary though.

Header will have 0 has footer offset, unless updated, anyway I don't
think the code will be complicated, overwriting old partition is trivial
 (seek offset, same function) and new header should take the same amount
of bytes (except if index tables are added in header, but 16k should be
enough like freemxf does).

All files I have in hands have a footer.
Also I know that D-10 mapping specs recommends index tables to be in
_header_.

>>
>>>> "Where present, a Footer Partition shall be located at the end of the
>>> file.
>>>> It shall comprise a Footer Partition Pack
>>>> followed optionally by the Header Metadata, and optionally by Index Table
>>>> segments. The Footer Partition may
>>>> optionally be followed by a Random Index Pack. "
>>> "where present" means "if there is" so it says
>>> "if there is a footer partition then it should be at the end of the file"
>>>
>>> baptiste probably can say more about all this, but i think he isnt here
>>> ATM?

I think s377m mandates a footer unless explicitly stated optional in
operational pattern.

>>>
>>>> 3) I run ./ffmpeg -i test.mpg test.mxf
>>>> it generate unstreamed files, and how to generated streamed files?
>>> ./ffmpeg -i test.mpg -f mxf - >test.mxf
>>>
>>> I mention again the former issue which you seems missed here:
> 
>> when files is not streamed, we can seek by offset freely,
>>  and when files is streamed, we can not seek.
> 
> yes
> 
> 
>>  But if cannot, when wrting the header partition, we can not get the correct
>>  value until end of the file, so we will write a default value and mark the
>> position then update later.
>>
>> so, if streamed file muxed , any solution about this?
> 
> if we ommit the footer then theres no need to update the pointer to it
> and header_byte_count can be updated likely as there is a small internal
> buffer that allow small seeks before put_flush_packet() even in streamed
> files
> 

Well It's good to have a closed complete header when we can IMHO, I
think it is trivial to update header.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA



More information about the FFmpeg-soc mailing list