Originally committed as revision 18831 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -44,13 +44,14 @@ · 43 unmodified lines | |||
| 44 | #define MODE_IPOD 0x20 | 44 | #define MODE_IPOD 0x20 |
| 45 | 45 | ||
| 46 | typedef struct MOVIentry { | 46 | typedef struct MOVIentry { |
| 47 | unsigned int flags, size; | 47 | unsigned int size; |
| 48 | uint64_t pos; | 48 | uint64_t pos; |
| 49 | unsigned int samplesInChunk; | 49 | unsigned int samplesInChunk; |
| 50 | char key_frame; | ||
| 51 | unsigned int entries; | 50 | unsigned int entries; |
| 52 | int cts; | 51 | int cts; |
| 53 | int64_t dts; | 52 | int64_t dts; |
| 53 | #define MOV_SYNC_SAMPLE 0x0001 | ||
| 54 | uint32_t flags; | ||
| 54 | } MOVIentry; | 55 | } MOVIentry; |
| 55 | 56 | ||
| 56 | typedef struct MOVIndex { | 57 | typedef struct MOVIndex { |
| @@ -198,7 +199,7 @@ static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track) · 141 unmodified lines | |||
| 198 | entryPos = url_ftell(pb); | 199 | entryPos = url_ftell(pb); |
| 199 | put_be32(pb, track->entry); // entry count | 200 | put_be32(pb, track->entry); // entry count |
| 200 | for (i=0; i<track->entry; i++) { | 201 | for (i=0; i<track->entry; i++) { |
| 201 | if(track->cluster[i].key_frame == 1) { | 202 | if (track->cluster[i].flags & MOV_SYNC_SAMPLE) { |
| 202 | put_be32(pb, i+1); | 203 | put_be32(pb, i+1); |
| 203 | index++; | 204 | index++; |
| 204 | } | 205 | } |
| @@ -1877,9 +1878,10 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) · 1672 unmodified lines | |||
| 1877 | if (pkt->dts != pkt->pts) | 1878 | if (pkt->dts != pkt->pts) |
| 1878 | trk->hasBframes = 1; | 1879 | trk->hasBframes = 1; |
| 1879 | trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; | 1880 | trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; |
| 1880 | trk->cluster[trk->entry].key_frame = !!(pkt->flags & PKT_FLAG_KEY); | 1881 | if (pkt->flags & PKT_FLAG_KEY) { |
| 1881 | if(trk->cluster[trk->entry].key_frame) | 1882 | trk->cluster[trk->entry].flags = MOV_SYNC_SAMPLE; |
| 1882 | trk->hasKeyframes++; | 1883 | trk->hasKeyframes++; |
| 1884 | } | ||
| 1883 | trk->entry++; | 1885 | trk->entry++; |
| 1884 | trk->sampleCount += samplesInChunk; | 1886 | trk->sampleCount += samplesInChunk; |
| 1885 | mov->mdat_size += size; | 1887 | mov->mdat_size += size; |