aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorRoine Gustafsson <roine@users.sourceforge.net>2005-01-26 09:31:49 +0000
committerFrançois Revol <revol@free.fr>2005-01-26 09:31:49 +0000
commit53ffdd1434fbf0f5cc4d6c23d4907bd511863b15 (patch)
treee0865d56ec4076c4d5ddb6de8aefc8be661cb050 /libavformat
parenta64a006e95a674a6e257daa89b0eb2b74a26ec22 (diff)
downloadffmpeg-53ffdd1434fbf0f5cc4d6c23d4907bd511863b15.tar.gz
mov header field and compressor name patch by Roine Gustafsson <roine AT users DOT sourceforge DOT net>
Originally committed as revision 3885 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c7
-rw-r--r--libavformat/movenc.c32
2 files changed, 24 insertions, 15 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index e50f91f3f2..0d2ddce733 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -773,6 +773,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
//MOVStreamContext *sc = (MOVStreamContext *)st->priv_data;
int entries, frames_per_sample;
uint32_t format;
+ uint8_t codec_name[32];
/* for palette traversal */
int color_depth;
@@ -845,7 +846,11 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
#ifdef DEBUG
av_log(NULL, AV_LOG_DEBUG, "frames/samples = %d\n", frames_per_sample);
#endif
- get_buffer(pb, (uint8_t *)st->codec.codec_name, 32); /* codec name */
+ get_buffer(pb, codec_name, 32); /* codec name, pascal string (FIXME: true for mp4?) */
+ if (codec_name[0] <= 31) {
+ memcpy(st->codec.codec_name, &codec_name[1],codec_name[0]);
+ st->codec.codec_name[codec_name[0]] = 0;
+ }
st->codec.bits_per_sample = get_be16(pb); /* depth */
st->codec.color_table_id = get_be16(pb); /* colortable id */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b9118b01da..4a9f4431ff 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -451,6 +451,7 @@ const CodecTag codec_movvideo_tags[] = {
static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track)
{
int pos = url_ftell(pb);
+ char compressor_name[32];
int tag;
put_be32(pb, 0); /* size */
@@ -467,25 +468,28 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track)
put_be16(pb, 0); /* Reserved */
put_be16(pb, 1); /* Data-reference index */
- put_be32(pb, 0); /* Reserved (= 02000c) */
- put_be32(pb, 0); /* Reserved ("SVis")*/
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved (400)*/
+ put_be16(pb, 0); /* Codec stream version */
+ put_be16(pb, 0); /* Codec stream revision (=0) */
+ put_tag(pb, "FFMP"); /* Vendor */
+ if(track->enc->codec_id == CODEC_ID_RAWVIDEO) {
+ put_be32(pb, 0); /* Temporal Quality */
+ put_be32(pb, 0x400); /* Spatial Quality = lossless*/
+ } else {
+ put_be32(pb, 0x200); /* Temporal Quality = normal */
+ put_be32(pb, 0x200); /* Spatial Quality = normal */
+ }
put_be16(pb, track->enc->width); /* Video width */
put_be16(pb, track->enc->height); /* Video height */
- put_be32(pb, 0x00480000); /* Reserved */
- put_be32(pb, 0x00480000); /* Reserved */
+ put_be32(pb, 0x00480000); /* Horizontal resolution 72dpi */
+ put_be32(pb, 0x00480000); /* Vertical resolution 72dpi */
put_be32(pb, 0); /* Data size (= 0) */
put_be16(pb, 1); /* Frame count (= 1) */
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved */
- put_be32(pb, 0); /* Reserved */
+ memset(compressor_name,0,32);
+ if (track->enc->codec->name)
+ strncpy(compressor_name,track->enc->codec->name,31);
+ put_byte(pb, FFMAX(strlen(compressor_name),32) );
+ put_buffer(pb, compressor_name, 31);
put_be16(pb, 0x18); /* Reserved */
put_be16(pb, 0xffff); /* Reserved */