mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
write flt packet, might need some tweaking but it works
Originally committed as revision 17893 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
a96b1a903a
commit
aaa43de31a
@ -60,6 +60,8 @@ typedef struct GXFContext {
|
||||
AVRational time_base;
|
||||
int flags;
|
||||
GXFStreamContext timecode_track;
|
||||
unsigned *flt_entries; ///< offsets of packets /1024, starts after 2nd video field
|
||||
unsigned flt_entries_nb;
|
||||
} GXFContext;
|
||||
|
||||
typedef struct GXF_Lines {
|
||||
@ -347,25 +349,30 @@ static int gxf_write_map_packet(AVFormatContext *s)
|
||||
return updatePacketSize(pb, pos);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int gxf_write_flt_packet(AVFormatContext *s)
|
||||
{
|
||||
GXFContext *gxf = s->priv_data;
|
||||
ByteIOContext *pb = s->pb;
|
||||
int64_t pos = url_ftell(pb);
|
||||
int i;
|
||||
int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1;
|
||||
int flt_entries = gxf->nb_fields / fields_per_flt - 1;
|
||||
int i = 0;
|
||||
|
||||
gxf_write_packet_header(pb, PKT_FLT);
|
||||
|
||||
put_le32(pb, 1000); /* number of fields */
|
||||
put_le32(pb, 0); /* number of active flt entries */
|
||||
put_le32(pb, fields_per_flt); /* number of fields */
|
||||
put_le32(pb, flt_entries); /* number of active flt entries */
|
||||
|
||||
for (i = 0; i < 1000; ++i) {
|
||||
put_le32(pb, 0);
|
||||
if (gxf->flt_entries) {
|
||||
for (i = 0; i < flt_entries; i++)
|
||||
put_le32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]);
|
||||
}
|
||||
|
||||
for (; i < 1000; i++)
|
||||
put_le32(pb, 0);
|
||||
|
||||
return updatePacketSize(pb, pos);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int gxf_write_umf_material_description(AVFormatContext *s)
|
||||
{
|
||||
@ -721,7 +728,7 @@ static int gxf_write_header(AVFormatContext *s)
|
||||
gxf->flags |= 0x200000; // time code track is non-drop frame
|
||||
|
||||
gxf_write_map_packet(s);
|
||||
//gxf_write_flt_packet(s);
|
||||
gxf_write_flt_packet(s);
|
||||
gxf_write_umf_packet(s);
|
||||
put_flush_packet(pb);
|
||||
return 0;
|
||||
@ -737,6 +744,7 @@ static int gxf_write_eos_packet(ByteIOContext *pb)
|
||||
|
||||
static int gxf_write_trailer(AVFormatContext *s)
|
||||
{
|
||||
GXFContext *gxf = s->priv_data;
|
||||
ByteIOContext *pb = s->pb;
|
||||
int64_t end;
|
||||
|
||||
@ -745,11 +753,14 @@ static int gxf_write_trailer(AVFormatContext *s)
|
||||
gxf_write_eos_packet(pb);
|
||||
end = url_ftell(pb);
|
||||
url_fseek(pb, 0, SEEK_SET);
|
||||
/* overwrite map and umf packets with new values */
|
||||
/* overwrite map, flt and umf packets with new values */
|
||||
gxf_write_map_packet(s);
|
||||
//gxf_write_flt_packet(s);
|
||||
gxf_write_flt_packet(s);
|
||||
gxf_write_umf_packet(s);
|
||||
url_fseek(pb, end, SEEK_SET);
|
||||
|
||||
av_freep(&gxf->flt_entries);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -829,8 +840,18 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
put_buffer(pb, pkt->data, pkt->size);
|
||||
gxf_write_padding(pb, padding);
|
||||
|
||||
if (st->codec->codec_type == CODEC_TYPE_VIDEO)
|
||||
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
|
||||
if (!(gxf->flt_entries_nb % 500)) {
|
||||
gxf->flt_entries = av_realloc(gxf->flt_entries,
|
||||
(gxf->flt_entries_nb+500)*sizeof(*gxf->flt_entries));
|
||||
if (!gxf->flt_entries) {
|
||||
av_log(s, AV_LOG_ERROR, "could not reallocate flt entries\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
gxf->flt_entries[gxf->flt_entries_nb++] = url_ftell(pb) / 1024;
|
||||
gxf->nb_fields += 2; // count fields
|
||||
}
|
||||
|
||||
put_flush_packet(pb);
|
||||
|
||||
|
@ -27,8 +27,8 @@ af78858062599fcbba049e4a02588a15 *./tests/data/b-libav.mov
|
||||
913b6199765b1dcba196706574621c2f *./tests/data/b-libav.dv
|
||||
3600000 ./tests/data/b-libav.dv
|
||||
./tests/data/b-libav.dv CRC=0x7787e173
|
||||
8a29994b83b6a00cfc0e0714fcf25705 *./tests/data/b-libav.gxf
|
||||
806184 ./tests/data/b-libav.gxf
|
||||
71434c75f12f6f54f9cd8b86107a2c75 *./tests/data/b-libav.gxf
|
||||
810208 ./tests/data/b-libav.gxf
|
||||
./tests/data/b-libav.gxf CRC=0x9c06676e
|
||||
66a6584f9e83e8ea3af822a3ba71fbbe *./tests/data/b-libav.nut
|
||||
329264 ./tests/data/b-libav.nut
|
||||
|
@ -2907,59 +2907,59 @@ ret:-22 st:-1 ts:0.460008 flags:0
|
||||
ret:-22 st:-1 ts:-0.645825 flags:1
|
||||
----------------
|
||||
tests/data/b-libav.gxf
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:940 size:65536 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st:-1 ts:-1.000000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:-184467440737095520.000000 pos:66508 size:55076 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st:-1 ts:1.894167 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 0 ts:0.780000 flags:0
|
||||
ret: 0 st: 0 dts:0.800000 pts:-184467440737095520.000000 pos:661548 size:22568 flags:0
|
||||
ret: 0 st: 0 dts:0.800000 pts:-184467440737095520.000000 pos:665572 size:22568 flags:0
|
||||
ret: 0 st: 0 ts:-0.320000 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:940 size:65536 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st: 1 ts:2.580000 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 1 ts:1.480000 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 2 ts:0.360000 flags:0
|
||||
ret: 0 st: 0 dts:0.360000 pts:-184467440737095520.000000 pos:304084 size:23176 flags:0
|
||||
ret: 0 st: 0 dts:0.360000 pts:-184467440737095520.000000 pos:308108 size:23176 flags:0
|
||||
ret: 0 st: 2 ts:-0.740000 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:940 size:65536 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st:-1 ts:2.153336 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st:-1 ts:1.047503 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 0 ts:-0.060000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:-184467440737095520.000000 pos:66508 size:55076 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st: 0 ts:2.840000 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 1 ts:1.740000 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 1 ts:0.620000 flags:1
|
||||
ret: 0 st: 0 dts:0.600000 pts:-184467440737095520.000000 pos:476360 size:23728 flags:0
|
||||
ret: 0 st: 0 dts:0.640000 pts:-184467440737095520.000000 pos:504144 size:22976 flags:0
|
||||
ret: 0 st: 2 ts:-0.480000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:-184467440737095520.000000 pos:66508 size:55076 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st: 2 ts:2.420000 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st:-1 ts:1.306672 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st:-1 ts:0.200839 flags:1
|
||||
ret: 0 st: 0 dts:0.200000 pts:-184467440737095520.000000 pos:211244 size:20944 flags:0
|
||||
ret: 0 st: 0 dts:0.200000 pts:-184467440737095520.000000 pos:215268 size:20944 flags:0
|
||||
ret: 0 st: 0 ts:-0.900000 flags:0
|
||||
ret: 0 st: 0 dts:0.000000 pts:-184467440737095520.000000 pos:66508 size:55076 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st: 0 ts:1.980000 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 1 ts:0.880000 flags:0
|
||||
ret: 0 st: 0 dts:0.880000 pts:-184467440737095520.000000 pos:706964 size:22456 flags:0
|
||||
ret: 0 st: 0 dts:0.880000 pts:-184467440737095520.000000 pos:710988 size:22456 flags:0
|
||||
ret: 0 st: 1 ts:-0.220000 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:940 size:65536 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
ret: 0 st: 2 ts:2.680000 flags:0
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st: 2 ts:1.560000 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:751848 size:54320 flags:1
|
||||
ret: 0 st: 0 dts:0.960000 pts:-184467440737095520.000000 pos:755872 size:54320 flags:1
|
||||
ret: 0 st:-1 ts:0.460008 flags:0
|
||||
ret: 0 st: 0 dts:0.480000 pts:-184467440737095520.000000 pos:371708 size:53804 flags:1
|
||||
ret: 0 st: 0 dts:0.480000 pts:-184467440737095520.000000 pos:375732 size:53804 flags:1
|
||||
ret: 0 st:-1 ts:-0.645825 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:940 size:65536 flags:1
|
||||
ret: 0 st: 1 dts:0.000000 pts:0.000000 pos:4964 size:65536 flags:1
|
||||
----------------
|
||||
tests/data/b-libav.mkv
|
||||
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:505 size:28088 flags:1
|
||||
|
Loading…
Reference in New Issue
Block a user