mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
flac muxer: accept only STREAMINFO extradata
The other format (full flac header blocks) should not be exported by any demuxers anymore. This allows to drop an avpriv_ function and also simplify the following commits.
This commit is contained in:
parent
ed39cda029
commit
0097cbea69
@ -22,7 +22,7 @@
|
|||||||
#include "libavutil/channel_layout.h"
|
#include "libavutil/channel_layout.h"
|
||||||
|
|
||||||
#include "libavcodec/flac.h"
|
#include "libavcodec/flac.h"
|
||||||
#include "libavcodec/bytestream.h"
|
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "flacenc.h"
|
#include "flacenc.h"
|
||||||
|
|
||||||
@ -32,18 +32,17 @@ int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
|
|||||||
uint8_t header[8] = {
|
uint8_t header[8] = {
|
||||||
0x66, 0x4C, 0x61, 0x43, 0x00, 0x00, 0x00, 0x22
|
0x66, 0x4C, 0x61, 0x43, 0x00, 0x00, 0x00, 0x22
|
||||||
};
|
};
|
||||||
uint8_t *streaminfo;
|
|
||||||
enum FLACExtradataFormat format;
|
|
||||||
|
|
||||||
header[4] = last_block ? 0x80 : 0x00;
|
header[4] = last_block ? 0x80 : 0x00;
|
||||||
if (!avpriv_flac_is_extradata_valid(codec, &format, &streaminfo))
|
|
||||||
return -1;
|
if (codec->extradata_size < FLAC_STREAMINFO_SIZE)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
/* write "fLaC" stream marker and first metadata block header */
|
/* write "fLaC" stream marker and first metadata block header */
|
||||||
avio_write(pb, header, 8);
|
avio_write(pb, header, 8);
|
||||||
|
|
||||||
/* write STREAMINFO */
|
/* write STREAMINFO */
|
||||||
avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
|
avio_write(pb, codec->extradata, FLAC_STREAMINFO_SIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user