History

movenc: Rudimentary IODs support.

Alex Converse committed 15 years ago

Commit d3b8bde1 parent dabba0c5 files · +37 −17Browse files

Unified · Split

5 files
  1. libavformat/movenc.c +28 −11
  2. libavformat/movenc.h +3 −0
  3. tests/ref/acodec/alac +2 −2
  4. tests/ref/vsynth1/mpeg4 +2 −2
  5. tests/ref/vsynth2/mpeg4 +2 −2
libavformat/movenc.c+28−11
@@ -46,6 +46,9 @@ static const AVOption options[] = { · 45 unmodified lines
46 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },46 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
47 { "rtphint", "Add RTP hint tracks", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },47 { "rtphint", "Add RTP hint tracks", 0, AV_OPT_TYPE_CONST, {.dbl = FF_MOV_FLAG_RTP_HINT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
48 FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),48 FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
49 { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
50 { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
51 { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
49 { NULL },52 { NULL },
50};53};
51 54
@@ -1407,21 +1410,34 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) · 1355 unmodified lines
1407 return updateSize(pb, pos);1410 return updateSize(pb, pos);
1408}1411}
1409 1412
1410#if 0
1411/* TODO: Not sorted out, but not necessary either */
1412static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)1413static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
1413{1414{
1414 avio_wb32(pb, 0x15); /* size */1415 int i, has_audio = 0, has_video = 0;
1416 int64_t pos = avio_tell(pb);
1417 int audio_profile = mov->iods_audio_profile;
1418 int video_profile = mov->iods_video_profile;
1419 for (i = 0; i < mov->nb_streams; i++) {
1420 if(mov->tracks[i].entry > 0) {
1421 has_audio |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_AUDIO;
1422 has_video |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_VIDEO;
1423 }
1424 }
1425 if (audio_profile < 0)
1426 audio_profile = 0xFF - has_audio;
1427 if (video_profile < 0)
1428 video_profile = 0xFF - has_video;
1429 avio_wb32(pb, 0x0); /* size */
1415 ffio_wfourcc(pb, "iods");1430 ffio_wfourcc(pb, "iods");
1416 avio_wb32(pb, 0); /* version & flags */1431 avio_wb32(pb, 0); /* version & flags */
1417 avio_wb16(pb, 0x1007);1432 putDescr(pb, 0x10, 7);
1418 avio_w8(pb, 0);1433 avio_wb16(pb, 0x004f);
1419 avio_wb16(pb, 0x4fff);1434 avio_w8(pb, 0xff);
1420 avio_wb16(pb, 0xfffe);1435 avio_w8(pb, 0xff);
1421 avio_wb16(pb, 0x01ff);1436 avio_w8(pb, audio_profile);
1422 return 0x15;1437 avio_w8(pb, video_profile);
1438 avio_w8(pb, 0xff);
1439 return updateSize(pb, pos);
1423}1440}
1424#endif
1425 1441
1426static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)1442static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
1427{1443{
@@ -1829,7 +1845,8 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, · 401 unmodified lines
1829 }1845 }
1830 1846
1831 mov_write_mvhd_tag(pb, mov);1847 mov_write_mvhd_tag(pb, mov);
1832 //mov_write_iods_tag(pb, mov);1848 if (mov->mode != MODE_MOV && !mov->iods_skip)
1849 mov_write_iods_tag(pb, mov);
1833 for (i=0; i<mov->nb_streams; i++) {1850 for (i=0; i<mov->nb_streams; i++) {
1834 if(mov->tracks[i].entry > 0) {1851 if(mov->tracks[i].entry > 0) {
1835 mov_write_trak_tag(pb, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);1852 mov_write_trak_tag(pb, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);
libavformat/movenc.h+3−0
@@ -112,6 +112,9 @@ typedef struct MOVMuxContext { · 111 unmodified lines
112 112
113 int flags;113 int flags;
114 int rtp_flags;114 int rtp_flags;
115 int iods_skip;
116 int iods_video_profile;
117 int iods_audio_profile;
115} MOVMuxContext;118} MOVMuxContext;
116 119
117#define FF_MOV_FLAG_RTP_HINT 1120#define FF_MOV_FLAG_RTP_HINT 1
tests/ref/acodec/alac+2−2
@@ -1,4 +1,4 @@
1b25bcc7ec3f5c19cdfc01a6bbd32edb8 *./tests/data/acodec/alac.m4a18d9cb7f65c5b17c74e5f9bdc36f32b7d *./tests/data/acodec/alac.m4a
2389386 ./tests/data/acodec/alac.m4a2389410 ./tests/data/acodec/alac.m4a
364151e4bcc2b717aa5a8454d424d6a1f *./tests/data/alac.acodec.out.wav364151e4bcc2b717aa5a8454d424d6a1f *./tests/data/alac.acodec.out.wav
4stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 10584004stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
tests/ref/vsynth1/mpeg4+2−2
@@ -1,4 +1,4 @@
1080e75117f8142001b096cd977ba287e *./tests/data/vsynth1/odivx.mp419251145d12150cb639098016d61fc75e *./tests/data/vsynth1/odivx.mp4
2540156 ./tests/data/vsynth1/odivx.mp42540180 ./tests/data/vsynth1/odivx.mp4
38828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv38828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
4stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 76032004stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
tests/ref/vsynth2/mpeg4+2−2
@@ -1,4 +1,4 @@
18ffbe8ce43fe126b12cf9621717d641b *./tests/data/vsynth2/odivx.mp41c2ca709a0ed64833fd38f703b19e5e85 *./tests/data/vsynth2/odivx.mp4
2119809 ./tests/data/vsynth2/odivx.mp42119833 ./tests/data/vsynth2/odivx.mp4
390a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv390a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
4stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 76032004stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t