Commit 0c75bd8e authored by James Almer's avatar James Almer

avcodec/dnxhddata: move avpriv_dnxhd_parse_header_prefix to a header

It's a small and simple function that can be inlined.

This removes one private symbol and should reduce object dependencies with the next
major bump
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 26cb7232
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "avcodec.h" #include "avcodec.h"
#include "dnxhddata.h" #include "dnxhddata.h"
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
/* The quantization tables below are in zigzag order! */ /* The quantization tables below are in zigzag order! */
...@@ -1103,12 +1102,12 @@ int avpriv_dnxhd_get_interlaced(int cid) ...@@ -1103,12 +1102,12 @@ int avpriv_dnxhd_get_interlaced(int cid)
return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0; return ff_dnxhd_cid_table[i].flags & DNXHD_INTERLACED ? 1 : 0;
} }
#if LIBAVCODEC_VERSION_MAJOR < 58
uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf) uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf)
{ {
uint64_t prefix = AV_RB32(buf); return ff_dnxhd_parse_header_prefix(buf);
prefix = (prefix << 16) | buf[4] << 8;
return ff_dnxhd_check_header_prefix(prefix);
} }
#endif
static int dnxhd_find_hr_cid(AVCodecContext *avctx) static int dnxhd_find_hr_cid(AVCodecContext *avctx)
{ {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <stdint.h> #include <stdint.h>
#include "avcodec.h" #include "avcodec.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
/** Additional profile info flags */ /** Additional profile info flags */
#define DNXHD_INTERLACED (1<<0) #define DNXHD_INTERLACED (1<<0)
...@@ -83,7 +84,17 @@ static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix) ...@@ -83,7 +84,17 @@ static av_always_inline uint64_t ff_dnxhd_check_header_prefix(uint64_t prefix)
return 0; return 0;
} }
static av_always_inline uint64_t ff_dnxhd_parse_header_prefix(const uint8_t *buf)
{
uint64_t prefix = AV_RB32(buf);
prefix = (prefix << 16) | buf[4] << 8;
return ff_dnxhd_check_header_prefix(prefix);
}
int avpriv_dnxhd_get_frame_size(int cid); int avpriv_dnxhd_get_frame_size(int cid);
int avpriv_dnxhd_get_interlaced(int cid); int avpriv_dnxhd_get_interlaced(int cid);
#if LIBAVCODEC_VERSION_MAJOR < 58
attribute_deprecated
uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf); uint64_t avpriv_dnxhd_parse_header_prefix(const uint8_t *buf);
#endif
#endif /* AVCODEC_DNXHDDATA_H */ #endif /* AVCODEC_DNXHDDATA_H */
...@@ -190,7 +190,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, ...@@ -190,7 +190,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
header_prefix = avpriv_dnxhd_parse_header_prefix(buf); header_prefix = ff_dnxhd_parse_header_prefix(buf);
if (header_prefix == 0) { if (header_prefix == 0) {
av_log(ctx->avctx, AV_LOG_ERROR, av_log(ctx->avctx, AV_LOG_ERROR,
"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n", "unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
......
...@@ -30,7 +30,7 @@ static int dnxhd_probe(AVProbeData *p) ...@@ -30,7 +30,7 @@ static int dnxhd_probe(AVProbeData *p)
int w, h, compression_id; int w, h, compression_id;
if (p->buf_size < 0x2c) if (p->buf_size < 0x2c)
return 0; return 0;
if (avpriv_dnxhd_parse_header_prefix(p->buf) == 0) if (ff_dnxhd_parse_header_prefix(p->buf) == 0)
return 0; return 0;
h = AV_RB16(p->buf + 0x18); h = AV_RB16(p->buf + 0x18);
w = AV_RB16(p->buf + 0x1a); w = AV_RB16(p->buf + 0x1a);
......
...@@ -1071,7 +1071,7 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track) ...@@ -1071,7 +1071,7 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
int cid; int cid;
if (track->vos_data && track->vos_len > 0x29) { if (track->vos_data && track->vos_len > 0x29) {
if (avpriv_dnxhd_parse_header_prefix(track->vos_data) != 0) { if (ff_dnxhd_parse_header_prefix(track->vos_data) != 0) {
/* looks like a DNxHD bit stream */ /* looks like a DNxHD bit stream */
interlaced = (track->vos_data[5] & 2); interlaced = (track->vos_data[5] & 2);
cid = AV_RB32(track->vos_data + 0x28); cid = AV_RB32(track->vos_data + 0x28);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment