blob: 68981e75c7db746b6d51984a2660cd4f1811eb85 [file] [edit]
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef THIRD_PARTY_CREDENTIO_FORMATS_ID3_READER_H_
#define THIRD_PARTY_CREDENTIO_FORMATS_ID3_READER_H_
#include <cstdint>
#include "absl/base/nullability.h"
#include "absl/functional/function_ref.h"
#include "absl/status/statusor.h"
#include "formats/id3/id3.h"
#include "riegeli/bytes/reader.h"
namespace credentio {
// Callback function for IterateOverId3Frames.
// Returns true to continue iteration, false to stop, or an error to abort.
using Id3FrameProcessor =
absl::FunctionRef<absl::StatusOr<bool>(const Id3Frame&)>;
// Iterates over all ID3 frames in the given reader, calling the given function
// for each frame. Returns the ID3 header on success.
// Returns NotFoundError if no ID3 tag is found.
absl::StatusOr<Id3Header> IterateOverId3Frames(riegeli::Reader& reader,
Id3FrameProcessor processor);
} // namespace credentio
#endif // THIRD_PARTY_CREDENTIO_FORMATS_ID3_READER_H_