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
4646 { "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), AV_OPT_TYPE_FLAGS, {.dbl = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
4747 { "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" },
4848 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},
4952 { NULL },
5053 };
5154
@@ -1407,21 +1410,34 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) · 1355 unmodified lines
14071410 return updateSize(pb, pos);
14081411 }
14091412
1410−#if 0
1411−/* TODO: Not sorted out, but not necessary either */
14121413 static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
14131414 {
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 */
14151430 ffio_wfourcc(pb, "iods");
14161431 avio_wb32(pb, 0); /* version & flags */
1417− avio_wb16(pb, 0x1007);
1418− avio_w8(pb, 0);
1419− avio_wb16(pb, 0x4fff);
1420− avio_wb16(pb, 0xfffe);
1421− avio_wb16(pb, 0x01ff);
1422− return 0x15;
1432+ putDescr(pb, 0x10, 7);
1433+ avio_wb16(pb, 0x004f);
1434+ avio_w8(pb, 0xff);
1435+ avio_w8(pb, 0xff);
1436+ avio_w8(pb, audio_profile);
1437+ avio_w8(pb, video_profile);
1438+ avio_w8(pb, 0xff);
1439+ return updateSize(pb, pos);
14231440 }
1424−#endif
14251441
14261442 static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
14271443 {
@@ -1829,7 +1845,8 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, · 401 unmodified lines
18291845 }
18301846
18311847 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);
18331850 for (i=0; i<mov->nb_streams; i++) {
18341851 if(mov->tracks[i].entry > 0) {
18351852 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
112112
113113 int flags;
114114 int rtp_flags;
115+ int iods_skip;
116+ int iods_video_profile;
117+ int iods_audio_profile;
115118 } MOVMuxContext;
116119
117120 #define FF_MOV_FLAG_RTP_HINT 1
tests/ref/acodec/alac+2−2
@@ -1,4 +1,4 @@
1−b25bcc7ec3f5c19cdfc01a6bbd32edb8 *./tests/data/acodec/alac.m4a
2−389386 ./tests/data/acodec/alac.m4a
1+8d9cb7f65c5b17c74e5f9bdc36f32b7d *./tests/data/acodec/alac.m4a
2+389410 ./tests/data/acodec/alac.m4a
33 64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/alac.acodec.out.wav
44 stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400
tests/ref/vsynth1/mpeg4+2−2
@@ -1,4 +1,4 @@
1−080e75117f8142001b096cd977ba287e *./tests/data/vsynth1/odivx.mp4
2−540156 ./tests/data/vsynth1/odivx.mp4
1+9251145d12150cb639098016d61fc75e *./tests/data/vsynth1/odivx.mp4
2+540180 ./tests/data/vsynth1/odivx.mp4
33 8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
44 stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200
tests/ref/vsynth2/mpeg4+2−2
@@ -1,4 +1,4 @@
1−8ffbe8ce43fe126b12cf9621717d641b *./tests/data/vsynth2/odivx.mp4
2−119809 ./tests/data/vsynth2/odivx.mp4
1+c2ca709a0ed64833fd38f703b19e5e85 *./tests/data/vsynth2/odivx.mp4
2+119833 ./tests/data/vsynth2/odivx.mp4
33 90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
44 stddev: 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