[FFmpeg-devel] [Bulk] [PATCH 4/4] avformat/movenc: set pretty compressor name for XDCAM
Tim Nicholson
nichot20 at yahoo.com
Wed Oct 9 08:48:51 CEST 2013
On 07/10/13 17:22, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavformat/movenc.c | 30 ++++++++++++++++++++++++++++--
> 1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index cc8800b..c820dd5 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1139,6 +1139,33 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
> return 16;
> }
>
> +static void find_compressor(char * compressor_name, int len, MOVTrack *track)
> +{
> + int xdcam_res = (track->enc->width == 1280 && track->enc->height == 720)
> + || (track->enc->width == 1440 && track->enc->height == 1080)
> + || (track->enc->width == 1920 && track->enc->height == 1080);
> +
> + if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) {
> + av_strlcpy(compressor_name, track->enc->codec->name, 32);
> + } else if (track->enc->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) {
> + int interlaced = track->enc->field_order != AV_FIELD_UNKNOWN
> + && track->enc->field_order != AV_FIELD_PROGRESSIVE;
Just a query on style and consistency with current code. Since
AV_FIELD_* are from AVFieldOrder enum currently elsewhere (rawdec.c,
avuienc.c) the test is formed as:-
...->field_order > AV_FIELD_PROGRESSIVE
same goes for other patches in this set. I think your form is possibly
slighty clearer, the other more succinct.
> + AVStream *st = track->st;
> + int rate = av_q2d(find_fps(NULL, st));
> + av_strlcatf(compressor_name, len, "XDCAM");
> + if (track->enc->pix_fmt == AV_PIX_FMT_YUV422P) {
> + av_strlcatf(compressor_name, len, " HD422");
> + } else if(track->enc->width == 1440) {
> + av_strlcatf(compressor_name, len, " HD");
> + } else
> + av_strlcatf(compressor_name, len, " EX");
> +
> + av_strlcatf(compressor_name, len, " %d%c", track->enc->height, interlaced ? 'i' : 'p');
> +
> + av_strlcatf(compressor_name, len, "%d", rate * (interlaced + 1));
> + }
> +}
> +
> static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
> {
> int64_t pos = avio_tell(pb);
> @@ -1174,8 +1201,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
> avio_wb16(pb, 1); /* Frame count (= 1) */
>
> /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
> - if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
> - av_strlcpy(compressor_name, track->enc->codec->name, 32);
> + find_compressor(compressor_name, 32, track);
> avio_w8(pb, strlen(compressor_name));
> avio_write(pb, compressor_name, 31);
>
>
--
Tim
More information about the ffmpeg-devel
mailing list